git reference guide - part one
I'm still getting used to utilizing git for my version control. The part I like most is the merge handling. So here is another reference post for me, hopefully it will help me remember bits of my git work flow. Mostly basics, and some I do not need to remind myself, but it does not hurt to document.
Checkout repository - git clone
# Simple http
git clone https://github.com/user/project.git [directory name]
# or for an authenticated Fedora project repository:
git clone git://user@git.fedoraproject.org/git/project.git [directory name]
# or an authenticated github repository:
git clone git://git@github.com:user/Project.git [directory name]
git clone https://user@github.com/user/Gluster.git [directory name]
Add a file to the index - git add
git add path/to/file [more files]
See current status - git status
git status [path/to/file] [more files]
See differences between current changes and committed changes - git diff
Stash changes without committing them - git stash
Update local repository from remote - git pull
Commit changes in index - git commit
#Full set of added changes
git commit -a
# Ignore index and commit specific file(s)
git commit path/to/file [more files]
Generate a patch from local commit git format-patch
git format-patch {origin, branch}
Some useful options
- -find-renames, -M n%
- -output-directory, -o dir
- -numbered, -n
- -unnumbered, -N
- -signoff, -s
Directly send locally committed patch via e-mail - git send-email
see man page for Gmail config
git send-email --subject=SUBJECT --to=address [--to=additional] file.patch
Apply a patch set - git am
git am --signoff file.patch
Push changes to remote - git push
That is it for now, but I know there will be at least one more of this because I have not touched on branching and switching around between repositories.