Recently, I did only 1 commit but I don’t know why it shows 3 commits.
Here is what I did recently:
- Created a new repository on GitHub; initialized it with one
READMEand.gitignorefile. (I understand GitHub commited on my behalf and so this is my first lost commit.) -
addedandcommiteda file.- did a
git remote add origin git@github.com:me/repo.git - did
git pull origin masterto get the changes from the GitHub (README and .gitignore) - did
git push
My questions are:
- I haven’t done anything like
git mergethen why my third commit says “Merge branch ‘master’ of github.com:me/repo”? What is going behind the curtain? - I had only expected the first two commits (the one I did and the another which GitHub did when initialization of repo). Where did this 3rd came from? I can I get rid of these type of commits?
Any tips regarding this?
To not have the merge commit when you do a pull, you want to do
git pull --rebase origin master. This will move the changes and not cause a merge.http://gitready.com/advanced/2009/02/11/pull-with-rebase.html