On 6/7/10 7:50 PM, Aaron Paxson wrote:
> All,
>
> I've tried to figure this out on my own, and, from time to time, ask
> in IRC, but I'm just not *gitting* it, if you pardon the pun.
>
> I want to maintain my own GIT repository in my company. That is,
> maintain a bare repo that all my systems can "pull" from and "push" to
> with our custom code (mostly just custom events, agents, and ticketing
> code).
>
> *BUT* - I still want to "pull" from the opennms git repo for updates,
> both trunk and stable.
>
> Is this even doable in GiT?
>
> If so, can someone point me to a handy page, or point me in the right
> direction? Does anyone else do this?
>
> Thanks, and can't wait for 1.8!!
>
Yup, as long as both clones are based on the same code, you can push and
pull around however you want.  I do this sometimes when I want to test
on another one of my macs at home.  What you want is to have multiple
"remotes."  A remote is just a git URL that data can be pulled from.  By
default, "git clone" creates a "remote" called origin.

on your work server:
  git clone git://opennms.git.sourceforge.net/gitroot/opennms/opennms
internal-opennms

on your own machine:
  git clone ssh://internal-machine/path/to/internal-opennms
  git remote add opennms
git://opennms.git.sourceforge.net/gitroot/opennms/opennms

...if you run "git remote" then it should say:

  opennms
  origin

"origin" is your internal-opennms one, the default, and "opennms" points
to the upstream opennms repo.

By default, your internal is only going to have master, but you can give
it 1.8 as well by doing:

  git fetch opennms
  # create a 1.8 branch based on the "real" opennms 1.8
  git checkout -b 1.8 opennms/1.8
  # push to origin (internal) branch called 1.8
  # if it doesn't exist, it's created
  git push origin 1.8
  # converts your 1.8 branch to track origin/1.8 instead of opennms/1.8
for future pushes
  # run `git config -l` to see the current setting
  git config branch.1.8.remote origin

Then your normal workflow would be:

  # work with internal opennms repo
  <edit files>
  git add <files>
  git commit -m 'my changes'
  git push origin

  # get updates from "real" opennms repo
  git fetch opennms
  git merge opennms/master
  git push origin master

  # get 1.8 updates
  git fetch opennms
  git merge opennms/1.8
  # pushes to origin (internal) 1.8 branch, if you did the `git config`
above
  # you could also specify it explicitly: git push origin 1.8
  git push

-- 
Benjamin Reed
The OpenNMS Group
http://www.opennms.org/


Attachment: signature.asc
Description: OpenPGP digital signature

------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
Please read the OpenNMS Mailing List FAQ:
http://www.opennms.org/index.php/Mailing_List_FAQ

opennms-devel mailing list

To *unsubscribe* or change your subscription options, see the bottom of this 
page:
https://lists.sourceforge.net/lists/listinfo/opennms-devel

Reply via email to