10 Git Things I Regret Not Knowing Earlier
Git is a powerful tool for version control, but when you're starting out, it can feel overwhe...
For further actions, you may consider blocking this person and/or reporting abuse
I always used
git commit --amend
for fixing commit messages in point 1Love
--amend
but always run into trouble amending a commit I've already pushed 😭if it's already in the origin repo and you amend something, do a force push afterwards
I would only recommend doing it in your feature branch, not main or develop where multiple people are working.
This is the recommended way! Glad you're using it
One nice little feature that isnt talked about is organizing your branches into "folders". So instead of prefixing your branch name with
feature
or what have you, you can create a directory for all potential feature branches.git branch feature/my-branch-name
git branch feature/teammates-branch
added and updated! thank you!
Worth mentioning
git bisect
tool, it's good for finding which commit broke something.git reflog
is useful too, can undo evengit reset
.Also, semantic versioning, e.g. when topic applied to commits, like
feat
for features,fix
, have semantic release package, good to generate changelog automatically.added! thank you!
This is great. For branches though I'm a
git switch
,git switch -c
fan.Thank you!
Great article!
BTW, it seems the flag
--soft
is not needed ingit reset --soft HEAD~1
.Just
git reset HEAD~1
will do the trick, right?Thank you!
Great article. I did not know about
git revert
! It's a personal preference but I try to avoidgit stash
and use work trees instead.Thank you!
Well done. Concise but clear and useful
Thank you so much!
Nice job!
Thank you!
Great Article and nice comments. Thank You!
Thank you!
Hi chintanonweb,
Top 5, very nice and helpful !
Thanks for sharing.
Thank you so much!
Ohhh
I prefer to
git merge --continue
for completing a merge instead of writing another commit message in point 3 after adding your files.wooooww man, tks for your contribution. i didn't know about this parameter. I always continue with the commit message instead use this command. Will test later
Thanks.
Very informative
Thank you!
I find
git worktree
useful. We often work on two major branches, and usingworktree
lets me switch between them without needing to stash work in the other.Semantic commit/releases are so incredibly cool. Once you start releasing this way you will never want to do it any other way. Remember, as a rule you will need to avoid squashing commits when you get to this level or you will break semantic releases (it concatenates all the commit messages into one string).
also
git merge-base BranchA BranchB
useful when you need to find diverging point for branchesdev.to/hanzla-baig/the-ultimate-an...
Thank you
No rebase?? That would be my #1