Git常用記錄 && error: pathspec 'modify return validateParams' did not match any file(s) known to git.

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


參考鏈接:分支的運(yùn)用【分支】| 猴子都能懂的GIT入門(mén) | 貝格樂(lè)(Backlog)

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容