5 Common Git Blunders Every Beginner Should Avoid🚫!

5 Common Git Blunders Every Beginner Should Avoid🚫!

Β·

3 min read

HiπŸ‘‹, Ever wondered what it would be like to travel back in time and prevent yourself from making those common mistakes that made you feel silly and forced you to put in more effort than necessary?

Doctorstrange Drstrange GIF - Doctorstrange Drstrange Entrance - Discover &  Share GIFs

Learning online can be exhausting. I'm not saying you can't find solutions online, but it's essential to be aware of the mistakes you're making before seeking solutions.

In this article, I assume you know the basic Git commands. If not, you can find them in the Git documentation. Stick around here to learn about the basic mistakes you should avoid while collaborating with teams.

Here's the link of Git documentation.

  1. Git Branch: Yes, it's arguably the most powerful Git command. Before making any changes to a branch, please ensure you're on the correct oneβ€”typically not the main branch or a branch where all other pull requests are being merged. 🌟

    • Create a new branch for your changes and submit a pull request (PR) to that branch exclusively. πŸš€

πŸ“Note: Sometimes, there might be a naming convention for branch names outlined in the README.md file.

πŸ’‘Tip: Choose a branch name of your preference, make the changes, and then create a new branch (possibly the one specified for merging). After making the changes you wish to push, add, commit, and push them.

  1. Do not close the terminal while any Git command is running. 🚫

    It'll continue running in the background, and if you close the terminal, you might not be able to stop it easily. ⏳

    • Wait for it to finish (if possible). βŒ› Otherwise, if you need to stop the process:

Go to Task Manager (Ctrl + Shift + Esc). πŸ“Š -> Locate the Git process that's running. πŸ”„ -> Select the process. βœ”οΈ -> End the task. πŸ›‘

  1. One branch, one PR until it's merged. 🌿

    Before pushing the code to the remote repository, ensure you have made all the necessary changes and created a PR for it. Making another PR before the previous one gets merged can cause merge conflicts. πŸš«πŸ”„

  2. Git Pull: If you're working on any issue, feature, or task on a branch and it's taking time, ensure to pull all the changes made to the project's main branch (note: "main branch" here refers to the branch where all PRs are being merged) before creating any PR. Failure to do so can lead to merge conflicts. ⚠️

  3. Git Stash: If you've made unnecessary changes in the local repository that you want to revert to the state of the previous commit, use this command. πŸ’Ό

As of now, I've made these mistakes, and let me tell you, it's pretty annoying when you make these silly errors. But that's how the learning journey unfolds. I'm happy that you are improving. Let me know what other mistakes you encounter while using Git.

Happy coding! πŸš€

Β