Changes between Version 12 and Version 13 of MergerTips
- Timestamp:
- Mar 9, 2021, 2:10:20 AM (4 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
MergerTips
v12 v13 23 23 == Automating Backports == 24 24 25 Backporting can be tedious. The following script makes it a bit easier by performing the `git cherry-pick` and modifying the commit message by prepending the branch name and appending "Backport of <full hash> from ma ster.".25 Backporting can be tedious. The following script makes it a bit easier by performing the `git cherry-pick` and modifying the commit message by prepending the branch name and appending "Backport of <full hash> from main.". 26 26 27 27 Put the contents below in `django-src/backport.sh`. Add `backport.sh` to `django-src/.git/info/exclude` to prevent the file from appearing in `git status`. 28 28 29 After committing a change to ma ster. Switch to the branch you wish to backport to and execute `./backport <full hash of commit to backport>`. You can double check the commit message looks ok, then `git push`.29 After committing a change to main. Switch to the branch you wish to backport to and execute `./backport <full hash of commit to backport>`. You can double check the commit message looks ok, then `git push`. 30 30 {{{ 31 31 #!/bin/bash … … 41 41 42 42 REV=$1 43 : ${ORIGBRANCH=ma ster}43 : ${ORIGBRANCH=main} 44 44 45 45 TMPFILE=tmplog.tmp … … 54 54 55 55 # Create new log message by modifying the old one 56 git log --pretty=format:"[${BRANCH_NAME}] %s%n%n%b%nBackport of ${REV} from ma ster" HEAD^..HEAD \56 git log --pretty=format:"[${BRANCH_NAME}] %s%n%n%b%nBackport of ${REV} from main" HEAD^..HEAD \ 57 57 | grep -v '^BP$' > ${TMPFILE} 58 58 … … 96 96 git co stable/1.6.x && git merge --ff-only upstream/stable/1.6.x && \ 97 97 git co stable/1.5.x && git merge --ff-only upstream/stable/1.5.x && \ 98 git co ma ster && git merge --ff-only upstream/master98 git co main && git merge --ff-only upstream/main 99 99 }}} 100 100