I feel like an outcast after reading all the comments here. I've never really had issues using git. I didn't realize so many people had trouble with it.
Meanwhile, I refer to Git Flight Rules (https://github.com/k88hudson/git-flight-rules) on a weekly basis. Especially the branches section - somehow I'm checking in or pulling from the wrong branch, or branching from the wrong parent, and cleaning up is so tedious/annoying.
I'm gonna check out this "git undo" command in the article.
Mine is as simple as:
- git pull -r (to pull & automatically rebase commits from the common branch)
- git checkout -b (to create my own feature/debug branch from the common branch)
- git add -A/commit -m/push (to add, commit and push… I usually let my IDE handle that part)
- git rebase (to rebase commits from the common branch)
- git reset (to squash all the "WIP" and "fix" commits on my feature/debug branch. I then do 1 or 2 clean commits and push -f)
- finally I do a merge request, or directly git cherry-pick the commits to the original branch if nobody else works on the project
I've been doing this for years and it just works.