github上,可以forks别人已有的项目,而且同步更新合并也很方便,但如果是自己新建的项目,而导入的是别人的代码修改后,别人的又更新了,自己想获取他的更新,怎么办呢?其实很简单。

1 git clone 自己新建的项目到本地,例如新建了一个suda_android:

git clone https://github.com/DinphyMod/suda_android.git

2 进入克隆下来的本地项目里

cd suda_android

3 由于是import别人的代码,想要同步更新原有的项目android:

git pull https://github.com/SudaMod/android.git

4 合并,按提示操作,一般直接Ctrl + X 就可以了

5 将本地合并的上传到github上

git push origin main


Quick setup — if you’ve done this kind of thing before

https://github.com/anjue39/pcrs.git

Get started by creating a new file or uploading an existing file. We recommend every repository include a README, LICENSE, and .gitignore.

…or create a new repository on the command line

echo "# pcrs" >> README.md
git init
git add README.md
git commit -m "first commit"
git branch -M main
git remote add origin https://github.com/anjue39/pcrs.git
git push -u origin main

…or push an existing repository from the command line

git remote add origin https://github.com/anjue39/pcrs.git
git branch -M main
git push -u origin main

…or import code from another repository

You can initialize this repository with code from a Subversion, Mercurial, or TFS project.