简体   繁体   中英

GitHub Clone - how to prevent pull requests from going to the original repository?

I am going to clone a GitHub repo, and as per their instructions:

git clone --depth 1 https://github.com/mgechev/angular2-seed.git my-proj

The additional steps I usually do after this, to prevent my updates from going back to that project, are:

rd .git /S/Q  (this removes the git links to the mgechev repo)
git init
git add .
git commit -m "Initial commit"
git remote add origin <my new repo address on github>
git push -u origin master

Are these steps necessary for me to prevent my subsequent branch creation, pull requests to my master etc from going to the original repo?

I don't want to inadvertently send request to the original repo, and I do it like this because I don't know any better to be honest. It's just that none of the clone/fork instructions in the Readme files of repos have these steps, and I had to go looking for them. So I don't know if I'm doing something unnecessary

You'll lose all your history that way. Better to just change the url for the remote

git remote set-url origin <my new repo address on github>

Now the old url is no longer a part of the repository, so it's impossible to accidentally push there.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM