DEV Community

niuniu
niuniu

Posted on

Quick Tip: Git Commands You Should Know

💡 Quick Tip

Here are 5 Git commands every developer should know:

1. Undo Last Commit

git reset --soft HEAD~1
Enter fullscreen mode Exit fullscreen mode

2. Create and Switch to Branch

git checkout -b feature/new-feature
Enter fullscreen mode Exit fullscreen mode

3. Stash Changes

git stash
git stash pop
Enter fullscreen mode Exit fullscreen mode

4. View Commit History

git log --oneline --graph
Enter fullscreen mode Exit fullscreen mode

5. Amend Last Commit

git commit --amend
Enter fullscreen mode Exit fullscreen mode

🤖 AI Tip

I used MonkeyCode to learn these Git commands. It's a free AI coding assistant that explains code and commands.

Try it: https://monkeycode-ai.net/

git #devops #tips

Top comments (0)