Thread (2 messages) 2 messages, 2 authors, 2016-06-15

Re: .git and retrieving full source tree for own project(s)

flat view

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:47:21

"armencho@gmail.com" [off-list ref] writes:
What I am wondering about is, what is gits identity for a repository?
I don't share or publish the source directory anywhere, and just for
testing I removed everything but the ".git" directory and tried "git
checkout" and "git checkout master".
"git checkout" is a short-hand for "git checkout HEAD" which is to request
"switch to the branch denoted by HEAD, i.e. the current branch, while
keeping my local changes to the work tree and the index".

"git checkout master" is a request to "switch to the master branch, while
keeping my local changes to the work tree and the index".

In this case, your "delete everything" is your local change, and git did
its best to preserve it while switching branches.

If you want to "copy this and that files and directories out of the
commit at the tip of the current branch and deposit them in my work tree
and index", you would say

    $ git checkout HEAD this that

so a request for checking everything out would be a natural extension of
the above that would be:

    $ git checkout HEAD .

If you want to "copy this and that files and directories out of the index
and deposit them in my work tree", you would say

    $ git checkout this that
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help