Upgrading the working tree to Git HEAD

I think I said that everything is correct.

I have an intermediate server with Git on it, my friend and I push the changes to this Git repository from our local clones of this repo, when we are ready to do something public, we flag it all this, but then I have to do git reset --hardso update the actual files on the server to HEAD, which seems a little strange to me.

I think the problem may be a fundamental misunderstanding of how Git works. Usually I share my code on my local repo, work on it, and then combine it with the master repo, then git push, is that right?

Sorry, I'm pretty new when it comes to git, any resources for working with remote Git repositories would be greatly appreciated, thanks!

+3
source share
4 answers

It looks like you are clicking on a non-bare repo on your server. When you click on a repo, the internal state of the repo changes, but the extracted files are not updated, so you need to do git reset --hard(or git checkout) check for updated copies of the files. For this reason, it is recommended only to click on the bare repo. You can create a bare repo with git --bare initor git clone --bare.

+7
source

Zack

, , (.. ). - , /, . ( ) "git reset --hard", , , .. .

"--bare", .. , :

$git init --bare

.

, , // .

+2
+1

, , . , , git, .

, . , git, , git.

+1
source

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


All Articles