I have a git repository with two branches: master
and gh-pages
. If I want to copy a file foo
from master
to gh-pages
without merging them. What command should I use? Many thanks.
The easiest way to copy files and folders from within a working tree is to use the right-drag menu. When you right-drag a file or folder from one working tree to another, or even within the same folder, a context menu appears when you release the mouse.
The implementation behind Git branches is much more lightweight than other version control system models. Instead of copying files from directory to directory, Git stores a branch as a reference to a commit.
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 diffs between 2 branches: you can use git difftool master gh-pages
or git difftool <SHA1 of gh-pages> .
If you want to get diff for specific list of files follow this:
git diff master gh-pages -- path/to/file
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With