Skip to content

Instantly share code, notes, and snippets.

@jorotenev
Last active November 25, 2024 11:14
Show Gist options
  • Select an option

  • Save jorotenev/76787a53107e971a7c75bcfaee64cf15 to your computer and use it in GitHub Desktop.

Select an option

Save jorotenev/76787a53107e971a7c75bcfaee64cf15 to your computer and use it in GitHub Desktop.

Revisions

  1. Georgi Tenev revised this gist Apr 1, 2017. 1 changed file with 8 additions and 1 deletion.
    9 changes: 8 additions & 1 deletion workflow.md
    Original file line number Diff line number Diff line change
    @@ -36,4 +36,11 @@ Example - change files in both the `thesis` and the `memory-engine` folders:
    `git push origin master`
    * Push to the `memory-engine` repo
    `georgi@georgi-laptop:~/Projects/thesis(master)$ git subtree push --prefix memory-engine memory-engine-origin master`
    * If we open the GitHub of `thesis` - we will see the commit, with both files changed. If we open the GitHub of `memory-engine`, only the memory-engine/README.md will be in the commit. Voila
    * If we open the GitHub of `thesis` - we will see the commit, with both files changed. If we open the GitHub of `memory-engine`, only the memory-engine/README.md will be in the commit. Voila
    ## Change the branch of `memory-engine`
    http://stackoverflow.com/questions/18536279/git-subtree-possible-to-change-subtree-branch-path-in-a-forked-repository
    * push the branch to the `memory-engine` repo
    * In `thesis`
    `rm -rf memory-engine`
    * Commit
    * `georgi@georgi-laptop:~/Projects/thesis(master)$ git subtree add --prefix=memory-engine/ memory-engine-origin <memory-engine-branch-we-want>`
  2. Georgi Tenev revised this gist Mar 31, 2017. 1 changed file with 4 additions and 3 deletions.
    7 changes: 4 additions & 3 deletions workflow.md
    Original file line number Diff line number Diff line change
    @@ -1,14 +1,15 @@
    ```
    ./thesis
    ├── docker-compose.yaml
    ├── micrsoserviceX
    ├── micrsoserviceY
    ├── memory-engine

    ```
    # Subtree workflows
    Adapted from [here](https://medium.com/@v/git-subtrees-a-tutorial-6ff568381844). Below is an executive summary for the use case of a university collaborative thesis project.

    We have the `thesis` repo and some other, subproject repo (the `memory-engine` repo in this example).
    We want the `thesis` to be the "main" repository, such that on a new machine, just pulling it is enough to get us started.
    We have the `thesis` folder and some other, subproject folder (the `memory-engine` in this example).
    We want the `thesis` to be a "main" repository, such that on a new machine, just pulling it is enough to get us started.
    We also want to make it easy to make changes either to `memory-engine/` code, or to code in the `thesis/` or to both, without having to bump versions/commits every time we push to `memory-engiine`.
    We could have used `git submodules` but it's so much pain (really).
    ## Set up a new subtree
  3. Georgi Tenev revised this gist Mar 31, 2017. 1 changed file with 7 additions and 1 deletion.
    8 changes: 7 additions & 1 deletion workflow.md
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,13 @@
    ./thesis
    ├── docker-compose.yaml
    ├── micrsoserviceX
    ├── micrsoserviceY
    ├── memory-engine

    # Subtree workflows
    Adapted from [here](https://medium.com/@v/git-subtrees-a-tutorial-6ff568381844). Below is an executive summary for the use case of a university collaborative thesis project.

    Say we have the `thesis` repo and some other, subproject repo (the `memory-engine` repo in this example).
    We have the `thesis` repo and some other, subproject repo (the `memory-engine` repo in this example).
    We want the `thesis` to be the "main" repository, such that on a new machine, just pulling it is enough to get us started.
    We also want to make it easy to make changes either to `memory-engine/` code, or to code in the `thesis/` or to both, without having to bump versions/commits every time we push to `memory-engiine`.
    We could have used `git submodules` but it's so much pain (really).
  4. Georgi Tenev revised this gist Mar 30, 2017. 1 changed file with 10 additions and 10 deletions.
    20 changes: 10 additions & 10 deletions workflow.md
    Original file line number Diff line number Diff line change
    @@ -9,24 +9,24 @@ We could have used `git submodules` but it's so much pain (really).
    * In `thesis/`:
    `git remote add memory-engine-origin git@github.com:warreee/memory-engine.git`
    * add the subtree (this will clone the master of the `memory-engine` repo and configre the thesis) repo.
    `git subtree add --prefix=memory-engine/ memory-engine-origin master`
    `git subtree add --prefix=memory-engine/ memory-engine-origin master`
    ## Changing `memory-engine` from within the `thesis`
    We have opened the thesis repo in, say, PyCharm, we make a change in the 'memory-engine' folder and just want to publish our changes without having to push first to the `memory-engine` repo and then pulling from `thesis`.
    * e.g. if we are in `thesis/`, we can make changes to the memory-engine
    * e.g. if we are in `thesis/`, we can make changes to the memory-engine
    `touch ./memory-engine/boo`
    * and then push the changes to the `thesis` repo
    `git commit -am "added boo"`
    * and then push the changes to the `thesis` repo
    `git commit -am "added boo"`
    `git push origin master` (origin here is the thesis origin)

    In GitHub of `thesis`, the commit would appear. Nothing special, but still useful because we didn't have to bump versions anywhere.
    ## Changing files from both repos
    Example - change files in both the `thesis` and the `memory-engine` folders:
    Example - change files in both the `thesis` and the `memory-engine` folders:
    * make the changes
    `georgi@georgi-laptop:~/Projects/thesis/memory-engine(master)$ echo "boo :)" >> README.md`
    `georgi@georgi-laptop:~/Projects/thesis(master)$ echo "testing" >> README.md`
    * make a commit and push it to the `thesis` repo
    `git commit -am "made a commit to both repos"`
    `georgi@georgi-laptop:~/Projects/thesis/memory-engine(master)$ echo "boo :)" >> README.md`
    `georgi@georgi-laptop:~/Projects/thesis(master)$ echo "testing" >> README.md`
    * make a commit and push it to the `thesis` repo
    `git commit -am "made a commit to both repos"`
    `git push origin master`
    * Push to the `memory-engine` repo
    * Push to the `memory-engine` repo
    `georgi@georgi-laptop:~/Projects/thesis(master)$ git subtree push --prefix memory-engine memory-engine-origin master`
    * If we open the GitHub of `thesis` - we will see the commit, with both files changed. If we open the GitHub of `memory-engine`, only the memory-engine/README.md will be in the commit. Voila
  5. Georgi Tenev revised this gist Mar 30, 2017. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions workflow.md
    Original file line number Diff line number Diff line change
    @@ -8,10 +8,10 @@ We could have used `git submodules` but it's so much pain (really).
    ## Set up a new subtree
    * In `thesis/`:
    `git remote add memory-engine-origin git@github.com:warreee/memory-engine.git`
    * add the subtree (this will clone the master of the `memory-engine` repo and configre the thesis) repo.
    * add the subtree (this will clone the master of the `memory-engine` repo and configre the thesis) repo.
    `git subtree add --prefix=memory-engine/ memory-engine-origin master`
    ## Changing `memory-engine` from within the `thesis`
    We have opened the thesis repo in pycharm, we make a change in the 'memory-engine' folder and want to just want to publish our changes without having to push first to the memory-engine repo and then pulling from thesis.
    We have opened the thesis repo in, say, PyCharm, we make a change in the 'memory-engine' folder and just want to publish our changes without having to push first to the `memory-engine` repo and then pulling from `thesis`.
    * e.g. if we are in `thesis/`, we can make changes to the memory-engine
    `touch ./memory-engine/boo`
    * and then push the changes to the `thesis` repo
  6. Georgi Tenev revised this gist Mar 30, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion workflow.md
    Original file line number Diff line number Diff line change
    @@ -6,7 +6,7 @@ We want the `thesis` to be the "main" repository, such that on a new machine, ju
    We also want to make it easy to make changes either to `memory-engine/` code, or to code in the `thesis/` or to both, without having to bump versions/commits every time we push to `memory-engiine`.
    We could have used `git submodules` but it's so much pain (really).
    ## Set up a new subtree
    * In `thesis/`
    * In `thesis/`:
    `git remote add memory-engine-origin git@github.com:warreee/memory-engine.git`
    * add the subtree (this will clone the master of the `memory-engine` repo and configre the thesis) repo.
    `git subtree add --prefix=memory-engine/ memory-engine-origin master`
  7. Georgi Tenev revised this gist Mar 30, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion workflow.md
    Original file line number Diff line number Diff line change
    @@ -6,7 +6,7 @@ We want the `thesis` to be the "main" repository, such that on a new machine, ju
    We also want to make it easy to make changes either to `memory-engine/` code, or to code in the `thesis/` or to both, without having to bump versions/commits every time we push to `memory-engiine`.
    We could have used `git submodules` but it's so much pain (really).
    ## Set up a new subtree
    * In `thesis`
    * In `thesis/`
    `git remote add memory-engine-origin git@github.com:warreee/memory-engine.git`
    * add the subtree (this will clone the master of the `memory-engine` repo and configre the thesis) repo.
    `git subtree add --prefix=memory-engine/ memory-engine-origin master`
  8. Georgi Tenev revised this gist Mar 30, 2017. No changes.
  9. Georgi Tenev revised this gist Mar 30, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion workflow.md
    Original file line number Diff line number Diff line change
    @@ -3,7 +3,7 @@ Adapted from [here](https://medium.com/@v/git-subtrees-a-tutorial-6ff568381844).

    Say we have the `thesis` repo and some other, subproject repo (the `memory-engine` repo in this example).
    We want the `thesis` to be the "main" repository, such that on a new machine, just pulling it is enough to get us started.
    We also want to make it easy to make changes to code either to a `memory-engine/` code, or to code in the `thesis/` or to both, without having to bump versions/commits every time we push to `memory-engiine`.
    We also want to make it easy to make changes either to `memory-engine/` code, or to code in the `thesis/` or to both, without having to bump versions/commits every time we push to `memory-engiine`.
    We could have used `git submodules` but it's so much pain (really).
    ## Set up a new subtree
    * In `thesis`
  10. Georgi Tenev created this gist Mar 30, 2017.
    32 changes: 32 additions & 0 deletions workflow.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,32 @@
    # Subtree workflows
    Adapted from [here](https://medium.com/@v/git-subtrees-a-tutorial-6ff568381844). Below is an executive summary for the use case of a university collaborative thesis project.

    Say we have the `thesis` repo and some other, subproject repo (the `memory-engine` repo in this example).
    We want the `thesis` to be the "main" repository, such that on a new machine, just pulling it is enough to get us started.
    We also want to make it easy to make changes to code either to a `memory-engine/` code, or to code in the `thesis/` or to both, without having to bump versions/commits every time we push to `memory-engiine`.
    We could have used `git submodules` but it's so much pain (really).
    ## Set up a new subtree
    * In `thesis`
    `git remote add memory-engine-origin git@github.com:warreee/memory-engine.git`
    * add the subtree (this will clone the master of the `memory-engine` repo and configre the thesis) repo.
    `git subtree add --prefix=memory-engine/ memory-engine-origin master`
    ## Changing `memory-engine` from within the `thesis`
    We have opened the thesis repo in pycharm, we make a change in the 'memory-engine' folder and want to just want to publish our changes without having to push first to the memory-engine repo and then pulling from thesis.
    * e.g. if we are in `thesis/`, we can make changes to the memory-engine
    `touch ./memory-engine/boo`
    * and then push the changes to the `thesis` repo
    `git commit -am "added boo"`
    `git push origin master` (origin here is the thesis origin)

    In GitHub of `thesis`, the commit would appear. Nothing special, but still useful because we didn't have to bump versions anywhere.
    ## Changing files from both repos
    Example - change files in both the `thesis` and the `memory-engine` folders:
    * make the changes
    `georgi@georgi-laptop:~/Projects/thesis/memory-engine(master)$ echo "boo :)" >> README.md`
    `georgi@georgi-laptop:~/Projects/thesis(master)$ echo "testing" >> README.md`
    * make a commit and push it to the `thesis` repo
    `git commit -am "made a commit to both repos"`
    `git push origin master`
    * Push to the `memory-engine` repo
    `georgi@georgi-laptop:~/Projects/thesis(master)$ git subtree push --prefix memory-engine memory-engine-origin master`
    * If we open the GitHub of `thesis` - we will see the commit, with both files changed. If we open the GitHub of `memory-engine`, only the memory-engine/README.md will be in the commit. Voila