0

So I'm in the process of learning Git and I'm using the sourcetree GUI. I have a remote repository on server A(not a bare repo but a working one). So i cloned the remote repo onto my local machine and then I created a new file called "blah.txt" and then added, committed the changes to the local repo.

Then after setting git config receive.denyCurrentBranch ignore , i pushed to the remote repo from the local repo. However, after the push, I can't see the file I created(blah.txt) in the remote repo.

However, when I clone the same remote repo into a different folder onto my local machine, blah.txt appears again. Can anyone explain whats going on?

user1943079
  • 511
  • 6
  • 20

1 Answers1

0

git push only pushes the changes into the .git directory in the remote repo, but it does not update the files in the working directory of the remote repo.

You can say git reset --hard in the remote repo to update the files, but if there were uncommitted edits to some files, you will lose those changes. (You can even make a git hook that runs git reset --hard if you want the files automatically updated every time a pull is received.)

Sampo Smolander
  • 1,605
  • 2
  • 15
  • 33