Skip to main content

git


git config user.name aliveAmy
git config user.email aliveAmy719@gmail.com
git remote add aliveAmy
gp aliveAmy master

basic

commit vs commit -a

-a:

  1. git add
  2. 自动删除在 index file 中,但是不在工作树中的文件
  3. commit

结论: git commit -a === git add . && git commit

command

push

443 || 10054

Failed to connect to github.com port 443: Timed out || OpenSSL SSL_read: Connection was reset, errno 10054

git config --global http.proxy ""

如果还是不能解决

git config --global http.sslverify false

merge

git merge命令的语法是,将指定分支合并到当前所在分支。 所以把 a 分支的内容合并到 b分支时,需要切到b分支,执行git merge a

commit

LF & CRLF

fatal: LF would be replaced by CRLF in some file

git config --global core.safecrlf false

提交邮箱校验

需要修改最近一次的 commit author

git commit --amend --author="aliveAmy <aliveAmy719@gmail.com>"

remote version

  • check remote version
git remote -v
  • add remote version
git remote add [origin or someveriosn name]
  • remove remote version
git remote remove [origin or someversion name]

branch delete

// delete locally
git branch -d localBranchName

// delete remotely
git push origin --delete remoteBranch

SSH

生成秘钥

  ssh-keygen -t rsa -C aliveamy719@gmail.com

shortcut

windows

.bashrc
alias g='git'
alias gst='git status'
alias gd='git diff'
alias gdc='git diff --cached'
alias gl='git pull'
alias gup='git pull --rebase'
alias gp='git push'
alias gd='git diff'
alias gc='git commit -v'
alias gc!='git commit -v --amend'
alias gca='git commit -v -a'
alias gca!='git commit -v -a --amend'
alias gcmsg='git commit -m'
alias gco='git checkout'
alias gcm='git checkout master'
alias gr='git remote'
alias grv='git remote -v'
alias grmv='git remote rename'
alias grrm='git remote remove'
alias grset='git remote set-url'
alias grup='git remote update'
alias grbi='git rebase -i'
alias grbc='git rebase --continue'
alias grba='git rebase --abort'
alias gb='git branch'
alias gba='git branch -a'
alias gcount='git shortlog -sn'
alias gcl='git clone'
alias gcp='git cherry-pick'
alias glg='git log --stat --max-count=10'
alias glgg='git log --graph --max-count=10'
alias glgga='git log --graph --decorate --all'
alias glo='git log --oneline --decorate --color'
alias glog='git log --oneline --decorate --color --graph'
alias gss='git status -s'
alias ga='git add'
alias gm='git merge'
alias grh='git reset HEAD'
alias grhh='git reset HEAD --hard'
alias gclean='git reset --hard && git clean -dfx'
alias gwc='git whatchanged -p --abbrev-commit --pretty=medium'

#remove the gf alias
#alias gf='git ls-files | grep'

alias gpoat='git push origin --all && git push origin --tags'
alias gmt='git mergetool --no-prompt'

alias gg='git gui citool'
alias gga='git gui citool --amend'
alias gk='gitk --all --branches'

alias gsts='git stash show --text'
alias gsta='git stash'
alias gstp='git stash pop'
alias gstd='git stash drop'

# Will cd into the top of the current repository
# or submodule.
alias grt='cd $(git rev-parse --show-toplevel || echo ".")'

# Git and svn mix
alias git-svn-dcommit-push='git svn dcommit && git push github master:svntrunk'

alias gsr='git svn rebase'
alias gsd='git svn dcommit'

mac

直接上 zsh~

private key