0

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!

kornisb
  • 260
  • 1
  • 12
  • Does NetBeans have a config for excluded directories? It sounds like it is monitoring the `.git` dir in your project directory, and changing the files therein. – New Alexandria Jan 30 '13 at 14:36
  • I do not know it, but i will check. Thanks for your help! :) – kornisb Jan 30 '13 at 22:15

1 Answers1

0

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.

asm
  • 8,758
  • 3
  • 27
  • 48
  • Thanks for your help! You're right, it seems logical. But then is there any way to show the last commit message in the pull summary, which is not from a merge? Because the merge message is kind of a "meaningless" message, it would be much more useful to know the latest modification of other collaborators. Or I can see these informations only in the history? Thanks in advance! – kornisb Jan 30 '13 at 14:49
  • If the merge really is meaningless then you should probably be [rebasing](http://git-scm.com/book/en/Git-Branching-Rebasing) instead of merging. However, you want to really make sure you understand the scenarios when rebasing is appropriate and when it is not. If you rebase under the wrong conditions you'll cause some really strange things in your repository that may be hard to recover from. – asm Jan 30 '13 at 14:58