Practical uses of git reset –soft?

git reset is all about moving HEAD, and generally the branch ref.Question: what about the working tree and index?When employed with –soft, moves HEAD, most often updating the branch ref, and only the HEAD.This differ from commit –amend as: it doesn’t create a new commit. it can actually move HEAD to any commit (as commit … Read more

Delete commits from a branch in Git

Careful: git reset –hard WILL DELETE YOUR WORKING DIRECTORY CHANGES. Be sure to stash any local changes you want to keep before running this command. Assuming you are sitting on that commit, then this command will wack it… The HEAD~1 means the commit before head. Or, you could look at the output of git log, … Read more

How to upgrade Git on Windows to the latest version

Since Git 2.16.1(2) you can use In version between 2.14.2 and 2.16.1, the command was (It was later renamed to avoid confusion with updating the local repository, e.g. like svn update does it.) That command does not exist in Git 2.13 and before. If this errors with “is not a git command” then either you don’t actually … Read more

How can I see the differences between two branches?

You want to use git diff. Where <commit> is your branch name, the hash of a commit or a shorthand symbolic reference For instance git diff abc123…def567 or git diff HEAD..origin/master That will produce the diff between the tips of the two branches. If you’d prefer to find the diff from their common ancestor to test, you can use three dots instead of two: … Read more

Git fetch remote branch

Update: Using Git Switch All of the information written below was accurate, but a new command, git switch has been added that simplifies the effort. If daves_branch exists on the remote repository, but not on your local branch, you can simply type: Since you do not have the branch locally, this will automatically make switch look on the remote repo. It … Read more

GitHub Error Message – Permission denied (publickey)

GitHub isn’t able to authenticate you. So, either you aren’t setup with an SSH key, because you haven’t set one up on your machine, or your key isn’t associated with your GitHub account. You can also use the HTTPS URL instead of the SSH/git URL to avoid having to deal with SSH keys. This is GitHub’s recommended … Read more