git clone --depth 1 --branch branch/tag_name remoteurl

[lake@localhost source]$ git clone   --depth 1  --branch   sshfs_2_5      https://github.com/libfuse/sshfs
Cloning into 'sshfs'...
remote: Enumerating objects: 19, done.
remote: Counting objects: 100% (19/19), done.
remote: Compressing objects: 100% (18/18), done.
remote: Total 19 (delta 0), reused 11 (delta 0), pack-reused 0
Receiving objects: 100% (19/19), 50.07 KiB | 178.00 KiB/s, done.
Note: switching to '6b4415ada44e0cbf1924f534cd04d117a5a4dbd3'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:

  git switch -c <new-branch-name>

Or undo this operation with:

  git switch -

Turn off this advice by setting config variable advice.detachedHead to false

[lake@localhost source]$ cd sshfs/
[lake@localhost sshfs]$ git branch
* (no branch)
[lake@localhost sshfs]$ git log
commit 6b4415ada44e0cbf1924f534cd04d117a5a4dbd3 (grafted, HEAD, tag: sshfs_2_5)
Author: Miklos Szeredi <[email protected]>
Date:   Tue Jan 14 15:23:31 2014 +0100

    Released 2.5
[lake@localhost sshfs]$
 

猜你喜欢

转载自blog.csdn.net/hushui/article/details/113251124