Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tips'n'Tricks -- general things learned while working on this project that could be used any any project #881

Open
NullVoxPopuli opened this issue May 25, 2020 · 1 comment

Comments

@NullVoxPopuli
Copy link
Owner

No description provided.

@NullVoxPopuli
Copy link
Owner Author

NullVoxPopuli commented May 25, 2020

Git

Fix branches / PRs when the repo directories are re-arranged

Example:
PR out that makes changes in packages/frontend/
but upstream changes moved that directory to client/web/emberclear/
normally, there would be a ton of conflicts if the PR submitter were to try to rebase.

To fix the conflicts issue, and re-write the diffs to apply to the correct directories:

git checkout your-branch
# squash down to one commit, or format-patch will make a diff file for each commit
#
# remember the additions/deletions
git diff HEAD~1 --shortstat

# this will output a file like 0001-commit-message-here.patch
git format-patch HEAD~1
git checkout master

# create new branch (don't want to destroy original branch yet)
git checkout -b your-branch-2

# now apply the diff
git apply -p3 --directory="client/web/emberclear" 0001-commit-message-here.patch
git commit -am"some new message"

# this should be *roughly* close to the original diff, 
# depending on what's changed in the upstream branch
# ideally, the diff stats here match those from earlier
git diff HEAD~1 --shortstat

source: https://blog.soltysiak.it/en/2017/08/how-to-use-git-patch-system-to-apply-changes-into-another-folder-structure/

@NullVoxPopuli NullVoxPopuli pinned this issue Sep 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant