Assume I have this git structure:
* hash3 (HEAD -> origin/bN, bN) Message N
|
* ...
|
* hash2 (origin/b2, b2) Message 2
|
* hash1 (origin/b1, b1) Message 1
|
* hash0 (origin/master, master) Message 0
If I want to modify something of b1
, I would do git rebase -i hash0
and edit the commit with message Message 1
. After the rebase I would have:
* hash6 (HEAD -> bN) Message N
|
* ...
|
* hash5 Message 2
|
* hash4 Message 1
|
| * hash3 (origin/bN) Message N
| |
| * ...
| |
| * hash2 (origin/b2, b2) Message 2
| |
| * hash1 (origin/b1, b1) Message 1
|/
* hash0 (origin/master, master) Message 0
Then, I link every new hash with its corresponding branches and push that to origin in order to have this:
* hash6 (HEAD -> origin/bN, bN) Message N
|
* ...
|
* hash5 (origin/b2, b2) Message 2
|
* hash4 (origin/b1, b1) Message 1
|
* hash0 (origin/master, master) Message 0
I do that with the following commands for every <b1, hash4>
, <b2, hash5>
, ...
, <bN, hash6>
(which is a pain in the ass):
git branch -f b1 hash4
git push origin b1 --force
Question: Is there any way to automate this logic?