This approach ensures a smooth transfer of work between computers while maintaining the version history.
The trick is that we commit the changes, push to remote, pull on destincation, create a patch from commit, and then revert the commit.
from there we apply the patch that contains our changes.
Remember to replace your_branch_name with actual BRANCH name.
Step 1: Commit Changes on Source Computer:
git add .
git commit -m "WIP"
Step 2: Push Changes to Remote:
git push origin your_branch_name
Step 3: Pull Changes on Destination Computer:
git pull origin your_branch_name
Step 4: Create a Patch from last commit that just pulled:
git checkout your_branch_name
git format-patch HEAD^ -o .
git add .
git stash save "Patch"
Step 5: Revert the WIP Commit:
git reset HEAD^
git add .
git commit -m "revert WIP"
Step 6: Pop Stash and Apply Patch:
git stash pop
git apply --ignore-space-change --ignore-whitespace 0001-wip.patch
This sequence of commands allows you to export changes from one computer to another using Git's version control features. It involves committing, pushing, pulling, generating a patch, stashing, reverting, and applying the changes.