1、史上最浅显易懂的Git教程: https://www.liaoxuefeng.com/wiki/896043488029600 2、图形游戏学习git: https://learngitbranching.js.org/ 3、菜鸟教程:https://www.runoob.com/git/git-tutorial.html
https://www.cnblogs.com/sandea/p/9855062.html 使用git checkout -b local_branch_name origin/remote_branch_name创建本地分支关联远程分支 远程生成新分支git push original local_branch_name 删除远程:git push original --delete remote_branch_name
git 本地分支提交到远程分支:远程先开好分支然后拉到本地git checkout -b feature-branch origin/feature-branch //检出远程的feature-branch分支到本地
本地先开好分支然后推送到远程
$ git checkout -b feature-branch //创建并切换到分支feature-branch $ git push origin feature-branch:feature-branch //推送本地的feature-branch(冒号前面的)分支到远程origin的feature-branch(冒号后面的)分支(没有会自动创建) 必须加冒号不然会有新的分支出现 git push origin debug100:xiaogongwei_v1.0 --force 强制推送整个分支被覆盖!!!!!!!
对比本地分支master与远程分支 origin/MG-APPS_Debug 的不同。 git diff master origin/MG-APPS_Debug
git stash是保存现场调试,然后git stash pop恢复, 然后git stash drop是删除
git fetch origin remote_branch_name 更新本地分支: git pull origin MG-APPS_Debug:MG-APPS_Debug
https://www.jianshu.com/p/36202c29e6ae
查看git git tag 显示tag信息 git show v1.4 创建git git tag -a v1.0 -m 'first version' push Git: git push origin v1.0或者将所有tag 一次全部push到github上 git push origin --tags
//删除github远端的指定tag git push origin :refs/tags/v1.0.0
https://www.cnblogs.com/zhangxiaoliu/p/6008038.html 在git中如果想忽略掉某个文件,不让这个文件提交到版本库中,可以使用修改根目录中 .gitignore 文件的方法(如果没有这个文件,则需自己手工建立此文件)。这个文件每一行保存了一个匹配的规则例如:
此为注释 – 将被 Git 忽略.sample # 忽略所有 .sample 结尾的文件 !lib.sample # 但 lib.sample 除外 /TODO # 仅仅忽略项目根目录下的 TODO 文件,不包括 subdir/TODO build/ # 忽略 build/ 目录下的所有文件 doc/.txt # 会忽略 doc/notes.txt 但不包括 doc/server/arch.txt
.gitignore规则不生效的解决办法把某些目录或文件加入忽略规则,按照上述方法定义后发现并未生效,原因是.gitignore只能忽略那些原来没有被追踪的文件,如果某些文件已经被纳入了版本管理中,则修改.gitignore是无效的。那么解决方法就是先把本地缓存删除(改变成未被追踪状态),然后再提交:
git rm -r --cached . git add . git commit -m ‘update .gitignore’
参考链接: https://www.cnblogs.com/shines77/p/3460274.html
步骤1 执行命令git filter-branch --force --index-filter ‘git rm --cached --ignore-unmatch path-to-your-remove-file’ --prune-empty --tag-name-filter cat – --all
git filter-branch --force --index-filter 'git rm --cached --ignore-unmatch projects/Moon.mp3' --prune-empty --tag-name-filter cat -- --all显示Ref ‘refs/heads/master’ was rewritten说明成功。
步骤2 强制上传:
git push origin master --force步骤3 清理工作
rm -rf .git/refs/original/ git reflog expire --expire=now --all git gc --prune=now git gc --aggressive --prune=now参考链接:https://www.jianshu.com/p/450cd21b36a4
分析 格式化与多余的空白字符,特别是在跨平台情况下,有时候是一个令人发指的问题。由于编辑器的不同或者文件行尾的换行符在 Windows 下被替换了,一些细微的空格变化会不经意地混入提交,造成麻烦。虽然这是小问题,但它会极大地扰乱跨平台协作。 其实,这是因为在文本处理中,CR(CarriageReturn),LF(LineFeed),CR/LF是不同操作系统上使用的换行符,具体如下:参考链接:
1、Google浏览器或者火狐浏览器 如果用 Chrome 的话,可以用 GitZip for github扩展: Gitzip官网:https://gitzip.org/最下面有插件安装方法,也可以百度搜素安装Google浏览器插件,把Gitzip安装上。
2、使用DownGit网站https://minhaskamal.github.io/DownGit/#/home 输入你要下载的链接:https://github.com/XiaoGongWei/MG_APP/tree/master/Testdata
1、使用git remote set-url origin "https://github.com/XiaoGongWei/XXX" 可以配置当前库的链接,上传下载出现问题时候使用git config --list查看配置是不是正确。注意必须用https不能用http
