Re: [git-users] How do I check out a remote git?
For shallow clones, you can use the --depth parameter, and for the branch, well, --branch. For more fine grained options you should consult the git-init manpage, which may present you other useful switches. For the last N commit part: N can be any positive integer, including one. This makes it possible to get an actual snapshot of the given branch. Which leads directly to your other question. Git stores a directory tree snapshot with every commit, and this directory tree references files (blobs in Git terminology). Whenever you change a file's contents the corresponding blob changes and with it, naturally, the whole tree, and this new tree will be saved with your next commit. Now if you don't change a file through 200 commits, that means the corresponding blob reference in all your trees remains unchanged. Thus, you will get the same blob (the file's contents) in the last commit as you did 200 commits before. When you make a shallow clone, Git will fetch the tree of the last N commits (N is what you specified after --depth), and all the referenced blobs. However, as that old blob is referenced by both the old and new trees, you don't have to fetch 200 commits, just the last few (N). (Note that technically a bit different things happen in the background; but in the end you will get only those last N commits.) For more information on this subject, I suggest to read an article/book on Git's internals (like [1]) and shallow clones (like [2]). Best, Gergely [1] http://git-scm.com/book/en/v1/Git-Internals [2] http://strk.keybit.net/blog/2011/06/07/getting-just-the-tip-of-a-remote-git-branch/ On 25 Feb 2015 19:42, "Michael" wrote: > > On 2015-02-24, at 10:40 PM, Gergely Polonkai wrote: > > Hello, > > yes, basically that is the way. There is an option in recent Git called > shallow clone, which doesn't clone the whole history, only the last N > commits. You can also specify the branch name you want to use instead of > master, so using these two, you will actually get what you want. > > Alright, so what is the actual syntax? > > Also: the last N commits? Not the current state of the branch? ... > > What if there's one file in the directory that has not been changed in two > years -- would that mean fetching two years worth of history to retrieve > the current state of things? > > ... > > -- > You received this message because you are subscribed to the Google Groups > "Git for human beings" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to git-users+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Git for human beings" group. To unsubscribe from this group and stop receiving emails from it, send an email to git-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [git-users] How do I check out a remote git?
On 2015-02-24, at 10:40 PM, Gergely Polonkai wrote: > Hello, > > yes, basically that is the way. There is an option in recent Git called > shallow clone, which doesn't clone the whole history, only the last N > commits. You can also specify the branch name you want to use instead of > master, so using these two, you will actually get what you want. > Alright, so what is the actual syntax? Also: the last N commits? Not the current state of the branch? ... What if there's one file in the directory that has not been changed in two years -- would that mean fetching two years worth of history to retrieve the current state of things? ... -- You received this message because you are subscribed to the Google Groups "Git for human beings" group. To unsubscribe from this group and stop receiving emails from it, send an email to git-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [git-users] How do I check out a remote git?
Hello, yes, basically that is the way. There is an option in recent Git called shallow clone, which doesn't clone the whole history, only the last N commits. You can also specify the branch name you want to use instead of master, so using these two, you will actually get what you want. For the second question, again, the answer is the same: yes, it is usually done like this. However, on *NIX-like systems using filesystems that can produce hardlinks, there is a way to clone a local (residing on the same filesystem) repository that reuses the original's pack and object files. However, you cannot do this if those developers work with a common remote on a separate machine/filesystem (or at least I'm not aware of such solution). Best, Gergely On 25 Feb 2015 03:35, "Michael" wrote: > How would someone check out a copy of branch "limonite-placer" from > https://gist.github.com/5e037df5b5c9209885d5.git > > Is the only way to do a full clone of the entire history locally, and then > check out the files you want? > > Equally, if two local users wanted to work on the same project, how do > they share the same repository, or do they both have to have duplicate > copies of all of the git objects/history and clone things? > > --- > Entertaining minecraft videos > http://YouTube.com/keybounce > > -- > You received this message because you are subscribed to the Google Groups > "Git for human beings" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to git-users+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Git for human beings" group. To unsubscribe from this group and stop receiving emails from it, send an email to git-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[git-users] How do I check out a remote git?
How would someone check out a copy of branch "limonite-placer" from https://gist.github.com/5e037df5b5c9209885d5.git Is the only way to do a full clone of the entire history locally, and then check out the files you want? Equally, if two local users wanted to work on the same project, how do they share the same repository, or do they both have to have duplicate copies of all of the git objects/history and clone things? --- Entertaining minecraft videos http://YouTube.com/keybounce -- You received this message because you are subscribed to the Google Groups "Git for human beings" group. To unsubscribe from this group and stop receiving emails from it, send an email to git-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.