Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
694 views
in Technique[技术] by (71.8m points)

git - How can I fork my own GitHub repository?

So, total newbie to Git. Been reading through the guides and think I have the basics but am having difficulties accomplishing this one goal.

I have a repo created for my generic markup source code. Just stuff I reuse for every breakout. It's called markupDNA.git

I would like to have different directories in my mac sites dir ~/Sites/project-N. Where I build upon the generic stuff and do a breakout of a site. I would like these to be tied to my main git repo as forks, but you cannot fork your own repo?

I wish I could do something like this:

git clone <url> name
git add .
# make changes
git commit -m 'whatever'
git push

But I don't want it to push to origin. I want it to push to a fork of the markupDNA repo whence it was cloned. But it seems like it just pushes my changes right up into the origin master. The idea is to keep the markupDNA clean and just have a lot of forks for my different projects, each of which will have their own cloned dir on my hard drive.

Any ideas?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You're doing the right thing.

cd ~/Sites/
git clone ~/Dev/markupDNA/ project-N
cd project-N
git remote rename origin markupDNA
  • Nav to the folder where you store your projects
  • clone your base markupDNA repo with custom name
  • rename the remote so that if you want to an 'origin' later, you can

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...