Git/archive
From Sit
< Git
SiT! is experimenting with git as a Distributed Version Control System for the development of 4.0. We will be using GitHub.
Contents |
Getting Started with Git Development
- Register for an account at github.com
- Click 'fork' on the main SiT branch to create your own fork of the code.
- Follow the instructions to get your new branch available locally
- Develop your new feature/patch/bug fix in your new branch
- (Optional) If you had svn access, send message to xerosis requesting access to the main branch, you can then merge directly (6) if not go to (7)
- (Optional) If you have access to the sitracker branch::
-
$ git remote add sitracker git@github.com:sitracker/sitracker.git- this adds the master branch as a remote branch that you can merge with -
$ git pull sitracker master- this updates it -
$ git push sitracker master- this pushes your changes
-
- Click 'pull request' on the main SiT branch page to request your changes to merged.
The above in more CLI-orientated terms
SiT v3
As you forked from the sitracker git, you will have a remote branch for sitracker3. To get this available locally simple branch it:
$ git branch sitracker3 origin/sitracker3
SVN
If you want to keep up with SVN changes, see GitSvnBranches.
Your Branches
Running $ git branch -a should give you something (if you added an svn and sitracker3 branch as above) like:
local-svn/trunk
* master
sitracker3
remotes/origin/HEAD -> origin/master
remotes/origin/master
remotes/origin/sitracker3
remotes/sitracker/master
remotes/sitracker/sitracker3
remotes/sourceforge/trunk
remotes/sourceforge/trunk@1866
remotes/sourceforge/trunk@2451
remotes/sourceforge/trunk@556
remotes/sourceforge/trunk@719
To describe some of these:
-
master- this is your local branch of the sitracker git branch, you should keep this 'pristine' and create branches for code that you don't want commiting to sitracker git right away -
local-svn/trunk- this is your local copy of the remote sourceforge svn (if you're syncing with svn, if not you won't have this). In this branch you can merge with remotes/sitracker/master to relay git commits into svn
Git Use Cases
Working out why git is useful over something like svn can be tricky so here are a few examples where it excels:
- John wants to fix a bug so he forks the main branch, fixes the problem and submits a pull request via github. This is much easier than passing around svn diffs.
- Dave is working on a feature which will break the main code base. Peter will be working on some code that needs Dave's feature. Dave finishes his feature and merges with Peter's code. Once Peter has then finished his feature, the code is then merged into the main branch.
Git Commands
-
git push <clone URL from github>this merges your current branch with someone else's -
git reset --hard origin- revert all local changes to this branch -
git branch -r- List remote branches -
git cherry-pick <commit ID>- pull in a commit from another branch
SVN vs Git
| SVN Term/Commands | Git version |
|---|---|
| trunk | master |
| svn ci | git commit (Local working copy) git push origin (Remote repo) |
| svn up | git pull |