sync, merge: Added --allow-unrelated-histories option

Which is the same as the git merge option.

After last commit, this turns out to be needed in the test suite, and when
doing git-annex import from special remote, followed by a git-annex merge.

Sponsored-by: Svenne Krap on Patreon
This commit is contained in:
Joey Hess 2021-07-19 12:08:24 -04:00
parent b6bea0d3f2
commit 3d50b47ded
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
7 changed files with 67 additions and 34 deletions

View file

@ -42,19 +42,17 @@ currently checked out branch.
For example:
git annex import master --from myremote
git annex merge myremote/master
git annex merge --allow-unrelated-histories myremote/master
You could just as well use `git merge myremote/master` as the second step,
but using `git-annex merge` avoids a couple of gotchas. When using adjusted
branches, it adjusts the branch before merging from it. And it avoids
the merge failing on the first merge from an import due to unrelated
histories.
You could just as well use `git merge --allow-unrelated-histories myremote/master`
as the second step, but using `git-annex merge` avoids a couple of gotchas.
When using adjusted branches, it adjusts the branch before merging from it.
If you do use `git merge`, you can pass `--allow-unrelated-histories` the
first time you `git merge` from an import. Think of this as the remote
being a separate git repository with its own files. If you first
`git annex export` files to a remote, and then `git annex import` from it,
you won't need that option.
The --allow-unrelated-histories option is needed for at least the first
merge of an imported remote tracking branch, since the branch's history is
not connected. Think of this as the remote being a separate git repository
with its own files. If you first `git annex export` files to a remote, and
then `git annex import` from it, you won't need that option.
You can import into a subdirectory, using the "branch:subdir" syntax. For
example, if "camera" is a special remote that accesses a camera, and you

View file

@ -22,7 +22,12 @@ will not be done.
# OPTIONS
* The [[git-annex-common-options]](1) can be used.
* `--allow-unrelated-histories`, `--no-allow-unrelated-histories`
Passed on to `git merge`, to control whether or not to merge
histories that do not share a common ancestor.
* Also, the [[git-annex-common-options]](1) can be used.
# SEE ALSO

View file

@ -150,6 +150,11 @@ have the same value as the currently checked out branch.
less efficient. When --content is synced, the files are processed
in parallel as well.
* `--allow-unrelated-histories`, `--no-allow-unrelated-histories`
Passed on to `git merge`, to control whether or not to merge
histories that do not share a common ancestor.
* `--resolvemerge`, `--no-resolvemerge`
By default, merge conflicts are automatically handled by sync. When two