Changes between Version 9 and Version 10 of GitCookbook

Show
Ignore:
Timestamp:
09/09/09 06:41:11 (5 years ago)
Author:
dukeleto
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • GitCookbook

    v9 v10  
    103103{{{ git blame somefile }}} 
    104104 
     105= revert = 
     106 
     107The equivalent of '''svn revert''' is roughly '''git checkout'''. Let's say we totally borked a file, '''README''' and we want to revert that file: 
     108 
     109{{{ git checkout README }}} 
     110 
     111If you want to blow away all local changes, the equivalent of '''svn revert -R .''' is  
     112 
     113{{{ git checkout . }}} 
     114 
     115= help = 
     116 
     117Need more help? To get the man page for the git command '''foo'' type  
     118 
     119{{{ git help foo }}} 
     120 
     121If you just want a short rundown of commandline options and such, try  
     122 
     123{{{ git foo -h }}} 
     124 
     125= OH NOES, git lost my work, I hate git, give me svn back = 
     126 
     127If you think you lost your committed work, you are probably wrong. Try  
     128 
     129{{{ git reflog }}} 
     130 
     131This command is your best friend. It records the tip of '''every''' commit, even if it is not part of any branch. Did you 
     132accidentally delete that '''really important''' branch ? Did you rebase away that '''really''' cool feature? 
     133Find the sha1 one that you want to go to and then type 
     134 
     135{{{ git reset --hard sha1 }}} 
     136 
     137If you want to keep track of that important sha1, you probably want to create a branch at that point: 
     138 
     139{{{ git checkout -b this_branch_is_awesome }}} 
     140 
     141 
     142 
     143