1

For example i have dirA, dirB - all with subdirectories. I want to merge dirA into dirB with "force" dirA. I tryied to use this

/usr/bin/rsync -avh --progress dirA dirB

But "force" dirA don't work. Need similarity git merge with force overwrite. And found this

cp -r dirA dirB
BasicUser
  • 11
  • 3
  • Welcome to SE. Your second command will create `dirB/dirA`. I don't believe this is what you want. Could you clarify what you mean by "force"? – Panki Mar 30 '22 at 16:52
  • If you just want to copy everything from `dirA` into `dirB`, overwriting common files, that would be `cp -r dirA/* dirB/` – Panki Mar 30 '22 at 16:54
  • 1
    @Panki they'd be better with `cp -a dirA/. dirB/` (including that trailing dot in the source specification). Also see [this answer](https://unix.stackexchange.com/a/228637/100397) elsewhere on [U&L](https://unix.stackexchange.com) – roaima Mar 30 '22 at 17:16
  • Please would you [edit your question](https://unix.stackexchange.com/posts/697378/edit) to explain what you mean by "_Need similarity git merge with force overwrite_" – roaima Mar 30 '22 at 17:18
  • @Panki Thanks, I want logic like git merge, So that in a conflict, the dirA has an advantage – BasicUser Mar 30 '22 at 17:25
  • 2
    BasicUser believe it or not I don't use `git merge`. Please [explain in your question](https://unix.stackexchange.com/posts/697378/edit) the feature that you want in terms of what it should do, not in terms of another command. – roaima Mar 30 '22 at 20:17
  • @roaima Sorry language borders :). I want to scan two dirs with subdirs and check for changes, if same files, rewrite with newest. – BasicUser Mar 30 '22 at 20:50
  • 1
    Third time of asking: Please [EXPLAIN THIS IN YOUR QUESTION](https://unix.stackexchange.com/posts/697378/edit). Don't reply in the comments. – roaima Mar 30 '22 at 22:25
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Apr 07 '22 at 12:51

0 Answers0