| 1 | = Introduction = |
| 2 | This wiki aims to make a quick and short explanation about how to use git for Smokin' Guns. For more details, it is highly recommended to look for some other wikis over the Internet. |
| 3 | Git is the software that manage the SG codebase. You can get a Linux support via the packet usually named {{{git}}}. On Windows, you will have to download {{{git bash}}} via this [http://git-scm.com/ link]. |
| 4 | |
| 5 | = Content = |
| 6 | * cloning |
| 7 | * branches |
| 8 | * diff |
| 9 | * patch |
| 10 | * commit |
| 11 | * tag |
| 12 | |
| 13 | == Cloning == |
| 14 | You need to clone a repository when you need to modify the code on your computer. |
| 15 | You just need to know: |
| 16 | {{{ |
| 17 | git clone <url> |
| 18 | }}} |
| 19 | == Branches == |
| 20 | A branch is a separate working copy into a git repository. |
| 21 | For creating a new branch: |
| 22 | {{{ |
| 23 | git branch <name> |
| 24 | }}} |
| 25 | For setting which branch to use (default is master): |
| 26 | {{{ |
| 27 | git checkout <name> |
| 28 | }}} |
| 29 | |
| 30 | == Diff == |
| 31 | The same says everything: get the difference between the last commit and the actual code. |
| 32 | To show the differences: |
| 33 | {{{ |
| 34 | git diff |
| 35 | }}} |
| 36 | If you want to save the changes in a file: |
| 37 | {{{ |
| 38 | git diff > file.diff |
| 39 | }}} |
| 40 | And if you want to patch it later, just do: |
| 41 | {{{ |
| 42 | patch -p1 < file.diff |
| 43 | }}} |
| 44 | |
| 45 | == Commit == |
| 46 | You firstly need to save your changes, then commit it. And then if you want it, push it to the server. All commits have an unique ID. |
| 47 | Add all files to the commit: |
| 48 | {{{ |
| 49 | git add * |
| 50 | }}} |
| 51 | Making the commit: |
| 52 | {{{ |
| 53 | git commit |
| 54 | }}} |
| 55 | You will need to write a small description then save your changes. |
| 56 | |
| 57 | Sending it to the server: |
| 58 | {{{ |
| 59 | git push |
| 60 | }}} |
| 61 | |
| 62 | If you want to update your existing code, use {{{git pull}}}. If you want to show the commit log, use {{{git log}}} or {{{git show <id>}}} |
| 63 | |
| 64 | == Tag == |
| 65 | A tag is a static picture of the current codebase. It's very helpful to be sure what a release had. |
| 66 | Listing all tags: |
| 67 | {{{ |
| 68 | git tag |
| 69 | }}} |
| 70 | Creating a new tag: |
| 71 | {{{ |
| 72 | git tag -a <version> -m '<version comment>' |
| 73 | }}} |
| 74 | Then you need to send them to the server: |
| 75 | {{{ |
| 76 | git push origin --tags |
| 77 | }}} |