2

I am using Sourcetree and GitHub for a while now, and I have noticed there is missing some essential functionality that, in my opinion, would facilitate and speed up development.

When having multiple branches and fixing a bug on the master branch, I wish to cherry-pick this fix to another branche (let's say /test-branch). Later on, I wish to cherry-pick from /test-branch to /live-branch.

Is there, in some way, a possibility to track of ALL my cherry-picks done from the commit on the master branch and to see on which branches this commit is performed? I want some sort of output like:

[abc123] --commit SHA
    -> /master
    -> /test-branch
    -> /live-branch

EDIT I have found a webpage where something similar is resolved:

https://adamprescott.net/2015/10/02/tracking-commits-across-branches-with-git-and-sourcetree/

Here commits can be tracked accross branches using a Custom action. However, since cherry-picking results in an entirely new commit, the cherry-pick SHA does not correspond to the original commit SHA, thus does not work in my case.

Cœur
  • 37,241
  • 25
  • 195
  • 267
RazorAlliance192
  • 722
  • 9
  • 23
  • Note that the original branch might disappear. And even the original commit, if for example it is rebased after being cherry-picked from. Tracking is hard in the general case – Juh_ Jun 13 '18 at 12:33

1 Answers1

1

I would recommend daggy-fix merges for keeping track of your cherry-pick.

But the more general solution described in "Is there a way to figure out where a commit was cherry-pick'ed from?" proposes a script which can help determine which commit is a cherry-pick from another commit.
You would still need to script in order to get the result you want though.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Since cherry-picking maintains the original commit message, I would already be satisfied with searching by commit message. 'git log --grep="" --all'. Is there a command to get the current commit's message? Like $SHA gets you the commit's SHA – RazorAlliance192 Jun 03 '16 at 12:17
  • Yes, that is the idea, but you still need to script that search. – VonC Jun 03 '16 at 12:20
  • I can put that in a Custom Action then, no? I just need to know if there is a command to get the current commit's message? Similar to $SHA that gets the SHA of the current commit – RazorAlliance192 Jun 03 '16 at 12:21
  • @RazorAlliance192 There should be such a command: http://stackoverflow.com/a/7293026/6309, like `git log -1 --pretty=%B` – VonC Jun 03 '16 at 14:02