You are not allowed to add pages
This is an old revision of the document!
$ git config --list $ git config --global user.name "San Zhang" $ git config --global user.email "san.zhang@example.com" // global config file is ~/.gitconfig
$ git clone https://github.com/frdeng/oraclelinux.git
$ git remote add upstream https://github.com/boxcutter/oraclelinux.git $ git remote -v
$ git fetch upstream
$ git branch --set-upstream-to=upstream/master master
$ git checkout -b newfix
$ git add .
$ git commit -m "comments"
$ git push --set-upstream origin newfix
$ git checkout master $ git fetch upstream $ git rebase upstream/master $ git push origin master
$ 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
</code> # 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 from a branch or tag and switch to this branch ? $ git checkout -b [branch] # create a new branch and track remote branch $ git branch --track [branch] [remote-branch] # track remote branch for existing branch $ git branch --set-upstream-to [branch] [remote-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]
$ 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]
$ 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]
# 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
# 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
# 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