4 Git Habits & curated list of life-saving articles

Hi folks.
In this post I want to share some tips and suggestions on common best practices for the method of work, that are not always explicitly stated/taught.
When we transition to a new environment, there’s a certain learning curve involved before we…


This content originally appeared on DEV Community and was authored by Prakhar Yadav

Hi folks.
In this post I want to share some tips and suggestions on common best practices for the method of work, that are not always explicitly stated/taught.
When we transition to a new environment, there's a certain learning curve involved before we get on with our work smoothly.
I struggled with my modus operandi and after tripping on many pitfalls, I think these tips might be of help:

  1. Don't branch when you start working. Branch when need to push.
    I've had situations where I faced merge conflicts due to early branching. You don't know how long its gonna take for you to fix that defect or complete that story. By the time you are ready to push the changes to remote repository, there might be significant changes in many files. And may be even on the one that you're working on. This is typically the case when many teams are working on a repository. Hence, always create a branch to push your code when you are actually ready to push.

  2. Pull every morning. Keep the code base up to date
    Branching off of the previous comment, keeping the code base up to date is ofcourse very essential, but the frequency is what matters. I had this question when I started in my new role "how often should I pull?"
    The answer is every morning. Don't worry you won't lose your work. And if you're unable to, because of un-committed changes, then stash your things are apply them after you've pulled.
    This way, you can lift-off from where you ended yesterday.

  3. Always sign/author your commits, if you don't.
    Although some organizations have some guidelines regarding this, but that might not always be the case. Even though the organization has a way to keep track of who's changed what, it's always advisable to author your commits.
    I prefer ending the commit message with:
    Reviewed by: Reviewer Name <email@addre.ss>
    Signed-off-by: Your Name <your@email.id>

  4. Squash all your commits into one once you're done.
    This is something you must be aware of already. Squash all your commits before merging. This way all the code changes for a fix/feature are consolidated into one, and the whole thing is much clearly maintained and tracked.

These are the few things I learned the hard way. I hope you adopt these habits soon if you don't already.
Before signing-off, below are some guides and articles in Bonus section, that I find very useful & you might too.
  And even though cats may rule this world one day, you are reading Code with P. ??

BONUS - Resources


This content originally appeared on DEV Community and was authored by Prakhar Yadav


Print Share Comment Cite Upload Translate Updates
APA

Prakhar Yadav | Sciencx (2021-06-05T13:14:52+00:00) 4 Git Habits & curated list of life-saving articles. Retrieved from https://www.scien.cx/2021/06/05/4-git-habits-curated-list-of-life-saving-articles/

MLA
" » 4 Git Habits & curated list of life-saving articles." Prakhar Yadav | Sciencx - Saturday June 5, 2021, https://www.scien.cx/2021/06/05/4-git-habits-curated-list-of-life-saving-articles/
HARVARD
Prakhar Yadav | Sciencx Saturday June 5, 2021 » 4 Git Habits & curated list of life-saving articles., viewed ,<https://www.scien.cx/2021/06/05/4-git-habits-curated-list-of-life-saving-articles/>
VANCOUVER
Prakhar Yadav | Sciencx - » 4 Git Habits & curated list of life-saving articles. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2021/06/05/4-git-habits-curated-list-of-life-saving-articles/
CHICAGO
" » 4 Git Habits & curated list of life-saving articles." Prakhar Yadav | Sciencx - Accessed . https://www.scien.cx/2021/06/05/4-git-habits-curated-list-of-life-saving-articles/
IEEE
" » 4 Git Habits & curated list of life-saving articles." Prakhar Yadav | Sciencx [Online]. Available: https://www.scien.cx/2021/06/05/4-git-habits-curated-list-of-life-saving-articles/. [Accessed: ]
rf:citation
» 4 Git Habits & curated list of life-saving articles | Prakhar Yadav | Sciencx | https://www.scien.cx/2021/06/05/4-git-habits-curated-list-of-life-saving-articles/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.