Skip to content
Greg Flynn edited this page Jun 26, 2020 · 15 revisions

How to create a shared repo

New repo

git init --bare --shared=all $repodir

Edit a repo to be shared

chgrp -R foo $repodir
chmod -R g+rw $repodir
chmod g+s `find $repodir -type d`
gitk --all 
git stash list
git stash show <stash_hash>
git stash show -p <stash_hash>
git stash apply <stash_hash>
git stash save “foo”
git stash apply stash^{/foo}
git stash pop
git stash drop

Merging branches

git checkout master
git merge dev
git push
git checkout dev

git fetch

Merge one file

git checkout A
git checkout --patch B foo.txt
(Note if foo.txt does not exist do not use --patch)
or
git merge-file file1 original file2

Diff committed but not pushed files

git difftool --staged

View history

git log --patch -2  # is the number of commits to view
git log --stat -2
git rev-parse --short HEAD

Submodule tips and tricks

Revert submodule to pushed version

git submodule update

Sometimes you may need the -init flag

Additional resources

Clone this wiki locally