git更新github仓库

git更新github仓库

在github创建一个configRepo仓库,并push提交数据到该仓库中。

1. git init
2. git add client1/
3. git commit -m "first commit"
4. git branch -M main    # 当前master分支重命名为main
5. git remote add origin git@github.com:LiHangGithub/configRepo.git
6. git push -u origin main

在之后的开发中,对代码进行修改更新。

第一步,先把configRepo仓库中的数据clone到本地

$ git clone git@github.com:LiHangGithub/configRepo.git 
$ cd configRepo/              # 切换到configRepo仓库目录下

之后,在对仓库内的数据修改后。

$ git status  # 查看修改之后仓库的状况
On branch main

Your branch is up to date with 'origin/main'.
Changes not staged for commit:
  (use "git add/rm <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
        deleted:    client1/client1-dev.txt
        deleted:    client1/client1-prod.txt
        deleted:    client1/client1-test.txt
Untracked files:
  (use "git add <file>..." to include in what will be committed)
        client1/client1-dev.properties
        client1/client1-prod.properties
        client1/client1-test.properties
$ git add .
$ git commit -m "update github"
$ git pull          # 获取最新提交的分支
$ git push origin main  # 
Enumerating objects: 5, done.
Counting objects: 100% (5/5), done.
Delta compression using up to 8 threads
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 341 bytes | 341.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
To github.com:LiHangGithub/configRepo.git
   8d71f24..9fcb8dd  main -> main

此时github的仓库中的数据就已经更新了

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值