Back

Explore Courses Blog Tutorials Interview Questions
0 votes
1 view
in DevOps and Agile by (19.4k points)

I'm working on 2 different branches: release and development.

I noticed I still need to integrate some changes that were committed to the release branch back into the development branch.

The problem is I don't need all of the commit, only some hunks in certain files, so a simple

git cherry-pick bc66559

does not do the trick.

When I do a

git show bc66559

I can see the diff but don't really know a good way of applying that partially to my current working tree.

1 Answer

0 votes
by (27.5k points)

Here's a chunk of code that might be helpful: 

git cherry-pick -n <commit> # get your patch, but don't commit                                (-n = --no-commit)

git reset                   # unstage the changes from the                                      cherry-picked commit

git add -p                  # make all your choices (add the                                   changes you do want)

git commit                  # make the commit!

Welcome to Intellipaat Community. Get your technical queries answered by top developers!

28.4k questions

29.7k answers

500 comments

94.1k users

Browse Categories

...