git merge into master only overwrite changed files

Is it possible to merge branch edits into branch master with the following scenario:

many changes were made on edits as well as new files added.

  • Software for Git in the enterprise?
  • Understanding Git, working with a php ide and ftp
  • GitLab shows deleted branches
  • How to close a GitHub pull request with a commit message?
  • Automate Deployments with Git, Bitbucket and PHP
  • Sonar analysis using multiple git branches in Jenkins
  • many changes were also made to master as well as new files added.

    I’d like to overwrite any duplicate files in master and use the files from edits, so that when im done, master will contain all changes from edits, all new files from edits and all new files from master. If both contained new files, it would use edits‘s new files. If there are merges, I’d like to replace the entire file with the one from edits.

    I found this answer: https://stackoverflow.com/a/1295232/1166285 and tried the comment’s suggestion but that made conflicts which i’d have to resolve.

    Is this possible?

  • git log output like svn ls -v
  • How to git clone dotfiles into my home directory with one command?
  • git: how to push to master an unrelated repo
  • Git workflow with multiple stable branches, syncing with svn
  • What does PHP Composer provide that Git Submodules does not?
  • git push origin master doesn't register changes to repo
  • One Solution collect form web for “git merge into master only overwrite changed files”

    On the master branch, merge in the edits branch with the theirs merge strategy:

    git checkout master
    git merge -Xtheirs edits
    

    In case of conflicts, this will prefer the theirs branch. Changes from master where there is no conflict will be retained.

    Git Baby is a git and github fan, let's start git clone.