Skip to content

Instantly share code, notes, and snippets.

@chenxinlong
Last active December 2, 2022 02:44
Show Gist options
  • Select an option

  • Save chenxinlong/904e9f9a84567b90034e5651ceeb3483 to your computer and use it in GitHub Desktop.

Select an option

Save chenxinlong/904e9f9a84567b90034e5651ceeb3483 to your computer and use it in GitHub Desktop.
git
@chenxinlong
Copy link
Author

chenxinlong commented Jul 12, 2021

git alias

# git
alias glog='git --no-pager log --format="%C(yellow)%h %<(12)%Creset%an %C(white)%ci %s"'
alias gslog='git --no-pager shortlog --format="%C(yellow)%h %C(white)%ci %B"'
alias gam="git add . && git commit -m"
alias gba="git --no-pager branch -vva"
alias gb="git --no-pager branch -vv"
alias gck="git checkout"
alias gst="git status"
alias gss="git stash save --include-untracked"
alias gsl="git --no-pager stash list"
alias gsp="git stash pop"
alias gp="git pull"
alias gpb="git pull --rebase"
alias gfp="git fetch --prune"

gss

alias gss="git stash save --include-untracked"

正常的 git stash save 不会把 untracked file 给 stash 进去,例如我们新增了一个 .go 文件,此时还没有 add 这个 .go 文件的话是无法 stash 的。

如果想要 stash 这些还没有 add 的文件,就可以用 git stash save --include-untracked

@chenxinlong
Copy link
Author

chenxinlong commented Jul 12, 2021

git config

@chenxinlong
Copy link
Author

# ssh
# ssh connection keepalive
ssh -o TCPKeepAlive=yes -o ServerAliveInterval=60 root@1.1.1.1


# gpg2
# 国内可用 keyserver
# 建议 recv 和 send key 到 sks-keyserver pool : https://sks-keyservers.net/status/
# distributing keys : https://www.gnupg.org/gph/en/manual/x457.html
keyserver.ubuntu.com
pgp.mit.edu
...

@chenxinlong
Copy link
Author

gitk

安装

brew install git-gui

@chenxinlong
Copy link
Author

reset

把已经 commit 的代码回退到 uncommited

git reset --soft HEAD^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment