I have a local stash on a directory.
For some reasons, I had to re-import the same remote project into another directory.
Is there a way to move my stash from my old directory to the new created one since they follow the same remote project and branches ?
Git stash saves the uncommitted changes locally, allowing you to make changes, switch branches, and perform other Git operations. You can then reapply the stashed changes when you need them. A stash is locally scoped and is not pushed to the remote by git push .
To push the commit from the local repo to your remote repositories, run git push -u remote-name branch-name where remote-name is the nickname the local repo uses for the remote repositories and branch-name is the name of the branch to push to the repository. You only have to use the -u option the first time you push.
You should be able to copy the .git directory from the old repo over the new one. Git stores every object in files within that directory so that should return your stash.
You can use git stash branch
to create a branch from your stash:
$ git stash branch <branchname> [<stash>]
This command performs the following:
<branchname>
After you commit and push the changes on this branch, you can then fetch or pull from it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With