Tags

, ,


Refer: http://linux.yyz.us/git-howto.html
Basic Tasks:

#Download a linux kerrnel tree
$git clone $git://$git.kernel.org/pub/scm/linux/kernel/$git/torvalds/linux-2.6.$git linux-2.6

$git pull #Update, run in your closed path or
$git checkout -f #Undo all local modifications
$git commit -a #Check in all modifications

#Undo recent commits:
$git reset HEAD~2 #make last 2 commits disappear. DO NOT do this, if anyone has downloaded a tree containing the commits you just eliminated.
$git diff #Display changes since last '$git add' or '$git rm'
$git diff HEAD #Display changes since last commit
$git log #List all changeset descriptions
$git log net/ieee80211/ieee80211_module.c #List all changesets belonging to a specific file
$git branch #List all branches
$git checkout $branch #Make desired branch current in working directory
$git checkout -b my-new-branch-name master # Create a new branch and make it current
$git status #Examine which branch is current
$git diff master..HEAD #Obtain a diff between current branch and masterr branch
$git log master..HEAD #Obtain a list of changes between current branch and master branch
$git shortlog master..HEAD #Or obtain one line summary of changes

$git checkout M #Switch to branch M
$git merge A #Merge A into M
$git merge B #Merge B into M

$git gc #Optimize your repository
$git checkout -b tmp v2.6.22 #Check out an older kernel version
$git am --utf8 --singoff /path/to/mbox #Apply all patches in a Berkeley mbox-format file
$git tag my-tag #Tag a particular commit
Advertisements