On Tue, 13 Mar 2012 09:30:04 -0500 Nick Anderson <n...@cmdln.org> wrote: 

NA> On 03/13/2012 09:22 AM, Mikhail Gusarov wrote:
>> Something like "git clean -fxd"?

NA> Something like that. When I do it with svn I like to track which files
NA> had which state so I can send a report to the person who cared about the
NA> content of the checkout. This file was out of date, this was an extra
NA> file found, this file was missing ... etc ...

You probably want to look at `git status --porcelain' to find out the
status of all the files.  I do the following clean steps to ensure there
is no garbage and I have a clean checkout (in Perl):

#+begin_src perl

my $ret = system("$git clean -f -f -x -q -d .");
die "Error cleaning up with -x" if $ret;
$ret = system("$git reset -q --hard HEAD");
die "Error resetting1" if $ret;
$ret = system("$git checkout $branch");
die "Error resetting1" if $ret;
$ret = system("$git pull -q -s recursive -Xtheirs origin $branch");
die "Error updating" if $ret;
$ret = system("$git reset -q --hard HEAD");
die "Error resetting2" if $ret;

#+end_src

These steps are possibly overkill but for the specific environment I had
to make really, really sure updates would not fail.  I had reasons for
each step because of repository reconfiguration, submodules, etc.  For
instance a machine could switch the active branch (qa, dev, preprod,
prod, etc.) at any update point and a simple `git clean' would not be
enough.

Ted
_______________________________________________
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to