Reputation: 4826
I have a few commits in my repo, but for the moment, I want to build without the first 2 changes. How can I make a branch to go from where I was before these commits (Old
code), jump over 2 of them (A and B
), and use the Third (C
)?
Here is (basically) what I have now, all in one master branch:
Old---A---B---C (Master)
Here is something along the lines of what I'd like:
Old---A---B---C (Master)
\----------C (New_Branch)
Then I would intend to temporarily build from New_Branch, then get rid of it when finished. Is there a way to skip over/temporarily drop commits like this? I've tried branching but I always seen to pick up every commit along the way, so that my branches end up identical.
Upvotes: 0
Views: 419
Reputation: 457
You could right click the commit on C and create a new branch. This new branch will hold commits A, B and C. You can then right click A and do 'reverse commit', repeat this with commit B. However if commit C changes code/files from commit A and B then you could get into a bit of a mess.
Upvotes: 0
Reputation: 1929
With plain git you would use
git branch New_Branch Old
git checkout New_Branch
git cherry-pick C
I don't know how to do this with SourceTree.
Upvotes: 1