Reputation: 109
how can I stash the difference between current branch and master to apply it to an old commit, in other words I should apply a new feature in current version(Master) and old version(old Master commit 1 year ago).
Upvotes: 1
Views: 208
Reputation: 263
There are few ways to apply a new feature to any branch on your master:
1.Cherry-pick all commits one by one using
git cherry-pick hash_of_commit
But it will take some time to do if you have a lot of commits.
To squash you can use git rebase -i hash_of_the_commit
- this command would do an interactive rebase to hash_of_the_commit
, which should be one commit before you started developing feature. Then in interactive mode you mark all commits to squash. Might lead to conflicts while squashing.
3.Create patch
git diff from-commit to-commit > output-file
and then apply patch to your other branch:
git apply output-file
Upvotes: 1