---
title: git cmd
tags: git
---
git update 系統更新git版本
git log 檢視提交的歷史記錄(commit), 按 q 離開
git commit 最初始的commit
git commit --amend -m "" 修改最後一次的 commit
git branch -a List all branches
git branch -d <branchName> delete branch
git switch <branchName> switch branch
del -f .git/index.lock (Another git process seems to be running in this repository) issue,也可以手動刪除 git
git update-ref -d HEAD delete initial commit, if not =>(git reset HEAD~)
後來我直接刪除專案資料本身隱藏的git folder 當作reset 整個git
git show show content
ls -a see all of files under the folder
rm -rf .git delete the .git files
git status see content in .git file
git reset HEAD^ delete last commit
git reset "HEAD^"
git reset 'HEAD@{1}' undo reset(get last commit back)
git reflog see the commit history
git reset <commit-code>
//undo that <commit-code> commit, can use 'git reflog' to see commit-code
git clean -f clean untracked files from the working tree
git checkout . Switch branches or restore working tree files
git remote -v see remote name/url
git remote set-url origin <your-remote-gitURL> change the URI (URL) for a remote Git
git reset --hard HEAD
git clean -f -d deletes all your untracked files/directories and can't be undone
git push heroku master --force force to push
git rm --cached yourFile. remove from git be untracked
git config --global user.name
git config --global user.email
git config --global -e open git setting file
git rebase
git rebase ---contuine
git stash save uncommit thing to git default register
git stash pop take latest uncommit thing
git commit --amend update now commit
git push origin <branch-name> -u remember the push history, next time just "git push" in that branch
---
> git config -e
[user]
name = <name>
email = <email>
signingkey = <commit-verify-gpg-key>
[commit]
gpgsign = true
[alias]
lg = log --color --graph --all --pretty=format:'%Cred%h%Creset - %s%C(yellow)%d%Creset <%C(blue)%an%Creset> %C(green)%cr%Creset.' --abbrev-commit --
—