Just my own git commands reference for personal use.
Install the CLI tool (with or without Python) here. Seriously, do it! It's super useful. Supports Windows!
git log # get commit SHA [make sure it's the right one] git checkout <branch> git cherry-pick COMMIT_SHA
git diff <b> <b> -- myfile.pog
git branch -D <branch>
git push <remote-name> :<branch>
# local branch git branch -m <new-name> # other branch git branch -m <old-nane> <new-name> # to update/delete on remote git push <remote-name> :<old-name> # delete the old upstream as it hasn't been updated with new name git branch --unset-upstream <new-name> # push renamed branch to remote git push <remote-name> <new-name> # set the correct upstream for the newly pushed local branch git push <remote-name> -u <new_name> # response will look something like this # "Branch 'new_branch_name' set up to track remote branch 'new_branch_name' from 'origin'."
git pull # you should see something like this: " * [test branch] test_branch -> origin/test_branch" git checkout <branch-name>
# ensure you are not checked out on the branch you wish to delete git branch --merged >/tmp/merged-branches && \ vi /tmp/merged-branches && xargs git branch -d </tmp/merged-branches # select the ones to delete with an astericks, press your I key to insert. Escape key when you're done. `:wq` to finish!
In Git, "origin" is a shorthand name for the remote repository that a project was originally cloned from. More precisely, it is used instead of that original repository's URL - and thereby makes referencing much easier. Note that origin is by no means a "magical" name, but just a standard convention.