Download Pragmatic Guide to Git
Transcript
M ERGING C OMMITS B ETWEEN B RANCHES Merge changes from development to the master branch. prompt> git checkout master Switched to branch 'master' prompt> git merge development Updating af0fe21..290b0d2 Fast-forward old/README.rst | 8 ++-----1 files changed, 2 insertions(+), 6 deletions(-) Merge changes, but don’t commit. prompt> git merge --no-commit development Automatic merge went well; stopped before committing... Force the creation of a merge commit. prompt> git merge --no-ff development Merge made by recursive. old/README.rst | 8 ++-----1 files changed, 2 insertions(+), 6 deletions(-) Add a one-line log message from each merged commit to the merge message. prompt> git merge --log development Specify a custom log message for a merge commit, if created. prompt> git merge -m "my message" development You can use git commit --amend to modify the commit message after the fact too. Here’s an example: prompt> git merge --log --no-ff development prompt> git commit --amend -c HEAD ... editor launches ... Related Tasks • • • • • • Task 13, Creating and Switching Branches, on page 54 Task 14, Viewing Branches, on page 56 Task 16, Rewriting History by Rebasing, on the next page Task 21, Retrieving Remote Changes, Part II, on page 74 Task 24, Handling Conflicts, on page 82 Task 25, Handling Conflicts with a GUI, on page 84 Report erratum Download from Wow! eBook <www.wowebook.com> this copy is (P1.0 printing, October 2010) 59