James.Smith
James.Smith

Reputation: 139

Git: How to pull only a subset of Dev branch into Master

I need to pull a subset of files from my dev branch into Master. I am new to Git, and I am using it inside of VS2015 (VSTS). I want to pull 4 of 7 from dev into master but I am lost as to how.

Can I do it through the GUI, do I need to go to the command line?

Upvotes: 1

Views: 320

Answers (2)

Chandan Rai
Chandan Rai

Reputation: 10369

If you are talking about moving certain commits.

git checkout master
git fetch 
git cherry-pick <coma separated commit-hashes>
git push origin master

If certain files

git checkout master
git fetch
git checkout -m <revision> <yourfilepath>
git add <yourfilepath>
git commit

Upvotes: 0

VonC
VonC

Reputation: 1324347

For fine-grained operations like that, it is best to revert to the Git command-line (even for VSTS: Visual Studio Team Services) and follow some of the options of "How do you merge selective files with git-merge?".

In your case, since we are talking about only 4 files:

git checkout master
git checkout dev -- <paths>...

Or to selectively merge hunks

git checkout -p dev -- <paths>...

Upvotes: 1

Related Questions