简体   繁体   中英

How to setup GIT for Solo Dev?

Ok, so I have gotten myself completely confused here. I am not sure why I can't seem to grasp some of GITs setup but I am just not cutting it! Please someone help me out. I have read tons of tutorials and nothing seems to fit what I want so it just confuses me.

Here is what I want to do but cannot get it right.

There is an open source project on github that has a branch (development) that I would like to grab to improve on, then at a later time publish to my own server. This repository is private read only which I have access to. I tried cloneing the project then making shcnages but I don't know where to put them. Plus when changes come in from the github project, I still don't get how to grab updates properly from the github dev branch (or even master branch when it gets that far) and not overwrite my own stuff.

Part of the confusion is that the project is using http://nvie.com/posts/a-successful-git-branching-model/ git-flow model which is throwing me off even more.

I am trying to use http://www.git-tower.com/ for managing GIT.

Could some compassionate soul help me by giving me a step by step for this particular instance?

I'll try to do this step by step and you can ask questions so that I can expand on the answer.

  1. Make a clone of the repository on github on your local machine.

    This is done using the git clone command. Something like git clone -b development git://github.com/nibrahim/Xenon-Retroblast.git should do it. The url here will be read only since you won't have write access to the original repository. I've used one of my own projects here as an example.

  2. This will create a local clone inside the Xenon-Retroblast directory. The clone will by default point to the master branch but the -b parameter you gave while cloning it should take care of that.

  3. Now, make your changes locally and commit them.

  4. Let's say your own server hamman.com and you set up a repository over there. You can add that as a remote in your local clone using the following command git remote add myown ssh john@hamman.com:~/repos/project.git . This is your private repository which you can mess with as you please. The local name of this repository is myown . If you're a github user, this remote can be a repository on github. You can also click "fork this project" on github and create a fork directly on the website, clone from that and add the official repository as a remote.

  5. To push your commits to this repository, you have to say git push myown development (push the current branch to the 'development' branch on the remote 'myown'). To fetch from the github repository, say git pull origin development .

I'm sure that the answer is incomplete but ask questions and I can flesh it out for you hopefully.

if you don't have the write permission, why don't you fork the project first?

and then you can create or modify the code into your own forked project.

You can create a patch from master branch, then apply it to your own branch. But you must watch the master project for every changes because AFAIK github doesn't notify you about the changes.

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