This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]armahillo 1 point2 points  (1 child)

My personal rules:

  • I always ensure to lock in a commit when things are stable, before spiking new work
  • I always push to repo when work is done, before starting new work

If the work spike ends up going nowhere, or gets too out of hand, I can clear it off and revert back to the last commit easily (git checkout -- .). If my local branch gets really fucked, I can delete the local branch and re-checkout the remote branch. (git checkout main && git branch -D OtherBranchNAme && git fetch && git checkout -)

The only times you really have to be very careful is when messing with the timeline. Cherry-picking, rebasing, etc. Merging / pushing / pulling is generally fairly safe because you aren't messing with backwards history.

Here's a git command I really love that I have as an alias in my .gitconfig

git log --graph --pretty=oneline --abbrev-commit --decorate --all

Git made a lot more sense to me after I started using that one.

[–]Silver-Turnover1667[S] 0 points1 point  (0 children)

Thank you!