I am working on a python script to automatically sync my workspace if possible and need to judge if I can rebase my changes on top of remote master changes.
I am trying to use the brilliant answer here : https://stackoverflow.com/a/6283843/965830
I want to run the following commands :
- Fetch the remote to your repository. For example: git fetch origin master
- Run git merge-base: git merge-base FETCH_HEAD master
- Run git merge-tree: git merge-tree mergebase master FETCH_HEAD(mergebase is the hexadecimal id that merge-base printed in the previous step)
For command 1, I am using the following successfully
gitRepo = git.Repo(abspath);
gitRepo.remotes.origin.fetch(refspec="master")
However, I am not able to find any documentation for merge-base and merge-tree commands.
------Edit
Found this documentation of merge-tree : https://gitpython.readthedocs.io/en/stable/reference.html?highlight=merge-tree#git.index.base.IndexFile.merge_tree
How can I write this in a way that it doesn't actually perform the merge.
