| | 99 | You can add some aliases so that some git commands spell like the svn ones. The following are useful: |
| | 100 | |
| | 101 | {{{ |
| | 102 | git config alias.co checkout |
| | 103 | git config alias.ci commit |
| | 104 | git config alias.st status |
| | 105 | }}} |
| | 106 | |
| | 107 | == Scenario 1 == |
| | 108 | |
| | 109 | Getting the sources from the NumPy repository, just to look at the sources, or to build from last version instead of released: |
| | 110 | |
| | 111 | {{{ |
| | 112 | git clone http://git.scipy.org/git/numpy numpy |
| | 113 | }}} |
| | 114 | |
| | 115 | A tarball will also be made available on the scipy website, so that you don't need git at all in this scenario. |
| | 116 | |
| | 117 | == Scenario 2 == |
| | 118 | |
| | 119 | I have found a bug, and I want to submit a patch. I want to do it like in svn, I don't care about git: |
| | 120 | |
| | 121 | {{{ |
| | 122 | # This will list the changed files |
| | 123 | git status |
| | 124 | # This will put the changes into a patch |
| | 125 | git diff |
| | 126 | }}} |
| | 127 | |
| | 128 | == Scenario 3: reverting changes == |
| | 129 | |
| | 130 | I have made some changes, but I am confused, I just want to restart from last revision and throw everything away. |
| | 131 | |
| | 132 | There are several solutions - do NOT use revert, git revert is totally different from svn revert. The safe and easy one: |
| | 133 | |
| | 134 | {{{ |
| | 135 | git stash |
| | 136 | }}} |
| | 137 | |
| | 138 | This will put your changes aside (in a 'stash'), and your working tree will be exactly as if you checked out from the last revision of your repository. It is safe because your changes are not lost - you can reapply them: |
| | 139 | |
| | 140 | {{{ |
| | 141 | git stash apply |
| | 142 | }}} |
| | 143 | |
| | 144 | If you really don't care about the changes, and are ready to throw them away with no change of recovering: use the checkout option: |
| | 145 | |
| | 146 | {{{ |
| | 147 | git co myfile |
| | 148 | }}} |
| | 149 | |
| | 150 | This will have the same semantics as svn revert. |