=== Contribute to github ===
- configure local git
$ git config --list
$ git config --global user.name "San Zhang"
$ git config --global user.email "san.zhang@example.com"
// global config file is ~/.gitconfig
- fork a repo on github.com
- clone repo
$ git clone https://github.com/frdeng/oraclelinux.git
- add upstream to your repo
$ git remote add upstream https://github.com/boxcutter/oraclelinux.git
$ git remote -v
- fetch upstream
$ git fetch upstream
- set upstream branch
$ git branch --set-upstream-to=upstream/master master
- create new branch for changes
$ git checkout -b newfix
- make code changes
- add changes
$ git add .
- commit changes
$ git commit -m "comments"
- push to origin
$ git push --set-upstream origin newfix
- create new pull request on github.com
- Once PR is accepted, the fix is merged to upstream, then sync up with upstream. Fetch upstream, and rebase upstream, then push to own forked repo(origin>
$ git checkout master
$ git fetch upstream
$ git rebase upstream/master
$ git push origin master
=== git configuration ===
$ git config --list
$ git config [--global] -e
$ git config [--global] user.name "San Zhang"
$ git config [--global] user.email "san.zhang@example.com"
// global config file is ~/.gitconfig
=== branch and tag ===
# list tags
$ git tag -n
# list local branches
$ git branch
# list remote branches
$ git branch -r
# list local and remote branches
$ git branch -a
# create a new branch, but do not switch to the branch
$ git branch [branch]
# create a branch and switch to it
$ git checkout -b [branch]
# create a new branch and track remote branch
$ git branch --track [branch] [remote-branch]
$ git checkout -b [branch] --track [remote-branch] or git checkout -b [branch] [remote-branch] //tracking is by default
# track current branch to remote branch
$ git branch --set-upstream-to [remote-branch]
# track a branch to remote branch
$ git branch --set-upstream-to [remote-branch] [branch]
# merge a branch to current branch
$ git merge [branch]
# pick a commit and merge to current branch
$ git cherry-pick [commit]
# delete a branch
$ git branch -d [branch]
# delete a remote branch
$ git push origin --delete [branch] or git branch -dr [remote/branch]
# list tags
$ git tag
# create a tag at current commit
$ git tag [tag]
# create a tag at specific commit
$ git tag [tag] [commit]
# delete local branch
$ git tag -d [tag]
# push specific tag
$ git push [remote] [tag]
# push all tags
$ git push [remote] --tags
# create a new branch from a tag
$ git checkout -b [branch] [tag]
=== add/remove file ===
$ git add [file1] [file2] ... [-p]
$ git add . //add all files to cache
$ git rm [file1] [file2] ...
$ git rm --cached [file1] //remove from cache but remain in working area
$ git mv [filename] [new filename]
=== commit ===
$ git commit -m "message"
$ git commit [file1] [file2] ... -m "message"
$ git commit -a //commit all
$ git commit -v //show diff info
# show one specific commit
$ git show [commit]
# show the affected files in the commit
$ git show --name-only [commit]
# display the file content at the cmmit
$ git show [commit]:[filename]
=== get diff ===
# display diff between working area and cache
$ git diff
# display diff between cache and last commit
$ git diff --cached [file]
# display diff between work and latest commit
$ git diff HEAD
# display diff between two branches
$ git diff [branch1]...[branch2]
# display diff on specific directory between two branches
$ git diff release-3.1..master -- version/
diff --git a/version/version.go b/version/version.go
index 6cb3c08..9134ceb 100644
--- a/version/version.go
+++ b/version/version.go
@@ -26,7 +26,7 @@ import (
var (
// MinClusterVersion is the min cluster version this etcd binary is compatible with.
MinClusterVersion = "3.0.0"
- Version = "3.1.0+git"
+ Version = "3.2.0+git"
APIVersion = "unknown"
// Git SHA Value will be set during build
=== get information ===
# display changes
$ git status
# display current branch version history
$ git log
# display current branch commit history including affected files
$ git log --stat
# search from log by keyword
$ git log -S [keyword]
# display all changes after some specific commit, show each commit in one line
$ git log [tag ] HEAD --pretty=format:%s
# display all changes after some specific commit, and search keyword
$ git log [tag] HEAD --grep [keyword]
# display one specific file history, including file name
$ git log --follow [file] or git whatchanged [file]
# display each diff of a file
$ git log -p [file]
# display last 5 commits
$ git log -5 --pretty --oneline
# display all users that have commits, sort by # of commits
$ git shortlog -sn
# display the specific file when and who has changed
$ git blame [file]
# reference log
$ git reflog
=== remote ===
# download all changes
$ git fetch [remote]
# show remote
$ git remote -v
# add a new remote git repo and name it
$ git remote add [shortname] [url]
# pull all remote changes and merge to local branch
$ git pull [remote] [branch]
# upload local branch to remote
$ git push [remote] [branch]
# force to push current branch to remote
$ git push [remote] --force
# push all branches to remote
$ git push [remote] --all