Git Merge subdirectory to branch to root directory of master

I have a branch that has the content of the master branch as a subdirectory. Now I made some changes to this subdirectory. Ideally I want to be able to merge these changes back into the master branch.

Branch layout:

  • Differences between git remote update and fetch?
  • Managing dependent in-progress git feature branches / branch sets
  • Emacs Based Git Diff Tool?
  • How do I 'overwrite', rather than 'merge', a branch on another branch in Git?
  • .gitignore on a new repo (can't reset on a fresh repo)
  • Using React Native with Git
  • index.html
    subdirectory
      > a.txt
      > b.txt
    

    Master layout

    a.txt
    b.txt
    

    How would I go about doing this? Is it even a good approach? In SVN I avoided merging subdirectories back into the trunk. But this is a somewhat different use case, the layout of both, the branch and master, will never change.

  • Why does git modify my files? How do i undo it?
  • patch differences between android kernel and vanilla linux kernel
  • Configure TortoiseGitPlink to autoload key for a specific URL
  • GitLab: Is there a way to protect a branch from command line?
  • Pulling git changes into a branch that hasn't been checked out
  • Should I use Git for deployment of web apps?
  • 2 Solutions collect form web for “Git Merge subdirectory to branch to root directory of master”

    You could try

    • making a branch from your current branch (git branch to_be_merge_to_master)
    • moving back your file to the correct structure (git mv ...)
    • merging that second branch to master

    make use of git submodules

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