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] //刪除遠端分支,分支前面的冒號表明刪除
當拉取下來的文件與本地修改的文件有衝突,先提交你的改變,或者先將你的改變暫時存儲起來html
git stash
git pull
git stash pop stash@{0}
也能夠簡寫git
git stash pop
git checkout --filename //單個文件 git checkout . //所有文件
rm filename / rm dir -rf //單個文件 //直接刪除文件 git clean -xdf //所有文件 // 刪除新增文件,若是文件已經git add到緩存區,並不會刪除
git reset HEAD filename //單個文件 git reset HEAD . //所有文件
git reset commit_id //commit_id是你回到的那個節點,可經過git log查看,能夠只選前幾位 //撤銷以後,已經commit的修改還在工做區 git reset --hard commit_id //撤銷以後,已經commit的修改將會刪除,仍在工做區/暫存區的代碼不會清除
出現這種狀況多是git
在執行的過程當中,你停止以後異常,進程一直停留github
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
問價刪除掉ide
操做步驟:gitlab
安裝包地址:https://git-lfs.github.com/this
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.
F:\鏡像文件\vmware-image>git lfs install Updated git hooks. Git LFS initialized.
F:\鏡像文件\vmware-image>git lfs track "*.wim" Tracking "*.wim"
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.wim 1 file changed, 3 insertions(+) create mode 100644 install.wim F:\鏡像文件\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