Search code examples
gitgit-stash

Git command to do a pull and put my changes at the top without stashing?


Everytime I have to get the latest changes from the repo I have to stash my changes then do a pull and then unstash my changes again, this process gets very tedious when there's a lot of people working on the project and you have to do this many times a day.

I was wondering if there's a git command that does that.


Solution

  • What about doing a normal git fetch followed by git rebase --autostash?

    from man git-rebase:

    --[no-]autostash
           Automatically create a temporary stash before the operation begins, 
           and apply it after the operation ends. This means that you can run
           rebase on a dirty worktree. However, use with care: the final stash 
           application after a successful rebase might result in non-trivial
           conflicts.