
Git Commands That Will Make You Look Like a Senior Developer
Most developers know add, commit, push. Here are the Git commands and workflows that separate juniors from seniors. Interactive Rebase: Clean Up Your History # Squash last 3 commits into one git rebase -i HEAD~3 Your editor opens: pick abc1234 Add user model pick def5678 Fix typo in user model pick ghi9012 Add validation to user model Change to: pick abc1234 Add user model squash def5678 Fix typo in user model squash ghi9012 Add validation to user model Result: one clean commit instead of three messy ones. Stash: Save Work Without Committing # Save current changes git stash # Save with a description git stash push -m "WIP: user authentication" # List stashes git stash list # Apply most recent stash git stash pop # Apply specific stash git stash apply stash@ { 2 } # Stash only specific files git stash push -m "partial work" src/auth.py src/models.py Bisect: Find the Bug-Introducing Commit git bisect start git bisect bad # current commit is broken git bisect good v1.0.0 # this tag was wo
Continue reading on Dev.to Tutorial
Opens in a new tab


