I've been looking around for a while and different options trying to find an answer but am struggling with how I can accomplish this function. We have a high volume of changes and sometimes certain changes don't get approved in cycles while others do and our group wants to move to an Agile methodology.
We have this current setup in our repository for git:
Master - C1
\ \
\ Release1 - C1
\
Develop - C1 - C2 - C3 - C4 - C5 - C6
We have Develop created from Master at some point in time along with the first Release, all at the same commit level. Develop then gets a continuous flow of commits, some which pass testing and some don't. How can we individually move specific commits from Develop to Release1?
Something like this:
Master - C1 - - - - - Master
\ \ /
\ Release1 - C1 - C3 - C5 - C2
\
Develop - C1 - C2 - C3 - C4 - C5 - C6 - C7 - C8 - C9
I've tried cherry pick on C3 for example but it brings C2 with it. Any help would be greatly appreciated.
Edit: From the comments here are the steps and the output. I am trying to pick one or two of the commits and always get the same result. Am I doing it wrong?
~/git/cherrypick_test (Develop)
$ git log
commit 9d296fb748731c9252b55bcb52a14d2638112bd1 (HEAD -> Develop, origin/Develop)
Change3 123
commit 3e01cdf9d11043fd58e4684742a3f69ee350b037
Change 125
commit 62ab4c96a767113d22fb2f78d20b6d72587fff86
Change 124
commit c28ce2ea753611f5f5b559f4f6598b2584f3e2f6
Change2 123
commit 7763c4ef9c01b7b7c5189d9b9fa2cedaeff62d68
Change 123
commit 2a60e37761ed3de745e760d5a472fd593c4c9b26 (origin/release/Sprint1, release/Sprint1)
$ git checkout release/Sprint1
Switched to a new branch 'release/Sprint1'
Branch 'release/Sprint1' set up to track remote branch 'release/Sprint1' from 'origin'.
~/git/cherrypick_test (release/Sprint1)
$ git log
commit 2a60e37761ed3de745e760d5a472fd593c4c9b26 (HEAD -> release/Sprint1, origin/release/Sprint1)
~/git/cherrypick_test (release/Sprint1)
$ git cherry-pick 3e01cdf9d11043fd58e4684742a3f69ee350b037 62ab4c96a767113d22fb2f78d20b6d72587fff86
error: could not apply 3e01cdf9d...
hint: after resolving the conflicts, mark the corrected paths
hint: with 'git add <paths>' or 'git rm <paths>'
hint: and commit the result with 'git commit'
I don't understand why there would be conflicts as this is just added code to a single file for demonstration, but after opening up the file from SourceTree I see the following in merge conflict:
<<<<<<< HEAD
=======
//adding change 123
//second change 123
//change 124
//change 125
>>>>>>> 3e01cdf9d... SG7-125 test cherry picking function
In this example I should only get 124 and 125 but both 123s come along with them.