Git常用記錄? ?&&
error: pathspec 'modify return validateParams' did not match any file(s) known to git.
git commit 提交的時(shí)候報(bào)錯(cuò),原因是少了參數(shù)-m,無(wú)法識(shí)別note
也有可能是路徑不對(duì)
Git命令簡(jiǎn)單常用如下:
? ? 本地空文件夾初始化倉(cāng)庫(kù):
? ? ? ? ? ? git init
? ? ? ? ? ? git remote add origin http://mobileapi.gree.com:3000/180476/inforapi.git
? ? ? ? ? ? git pull origin jia
? ? ? ? ? ? note:.git 文件追蹤本地倉(cāng)庫(kù),如果不要倉(cāng)庫(kù)了,把.git 刪掉就好了
? ? Git查看分支信息
? ? ? ? ? ? git branch -a? ? ? ? ? ? ? ? ? ? ?查看遠(yuǎn)程分支
? ? ? ? ? ??git branch? ? ? ? ? ? ? ? ? ? ? ? ?查看本地分支
? ? ? ? ? ? git branch -d 分支名? ? ? ? ?刪除本地分支
? ? ? ? ? ? git checkout 分支名? ? ? ? ? 切換分支
????Git切換分支提交代碼:
? ??????????git checkout devops
????????????git status
????????????git add .? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 暫存區(qū)
????????????git commit -m "first commit"? ? ?本地服務(wù)器
????????????git push origin master? ? ? ? ? ? ? 遠(yuǎn)程服務(wù)器
????將本地變更暫存,繼續(xù)操作與遠(yuǎn)程同步
? ? ? ? ? ? git stash
? ? ? ? ? ? git stash list
? ? ? ? ? ? git stash show
? ? ? ? ? ? git stash clear? ? ? ? ? ? ? ? ? ? ? ? ? ?清除不用的暫存
? ??????????git add 只是把文件加到git 版本控制里,并不等于就被stash起來(lái)了,git add和git stash 沒(méi)有必然的關(guān)系,但是執(zhí)行g(shù)it stash 能正確存儲(chǔ)的前提是文件必須在git 版本控制中才行
? ? 空文件夾下載代碼:
????????????新建空文件夾->git bash here打開(kāi)
? ? ? ? ? ? git clone http://mobileapi.gree.com:3000/180476/inforapi.git? ? ? ? ? ? ? ?下載代碼
????如何把本地項(xiàng)目傳到Git
? ? ? ? ? ? git init
? ? ? ? ? ? git add.? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?添加文件夾下所有文件
? ? ? ? ? ? git commit -m "提交說(shuō)明"
? ? ? ? ? ? git remote add origin Git地址
? ? ? ? ? ? git pull --rebase origin master? ? ? ? ? ? ? ? 遠(yuǎn)程庫(kù)與本地同步
????????????git push origin master? ? ? ? ? ? ? ? ? ? ? ? ? ? 本地倉(cāng)庫(kù)推送到遠(yuǎn)程
????????????git status
????查看并更改Git賬戶(hù)或郵箱:
? ? ? ? ? ? git config --global user.name? ? ? ? ? ? ? ? ? ? ? ? ?查看用戶(hù)?
? ? ? ? ? ? git config --global user.email? ? ? ? ? ? ? ? ? ? ? ? ?查看郵箱?
? ? ? ? ? ? git config --global user.name "test"? ? ? ? ? ? ? ?更改賬戶(hù)??
? ? ? ? ? ? git config --global user.email "fighting_z125@163.com"? ? ? ? ? ??更改郵箱??
未提交到遠(yuǎn)程的情況下,修改commit記錄:
? ??????git commit --amend? 進(jìn)入vim界面
? ? ? ? i? 進(jìn)入可編輯模式
? ? ? ? Esc退出? :wq!
? ? ? ? git commit --amend? 查看修改結(jié)果
git在Linux免密登錄:
? ? git config --global credential.helper store
? ? cat ~/.gitconfig
? ? git pull 輸入賬戶(hù)密碼
? ? cat /root/.git-credentials