-2

I wanted to (fork? branch?) develop my own features on an open source repository, while keeping changes that are made to main repository

For example Main_repository < where original developers do their work MyRepo < Where I make my changes to the copy of Main_repository.

What I want to achive is to have my repository, with my changes while being allowed to merge changes from original repository to my repository.

Is it possible? Read a bit about fork and branch of git, but not sure which of them is meant for this (if any of those options have that possibility).

I'm using SourceTree, and private Repo, original repository is on GitHub. I want my fork/branch to be on private repository.

Is it possible to "chain" like that 2 repositories from different server?

3
  • It sounds like you just want a basic clone of the Main_repository. And then a clone of the clone... I think. Commented Dec 15, 2013 at 9:19
  • Erm... um... not sure tbh. I'm quite new to git. clone fork and branch are 3 different things?
    – Grzegorz
    Commented Dec 15, 2013 at 9:22
  • read manual or some tutorial about branches.
    – Marek R
    Commented Dec 15, 2013 at 9:23

2 Answers 2

0

First thing is to "clone" the repository, in this way you will get the remote repository into your repository.

After every change you make - you need to do git add, and when you are satisfied do "commit" to your local repository.

If you believe that in some point the original repository was modified, you can do git pull (only after commit) to update it.

0
0

Standard Github practice when you aren't a direct participant of the original project/repo is to fork the original repo to create your own forked (remote) repo. Next, you'll clone your forked (remote) repo to your local computer so you have a local workspace/repo to make your changes. You'll commit your changes to your local workspace/repo and you'll regularly push the commits from your local repo back to your remote repo.

In order to keep your forked repo in sync with the original repo, you will give your local workspace a 2nd remote repo, i.e. your local repo will track 2 remote repos - your forked repo (setup when you originally created your local workspace/repo) and the original repo (you add manually). You'll pull changes down from the original repo, merge them in with your changes in your local workspace/repo, and then push the merged changes back up to your forked repo.

Github explains it in detail here:

https://help.github.com/articles/syncing-a-fork

The Setup

Before you can sync, you need to add a remote that points to the upstream repository. You may have done this when you originally forked. ...

Syncing

There are two steps required to sync your repository with the upstream: first you must fetch from the remote, then you must merge the desired branch into your local branch. ...

Fetching

Fetching from the remote repository will bring in its branches and their respective commits. These are stored in your local repository under special branches. ...

Merging

Now that we have fetched the upstream repository, we want to merge its changes into our local branch. This will bring that branch into sync with the upstream, without losing our local changes. ...

1
  • I setup a a repo (I use bitbucket). Then added local SourceTree repo and added 2 remotes. One of original github and one from bitbucket. Pulled from git and pushed to bitbucket. Is it good?
    – Grzegorz
    Commented Dec 17, 2013 at 12:23

Not the answer you're looking for? Browse other questions tagged or ask your own question.