Git error: Your local changes to the following files would be overwritten by checkout

When you get the Git checkout error, “Your local changes to the following files would be overwritten by checkout,” one likely cause is that files in the master branch are indeed newer than the files in your feature branch.

But another possibility that I just learned about is that you did a git add, but forgot to do a git commit before trying to switch branches. My current wrong/accidental workflow looks like this:

Notes related to handling some comments/conversation on a Github pull request

Here are some brief notes related to handling some comments on a Github pull request. Every other pull request I’ve done has been simply accepted, but I’m currently working through a conversation related to a large pull request. Here are the notes:

git fetch wasn’t showing the comments/changes I just approved on Github, but this set of commands successfully pulled those changes from Github and brought them onto my system:

git branch                      #to list the branches
git checkout my-branch-name     #switch to my branch
git pull origin my-branch-name

Howto: Steps to create a pull request on Github

I haven’t worked on many open source projects, so my ability to fork a Github project, pull it down, create a branch, push that branch back, and then submit a pull request are weak, at best.

That being said, I’ve done it a few times lately, so I’m getting better at it. Today was a very smooth process, so I thought I’d make these notes while they’re still fresh in my mind.

git push after git tag problem (everything up-to-date)

If you attempt to do a normal git push origin master after adding a tag, you’ll get an “Everything up-to-date” message from Git. In short, this is because you have to push a tag to the origin just like you push a branch.

In my case I just created a tag named v0.1, so I pushed it like this:

git push origin v0.1

The output from the git push command looks like this:

Using git with ssh running on a non-standard port

Yesterday I needed to be able to specify a port with a git clone command, because the git server runs ssh on a non-standard port. In short, the solution was to put this text in my ~/.ssh/config file: