Provides set of operations to efficiently maintain set of patch for long time and be able to submit those for review.
Let's say we clone a repo and 'master' is upstream branch and we will keep it up-to-date on regular base.
We can created a branch for a new feature and will try to keep it fresh and with addressed reviews.
- Reset 'master' branch
git checkout -B master upstream/masterand pull changesgit pull - Start a new branch 'feature':
git checkout -b feature master - Addressing reviews by creating new commit for every old commit (or even per change)
- Squashing old and new commits:
git rebase -i HEAD~<n>(where n = amount of affected old commits + new commits)- new commits can be moved around (after related old commit) and prefix changed to 'f'
- Refreshing base from master:
git rebase --onto master feature~<n> feature(n = amount of commits in the 'feature') - Push refreshed/updated branch:
git push -f origin feature
Let's say we clone a repo and we will keep our new feature patches in the queue (one feature at a time?)
- Reset repo:
hg revert -a && hg qpop -athenhg pull && hg update - After reset, one-by-one adding patches from queue
hg qpush(resolve conflicts thenhg qrefresh) - During addressing of the review, move back to forward using to the needed changeset
hg qpopandhg qpushadd change thenhg qrefresh - Patches can be exported via
hg export <name>(where name is id in the queue)
Let's say we clone a repo and we will keep our feature patches at various bookmarks.
- Create master bookmark before:
hg bookmark master - Clear and start new bookmark clean:
hg revert -a && hg update master -Candhg bookmark feature - List changeset without other bookmarks:
hg log -r feature -f -l 10 - Refresh base:
hg rebase -s <id> -d master(id is oldest feature commit) - Append changes:
- to last commit
hg commit --amend - to commit with children:
hg update 'parents(<id>)' && hg export <id> | hg import --no-commit -, append new changes,hg commit -e --amend(previous commit messagehg log -r <id> --template='{desc}')
- to last commit
- Append commit without change
hg export <id> | hg import - - Append commit and children and update their bookmarks
hg rebase -s <id>
[alias]
cmsg = !$HG log -r "$1" --template '{desc}'
cvim = !vi `$HG root`/.hg/last-message.txt
cget = !$HG log -r "$1" --template '{desc}' > `$HG root`/.hg/last-message.txt && \
$HG export "$1" | $HG import --no-commit -
ccopy = !$HG export "$1" | $HG import -
cci = !$HG ci -l `$HG root`/.hg/last-message.txt
stu = !$HG status -u "$1" | awk '{print $$2}'
slh = !$HG heads -T '{node|short} {bookmarks}\n' | grep -e '\s$$'
gclh = !$HG slh | xargs $HG strip --no-backup