Information Technology Reference
In-Depth Information
$ cd git-recipes
$ cp -R 05-01 05-12
$ cd 05-12
If you prefer, you can create local clones with the $ cp command. The clone cre-
ated with $ cp will be slightly different: its reflog is not empty and it doesn't contain
a remote. However these differences do not count in this recipe, therefore, you can
practice cloning with the $ cp command.
I presume you are currently on the master branch. Change the contents of the
m1.txt file and commit the change:
$ git checkout master
$ echo The new content from Recipe 5-12 > m1.txt
$ git snapshot The new content from Recipe 5-12
The only files available in the master branch are m1.txt , m2.txt , and
m3.txt . You want a copy of the i1.txt file, which is stored in the info branch.
You can achieve this with:
$ git checkout info -- i1.txt
It may happen that you will need to rename the file during checkout. That's exactly
why we modified the m1.txt file in the master branch. Right now, the version of
the m1.txt file in the master branch is different than the version in other branches.
How to get the m1.txt file from the doc branch without losing the version that is
stored in the working directory? You can display the m1.txt file stored in doc
branch on stdout by using:
$ git show doc:m1.txt
To save it with a different name, send the output to a file using stream redirection:
$ git show doc:m1.txt > m1-from-doc-branch.txt
Finish the recipe by creating another revision with the $ git snapshot Files
from other branches command.
Search WWH ::




Custom Search