The local git repo command is updated from the remote git repository. (deployment with a thick client)

Update: I think this is due to a problem with the git client msysgit window. Sorry to bother you guys. http://code.google.com/p/msysgit/issues/detail?id=379&colspec=ID%20Type%20Status%20Priority%20Component%20Owner%20Summary

I am looking for a way to keep multiple client mailboxes in sync with a remote git repo. Forcing updates from a remote repo and rejecting everything that can be changed in client mailboxes.

The problem I am facing is that client boxes will modify some files (installation logs, etc.) and give me a merge nightmare when I need to update them from a remote repo. I tried several commands to try and reset their local changes (local changes should just be left), but no one works as advertised (git reset --hard).

I don’t want to make a clone and then delete dir.git in these blocks, since I would prefer that they be updated only with changes, and not reset the entire repo every time.

Any ideas?

+2
source share
5 answers

I assume that you have a good reason for using Git for this, and not for rsync.

Here is how I would do it (on Clients):

git fetch origin git reset --hard origin/master git clean -dfx 

Note that you need to reset to origin/master , not HEAD , because the local HEAD does not include initial new commits (for now).

+5
source

It looks like you are looking for rsync, not git. Can you explain a little more why you would like to use a complete version control system to β€œjust” keep some files in sync?

+1
source

The following two commands should reset the client processing tree to a clean state, i.e. the same as the previous git clone :

 git reset --hard HEAD 

This will cancel any changes made to files that are being tracked (i.e. that exist in the repo).

 git clean -fdx 

This will delete any files that were recently created by the client, i.e. which are not tracked by git.

+1
source

Oddly, git reset --hard should remove any changes made to local repositories.

you can try git stash && git pull , it just pushes changes in some kind of temporary branch ( git stash clear to remove any change trace)

If this does not work, you can try this (if you are on the main branch and that the tmp branch does not exist)

 git checkout origin/master -b tmp git branch -D master git branch -m master 
+1
source

For the record, this original problem is apparently limited to msysgit 1.6.5.1 ( issue 379 ), as mentioned by OP.

However, the same problem mentions in 2012 a similar problem with other causes:

For the record, I have this problem with autocrlf = false.

Running git reset --hard still leaves uncommitted changes related to file permissions:

 $ git reset --hard HEAD is now at 088c702 BranchA $ git diff diff --git a/path/to/file b/path/to/file old mode 100755 new mode 100644 ... 

This applies to " Deleting files with" old mode 100755 new mode 100644 "from unstated changes in git "

I found that for some reason core.filemode was set to true at the repository level (I did not install it myself):

 $ cat .git/config [core] repositoryformatversion = 0 filemode = true bare = false logallrefupdates = true ignorecase = true 

So: git config core.filemode false recommended.

0
source

Source: https://habr.com/ru/post/1012905/


All Articles