DEV Community

Discussion on: How to write your own git commands like "git refresh"?

Collapse
 
nbelakovski profile image
nbelakovski

Thanks for this, I knew it was possible to make one's own git verbs, but needed to know how. So glad I was able to find this!

A suggestion if I may, your example set of commands could be much simplified with existing git functionality. You can achieve the same result with

git fetch origin master
git rebase --autostash origin/master

Autostash does exactly what you think it does, it automatically stashes any local changes, does the rebase, and then pops the changes. By fetching and rebasing off of the remote branch, you skip the need to update your local branch. Of course, this all besides the point of the article, thanks again!