日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

git常用的指令

發布時間:2023/12/3 编程问答 35 豆豆
生活随笔 收集整理的這篇文章主要介紹了 git常用的指令 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

最近項目從svn遷入到git,常用的git指令需要用到

?

一、git倉庫安裝

git config --global user.name "user name" git config --global user.email "email@email.com"#初始化 git init#加倉庫 git remote add origin https://github.com/user/project.git#暴力提取 git fetch origin#克隆倉庫,等價git init + git fetch git clone https://github.com/user/project.git#展示遠程倉庫列表 git remote -v#展示遠程倉庫 git remote show origin#遠程倉庫重命名 git remote rename origin originNew#移除遠程倉庫 git remote rm originNew#提交到指定分支,并且記錄使用的遠程倉庫 git push -u origin master

?

二、提交更新

#更新本地倉庫 git pull#比較不同的內容 git diff#撤銷修改 git checkout -- file#改名 git mv fileA fileB#刪除文件 git rm file#添加進緩存區 git add .#比較緩存區 git diff --cached#緩存區的狀態 git status#撤銷緩存 git reset HEAD file #等價上面 git unstage file#刪除文件,并且從緩存區刪除 git rm -f file#刪除緩存區的文件 git rm --cached file#提交 git commit -m '備注'#添加到緩存區并提交 git commit -am '備注'#追加更改提交 git commit --amend#推送到遠程倉庫 git push#未pull,暴力推送更改的信息 git push -f

?

三、撤退版本

#commit日志 git log#HEAD指針日志 git reflog#最后一次提交日志 git last#回退版本,本地倉庫、緩存區、修改區回退到指定版本 git reset --hard versionNumber#回退版本,本地倉庫回退到指定版本 git reset --soft versionNumber#回退版本,本地倉庫、緩存區回退到指定版本 git reset --mixed versionNumber#撤銷緩存區 git reset HEAD#回滾上一個版本 git revert HEAD#回滾上上個版本 git revert HEAD^#回滾commitId版本之前的版本 git revert commitId

?

四、分支管理

#創建分支 git branch brance_one#創建分支并且切換分支 git checkout -b brance_one#查看所有分支,包括遠程倉庫 git branch -a#列出分支詳情 git branch -v#切換分支 git checkout brance_one#推送分支 git push origin brance_one:brance_one#合并分支并提交 git merge brance_one #合并分支出現沖突 git status git add . git commit -m 'fixed'#查看合并的分支 git branch --merged#查看未合并的分支 git branch --no-merged#刪除遠程分支 git push origin --delete brance_one#同上 git push origin :brance_one#刪除本地分支 git branch -d brance_one

?

五、標簽

#查看分支 git branch#切換分支 git checkout branch_one#給最近版本打標簽 git tag tagName#查看所有標簽 git tag#查看提交日志 git log #給commmitId版本打標簽 git tag tagName commmitId#查看標簽信息 git show tagName #給commmitId版本打標簽并添加備注 git tag -a tagName -m "備注" commmitId

?

總結

以上是生活随笔為你收集整理的git常用的指令的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。