git
Revision as of 05:29, 10 January 2008 by Brandon CS Sanders (talk | contribs) (HowToUseGit moved to git)
Contents
Checkout
git clone <repo> name
Checks out a copy of repo into the named directory
git clone nimbus.aboutus.com:/opt/git/aboutus aboutus-1.10.0
you'll want to edit .git/info/exclude and add at least LocalSettings.php, don't know how we can get these transmitted automatically
Status
git status
Diff
git diff
Update
git pull
Commit
git commit -a -m "commit message"
This will commit the changes to your local repository.
make *sure* you check status first, this will add all new files and commit them to your local repository.
If you don't want to use -a (probably a good idea) then run git add for each file you want to update before you run git commit.
Yes, that means that you have to git add a file every time you modify it, even if the file is already being tracked.
Push
git push origin
will push all commited patches you have on your local repository to the shared one you checked out from
Revert
for CVS style revert, i.e. to replace a fie with what it was before you changed it:
git diff filename | patch -R
making gitk not ugly
Add these lines to your ~/.gitk file. Apparently only the first three lines are really necessary. From http://scie.nti.st/2006/12/20/gitk-on-mac-os-x-screenshot
set mainfont {Arial 12}
set textfont {"Courier" 12}
set uifont {Arial 12 bold}
set findmergefiles 0
set maxgraphpct 50
set maxwidth 16
set cmitmode patch
set wrapcomment none
set showneartags 1
set bgcolor white
set fgcolor black
set colors {green red blue magenta darkgrey brown orange}
set diffcolors {red "#00a000" blue}
set permviews {}
$ mkdir new_shared_repo $ chown jason.developer new_shared_repo $ chmod g+s new_shared_repo $ cd new_shared_repo $ git --bare init --shared $ git --bare fetch /home/jason/new_project master:master
Branches via Multiple Repository
- make a new shared repo, cloned from the main repo
- developers on the branch clone from the new repo, and only push / pull to that
- to bring the branch up to date with changes to trunk, do a git pull and specify the trunk repo location
Things to Research
- how to revert a messed up merge between branches (can't revert multiparent commit)
- git seems to love branches but we aren't really using them ... what don't we know about branches that maybe would be helpful in the future?
