Difference between revisions of "Git Notes"

(How to create a shared remote repository?)
(added category Git)
Line 46: Line 46:
 
<dd>Creates a bare remote repository at <code>ssh://server/home/you/remote.git</code> that tracks your local repository in <code>/home/you/local</code>.  Adopted from [[http://toolmantim.com/articles/setting_up_a_new_remote_git_repository Tim Lucas]].
 
<dd>Creates a bare remote repository at <code>ssh://server/home/you/remote.git</code> that tracks your local repository in <code>/home/you/local</code>.  Adopted from [[http://toolmantim.com/articles/setting_up_a_new_remote_git_repository Tim Lucas]].
 
</dl>
 
</dl>
 +
 +
 +
[[Category:Git]]

Revision as of 12:21, 10 February 2009

Some things that I wouldn't remember otherwise

This list is expected to be incomplete and even wrong, do not trust it!

git init --shared=group
Tell the repository that it should always set the permissions to g+w.
git branch -m <new branch name>
Rename the current branch.
git reset --hard HEAD^
Roll back.
git reset --hard HEAD@{1}
Roll back.
git checkout HEAD@{1} -- <file>
Cherry pick.
git diff <branch1> <branch2> -- <file>
Diff a file between two branches.
git log -p --color-words
Display a log with colored word diffs. Say "-S" to less to virtually wrap long lines.
git diff <commit a>:<file> <commit b>:<file> --color-words
Display a diff with colored words. Say "-S" to less to virtually wrap long lines.

Tutorials

How to create a shared remote repository?

ssh you@server
mkdir repos/remote.git
cd repos/remote.git
git --bare init --shared=group
logout

cd ~/local
git remote add origin ssh://you@server/home/you/remote.git
git push origin master
git-config branch.master.remote origin
git-config branch.master.merge refs/heads/master

Creates a bare remote repository at ssh://server/home/you/remote.git that tracks your local repository in /home/you/local. Adopted from [Tim Lucas].