[git] git 应用

本文详细介绍了Git中常用的命令操作,包括查看状态、同步远程仓库、解决推送错误等实用技巧。通过具体实例,帮助读者掌握如何高效地使用Git进行版本控制。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

repo status         //查看该文件夹下所有工程目录下的状态,包括一些更改

 

repo sync            //与远程工程同步,本地的更改如果没有commit,不会影响本地的更改,如果出现与本地发生冲突,会出现sync erro

 

出现错误时,可以去当前的工程目录下git pull,获得远程最新的状态。git pull korg remote_branch:local_branch

 

repo diff               //查看本地未提交的更改

 

git add --all          //添加文件

git commit           //commit

git commit --amend //修订上一次提交的msg,如果你想更改commit的注释,可以用该命令


repo forall -c 'git push korg my_dev:remote_branch'   //check in。远程的branch名称:korg/remote_branch

 

error: failed to push some refs to 'ssh://bearr/android/kernel/linux-2.6.31.git'
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes before pushing again.  See the 'Note about
fast-forwards' section of 'git push --help' for details.
Everything up-to-date

 

//如果出现以下git push reject,可以按下面的做

 

git rebase -i korg/remote_banch
Successfully rebased and updated refs/heads/my_dev.

 

git push korg my_dev:aster_imx_r9
Counting objects: 17, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (9/9), done.
Writing objects: 100% (9/9), 1.70 KiB, done.
Total 9 (delta 7), reused 0 (delta 0)
To ssh://bearr/android/kernel/linux-2.6.31.git
   3b96c8c..ae538dc  my_dev -> remote_branch

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值