如何使本地WordPress副本与在线仓库保持同步?

时间:2016-06-21 08:34:14

标签: wordpress git github

我想从GitHub获得WordPress repo的本地副本。

我从clone开始:

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

由于我使用此WordPress进行了一些开发,我喜欢排除ceratin文件/文件夹以进行更新。我的.gitignore看起来像这样:

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

有时在开发过程中我需要修改一些核心文件(基本变量输出,旁路缓存等)。

要回到初始状态,我试试

git remote update

但不会覆盖已更改的文件。

git rebase master

不起作用,因为有非分期更改。

git pull --all

也不起作用。

如何更新在线版本的本地仓库,包括所有更改和分支

2 个答案:

答案 0 :(得分:1)

首先存储您的更改

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

然后

git pull

答案 1 :(得分:0)

这就是我最后的表现:

#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

使用git checkout master可以轻松切换到当前的测试版。您随时可以切换到任何版本