git进阶操作

fork 主仓地址

在本地新建目录,git clone (ssh路径)
 

cd 新建目录 ,并拷贝待上传文件

查看分支
git branch -a

切换分支
git checkout -t 分支名

(git checkout -t 分支名   先创建分支;如果已经创建,可以 git checkout 分支名字)

git pull代码

git add .
问题:
The file will have its original line endings in your working directory

git config --global core.autocrlf false
https://www.cnblogs.com/lovebing/p/7121754.html
 

git commit (写上【需求单号/问题单号】和【修改说明】)

git commit -am "add new files"

git commit --amend
加上【修改说明】

git push origin demo (注意:文件大小需小于50M,不能上传.pth模型文件和.o .so文件)

git push origin 分支名称
git push remotes/origin/分支名称

合并请求(MR)

gitlab或github下fork后如何同步源的新更新内容:
git remote -v
git remote add upstream 主仓https地址
git fetch upstream

git pull upstream develop
git add .
git merge --continue
git push origin demo --force
https://www.zhihu.com/quest1ion/28676261

问题:
SSL certificate problem: unable to get local issuer certificate
解决:
git config --global http.sslVerify false
https://blog.youkuaiyun.com/vtopqx/article/details/86216233
 

解决日志问题:

git log 找出问题提交ID
git rebase -i 提交ID
reword 更改内容
git push origin demo --force

git init
通过git init命令把这个目录变成Git可以管理的仓库

git log
git log命令显示从最近到最远的提交日志

git reset
在Git中,用HEAD表示当前版本,也就是最新的提交1094adb...(注意我的提交ID和你的肯定不一样),上一个版本就是HEAD^,上上一个版本就是HEAD^^,当然往上100个版本写100个^比较容易数不过来,所以写成HEAD~100。
回退到上一个版本
git reset --hard HEAD^
同步到远端仓库
git push -f
https://segmentfault.com/q/1010000020797287

git reflog
Git提供了一个命令git reflog用来记录你的每一次命令,找到commit id,如1094adb,指定回到未来的某个版本
git reset --hard 1094adb
https://www.liaoxuefeng.com/wiki/896043488029600/896827951938304

删除远程分支
git push origin --delete branch
https://www.jianshu.com/p/5068997164cb
或者 在如下页面里删除

删除项目

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

WX Chen

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值