wingrunr21 / gitolite

A Ruby interface for the gitolite git backend system
https://github.com/wingrunr21/gitolite
MIT License
82 stars 37 forks source link

pull first #12

Closed mmcc closed 12 years ago

mmcc commented 12 years ago

Thanks for the great resource! One issue I'm having on a potential multi-user setup is this script does not do update the gitolite-admin repo before editing and attempting to push back. Am I missing something here?

wingrunr21 commented 12 years ago

Hi, Doing a pull on the repository is currently a future feature I have planned. The issue is how to properly sync the repository with remote changes without human involvement. Simply destroying all local changes is an option, but that may not be the best option. The issue is how to do a git merge without human interaction (ie all in software). It is a problem I'm working on but for the moment it is not available.

If you need this functionality, you will have to issue a hard git reset, a git pull, and then reloading the gitolite admin in the gem.

RLovelett commented 12 years ago

Can you give an example of how to issue that hard git reset, pull and reload?

wingrunr21 commented 12 years ago

Implemented in 1887007dfc.

Details are in the docs but there are three new methods: update, reset! and reload!

In opposite order:

reload! will remove all in-memory changes and read the repository data from the file system.

reset! will run a hard git reset, and a git clean. This means the repository will be completely reset to head. All untracked files will be deleted and all local changes to tracked files will be undone. It will perform a reload! for you as well.

Update will perform a reset!, do a pull from master, and do a reload! You can pass :reset => false to skip the reset and :rebase => true to perform a rebase on pull.