Xaver
Xaver

Reputation: 11682

How to keep a local WordPress copy in sync with the online repo?

I would like to have a local copy of the WordPress repo from GitHub.

I start with a clone:

git clone https://github.com/WordPress/WordPress.git

Since I do some development with this WordPress I like to exclude ceratin files/folders to get updated. My .gitignore looks like this:

.DS_Store
sftp-config.json
wp-content/*
wp-config.php
svn/*
wc-logs/*

Sometimes during development I need to modify some core file (basic variable output, bypass caching etc.).

To get back to the initial state I try

git remote update

but doesn't overwrite the changed files.

git rebase master

doesn't work cause there are unstaged changes.

git pull --all

doesn't work either.

How can I update the local repo including all changes and branches of the online version?

Upvotes: 1

Views: 113

Answers (2)

Xaver
Xaver

Reputation: 11682

This is how I do it finally:

#checkout to master (latest beta)
git checkout master

#stash any changes
git stash save "reload"

#get everything from the repo
git pull --all
git pull --tags
git fetch origin

#optional: show the 5 most recent changes
git log --oneline -5

#check out to the latest stable (manual adjusted)
git checkout -q 4.5.3

switching to the current beta is easy with git checkout master. You can always switch to any version

Upvotes: 0

Vishal
Vishal

Reputation: 589

First stash your changes

git stash save "my local changes which I will apply later after getting latest"

Then

git pull

Upvotes: 1

Related Questions