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 pull 3、还原暂存的内容git stash pop stash@{0}也可以简写git stash popgit放弃修改文件本地修改了文件但还未addgit checkout –filename //单个文件git checkout . //全部文件本地新增了文件还未addrm 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的修改将会删除,仍在工作区/暂存区的代码不会清除git另一个进程还在运行问题描述出现这种情况可能是git在执行的过程中,你中止之后异常,进程一直停留Another git process seems to be running in this repository, e.g.an editor opened by ‘git commit’. Please make sure all processesare terminated then try again. If it still fails, a git processmay 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.gitCloning 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 installUpdated git hooks.Git LFS initialized.4、选择要作为大文件处理的文件扩展名F:\镜像文件\vmware-image>git lfs track “.wim"Tracking “.wim"5、提交文件F:\镜像文件\vmware-image>git add install.wimPossibly malformed conversion on Windows, see git lfs help smudge for more details.F:\镜像文件\vmware-image>git commit -am “添加install.wim”[master 43c28b8] 添加install.wim 1 file changed, 3 insertions(+) create mode 100644 install.wimF:\镜像文件\vmware-image>git push origin xxxLocking support detected on remote “origin”. Consider enabling it with: $ git config lfs.https://xxxx/dc/vmware-image.git/info/lfs.locksverify trueUploading LFS objects: 100% (1/1), 11 GB | 23 MB/s, doneCounting 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=xxxremote:To https://xxx/dc/vmware-image.git * [new branch] xxx -> xxx参考https://blog.csdn.net/ustccw/article/details/79068547https://blog.csdn.net/top_code/article/details/51931916https://www.cnblogs.com/wteam-xq/p/4122163.html