5
1
It's really tedious to type the following command:
git checkout 622fe0a9b6bffdf4723026ae6e673245b510ac66
Is there autocomplete or shortcut to do this?
5
1
It's really tedious to type the following command:
git checkout 622fe0a9b6bffdf4723026ae6e673245b510ac66
Is there autocomplete or shortcut to do this?
6
Note that you have a ton of shortcuts which avoid entering the SHA1 altogether.
The short SHA1 are mentioned in "Git Tools - Revision Selection", but git rev-parse
section on "SPECIFYING REVISIONS" mentions also (small extract):
master@{5}
: the 5th prior value of mastermaster~3
A suffix ~<n>
to a revision parameter means the commit object that is the <n>
th generation ancestor of the named commit object:/fix nasty bug
names a commit whose commit message matches the specified regular expressionmaster@{yesterday}
, HEAD@{5 minutes ago}
: specifies the value of the ref at a prior point in time. So if you known when or where you old commit is based on the current branch, for instance, you have other options.
+1. I'd recommend that you get familiar with the treeishes VonC has linked to in his answer. They're much more effective than partial or complete SHAs. – Noufal Ibrahim – 2012-08-21T05:41:17.733
5
If you only enter the first few characters, it'll work as long as it's unambiguous.
Copy/paste seems to be the fastest way ;) But yes, you can just type in the first X characters until you have specified an unambiguous commit ID. I've never had to enter more than 6 characters. – MichaelM – 2012-08-21T04:27:04.037
1@Mechanicalsnail I'm using
oh my zsh!
– mko – 2012-08-21T05:04:04.290