wiki:SmokinGuns/Building/git

Introduction

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. 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 link.

Content

  • cloning
  • branches
  • diff
  • patch
  • commit
  • tag

Cloning

You need to clone a repository when you need to modify the code on your computer. You just need to know:

git clone <url>

Branches

A branch is a separate working copy into a git repository. For creating a new branch:

git branch <name>

For setting which branch to use (default is master):

git checkout <name>

Diff

The same says everything: get the difference between the last commit and the actual code. To show the differences:

git diff

If you want to save the changes in a file:

git diff > file.diff

And if you want to patch it later, just do:

patch -p1 < file.diff

Commit

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. Add all files to the commit:

git add *

Making the commit:

git commit

You will need to write a small description then save your changes.

Sending it to the server:

git push

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>

Tag

A tag is a static picture of the current codebase. It's very helpful to be sure what a release had. Listing all tags:

git tag

Creating a new tag:

git tag -a <version> -m '<version comment>'

Then you need to send them to the server:

git push origin --tags
Last modified 3 years ago Last modified on Dec 24, 2013 5:18:30 PM