DEV Community

loading...

Discussion on: A Git Cheatsheet Of Commands Every Developer Should Use

Collapse
myrtletree33 profile image
jhtong

Another command I would add is Git Rebase:

git rebase origin/master
Enter fullscreen mode Exit fullscreen mode

Which would apply all the changes in master, below your branch, to make your commits grouped together and more organized.

Also, I use this quite a lot:

git rebase -i HEAD~2
Enter fullscreen mode Exit fullscreen mode

Which runs your rebase in interactive mode for the most recent 2 commits (which is really helpful for squashing and renaming your commits), making it more readable.

Collapse
ravimengar profile image
Ravi Mengar Author • Edited

Hey, jhtong

Thanks for letting me know about these commands. Will surely make use of it. Appreciate your help manπŸ‘

Collapse
liliang8858 profile image
Collapse
eecolor profile image
EECOLOR

In practice I have noticed more problems arise when using rebase. These problems come up when you work as a team in a branch or have merged other branches (and solved conflicts).

We now have the policy that you are only allowed to rebase if the code has not been pushed to the remote. We also prevent push --force which is required for most rebases.