Differences between revisions 11 and 12
Revision 11 as of 2020-07-03 19:54:56
Size: 3788
Editor: JendrikSeipp
Comment: Document how to use hg-git.
Revision 12 as of 2020-07-06 09:08:01
Size: 4255
Editor: JendrikSeipp
Comment: Add note about code protection.
Deletions are marked like this. Additions are marked like this.
Line 65: Line 65:
== 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.

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:

  • TODO: git bisect with --first-parent etc. (Malte sent a few links)
  • TODO: how to configure git + meld
  • TODO: can we use github's facilities on the webpage for, e.g., merging pull requests or does this do "wrong" things?

Suggested workflow:

  • git checkout -b issue999
  • ...
  • git commit -m "[issue999] some changes"
  • ...
  • git tag issue999-base <rev>

  • git tag issue999-v1 <rev>

  • git push --set-upstream origin issue999 --tags
  • ...
  • git checkout main
  • git merge --no-ff issue999
  • git branch -d issue999
  • git push

.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
  • [Silvan] I also found out that meld actually knows about hg/git, so instead of configuring above and typing hg meld/git meld, one could also just type meld .
  • [Silvan] Unfortunately, I haven't found a way for git merge to automatically open meld instead of first doing an incomplete merge and then viewing the failed merge via hg mergetool, which, if configured as above to take $MERGED as the middle file, contains the failed merge in the >>>> ... <<<< ... format, which I really don't like. If anyone finds out how to let git automatically merge what it can and then immediately prompt the user via mergetool instead of requiring this to be called manually, and even better, without showing the failed merge, I would be very happy.

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 mercurial python-dulwich

hg clone https://foss.heptapod.net/mercurial/hg-git /path/to/hg-git
cd /path/to/hg-git
hg up 0.9.0a1  # pre-release adds support for Mercurial >= 5.3 (untested) 

# Add to ~/.hgrc file:
[extensions]
hggit = /path/to/hg-git/hggit

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
hg update main

[tested with Ubuntu 18.04]

FastDownward: ForDevelopers/Git (last edited 2023-02-14 15:29:06 by SilvanSievers)