DEV Community

Discussion on: How do you commit in GitHub ?

Collapse
 
codeandclay profile image
Oliver • Edited

My personal preference is to git add ... -p. Eyeballing each line as I commit it gives me one last sanity check.

I also like to git commit -v so I can refer to the code whilst writing the commit message.

One thing I do a lot is that I like to create a new branch for even the smallest of changes. If I find I need to further prepare for that change, I can create a new branch from master, make the change then head back to the original new branch and rebase.

I also git reset --hard a lot. And, git commit --fixup ... helps me keep my commits tidy but I know if I'm using it a lot, I'm on my way to a mess.

Collapse
 
nazimboudeffa profile image
Nazim Boudeffa • Edited

You look like an advanced user @updated_tos , do you have a tutorial reference please ?

Collapse
 
codeandclay profile image
Oliver • Edited

These are things I've picked up as I've gone along. I got burnt by git too often when I started out.

Thread Thread
 
nazimboudeffa profile image
Nazim Boudeffa • Edited

tbh I first follow the official documentation in any technology I use and in this case my steps are taken from the official hello world and I didn't change it from the beggining just learned to git add . and always work on the master branch which is not the best as i see in our discussion here

And I just noticed that it is said :

  • Create a repo on the site first O.o

After that it's all about how to commit so it's why I titled this post "How do you commit in GitHub" to start a discussion and to go ahead easy