How do I change the commit message after a git-pull auto-merge?

Sometimes my collaborators will "panic" when the result is an automatic merge, as a result git-pull

, and just accept the default commit message. Before this commit is pushed, I want to make sure the message is fixed but --amend

doesn't seem to work. What is the best way to fix the message generated in this scenario. The best instructions I can think of for them are

git reset --soft HEAD~
git merge -m <message> <the tracked remote branch>

      

but that seems a little scary ( reset

) and error prone (the remote tracked branch must be injected explicitly).

Is there an easy way to change the commit message that was only generated by merging into the remote tracking repository? Why --amend

doesn't it work?

+3


source to share


3 answers


git commit --amend

should work in this scenario. What exactly isn't working?



0


source


You can always try using git pull --rebase to put your commits on top of the tree. But git warns about this statement.

"This is a potentially dangerous mode of operation. It overwrites history, which doesn't bode well when you've already posted that history. Don't use this option unless you've read git -rebase (1) carefully." ( http://git-scm.com/docs/git-pull )



If you're okay with fixing your merge history, then this is the option for you.

-1


source


@{u}

is a good replacement for yours <the tracked remote branch>

and then you can just stick two steps into one. Maybe a shell script you can propagate to them, or an alias they can add to their shells.

-1


source







All Articles