git简单命令

修改现有分支推送到另一个仓库分支

# 推送zhouyishop分支到远程仓库 https://gitee.com/yyyyjinying/zhouyishop.git
git checkout zhouyishop
git remote add upstream https://gitee.com/yyyyjinying/zhouyishop.git
git pull origin zhouyishop 
git branch --set-upstream-to=origin/zhouyishop zhouyishop

window连接gitee免密登录

https://blog.csdn.net/qq_33499889/article/details/104518290

简易的命令行入门教程:

Git 全局设置:

git config --global user.name “yyyyjinying”
git config --global user.email “12343343@qq.com”

创建 git 仓库:

mkdir wx-project
cd wx-project
git init
touch README.md
git add README.md
git commit -m “first commit”
git remote add origin https://gitee.com/yyyyjinying/wx-project.git
git push -u origin “master”

已有仓库

cd existing_git_repo
git remote add origin https://gitee.com/yyyyjinying/wx-project.git
git push -u origin “master”

问题

commit or discard the untracked or modified content in submodules)

状态解读:在当前文件夹内部存在其它的.git文件
解决办法:找到其它的.git文件,删除后重新 add commit
因为之前的项目有.git,后面又提交到新的仓库,出现了子模块,所有需要将多余的.git文件删除,ls -a && rm -rf .git

git更改远程仓库地址

  1. 查看当前远程仓库地址:使用命令git remote -v可以查看当前远程仓库的地址。
  2. 更改远程仓库地址:使用命令git remote set-url origin 可以将远程仓库的地址更改为新的URL。
  3. 验证更改是否成功:使用命令git remote -v再次查看远程仓库地址,确认更改已生效。
  4. 推送更改到远程仓库:使用命令git push origin master将本地仓库的更改推送到远程仓库。
  5. 更新本地仓库:使用命令git pull origin master可以更新本地仓库,确保与远程仓库同步。
  6. git push -f origin master
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值