git常用指令
git指令:
一、pull操作
1、将远程指定分支 拉取到 本地指定分支上:
1|git pull origin <远程分支名>:<本地分支名>
(注:命令里的尖括号<>只是包裹中文的标识,方便你看的,实际使用时不用写,不过冒号需要)
2、将远程指定分支 拉取到 本地当前分支上:
1|git pull origin <远程分支名>
3、将与本地当前分支同名的远程分支 拉取到 本地当前分支上(需先关联远程分支,方法见文章末尾,只需关联一次)
1|git pull
在克隆远程项目的时候,本地分支会自动与远程仓库建立追踪关系,可以使用默认的origin来替代远程仓库名
二、push操作
1、将本地当前分支 推送到 远程指定分支上(注意:pull是远程在前本地在后,push相反):
1|git push origin <本地分支名>:<远程分支名>
2、将本地当前分支 推送到 与本地当前分支同名的远程分支上(注意:pull是远程在前本地在后,push相反):
1|git push origin <本地分支名>
3、将本地当前分支 推送到 与本地当前分支同名的远程分支上(需先关联远程分支,方法见文章末尾)
1|git push
附:
将本地分支与远程同名分支相关联
git push -u origin <本地分支名>
git 分支冲突解决
git fetch --all
git branch (获取当前远端分支名称,下图红框部分)
git reset -- hard origin/当前远端分支名称
git reset HEAD~1 冲突回退提交,返回提交之前状态
abandoned git reset ,git stash save ,git pull ,git stash pop,git commit ,git push
记住登录密码 git config --global credential.helper store
git命令统计的代码
git log --since ==2020-11-09 --until==2020-11-21 --author="zwx556674" --pretty=tformat: --numstat | gawk '{ add += $1 ; subs += $2; loc += $1 - $2 } END { printf "added lines: %s removed lines : %s totallines: %s\n",add,subs,loc }'
git config --global core.longpaths true 文件名过长

浙公网安备 33010602011771号