Question

I'm translating some document into Japanese. This document is being versioned with git.

Because the document is going to be updated again and again, translation is also need to keep track of changing. I created "ja" branch and copy them into "ja" directory as following:

.
├── 01.1.md
├── 01.2.md
├── README.md
└── ja
    ├── 01.1.md
    ├── 01.2.md
    └── README.md

Then I started to translate the original commits one by one. Now I want to know which commits are not translated so far. How should I tie up between translated commits and original commits? Can I improve version control related works like reverting on original commit tree?


Example (update)

Now the whole commit log looks like:

$ git log --graph --all --oneline --decorate

* 63978c0 (HEAD, ja) cherry-pick 220d6f3 + translate
* eef200a cherry-pick 1f828c2 + translate
* 319100b copy files to ja dir
| * 220d6f3 (master) append line to 01.1.md
| * aff68a6 add text to 01.2.md
| * 1f828c2 add text to 01.1.md
|/  
* 33db727 init (touch {01.1.md|01.2.md|README.md})

I wonder if I can git-cherry even if it's containing amended contents.

$ git checkout master
$ git cherry --some-magic-option ja

+ aff68a6eb865590dab3768edeac43a318834dea0
Was it helpful?

Solution

As both branches share the same files (and the ja branch only adds translations) I would suggest merging master into ja regularly.

You basically first merge new changes of master into your translation branch. This should work without problems as your translation branch does not change the original files.

Afterwards you can use git diff HEAD^ or git show -m to view the new changes and add another commit with your translations.

If you want to check for untranslated commits you then can do git fetch; git log -p ja..origin/master, which shows you all commits on the remote master, which you did not already merged into your local ja branch.

Of course this cannot check if you really translated everything correctly, but it allows you to do something like git log -p -m --first-parent to manually check for yourself. This should alternately show a translated diff (by you) and an untranslated commit (from the merge).

You can also do git fetch; gitk --all to get a visual impression what is going on.

This would result in a graph like this:

→ M → T  →  M → T  →  M → T → (ja)
  ↑         ↑         ↑
→ O    →    O    →    O   →   (master)

Where O is one original commit M is the merge and T is the translation commit.

You could also add the translation directly into the merge commit to have only one single (merge) commit for each original commit, but maybe having two seperate commits might be a bit clearer.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top