0

I'm trying to track modified files on a live website with GIT, I have deployed a non-bare repository on the website, with a post-receive hook.

Is it possible to see what changes have been made in the remote's working copy without committing them?

I'll give an example to clarify things:

  • I have a live installation of Wordpress with a repository on its root.
  • I push changes from local repository, but Wordpress itself has made changes to remote's files, so the push won't affect these files since they have uncommitted changes.
  • I would like to see what changes has Wordpress made so I can stage them or not.
Cœur
  • 37,241
  • 25
  • 195
  • 267
luislpv22
  • 3
  • 1

2 Answers2

0

git fetch will do this for you. It gets the changes in the remote branches without changing your local copy. Look at What is the difference between 'git pull' and 'git fetch'? for more information.

Community
  • 1
  • 1
neontapir
  • 4,698
  • 3
  • 37
  • 52
  • I understand it, but I would need to commit changes from the remote first to fetch them, what I want to do is to only get uncommited changes from the remote. – luislpv22 Mar 29 '17 at 19:06
0

Think of Wordpress itself as just another person using Git. He is Word Press <word@press.program>.

If Mr Press does not commit his changes, the only way for you to get his changes is some "out of band" method. For instance, he could run git diff and email you the result.

If Mr Press does commit his changes, and you have access (such as git fetch permission) to his repository, then you can get those changes into your own repository directly, via Git commands.

torek
  • 448,244
  • 59
  • 642
  • 775
  • Thank you that was so easy to understand. Is it possible for Mr Press to auto commit his changes? Maybe in post-receive? – luislpv22 Mar 29 '17 at 19:11
  • Automatic commit is somewhat error prone, but yes, you can drive it from any point you like. Consider which files should be committed; `git add` them (or `git add .` to add everything) and then `git commit -m message` to create a new commit on the current branch. It's probably wise for Mr Automated Press to use "his own branch" for this, which is what starts to make this so tricky (how will you and Mr Automated Press share work on this branch?). – torek Mar 29 '17 at 19:28
  • Yeah it's starting to get complex, I think I will keep using the old way of gzip the entire website and unzip it inside my local repo so I can then see what has changed since my last pull. RIP Mr. Press :( – luislpv22 Mar 29 '17 at 19:34