Changes between Initial Version and Version 1 of SmokinGuns/Building/git


Ignore:
Timestamp:
Dec 24, 2013 5:18:30 PM (4 years ago)
Author:
barto
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • SmokinGuns/Building/git

    v1 v1  
     1= Introduction = 
     2This 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. 
     3Git 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 == 
     14You need to clone a repository when you need to modify the code on your computer. 
     15You just need to know: 
     16{{{ 
     17git clone <url> 
     18}}} 
     19== Branches == 
     20A branch is a separate working copy into a git repository. 
     21For creating a new branch: 
     22{{{ 
     23git branch <name> 
     24}}} 
     25For setting which branch to use (default is master): 
     26{{{ 
     27git checkout <name> 
     28}}} 
     29 
     30== Diff == 
     31The same says everything: get the difference between the last commit and the actual code. 
     32To show the differences: 
     33{{{ 
     34git diff 
     35}}} 
     36If you want to save the changes in a file: 
     37{{{ 
     38git diff > file.diff 
     39}}} 
     40And if you want to patch it later, just do: 
     41{{{ 
     42patch -p1 < file.diff 
     43}}} 
     44 
     45== Commit == 
     46You 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. 
     47Add all files to the commit: 
     48{{{ 
     49git add * 
     50}}} 
     51Making the commit: 
     52{{{ 
     53git commit 
     54}}} 
     55You will need to write a small description then save your changes. 
     56 
     57Sending it to the server: 
     58{{{ 
     59git push 
     60}}} 
     61 
     62If 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 == 
     65A tag is a static picture of the current codebase. It's very helpful to be sure what a release had. 
     66Listing all tags: 
     67{{{ 
     68git tag 
     69}}} 
     70Creating a new tag: 
     71{{{ 
     72git tag -a <version> -m '<version comment>' 
     73}}} 
     74Then you need to send them to the server: 
     75{{{ 
     76git push origin --tags 
     77}}}