nceas-coding-club / nceas-coding-club.github.io

data-science-chats collaborative website created using Quarto as a way of learning Quarto together!
https://nceas-coding-club.github.io/
5 stars 2 forks source link

Git Panic #7

Open camilavargasp opened 1 year ago

camilavargasp commented 1 year ago

git commands

Command Description
git status Lists which branch you are working from and lists which files are staged, unstaged, and untracked.
git branch List of all local branches
git branch -r List of all remote branches
git branch -a List of all branches (local and remote)
git checkout name_of_branch Swiches/ check out banch named name_of_branch branch
git checkout -b new_branch Create and check out a new branch named new_branch
git push -u origin pushes the new local branch and and all commits within that branch
git add . stage all files
git commit -m write_a_message_here commit all staged files with commit message.
reset --hard origin/main remove all the commits ahead of the remote main branch
git push -u origin branch-name pushing a new branch with all the commits in the branch
git log --graph --all graphic representation of what is going on with your branches and commits
git push --delete origin branch_name delete a branch locally and remote
camilavargasp commented 1 year ago

Exercise:

brunj7 commented 1 year ago

FYI could be of interest, especially the references: https://github.com/nceas-coding-club/hacky-hour-materials/blob/master/2018-05-08_git-advanced.md

camilavargasp commented 1 year ago

Git Workflow

Start with: git fetch git rebase OR git pull Then, after you have done your changes: git add . git commit -m "message" git fetch git rebase git push

camilavargasp commented 3 months ago

git cherry-pick allows you to select a specific commit and bring it into the checkout branch. See explanation and examples here