git命令与github随记

git init  //初始化为本地的仓库

git stash  //保存到栈里

 

git pull --rebase //更新最先版本

$ git pull --rebase origin master//更新特定版本分支

 

git stash pop //添加到最先版本中

 

git add .  //添加代码

 

git commit -m 'feat: 模型爆炸范围调整' //递交

 

git push   //提交到分支

 

查看所有分支 git branch -a

新建本地分支 git checkout -b 《分支名》

更新分支至远程分支

git push origin 《分支名》:《分支名》

 

切换分支 git checkout 《分支名》

新建分支 git checkout -b 《分支名》

新建分支递交到远程仓库 git checkout  origin  分支名

 

feature: 新功能(feature)

fix: 修补bug、style等

refactor: 重构(即不是新增功能,也不是修改bug的代码变动)

test: 增加测试 chore: 构建过程或辅助工具的变动

 

 

 

git config --global credential.helper osxkeychain //Mac_设置密码

ssh-add ~/.ssh/id_rsa //Mac添加

git reset HEAD~1 //取消递交

git reset --hard HEAD~1//取消递交取消修改

git log//查看git 消息

git reset --soft 哈希值//取消刚刚的修改

git reset --hard 哈希值//取消修改

      

//更新dev
Git checkout dev
Git pull --rebase


//当前分支

git pull
git rebase dev
confit的话git add .;git rebase --continue ;git push
git rebase --skip//跳过
git branch --set-upstream-to/git branch -u origin/远程分支//关联
git branch -vv//查看关联
git push -u origin master -f//强制远程更新


//dev
Git merge dev
Git push
//结束

//github

登录github:Settings->SSH keys-> Add SSH key ->拷贝在公钥(id_rsa.pub)文件->添加公钥

查看git本地秘钥:cd .ssh -> cat id_rsa.pub//公钥 ; cat id_rsa//私钥

 git clone git@github.com:username/userproductname.git ,

把本地的库与github上的git关联 git remote add origin git@github.com:username/userproductname.git

//github开启代理

1.查看Mac网页端口

2.设置代理:

全局代理:

git config --global http.proxy 127.0.0.1:自己的端口号
git config --global https.proxy https://127.0.0.1:自己的端口号

局部代理:

git config --local http.proxy 127.0.0.1:自己的端口号
git config --local https.proxy https://127.0.0.1:自己的端口号

只对 github 进行代理

git config --global http.https://github.com.proxy https://127.0.0.1:xxx
git config --global https.https://github.com.proxy https://127.0.0.1:xxx

 3.查询代理

git config --global http.proxy
git config --global https.proxy
git config --local http.proxy
git config --local https.proxy

4.取消代理

git config --global --unset http.proxy
git config --global --unset https.proxy
bashgit config --local --unset http.proxy
git config --local --unset https.proxy

(注:对SSH:git@github,com无效,https有效)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值