git config --local user.name "tongqijie"
git config --local user.email "tongqijie@hotmail.com"
git config credential.helper store
git config core.ignorecase false
: 设置文件名大小写敏感
git config --local --unset user.password
git config --local advice.detachedHead false
git config --local http.sslVerify false
git pull
git push
git clone [remote-repository] [local folder]
git status
git add [file|folder]
stage specified single file or specified folder
git add -A
stage all changes files
git stash save "message"
store all staged changes.
git stash apply stash@{0}
restore
git diff [file]
diff unstaged changes with staged changes
git diff --staged [file]
diff staged changes with last commit
git commit -m [comment]
commit with comment
git commit -a
commit with unstaged files
git tag [tag name]
set tag
git push --tags
push all tags to server
git push [tag name]
push a tag to server
git rm --cached [file]
remove single file that has committed
git rm --cached -r [folder]
remove all files under folder that have committed
git mv [old file] [new file]
git log --graph --pretty=oneline --name-status
git log --pretty=format:"%h%x09%ad%x09%s" --date=format:'%Y-%m-%d %H:%M:%S' --max-count=10
git reset HEAD [file]
remove staged file
git reset --hard
undo changes of modified files
git checkout -- [file]
undo unstaged files
git clean -fd
remove all untracked files and directories.
git reset [--soft|--hard|--mixed] [commit id]
--soft: HEAD pointer points to specified commit, but working directory does not changes. All changes since specified commit have been staged to commit.
--hard: HEAD pointer points to specified commit, and all changes since specified commit will be discarded.
--mixed: HEAD pointer points to specified commit, but working directory does not changes. All changes since specified commit are not staged.
git branch [new branch]
create new branch
git branch [new branch] [commit id]
create new branch from specified commit
git branch -d [branch]
delete branch
git checkout [branch]
switch to specified branch
git branch -D [branch]
delete local branch
git push origin --delete [branch]
delete remote branch
git push origin [branch]
push branch to remote server
git merge [branch]
merge specified branch to current branch
git merge --abort
abort the merge
git remote prune origin
remove info about removed remote branches
git revert [commit id]
回滚指定的commit,生成一个新的commit来抵消原来的commit