2011-06-30 14 views
10

Mi git log está mostrando algo como:¿Cómo pagar una versión particular en git desde el registro de git?

enter code here 
[git_trial]$ git log 
commit 4c5bc66ae50780cf8dcaf032da98422aea6e2cf7 
Author: king <[email protected]> 
Date: Thu Jun 30 15:09:55 2011 +0530 


This is third commit 

commit 8072be67ddd310bc200cab0dccb8bcb2ec4f922c 

Author: king <[email protected]> 

Date: Thu Jun 30 14:17:27 2011 +0530 

This is the second commit 

commit 3ba6ce43d500b12f64368b2c27f35211cf189b68 

Author: king <[email protected]> 

Date: Thu Jun 30 14:00:01 2011 +0530 


This is the first git commit for file1 

la pregunta 1) Ahora cómo obtener sólo la primera versión? Pregunta 2) También cuando lo hago, git solo inicia sesión en File1, ¿por qué muestra solo first commit?

[git_trial]$ git checkout 3ba6ce43d500b12f64368b2c27f35211cf189b68 
Note: moving to "3ba6ce43d500b12f64368b2c27f35211cf189b68" which isn't a local branch 
If you want to create a new branch from this checkout, you may do so 
(now or later) by using -b with the checkout command again. Example: 

    git checkout -b <new_branch_name> 


    [git_trial]$ git log File1 

    commit 3ba6ce43d500b12f64368b2c27f35211cf189b68 

    Author: king <[email protected]> 
    Date: Thu Jun 30 14:00:01 2011 +0530 

    This is the first git commit for file1 

Respuesta

28

Puedes retirar una confirmación utilizando git checkout sha-of-commit la que ya tiene.

Pero no puedes comprometer nada (ya que no estás en una sucursal, estás en una confirmación estática).

Si necesita confirmar algo además de esa confirmación, debe verificarlo en una rama usando git checkout sha-of-commit -b testing-a-commit.

git log <file> solo muestra confirmaciones que afectan a ese archivo.

+0

Perdón por la respuesta tardía ... la red es demasiado lenta aquí. Entonces, ¿quieres decir que si creo una sucursal y realizo mis primeras y sucesivas confirmaciones, entonces puedo verificar alguna versión en particular? – kingsmasher1

+0

¿Qué es sha-of-commit? – kingsmasher1

+0

@ kingshasher1, sha = SHA1 hash, como '3ba6ce43d500b12f64368b2c27f35211cf189b68'. – Dogbert

Cuestiones relacionadas