bloc referral

If you are interested in learning to code with a mentor, try bloc and get $100 off.

Wednesday, June 25, 2014

Git Cherry-Pick

Cherry-picking since day 1 at the new job. I learned this cool tool which has been a life saver while navigating my way through the new code base. I never had had the opportunity to use it previously, actually a lot of the cool git functionality I didn't use previously. Working on your own projects is completely different on collaborating on a project together with others. For example, when I was working on Chuych, I committed everything to master and rarely made branches unless I planned to break something.

git cherry-pick is a tool to copy specific commits from different branches with ease. I completed a fix to the app at work last work but realized I referenced the wrong ticket number within my commits and branch. The workflow is to use Jira to keep track of User Stories and Fix Tickets. Jira helps track how well the team is doing in the most current Sprint.

My error was discovered by a colleague reviewing my pull request. My initial though was to close the pull request and start over, but was given the opportunity to cherry-pick. If you look in github at a project, each commit has a unique id which can be called within the same project. The fix involved me creating a new branch and calling 'git cherry-pick <unique commit id> (its important to know you must cherry-pick from top to bottom, since each commit succession may be dependent on each other)










It as as simple as that and all my code transferred over without the need to start completely over. I am told cherry picking is not used as often but its great to know of this feature if needed. If you have been working on your own projects for awhile and have not contributed an open sourced project, I recommend the Odin Project. You will have the opportunity to use tools like 'git fetch' 'git pull' and even 'git cherry-pick' if necessary. Get out there and work with a team on something.

As I learn new tools I will be sharing them on the blog, so please subscribe or follow me on Twitter for updates.

No comments:

Post a Comment