Back to articles
Git beyond push: the commands nobody taught you
How-ToTools

Git beyond push: the commands nobody taught you

via Dev.toLucas Braun

Everyone learns Git the same way: git init , git add . , git commit -m "first commit" , git push . And then just... stops there. The problem is that Git has a huge set of commands that make a real difference day-to-day — and almost no beginner tutorial ever mentions them. You only find out about them when something breaks, at 11pm, with an open pull request. This article is here to change that. 1. git stash — Git's secret pocket You're in the middle of a feature, the code is half-done, and you get a message: "there's an urgent bug to fix on main" . What do you do? If you try git checkout like that, Git will complain. If you make a commit, you'll pollute your history with a "WIP: saving to switch branches". The solution is stash : git stash This saves all your uncommitted changes to a temporary place and leaves your working directory clean. Fix the bug, come back, and restore: git stash pop Want to see what you have saved? git stash list You can have multiple stashes and give them names

Continue reading on Dev.to

Opens in a new tab

Read Full Article
3 views

Related Articles