I have a git repository with two branches: master and gh-pages . If I want to copy the foo file from master to gh-pages without merging them. Which command should I use? Thank you very much.
master
gh-pages
foo
You can:
git checkout gh-pages git checkout master foo git commit -m 'Add file foo to gh-pages.'
If you want to compare all the differences between the two branches: you can use git difftool master gh-pages or git difftool <SHA1 of gh-pages> .
git difftool master gh-pages
git difftool <SHA1 of gh-pages> .
If you want to get diff for a specific list of files, follow this :
git diff master gh-pages -- path/to/file
How do I do this: when you commit, you have a choice of what to do and click. So copy only foo from master and then click it, then just merge it to github / bitbucket regardless of gh-pages