| 105 | = revert = |
| 106 | |
| 107 | The 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 | |
| 111 | If you want to blow away all local changes, the equivalent of '''svn revert -R .''' is |
| 112 | |
| 113 | {{{ git checkout . }}} |
| 114 | |
| 115 | = help = |
| 116 | |
| 117 | Need more help? To get the man page for the git command '''foo'' type |
| 118 | |
| 119 | {{{ git help foo }}} |
| 120 | |
| 121 | If 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 | |
| 127 | If you think you lost your committed work, you are probably wrong. Try |
| 128 | |
| 129 | {{{ git reflog }}} |
| 130 | |
| 131 | This command is your best friend. It records the tip of '''every''' commit, even if it is not part of any branch. Did you |
| 132 | accidentally delete that '''really important''' branch ? Did you rebase away that '''really''' cool feature? |
| 133 | Find the sha1 one that you want to go to and then type |
| 134 | |
| 135 | {{{ git reset --hard sha1 }}} |
| 136 | |
| 137 | If 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 | |