From cf5dfce27df2a44434891e9d7252cd8e03132ff6 Mon Sep 17 00:00:00 2001 From: gebele Date: Thu, 29 Oct 2015 11:26:23 +0100 Subject: additional tips for merging single files with git --- _posts/2012-06-29-useful-git-tricks.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/_posts/2012-06-29-useful-git-tricks.md b/_posts/2012-06-29-useful-git-tricks.md index b9dfa89..f8b4c04 100644 --- a/_posts/2012-06-29-useful-git-tricks.md +++ b/_posts/2012-06-29-useful-git-tricks.md @@ -60,3 +60,7 @@ Now, origin should also be downgraded on branch ``. Here is how to remov git push origin : +## Merge specific files from branch to branch + +Suppose you want merge a specific `FILE` or commit from branch `feature/foo` to any other branch eg. branch `master` you can use `--patch`. +First checkout to your destination branch `git checkout master`. Then `git checkout --patch feature/foo FILE`. It gives you additional prompt to control merge options where you can agree or deny single diffs within the file you want to merge. Same procedure with single commits. -- cgit v1.2.3