tags:

views:

71

answers:

3

So, total newbiee 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 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 from wence it was cloned. But it seems like it just push's 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?

+4  A: 

It will probably be a lot easier to use branches, rather than using separate forks. You can still have separate checkouts for each branch; just clone your repo multiple times, and use git checkout in each one to switch it to the appropriate branch (or git checkout -b to create the branch and check it out all at once). Once you have created the branches, you can push them to GitHub using git push origin <branchname>.

Brian Campbell
This seems like a good way to go about it. But when I clone my repo, make a new branch, edit from that branch and try to do a "git push [email protected]:rorourke/markupDNA.git" the branch doesn't appear up on github?
Fuego DeBassi
You need to do "git push origin <new-branch-name>" to create the new branch on the remote. I'm surprised the command you quoted doesn't give an error, or does it?
ebneter
@Fuego as ebneter says, you need to specify the branch name you are pushing when pushing new branches to GitHub.
Brian Campbell
+1  A: 

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
kubi
+1  A: 

Sure you can clone from a clone. In git there is no concept of a main repo. People often designate a main repo, but that is by convention, not because of a technical reason.

So you can do everything exactly as you describe and even more.

For example it makes sense to keep a branch in your breakout sites with ideas for additions or modifications to your generic stuff. You can pull these up towards your generic repo and distribute again from there.

Peter Tillemans