Question

I have forked a repo for adding some changes to the project; its a Vim plugin. I am planning to use my forked repo as the source for Vundle. But I would also like to get updates from the original repo if any in the future.

How should I go about maintaining the repo?

  • I have changes in a new branch; should I merge it?
  • If I don't merge it, I will have to manually switch to that branch after Vundle cloning the repo.
  • If I merge it, how do I receive updates from the original repo? The master would have changed. Will it get added as a new branch?
  • It would be great if someone can get some pointers to articles or suggest how I should search for solutions/best practices; my searches are picking trashes for a sometime (probably, I have no ideas regarding exact naming of stuff here).

note:

  • I am new to git and Vim.
Was it helpful?

Solution

If you're improving the plugin, the best solution might be to propose your patch to the owner of the original repo.

If you can't or don't want to do it, you could either keep it in a dev branch or in your master. It won't make any difference: either way you'll have to do a merge between your branch and origin/master every time you'll want to retrieve update from upstream.


Example: let's assume you want to keep it on your local master branch. Then you would have:

A ----------------- B
L origin/master     L master

where B is the commit you made with your modifications.

When you want to retrieve updates from upstream, using git fetch origin, you would end up with:

   ---- B
  /     L master
 /
A -- C -- D
          L origin/master

Then you'd just need to do, from your master branch: git merge origin/master, in order to get a commit with both your modifications and the updates

   ---- B -- E
  /         /L master
 /         /
A -- C -- D
          L origin/master

As we can see, it would be easier if your changes could be accepted upstream. Not only could anyone benefit from it; it would also be much easier for you.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top