代码之家  ›  专栏  ›  技术社区  ›  Xaver

如何保持本地WordPress副本与在线回购同步?

  •  1
  • Xaver  · 技术社区  · 10 年前

    我想要一份本地的 WordPress repo 来自GitHub。

    我从一个 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 回复  |  直到 10 年前
        1
  •  1
  •   Vishal    10 年前

    先把你的零钱藏起来

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

    然后

    git pull
    
        2
  •  0
  •   Xaver    10 年前

    我最终是这样做的:

    #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 。您始终可以切换到任何版本