Rajvaibhavi Yadav’s Post

View profile for Rajvaibhavi Yadav, graphic

DevOps Engineer | Cloud | Infrastructure | Containerization- Orchestration| CI/CD | Scripting | Configuration | Automation

💡 Simple Git Tips 💡 1. Use Auto-Correct for Git Commands: Git can automatically fix simple typos in commands. - git config --global help.autocorrect 1   Why It’s Useful: This is a lifesaver when you’re typing fast and accidentally mistype commands like 'git statsu' instead of 'git status', it will automatically assume the right command and wont throw error.   2. Quickly Undo the Last Commit (But Keep Changes) - git reset --soft HEAD~1   Why It’s Useful: If you accidentally commit something and realize you need to make more changes, this command lets you "uncommit" it without losing your work.   3. Revert a File to a Specific Commit - git checkout <commit-hash> -- <file-path>   Why It’s Useful: Handy when you only need to revert changes to one file instead of the entire project.   4. View Unpushed Commits - git log--branches --not --remotes   Why It’s Useful: It’s a good practice to check what hasn’t been pushed yet, especially before making a pull request or merging.   5. Clone Only the Latest Commit - git clone--depth=1 <repo-url>   Why It’s Useful: Saves time and space when you only need the most recent state of the repository.   6. Use Aliases for Common Commands  - git config --global alias.br branch --> (use git br instead of git branch) - git config --global alias.cm commit - git config --global alias.st status   Why It’s Useful: Saves time and keystrokes, making your workflow more efficient. #DevOps #Git #Github #opensource

To view or add a comment, sign in

Explore topics