xxxxxxxxxx# Git Authentication with CLI- conda install gh --channel conda-forge- gh auth login# Git asking repeatedly entering psw- git config --global credential.helper store
xxxxxxxxxx# No showing untracked files- git status -uno# Pull remote branch- git branch -r | grep name
xxxxxxxxxx# Retreat commit- git reset --soft HEAD^n# give up modification- git reset --hard HEAD~1# Check commits history- git log --oneline ## squash commits into one- git log --graph --decorate --pretty=oneline --abbrev-commit # to print all the commits# Combine commits into one- git rebase -i bb0c9c2 # combine till this commit, in interactive mode# ===============pick 382a2a5 add database settingssquash cd82f29 add cat 1pick 1de2076 add cat 2# Change to# ===============pick 382a2a5 add database settingspick cd82f29 add cat 1pick 1de2076 add cat 2# Amend commits and Force push local commits- git commit --amend- git push -f # "force local branch commit to cover the remote commit"
xxxxxxxxxxgit rebase -i HEAD~3git rebase --onto master 76cada^
xxxxxxxxxxgit stash push -m "my_stash_name"git stash apply stash^{/my_stash_name}
xxxxxxxxxxgit stash apply + version

xxxxxxxxxxgit mergetool
xxxxxxxxxxgit log --pretty=oneline --follow filename --- 显示某个文件的修改历史,加上--follow后即使文件被移动过也可以查看历史