I'm using Git versioning in NetBeans 7.2.1 with a GitHub repository. If I commit my changes and then I push it to the remote repository immediately after commit (suppose the remote version has not changed since my last push), my commit message appears on GitHub. When other collaborators do a pull, my commit message appears in their pull summary.
But the problem is that if I have to make a pull before my push (if the remote version has changed since my last push), then somehow my commit message gets overwritten by "Merge branch 'master' of https://github.com/...". Its very annoying. ow can I keep my original commit in this case?
Thanks!
I don't think your commit message is being overwritten, it's simply not the newest message in the log.
In the case where you don't have to pull before pushing to the remote repository your commit is the last (most recent) thing in the log so it shows up at the top. In the case where you have to do a pull Netbeans is automatically doing git merge origin/master
which creates a merge commit. This is where the Merge branch master
is coming from.
If you look in the commit log you should see something like this:
M <-- Merge commit from Netbeans
|\
| \
X \ <-- Your latest commit
| O <-- Commits made by someone else which Netbeans merged.
As an editorial suggestion, it would probably be good to learn to use git at the command line. In my experience developers who interact with git exclusively through a GUI have a much harder time understanding how git works and what's going on with their repository.