Ho una lunga stringa hash SHA-1. Mi piacerebbe ottenere la versione di stringa hash SHA-1 più breve e non ambigua. Cioè, quello che otterrei usando git log -1 --pretty=format:%h
, supponendo che l'hash lungo si riferisca all'ultimo commit.get get short hash from regular hash
risposta
Lo SHA1 più breve è possibile ottenere ha una lunghezza di 4. parse Rev vi darà una SHA1 di 7 di default con l'opzione di breve:
git rev-parse --short 921103db8259eb9de72f42db8b939895f5651489
921103d
È devi specificare 4 per l'opzione breve per avere il più breve inequivocabile SHA1:
git rev-parse --short=4 921103db8259eb9de72f42db8b939895f5651489
92110
Ma se si specifica quanto è breve, si potrebbe danneggiare l'ambiguità, vero? –
No, troverà il più breve SHA1 possibile ma ancora unico. Come puoi vedere nel mio esempio, SHA1 ha una lunghezza di 5 anche se ho specificato una lunghezza di 4. – cexbrayat
Potrebbe diventare ambiguo con i commit futuri. – meawoppl
capito:
$ git rev-parse --short 1a6f39665adf05810f70b37ef6470bbcf61fcd38
1a6f396
- 1. MD5 Hash From String
- 2. get Year from java.util.Date
- 3. jQuery get hash dell'elemento <a> utilizzando l'evento .on()
- 4. Rubino: get coppia di hash con valore massimo
- 5. get topic from kafka message in spark
- 6. Perl Regular Expressions per abbinare un hash MD5?
- 7. get convalide dal modello
- 8. jquery hash se no hash
- 9. Java hash di hash 2
- 10. API di Bing Maps API Ajax - get location from address
- 11. Get Authenticated from token in Django Rest Framework
- 12. Get Integer From Bits Inside `std :: vector <char>`
- 13. Get HTTPS risposta
- 14. get .findOrCreate() error
- 15. Tabella hash vs lista hash vs albero hash?
- 16. Jsoup get URL reindirizzato
- 17. filtrare rapidamente un hash Perl di hash
- 18. Funzione hash che produce brevi hash?
- 19. Creazione di una tabella hash/funzione hash
- 20. rubino Hash includono un hash, Assegno profonda
- 21. Come inserire hash in hash in Perl
- 22. Stampa hash Mercurial Revision Hash corrente?
- 23. Filtrare un hash di hash in perl
- 24. Differenza tra hash vuoto e no hash
- 25. JDBC get/setObject vs. get/setSpecificType
- 26. Hash universale
- 27. Sovrascrittura hash
- 28. Hash su Unicode password
- 29. Impossibile convertire Hash in stringa?
- 30. Web GET
Possibile duplicato di [Ottieni l'hash della versione git breve] (http://stackoverflow.com/questions/5694389/get-the-short-git-version-hash) –