DEV Community

Cover image for An Ultimate Guide to Git and Github

An Ultimate Guide to Git and Github

Suhail Kakar on August 27, 2021

As a developer, we all know a little about Git and GitHub but there are some developers who still have doubt and question about Git and GitHub. The...
Collapse
 
darkwiiplayer profile image
𒎏Wii 🏳️‍⚧️ • Edited

2. Main: When you create a new repository, it comes with a default development branch.

Last time I checked, the default branch was still called master. Calling it main instead is really just a weird thing that github does by default.

git commit -m "added index.js file"

Please don't... That's such a bad habit and sooo many newcomers are doing it because all the tutorials say so. Use git commit and write a proper commit message.

Collapse
 
suhailkakar profile image
Suhail Kakar

Yes, I agree but since I was talking about GitHub, I mentioned mainas default branch

Collapse
 
darkwiiplayer profile image
𒎏Wii 🏳️‍⚧️

Yes, but your title says "Git and Github" so it seems worthwhile to point out that there's a difference and which uses what :D

Thread Thread
 
suhailkakar profile image
Suhail Kakar

Yes, it is , but as you see the heading it is Basic GitHub terms

Thread Thread
 
darkwiiplayer profile image
𒎏Wii 🏳️‍⚧️

Without mentioning the git default, it's a bit misleading though. It makes sense if you already know git anyway, but that's not who this post seems to be for though.

Collapse
 
billraymond profile image
Bill Raymond

You may want to update your installation and documentation setup material. As @darkwiiplayer mentions, Git defaults to master. Since GitHub, GitLab, Atlasssian, and most new training material refers to main, it would be a good idea to use the same standard.

Could you add this to inform your readers?

git config --global init.defaultBranch main

Great article!

Collapse
 
darkwiiplayer profile image
𒎏Wii 🏳️‍⚧️

More than just point out how to change the config, I think it's important to explain that both standards exist and where they're used. There's still lots of master branches on github and people have occasionally used main long before any big platform made the switch. I'm sure there's at least one repo somewhere out there where the default branch is called potatoes.

Collapse
 
suhailkakar profile image
Suhail Kakar

Sure Bill, Thanks

Collapse
 
billraymond profile image
Bill Raymond

Thanks!

Collapse
 
labib profile image
Asif

Hey , do learning git commands worth in 2021 ? Whether you can use the git GUI ?

Collapse
 
billraymond profile image
Bill Raymond

I mostly use the UI as a single developer with the occasional collaborators, but the command line is very powerful, allowing you to perform more granular and feature-rich operations. It’s also useful if you spend a lot of time in a terminal window anyway.

All that said most of the basics, like cloning, branching, committing, etc are quite easy to learn with a UI. Actually, I learned the UI first, then when I wanted to do more advanced things, the GIT documentation made a lot more sense :)

Collapse
 
kayaks2fish profile image
kayaks2fish

It would be helpful if you understand how to use git commands.

Collapse
 
darkwiiplayer profile image
𒎏Wii 🏳️‍⚧️

Most of the cooler stuff git can do isn't really available from any GUI tools

Collapse
 
jdeepd profile image
JDeep

Learning the basic commands is never a harm.

Collapse
 
suhailkakar profile image
Suhail Kakar

I would be better, if you learn git commands, and as @darkwiiplayer mentioned, most of the git features aren't available is GUIs

Collapse
 
leandroninja profile image
Leandro Oliveira Moraes

Show.