rebase helper tool

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I'm currently rebasing a branch that diverged for quite a while and
introduced many changes that include a lot of code movement. I wrote a
tool to help me streamline a lot of the repetitive work that I am
doing when rebasing. It's not all I wanted to have, far from it, but
others might find it useful too:

https://github.com/yehudasa/rebase-tools

Consider a workflow were we have a feature branch, and a master branch
that diverged. We want now to rebase feature branch on top of master
branch. We can either cherry-pick each commit, or run a 'git rebase'
command.
The tool is just a bash script that analyzes a 'git diff' after a
failed cherry-pick and automates some of the steps that I usually take
when dealing with it. It produces an annotation of each line in that
diff (of the HEAD part of each conflict) that shows what the source of
that line is. Basically doing a git blame on those lines. It added
value is that it also specifies whether this line is old (prior to
feature branch creation), new (on feature branch, after its creation),
or master (changed on the master branch). This helps focus on what
were the changes that are needed to be looked at.

See here a sample output:

https://paste.fedoraproject.org/paste/ispeNUIluZ3B0XvguSpQfA

The usage is simple. First time it needs to be initialized (it creates
a local cache of the relevant commits, might not be really needed
eventually):

~/ceph/src $ ~/rebase-tools/init.sh <feature-branch> <master-branch> [subdir]

Where subdir can be 'rgw' for example, so that it only keeps info
about changes that happened under the rgw subdir.

Then try to cherry-pick or rebase, and if there is a conflict:

(note that it needs to be run from the repo root)
~ceph $ ~/rebase-tools/analyze.sh <feature-branch> <master-branch> <commit-id>

where the commit-id is the id of the commit that failed.

One of the things that it doesn't do now is that it doesn't show lines
that were removed (either on master, or on feature). So need to keep
that in mind when inspecting the changes. An improvement to the tool
that could really help would be to have it show for each conflict how
it changed on both master since branch creation. While this is easy to
do manually, it could make work more streamlined.

Hope that helps,
Yehuda
_______________________________________________
Dev mailing list -- dev@xxxxxxx
To unsubscribe send an email to dev-leave@xxxxxxx



[Index of Archives]     [CEPH Users]     [Ceph Devel]     [Ceph Large]     [Information on CEPH]     [Linux BTRFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux