You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何合并Bitbucket与Google Earth Engine仓库实现统一管理?

Answer

Absolutely, you can unify the management of your Bitbucket group repo and GEE code repo—let’s break down the best approaches to get the GEE code visible in Bitbucket and keep changes synced between both environments.

First, the reason you can’t see the GEE code in Bitbucket with submodules is that submodules only store a pointer (a commit hash) to the external repo, not the actual code. To make the code visible, you need to include the GEE code directly in your group repo, which can be done in two main ways:

Option 1: Merge the GEE repo into your Bitbucket group repo (simplest for visibility)

This approach copies all GEE code into your group repo, making it fully visible on Bitbucket. You’ll then set up sync between the two repos to keep changes aligned.

Steps:

  1. Remove the existing submodule (if you already added it):
    • In SourceTree, right-click the submodule folder, select "Remove Submodule", and confirm the deletion.
    • Or via command line if you prefer:
      git submodule deinit -f path/to/gee-submodule
      git rm -f path/to/gee-submodule
      rm -rf .git/modules/path/to/gee-submodule
      
  2. Clone your GEE repo locally (pull the latest changes if you already have it):
    git clone <your-gee-repo-url> gee-local
    cd gee-local
    git pull
    
  3. Copy GEE code into your group repo:
    • Move all files from the gee-local folder into a dedicated directory in your group repo (e.g., gee-code/).
  4. Commit and push to Bitbucket:
    • In SourceTree, stage the new gee-code/ directory, add a commit message like "Add GEE code to group repo", and push to your Bitbucket repo. Now the GEE code will be visible to your team on Bitbucket.
  5. Set up sync between GEE and group repo:
    • In your local group repo, add the GEE repo as a remote:
      git remote add gee <your-gee-repo-url>
      
    • Pull changes from GEE to group repo:
      Use git subtree to update just the gee-code/ directory (avoids messy merges):
      git subtree pull --prefix gee-code gee main --squash
      
    • Push changes from group repo to GEE:
      When your team makes changes to gee-code/ in Bitbucket, push them back to GEE with:
      git subtree push --prefix gee-code gee main
      
    • For team members using the GEE online interface: After they make changes in GEE, they’ll need to pull those into their local group repo (using the subtree pull command), commit, and push to Bitbucket. Conversely, if the group repo has updates, they can push to GEE and refresh their online interface to see changes.

Option 2: Use Git Subtree instead of Submodules (structured sync)

If you want to keep a formal connection to the GEE repo while having the code visible in Bitbucket, git subtree is a better alternative to submodules. It embeds the GEE code directly in your group repo but maintains a link to the original GEE repo for syncing.

Steps:

  1. Add the GEE repo as a subtree to your group repo:
    git subtree add --prefix gee-code <your-gee-repo-url> main --squash
    
    • The --squash flag keeps your commit history clean by merging GEE commits into a single commit.
  2. Pull updates from GEE:
    git subtree pull --prefix gee-code <your-gee-repo-url> main --squash
    
  3. Push changes back to GEE:
    git subtree push --prefix gee-code <your-gee-repo-url> main
    
  4. Commit and push to Bitbucket:
    Any changes from the subtree pull/push will be visible in your group repo—just commit and push as usual, and the GEE code will show up on Bitbucket.

Key Notes for Your Team

  • SourceTree Support: SourceTree has limited GUI support for subtree commands, so you’ll likely need to use the command line for the sync steps. But committing and pushing the code itself works fine in SourceTree.
  • Conflict Resolution: If both the GEE repo and group repo have changes to the same file, you’ll need to resolve conflicts locally before pushing—just like any other git merge.

Either approach will let you unify management: your team can access all code (Python/IDL/GEE) in the Bitbucket repo, and you can sync changes between the GEE online interface and the group repo seamlessly.

内容的提问来源于stack exchange,提问作者GeoMonkey

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.28 09:50:57