If you don't care about the story, you can make a separate commit on branch 2 containing the file, just like on the commit tip in Proj1:
git checkout Proj2 git checkout Proj1 -- index.html git commit -am "Modify Index.html"
Essentially, this means the file needs to be EXACTLY since it looks in the Proj1 branches.
git checkout -- means that after the dash you specify the file name (or path). This can be useful if you want to modify some files in your repository and save others.
Then, if you want, you can also reuse the commit message from the commit made in Proj1, as follows:
git checkout Proj2 git checkout Proj1
Git commit -C means reusing the commit comment you already had.
From the Git documentation "git checkout" :
Git checkout [-p|--patch] [<tree-ish>] [--] <pathspec>
When or --patch , git check does not switch branches. This updates the named paths in the working tree from the index file or on behalf of (most often - commit).
[...]
Git checking with or --patch used to restore modified or deleted paths to their original contents from an index or to replace paths with contents on behalf of (most often commit-MTF).
And from git documentation, "git commit"
git commit -C <commit>
--reuse-message=<commit>
Take the existing commit object and reuse the journal message and attribution information (including the timestamp) when creating the commit.
source share