tgit new fs/xyz [-b master]
git checkout master # ensure we are on master branch
git pull origin master --rebase # ensure master is up to date (fetch upstream && rebase)
git checkout -b fs/xyz # create the new src branch
git push -u origin @ # should we auto push new src branches to remote?
I. Should we auto push new src branches to remote? Maybe a opt-in flag?
tgit sync [-b master]
git pull origin master --rebase # ensure master is up to date (fetch upstream && rebase)
II. sync is a good name? Maybe update?
tgit bridge [-b stage] (entire branch)
git checkout -b fs/xyz--aux # create a temporary 'bridge' branch to rebase from target
git pull origin stage --rebase # ensure stage is up to date (fetch upstream && rebase)
# what should we do if user abort rebase?
git checkout stage # change HEAD to stage
git pull origin stage --rebase # since conflicts can last a long time, we do a fetch again
# otherwise we can do a simply `git reset --hard @{u}`
git merge fs/xyz--aux --ff-only # merge bridge branch with fast-forward into target branch
git push origin @ # should we auto push?
git checkout fs/xyz # if we auto push, back to the working branch?
III. I do not know if bridge is a good name. Aux maybe?
IV. Should we auto push when completed? If yes, should we back to the working branch?
tgit bridge 2 [-b stage] (last 2 commits, useful when making small changes after sent working branch to stage)
COMMITS=`git rev-parse @~0..@~1` # save the last 2 commits sha hash
# (4 = @~0..@~3) (3 = @~0..@~2) (1 = @~0..@~0 or just @~0) etc.
git checkout stage # change HEAD to stage
git pull origin stage --rebase # fetch stage remote and merge from upstream using rebase strategy
git cherry-pick $COMMITS # cherry-pick the saved commits
V. Should we use the same command name?
VI. What others commands should be useful?