How can I clone git repository with specific revision, something like I usually do in Mercurial:
hg clone -r 3 /path/to/repository
git clone <repository> . Alternatively, you can perform git-clone and then check out a specific revision with git-checkout. git clone <repository> . That's all about cloning a Git repository with a specific revision.
git clone If you only need the specific tag, you can pass the --single-branch flag, which prevents fetching all the branches in the cloned repository. With the --single-branch flag, only the branch/tag specified by the --branch option is cloned. $ git clone -b <tagname> –single-branch <repository> .
There are two ways to clone a specific branch. You can either: Clone the repository, fetch all branches, and checkout to a specific branch immediately. Clone the repository and fetch only a single branch.
How do I pull a specific commit? The short answer is: you cannot pull a specific commit from a remote. However, you may fetch new data from the remote and then use git-checkout COMMIT_ID to view the code at the COMMIT_ID .
$ git clone $URL $ cd $PROJECT_NAME $ git reset --hard $SHA1
To again go back to the most recent commit
$ git pull
To save online (remote) the reverted commit, you must to push enforcing origin:
git push origin -f
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