Linux Ask!

Linux Ask! is a Q & A web site specific for Linux related questions. Questions are collected, answered and audited by experienced Linux users.

Jan 122013
 

How to merge a specific file from another branch in Git

Answer:

You have two branches, develop and master. The develop branch contains a lot of commits but you only want to merge a particular commit (of two files), what would you do?

You can use git cherry-pick but the easiest way to do and most people need is the following:

# git checkout master
# git checkout develop /path/to/file1
# git checkout develop /path/to/file2
..
git commit -m 'Merge changes from develop for file1 and file2'

 Leave a Reply

(required)

(required)

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>