|
|
(29 intermediate revisions by 7 users not shown) |
Line 1: |
Line 1: |
− | ==Source== | + | ==Download sources== |
− | ===Getting Git===
| + | Clone the whole repository |
− | ====Windows====
| + | git clone git://git.code.sf.net/p/ufoai/code ufoai |
− | [[Image:Git-clone-gui.png|right|300px|thumb|Checking out with the official Git GUI]]
| |
− | [[Image:Git-clone-gui-step2.png|right|300px|thumb|Clicking the clone button will start the process but you won't see anything until the download is done]]
| |
| | | |
− | Install [http://code.google.com/p/msysgit/ msysGit] and [http://code.google.com/p/tortoisegit/ TortoiseGIT] or install the official Git (see the msysGit link) and use the official Git GUI.
| + | Only clone the master branch |
| + | git clone -b master git://git.code.sf.net/p/ufoai/code ufoai |
| | | |
− | Use the msys batch file in the msysGit directory to get the mingw shell and execute all the commands below (if you are not using TortoiseGit and would like to deal with Git on the commandline)
| + | If you are new to [[git]], checkout out our [[git|help]] page. |
− | | |
− | ====Mac OS X====
| |
− | Get git-core through [http://www.macports.org macports]
| |
− | | |
− | ====Linux====
| |
− | If you are under [[Linux]] git should be installable via your package manager. | |
− | | |
− | ==Getting the source==
| |
− | | |
− | ===Easy Way===
| |
− | If you want only last '''master''' head as most peoples do, then after installing {{http|code.google.com/p/msysgit/ msysGit}}. First, you need open its shotcut 'Git Bash' and type this:
| |
− | | |
− | git init ufoai
| |
− | cd ufoai
| |
− | git remote add -t master origin git://ufoai.git.sourceforge.net/gitroot/ufoai/ufoai
| |
− | git fetch --depth 1
| |
− | git checkout -t origin/master
| |
− | | |
− | Now you can use {{http|code.google.com/p/tortoisegit/ TortoiseGIT}} for easier management of all downloaded stuff. Instead, you can use '''Git Clone''' -> '''depth 1''' and it will download around 32000~ objects, but the first way is better.
| |
− | | |
− | ==Hard Way==
| |
− | The repository includes data_source, all branches and all tags. It's often enough to only check out the master branch - which is the current state of development.
| |
− | | |
− | Check out the repository with:
| |
− | git clone git://ufoai.git.sourceforge.net/gitroot/ufoai/ufoai
| |
− | to download the source. This is a read-only checkout until now. To get the repository with write support, type:
| |
− | git remote set-url --push origin ssh://USER@ufoai.git.sourceforge.net/gitroot/ufoai/ufoai
| |
− | | |
− | ====Also getting data_source====
| |
− | Not everyone might be interested in the data_source data, so by default it's skipped for a clone. To also download data_source just type:
| |
− | git config --add remote.origin.fetch '+refs/other/*:refs/remotes/origin/*'
| |
− | Run git fetch afterwards to get the branch.
| |
− | | |
− | ====Config====
| |
− | For non-global options you have to {{command|cd}} into your git checkout directory first.
| |
− | git config --global user.name "Your Name"
| |
− | git config --global user.email mail@example.com
| |
− | git config --global alias.upbase "rebase '@{u}'"
| |
− | git config --global alias.wu "log --stat origin..@{0}"
| |
− | git config --global push.default tracking
| |
− | git config --global core.excludesfile '~/.gitignore'
| |
− | echo "*~" >> ~/.gitignore
| |
− | git config --global color.branch auto
| |
− | git config --global color.diff auto
| |
− | git config --global color.interactive auto
| |
− | git config --global color.status auto
| |
− | | |
− | To always rebase on a pull do this:
| |
− | git config branch.master.rebase true
| |
− | | |
− | ====Creating a patch====
| |
− | If you commited them already and would like to create a patch from the latest revision:
| |
− | git format-patch HEAD~
| |
− | If you would like to make patches for your last three revisions:
| |
− | git format-patch HEAD~3
| |
− | | |
− | ====Applying patches====
| |
− | git am patch.diff
| |
− | | |
− | ====Stash local changes====
| |
− | If you have uncommited modification that you would like to keep, you can stash them, do whatever you need a clean working copy for and pop the changes back into your working copy when you are done.
| |
− | git stash save
| |
− | Do you changes here...
| |
− | git stash pop
| |
− | | |
− | ====Show local commits====
| |
− | Shows local commits that are not yet part of the tracking branch:
| |
− | git cherry -v
| |
− | | |
− | ====Creating a branch====
| |
− | Create a branch that tracks the current active branch. If you are e.g. in master, your new created branch will track master.
| |
− | git branch -t BRANCHNAME
| |
− | Publish this branch
| |
− | git push origin master:BRANCHNAME
| |
− | | |
− | | |
− | ====Subsequent uses of the command====
| |
− | git fetch
| |
− | will update your copy of the source and
| |
− | git upbase
| |
− | will merge your changes in. If there are conflicts you have to resolve them and call
| |
− | git add FILE
| |
− | to mark the file as resolved. After that the rebase must be continued with:
| |
− | git rebase --continue
| |
− | | |
− | git log
| |
− | in the same directory presents you a log of recent changes.
| |
− | git commit
| |
− | commit changes to your local git repository
| |
− | git push
| |
− | pushes your commits to the global git repository.
| |
− | git checkout .
| |
− | reverts your local/uncommited changes.
| |
− | git reset --hard HEAD~
| |
− | completely reverts the last commit in your local repository to the predecessor of HEAD (branch, index and working copy)
| |
− | git reset --soft HEAD~
| |
− | reverts the last commit in your local repository without reverting the changed files to the predecessor of HEAD (branch, index and working copy) - use that command to prevent losing changes made to files in the commit you revert
| |
− | git init buildbot
| |
− | cd buildbot
| |
− | git fetch git://ufoai.git.sourceforge.net/gitroot/ufoai/ufoai buildbot:buildbot
| |
− | git checkout buildbot
| |
− | Only fetches the buildbot branch.
| |
− | git rebase --whitespace=fix origin/master
| |
− | Fixes whitespaces in all of your local commits.
| |
− | git init buildbot; cd !$; git remote add -t buildbot origin git://ufoai.git.sourceforge.net/gitroot/ufoai/ufoai; git fetch; git co buildbot
| |
− | Fetches only the buildbot branch and tracks the remote buildbot branch.
| |
− | | |
− | ====Getting help====
| |
− | Shows all available git commands:
| |
− | git help --all
| |
− | | |
− | ===Next steps===
| |
− | * [[Coding#Compiling_the_source|Compiling the source]]
| |
− | * [[Mapping/Compile|Compiling the maps]]
| |
− | * [[Translating#Compile_the_language_files|Compiling the language files]]
| |
− | | |
− | == github ==
| |
− | There is a [https://github.com/ufoai github] mirror which you can use for cloning, too. Using this mirror could be a preferred option if you have slow internet connection, because github allows longer download times than SourceForge.
| |
− | To clone repository from github mirror, use this command:
| |
− | git clone --progress git://github.com/ufoai/ufoai.git
| |
− | If you want this clone to track SourceForge repository, enter following commands after cloning completes:
| |
− | cd ufoai
| |
− | git config remote.origin.url git://ufoai.git.sourceforge.net/gitroot/ufoai/ufoai
| |
− | Please also note that github mirror tracks only the master branch. You will have to use SourceForge to fetch any other branches.
| |
− | | |
− | == rsync way ==
| |
− | Also it is possible to get repo via the [{{http|en.wikipedia.org/wiki/Rsync}} rsync] utility. Use it if your network doesn`t allow to load whole repo via git.
| |
− | | |
− | rsync -av ufoai.git.sourceforge.net::gitroot/ufoai/* $PATH_TO_RSYNC_TARGET_DIR
| |
− | | |
− | After the fetching you need to do some more things:
| |
− | 1. rename ufo to .git
| |
− | 2. edit .git/config and set bare to false
| |
− | 3. go into ufoai and checkout your working copy
| |
− | git remote set-url --push origin ssh://USER@ufoai.git.sourceforge.net/gitroot/ufoai/ufoai
| |
− | git remote set-url origin git://ufoai.git.sourceforge.net/gitroot/ufoai/ufoai
| |
− | | |
− | ==Webclient==
| |
− | There is also a [http://ufoai.git.sourceforge.net/ GIT Webclient] to browse the repository with your webbrowser.
| |
− | | |
− | ==External Links==
| |
− | * [http://cia.vc/stats/project/ufoai ciabot]
| |
− | | |
− | ==Git config==
| |
− | [alias]
| |
− | abort = rebase --abort
| |
− | amend = commit --amend
| |
− | ann = annotate
| |
− | ada = add -A
| |
− | adu = add -u
| |
− | bvv = branch -vv
| |
− | cat = cat-file -p
| |
− | ci = commit -a
| |
− | co = checkout
| |
− | conflict = !$EDITOR -c '/^[<=|>]\\{7\\}\\( \\|$\\)' `git ls-files --unmerged | cut -c 51- | uniq`
| |
− | contains = branch -a --contains
| |
− | continue = !git adu && git rebase --continue
| |
− | cox = checkout-index
| |
− | cx = commit
| |
− | da = diff HEAD
| |
− | dci = svn dcommit
| |
− | di = diff
| |
− | dx = diff --cached
| |
− | drop = stash drop
| |
− | gn = grep -In
| |
− | graph = log --decorate --graph
| |
− | gw = grep -Inw
| |
− | less = -p cat-file -p
| |
− | lg = log --decorate --graph --name-status
| |
− | lg1 = log --decorate --graph --oneline
| |
− | list = stash list
| |
− | pop = stash pop
| |
− | save = stash save
| |
− | sf = svn fetch -q
| |
− | skip = rebase --skip
| |
− | st = status -s
| |
− | tar = archive --format=tar
| |
− | upbase = rebase '@{u}'
| |
− | updiff = log -p --reverse @{u}..
| |
− | upstream = branch --set-upstream
| |
− | [core]
| |
− | excludesfile = ~/.gitignore
| |
− | pager = less -x 2 -R
| |
− | [diff]
| |
− | renames = copies
| |
− | [gc]
| |
− | #auto = 0
| |
− | [merge]
| |
− | conflictstyle=diff3
| |
− | [push]
| |
− | default=tracking
| |
− | [user]
| |
− | email = YOUR_MAIL
| |
− | name = YOUR_NAME
| |
− | | |
− | ==Links==
| |
− | * [http://git.or.cz/course/svn.html For SVN users]
| |
− | * [http://progit.org/book/ Git Book]
| |
− | * [http://wiki.sourcemage.org/Git_Guide Git Guide]
| |
| | | |
| [[Category:Contribute]] | | [[Category:Contribute]] |
| [[Category:Coding]] | | [[Category:Coding]] |
| [[Category:Development]] | | [[Category:Development]] |