Hussein Negm
Hussein Negm

Reputation: 601

Files don't change on remote

I have 2 remote server one for production and one for testing So, pushing to production is fine since I push master

    git push production

but after I created a branch , checked it out, made changes, created a new commit and pushed to testing the files didn't change it shows the progress as in 83 files changed and "Everything is now up to date" but the actual files on testing stays exactly the same I trying pushing using these two commands but none of them worked for me

    git push testing newbranch
    git push testing

Upvotes: 0

Views: 77

Answers (3)

Hussein Negm
Hussein Negm

Reputation: 601

Ok after some more search this solution worked for me

   git push -u origin newbranch

then I pulled the new branch from the remote server I am not sure if future push will work or not but that got me through for now

more elegant/obvious solution it turns out I was pushing and the push was done successfully as the message "Everything is now up to date" indicated but on remote server I didn't checkout the new branch I checked it out and now everything is the way it should be

Upvotes: 0

Ryan Stewart
Ryan Stewart

Reputation: 128919

Pushing to a remote doesn't update any files in the sense you seem to be talking about. It only adds commits to the repo. Checked-out files are never updated by a push, which is why it's generally discouraged to push to a non-bare repository unless you know exactly what you're doing, and even moreso pushing to the currently checked-out branch, which it also sounds like you're doing.

If I'm understanding you right, what you should be doing is probably pushing to a "central" repo somewhere, and then pulling from that repo to your production and/or testing environments. A push is never the right way to update files. That's what pull is for.

Upvotes: 1

mrutyunjay
mrutyunjay

Reputation: 8350

you can use git remote -v command to check which is your remote... it will show you the remote servers to which you are allowed to push and fetch..

Upvotes: 0

Related Questions