简体   繁体   中英

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?

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>...

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM