-
Notifications
You must be signed in to change notification settings - Fork 0
Git
Greg Flynn edited this page Mar 6, 2023
·
15 revisions
git init --bare --shared=all $repodirchgrp -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
git checkout master
git merge dev
git push
git checkout dev
git fetch
get all of the branch names pulled down
git branch -r
get updates for all of the remote branches
git fetch --all
Push to a branch that does not exist on the remote
git push -u origin HEAD
git rev-parse --short HEAD
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
git difftool --staged
git log --patch -2 # is the number of commits to view
git log --stat -2
git rev-parse --short HEAD
git submodule update
Sometimes you may need the -init flag
See what's going on:
git submodule status
| symbol | meaning |
|---|---|
+ |
Not initialized (run git submodule init) |
- |
Local changes not committed |
U |
Conflicts in the submodule |
|
No confilcts |
Always use ssh instead of https
vi ~/.gitconfig
[url "ssh://git@github.com/"]
insteadOf = https://github.com/
Push only some commits?
git push origin local_ref:remote_branch
Local_ref could be any of the following:
master~3
master~~~
a specific hash
Or even more
git bundle create "test" master
git lfs migrate info