git merge 回退_Git命令
生活随笔
收集整理的這篇文章主要介紹了
git merge 回退_Git命令
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
git分支
查看分支
git branch //查看本地分支 git branch -r //查看遠端分支 git branch -a //查看所有分支創建分支
git branch [branch name] //創建本地分支切換分支
git checkout [branch name] //切換分支 git checkout -b [branch name] //創建+切換分支,相當于git branch & git checkout推送新分支
git push origin [branch name]刪除分支
git branch -d [branch name] //刪除本地分支 git push origin :[branch name] //刪除遠端分支,分支前面的冒號代表刪除git處理沖突
當拉取下來的文件與本地修改的文件有沖突,先提交你的改變,或者先將你的改變暫時存儲起來
1、將本地修改存儲起來
git stash2、pull內容
git pull3、還原暫存的內容
git stash pop stash@{0}也可以簡寫
git stash popgit放棄修改文件
本地修改了文件但還未add
git checkout --filename //單個文件git checkout . //全部文件本地新增了文件還未add
rm filename / rm dir -rf //單個文件 //直接刪除文件git clean -xdf //全部文件// 刪除新增文件,如果文件已經git add到緩存區,并不會刪除已經git add提交到了暫存區
git reset HEAD filename //單個文件 git reset HEAD . //全部文件git add以及git commit之后
git reset commit_id //commit_id是你回到的那個節點,可通過git log查看,可以只選前幾位//撤銷之后,已經commit的修改還在工作區git reset --hard commit_id//撤銷之后,已經commit的修改將會刪除,仍在工作區/暫存區的代碼不會清除回滾遠程分支
原理:先將本地分支退回某個commit,刪除遠程分支,再重新push本地分支git log //查看要回退的commit_id git branch the_branch_backup //備份當前這個分支的情況 git reset --hard commit_id //本地分支回滾到對應版本 git push origin :the_branch //刪除遠端分支 git push origin the_branch //用回滾后的本地分支建立遠端分支git另一個進程還在運行
問題描述
出現這種情況可能是git在執行的過程中,你中止之后異常,進程一直停留
Another git process seems to be running in this repository, e.g. an editor opened by 'git commit'. Please make sure all processes are terminated then try again. If it still fails, a git process may have crashed in this repository earlier: remove the file manually to continue.問題原因
因為進程的互斥,所以資源被上鎖,但是由于進程突然崩潰,所以未來得及解鎖,導致其他進程訪問不了。
問題解決
打開隱藏文件夾選項,進入工作區文件目錄的隱藏文件.git,把其中的index.lock問價刪除掉
git本地版本回退
- 通過tortoiseGit查看日志show log
- 選中需要回退的代碼版本
- 右鍵選擇Reset "master to this...
- 在彈出的窗口Reset Type選擇Hard:Reset working tree and index(discard all local changes)
git lfs的使用
操作步驟:
1、安裝lfs
安裝包地址:https://git-lfs.github.com/
2、把項目從gitlab clone下來
F:鏡像文件>git clone https://xxx/dc/vmware-image.git Cloning into 'vmware-image'... remote: Enumerating objects: 3, done. remote: Counting objects: 100% (3/3), done. remote: Total 3 (delta 0), reused 0 (delta 0) Unpacking objects: 100% (3/3), done.3、初始化git lfs項目
F:鏡像文件vmware-image>git lfs install Updated git hooks. Git LFS initialized.4、選擇要作為大文件處理的文件擴展名
F:鏡像文件vmware-image>git lfs track "*.wim" Tracking "*.wim"5、提交文件
F:鏡像文件vmware-image>git add install.wim Possibly malformed conversion on Windows, see `git lfs help smudge` for more det ails.F:鏡像文件vmware-image>git commit -am "添加install.wim" [master 43c28b8] 添加install.wim1 file changed, 3 insertions(+)create mode 100644 install.wimF:鏡像文件vmware-image>git push origin xxx Locking support detected on remote "origin". Consider enabling it with:$ git config lfs.https://xxxx/dc/vmware-image.git/info/lfs.loc ksverify true Uploading LFS objects: 100% (1/1), 11 GB | 23 MB/s, done Counting objects: 3, done. Delta compression using up to 4 threads. Compressing objects: 100% (3/3), done. Writing objects: 100% (3/3), 407 bytes | 0 bytes/s, done. Total 3 (delta 0), reused 0 (delta 0) remote: remote: To create a merge request for xxx, visit: remote: https://xxx/dc/vmware-image/merge_requests/new?merge_ request%5Bsource_branch%5D=xxx remote: To https://xxx/dc/vmware-image.git* [new branch] xxx -> xxx參考
- https://blog.csdn.net/ustccw/article/details/79068547
- https://blog.csdn.net/top_code/article/details/51931916
- https://www.cnblogs.com/wteam-xq/p/4122163.htmlgit 代碼沖突處理 - 蕭強 - 博客園?www.cnblogs.comhttps://www.cnblogs.com/wteam-xq/p/4122163.html
- https://blog.csdn.net/u013399759/article/details/52212436
總結
以上是生活随笔為你收集整理的git merge 回退_Git命令的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 高斯过程回归python_基于pytho
- 下一篇: 美国华盛顿特区为打击汽车盗窃案,免费向居