I am new to version control such as git so this may be an easy answer for some… for all my searching I can’t find a simple enough answer.
I am developing a wordpress site on a dev server. Another developer is making changes to the live (production) site and some changes are also ftp’ed to the dev site.
Is there a way for me to merge those changes to my local copy so I don’t override his changes and he doesn’t override mine?
I would hate to push a file to the live site that doesn’t have his changes and screw the live site up…
You need to do a
git pull
before trying to push your changes to the remote.It’s always a good practice to get hold of the latest
master
branch (assuming that’s used on your dev server) before youIdeally, before you start working on a feature, get your feature branch to branch off from the latest
master
. You can do agit fetch <remote_name>
and then do this –git checkout -b <feature_branch> <remote_name>/master
Or better yet, merge the remote
master
in your localmaster
and then create the feature branch from your localmaster
.This will ensure that your is created off the latest
master
on your dev server.When you cannot push to the dev server, you can do a
git pull
which will fetch and merge the latestmaster
, to ensure that any of your co-workers’ work is included in your work. After you do that, you will not have any issues pushing your code.