Stream: committers/git-help
Topic: Git Sync
Grahame Grieve (Jan 31 2020 at 03:22):
git pull often fails because there's local changes or untracked files or whatever in the local clone. What command should I use in a batch file to just get rid of any issue and ensure that the local clone is fully synchronised to the master?
https://stackoverflow.com/questions/1125968/how-do-i-force-git-pull-to-overwrite-local-files gives quite a list of options... I can't tell if they are all equivalent
Lloyd McKenzie (Jan 31 2020 at 03:39):
I usually do a Tortoise SVN commit and when it shows me the list of candidate files, I bulk-select and right-click and either delete or revert (or - if I actually want to keep the changes, do commit)
Grahame Grieve (Jan 31 2020 at 03:49):
this needs to run in a batch file, and I need it to be utterly reliable without human intervention. And by definition I can't lose any work I care about
Lloyd McKenzie (Jan 31 2020 at 04:19):
So you're certain that throwing away all local files will be fine? A revert of the whole folder should do what you want I think. (I'm absolutely not a Git expert though...)
Grahame Grieve (Jan 31 2020 at 04:20):
it won't deal with all the possiblities - files that exist but are not yet in version control and then being added
Lloyd McKenzie (Jan 31 2020 at 04:33):
I don't think an automated process can differentiate between uncommitted files that should be added and committed (presumably with a semantically appropriate commit comment) and those that shouldn't - or should perhaps even be added to an ignore file.
Grahame Grieve (Jan 31 2020 at 04:49):
I just want to update to the latest of what is in github. it seems remarkably hard to do
Jose Costa Teixeira (Jan 31 2020 at 04:57):
if you have uncommitted local changes , do you want to delete, stash, branch...?
Grahame Grieve (Jan 31 2020 at 05:17):
there won't be any uncommitted local changes that I care about. I just want them to go away whatever they are
Grahame Grieve (Jan 31 2020 at 05:20):
this is setting up the testing IGs we are talking about on the ig channel. I want to have a local copy, and I don't want to create a new copy from scratch because of bandwidth reasons (Australia!). I just want to update to the latest irrespective of whatever happens to be in my local clone after the last test run
Jose Costa Teixeira (Jan 31 2020 at 06:05):
would
git pull && git reset --hard && git clean -fd
work?
Grahame Grieve (Jan 31 2020 at 06:24):
sdc > git pull
Already up to date.
sdc > git reset --hard
error: unable to create file _updatePublisher.bat: Permission denied
fatal: Could not reset index file to revision 'HEAD'.
Grahame Grieve (Jan 31 2020 at 06:25):
I have no idea why that file is unable to be created
Josh Mandel (Jan 31 2020 at 06:36):
Does it work if you try writing to that file directly? Like echo test > _updatePublisher.bat
?
Jose Costa Teixeira (Jan 31 2020 at 06:47):
it could be a permissions thing, or Windows being Windows - antivirus scan holding on to the file.
Grahame Grieve (Jan 31 2020 at 08:36):
it is the anti-virus. It thinks Lloyd's batch file is infected with a virus. on top of it's general lloyd-ness
Lloyd McKenzie (Jan 31 2020 at 09:03):
Actually, most of those bat files are Jose's fault ;)
Last updated: Apr 12 2022 at 19:14 UTC