Thursday, December 23, 2010

GIT: Working on Branches: Sharing files and commits

Motivation:
You have several development branches but basically use the same files to test or benchmark all versions. Then there is no sense in developing different code in all these branches for the same purpose.
You can easily merge single files from one branch to the other by cherry-pick.

Example:
1. First commit a file and only the file you want to share, nothing else:
git commit bench.sh -m"Newest fancy script which does all tests for all versions"
2. Save the key somewhere.
3. Go to the other branch folder or checkout the other branch in the same folder, as you like.
4. git cherry-pick 123784hash

You should now have the same file in the other branch as well.


Thanks to Markus for pointing me towards this.

No comments:

Post a Comment