Recent Changes - Search:

Basics

Languages

Tools

OS

Resources

PmWiki

pmwiki.org

edit SideBar

Git /

RawNotes

==commands==
git config --global "property" "value"
edit properties in the global configuration

git config --list
list global configuration

git init
initialize repository

git status
check status of current repository

git add "filename"
Adds a file to the repository

git commit -m "blabla"
commits changes with message "blabla"

git log
tells you the history of this repo

git reset HEAD (optional filename)
unstage files for commits

git rebase -i HEAD~n
pick/remove/squash commits to change history

git diff filename
difference between last committed file and current file (+ = added content)

git diff code filename
difference between committed file (at commit given by code) and current

git diff code1 code2 filename
difference between two commits for the file

git diff --cached filename
compare between last committed file and currently staged file

git branch --list
List the branches currently in use

git branch "name"
creates a new branch

git branch -d "name"
Delete given branch

git checkout "name"
make "name" the current branch

git checkout "code"
checkout files as they were in the commit ID'd by the code

git merge "name"
add the changes from given branch to the master branch

git clone "target" "dest"
clone target repository into destination
- target: a git repository. Can be given as: user@domain:path/to/repo
- dest: the folder in which to setup the clone

git remote -v
List remote repositories with some details

========= Update local repo to a remote one ===========
git checkout master
git remote add upstream git@github.com:SupSuper/OpenXcom.git
git fetch upstream
git merge upstream/master

=============== Merge with other repos ================
# make a new branch (for safety..)
git checkout -b mybranch
# and add new repo (ex.: redv) as a remote and merge in his branch to yours:
git remote add redv git@github.com:redv/OpenXcom.git
git fetch redv
git merge redv/fix_alien_containment3

=================== Create a patch ====================
#This will create 1 patch file per commit 
git checkout "repo/branch of patch"
git checkout "last commit of a patch"
git format-patch "reference commit"

#This will create 1 patch file total
git checkout "repo/branch of patch"
git checkout "last commit of a patch"
git format patch "reference commit" --stdout > "Patch-File".patch

##NOTE: In theory it might be possible to create a patch by using: git diff "Last" "Ref" > Patch

==================== Apply a patch ====================
git checkout "Branch on which the patch will be applied" (use -b to create a new branch)
git am < "Patch to be applied"

## Additional checks:
Get the stats of the patch: git apply --stats "Patch"
Check changes and conflicts: git apply --check "Patch"

==global configuration==
user.name=Jean-Pierre Auclair
user.email=jn402157@dal.ca
core.autocrlf=input
core.editor=vi
color.ui=auto
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
Edit - History - Print - Recent Changes - Search
Page last modified on August 07, 2015, at 04:40 PM