Revision 14 as of 2020-07-06 12:25:56

Clear message

Back to developer page.

Git

Our Git workflow (work in progress)

Outcome of the discussion in the Fast Downward meeting on 21 February:

Best practices:

Suggested workflow:

.gitconfig file:

[merge]
tool = meld

[mergetool "meld"]
#cmd = meld "$LOCAL" "$BASE" "$REMOTE" --output "$MERGED"
cmd = meld "$LOCAL" "$MERGED" "$REMOTE" --output "$MERGED"

[diff]
tool = meld

[difftool "meld"]
cmd = meld "$LOCAL" "$REMOTE"

[difftool]
prompt = false

[alias]
ci = commit
st = status
meld = difftool

# aliases that match the hg in / out commands
out = !git fetch && git log FETCH_HEAD..
in = !git fetch && git log ..FETCH_HEAD

GitHub code protection

[Jendrik] We could protect against code loss by protecting the "main" branch. This is easy to do on the Settings->Branches page (example: https://github.com/aibasel/jendrik-downward/settings/branch_protection_rules/16688019). By default, protecting a branch means that no force pushes are allowed and the branch can't be deleted. There are additional options for protected branches, but I don't think we need to activate them now.

Interact with a Git repo from Mercurial

The hg-git tool allows to pull and push from and to a Git repository with Mercurial, allowing you use Mercurial for working on Git projects. It does so by converting all Git branches to Mercurial bookmarks and vice versa. Here is how to set it up:

sudo apt install python3-venv

mkdir hg-git
cd hg-git
python3 -m venv --prompt hg-git .venv
pip install -U pip wheel
pip install certifi==2020.6.20 dulwich==0.20.5 hg-git==0.9.0a1 mercurial==5.4.2 pkg-resources==0.0.0 urllib3==1.25.9

# Add to ~/.bash_aliases file:
alias hg="/path/to/hg-git/.venv/bin/hg --config extensions.hggit="

source ~/.bash_aliases

Now you can clone a repository. Remember to update to a bookmark to make it follow your commits:

hg clone git+ssh://git@github.com/aibasel/downward.git
cd downward
hg update main

[tested with Ubuntu 18.04]