Cherry Picking a Feature in GIT
A blog from the video available on SAP Web IDE channel.
This is in continuation with my previous blog https://blogs.sap.com/2017/02/01/git-basics-in-sap-web-ide-understanding-git/ . Refer to this blog, if you are not aware of how to create a GIT repository.
Cherry Picking a Feature means to take a commit from some other branch, and playback in desired / current branch.
This is required, for instance, if bug is fixed in one branch and we may need it to bring to another branch.
1.Create a local branch. Call it a “Feature” branch.
2. Make any changes in Feature branch.
3.Create a file “CommonMethods.js” in util folder. Our Project Explorer and git pane should be somewhat like this.
4.Click on Stage All, write Commit Description and Commit.
5. Check master branch, there won’t be any util folder. See below.
6. Now we want to commit this change to our local branch. For now its “master”. This will be known as cherry picking new feature to local branch. Cherry picking Feature Branch to Master branch.
Go to GIT history pane, then “Feature” branch. Select the branch. Click on Cherry-Pick.
Important : Make sure master branch is selected in GIT pane. As this is our local branch and we want new changes from feature branch to be reflected here.
After few seconds, desired commit will be cherry picked.
We are having util folder in our local branch now.
Now Push the changes of master branch to origin/master.
This is done with Cherry-Picking.
Please feel free to provide your queries/doubts/suggestions/corrections.