Total git newbie here,
I wanted to create a new folder that holds a specific commit I made. These are the steps I've taken:
git init
git add remote origin <ssh-clone-url>
git fetch origin <sha1>
git reset --hard HEAD
which gives me this error:
fatal: ambiguous argument 'HEAD': unknown revision or path not in the working tree.
What am I doing wrong here?
Your syntax for adding a remote is backwards.
...
git remote add origin <ssh-clone-url>
...
I think that the better way to do what you want to do is to pull down your master branch and cherry-pick which commit you want.
git remote add origin <ssh-clone-url>
git fetch origin master
git cherry-pick <sha1>
Remember that with git, you always have a full copy of your project history. If you really wanted to ONLY have that specific revision (I don't know why you would want this, but this seems to be what you are asking), simply execute the above command sequence and take the files that you want, getting rid of the detritus.
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