Free cookie consent management tool by TermsFeed Generator the ultimate guide to Git: learn everything you need in less than 1 hour | Amir Kamizi
AMIR KAMIZI
Home Blog Courses Books Newsletter Store Membership Buy me a coffee
the ultimate guide to Git: learn everything you need in less than 1 hour

the ultimate guide to Git: learn everything you need in less than 1 hour

Last Updated on Nov 28, 2022

Here is everything you need to know about git in a series of short question and answers.

Q: What is git?

Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency.

Q: Where can I download it?

you can download it from https://git-scm.com/

you can install it on mac, windows, linux. there is no limittion

Q: How can I initialize git in my project?

in your project folder run this command:

git init

Q: How can I see which files have been Added, Deleted or Updated?

you can see the status of all the files by running this command:

git status

Everything is untracked or changed

Untracked: it’s not added to git for version control (new files)

Changed: it’s been updated

Q: How can I add untracked or changed files?

you can run the command

git add <file-name>

or if you want to add everything, run this command:

git add .

after this you need to commit in order to have your changes stored in the local repository

Q: what is a repository?

A repository (repo) is nothing but a collection of files and source codes.

Q: what if I realized I don’t want the changes and I don’t want to commit them?

I recommend you to watch this video for detailed explanation

https://youtu.be/gv6qSY0Hv1s

 

Q: how can I commit the changes and store them in the local repository?

you can run the command

git commit -m "message you want to write for these changes"

Q: How can I see the history (logs) of my commits?

you can see them by running

git log

Q: how can I go back to a previous commit?

after you run

git log

it gives you an address (hash) for each commit by running the following command on your local repository you can go back to that specific head

git reset --(soft or hard) HEAD

more details:

https://devconnected.com/how-to-git-reset-to-head/

Q: what are branches and how can I work with them?

branches are like parallel timelines. it’s like going to another timeline to change something and if it was good you’d merge that to the current timeline.

to learn about git branch workflow you can watch this:

https://youtu.be/osNp79ew8f8

 

Q: what if I made a mistake and I want to remove the merged branch (timeline) from the master branch (current timeline)?

don’t worry. you can go back to the history when your timelines were not merged yet. if you want to learn more watch this:

https://youtu.be/qa2aTaMul8E

 

Q: some of the names and tasks are too hard to remember Or too long and I want to use another name or make the shorter. can I do that?

of course. you can make Aliases (shortcuts) for them.

if you want to learn how to do that you can watch this:

https://youtu.be/bUCIVgfs30o

 

Q: what are GitHub and GitLab?

everything you did so far was on your local computer. GitHub and GitLab are like the online git. when your repository is online it’s easier to work as a team and contribute to different projects.

Q: how can I interact with my online repository (project)?

it’s actually very easy. you can learn it by watching this:

https://youtu.be/K6THyJKayFo

 

Q: how can I contribute to other people’s repositories (projects)?

Now that you are ready to contribute, you can learn it by watching this video:

 

https://youtu.be/NdAaCcLrSmM

 

Resources:

Conclusion

Now you are able to find your way around git. You can add it to your list of skills.

I recommend you practice by creating a new repository Or find a project you like on GitHub and start contributing to open source projects.

If you have any suggestions, questions, or opinion, please leave a comment below. I’m looking forward to hearing from you!

Key Takeaways

  • initialize a git repository
  • add your files and get the status of all the files in your repository
  • commit your changes
  • see the log of your commits
  • interact with an online git repository
  • contribute to open source projects

Category: programming

Tags: #git

Join the Newsletter

Subscribe to get my latest content by email.

I won't send you spam. Unsubscribe at any time.

Related Posts

git branch workflow: 7 easy steps (video)
Nov 27, 2022 programming

git branch workflow: 7 easy steps (video)

Transcription Hello This is amir Today we are going to talk about git branching workflow I will go through it step by step and help you understand the process ...

9 Min Read Read More
How to use Git Alias to increase your productivity (video)
Nov 27, 2022 programming

How to use Git Alias to increase your productivity (video)

Today we are going to talk about Git Alias and how to increase your productivity by adding shorter aliases for commands that we use everyday. ...

8 Min Read Read More
how to use git restore and completely ignore the changes: 3 scenarios (video)
Nov 27, 2022 programming

how to use git restore and completely ignore the changes: 3 scenarios (video)

we are going to talk about ways to ignore the edits we made in a git project and restore the changes by git restore ...

9 Min Read Read More
undo git merge the easy way and then undo the undoing! (video)
Nov 27, 2022 programming

undo git merge the easy way and then undo the undoing! (video)

we are going to talk about how to undo git merge and then we talk about how to undo the undoing ...

9 Min Read Read More
5 essential commands to interact with an online git repository: push, pull, clone, fetch, remote (video)
Nov 27, 2022 programming

5 essential commands to interact with an online git repository: push, pull, clone, fetch, remote (video)

5 commands to interact with and online git repository ...

13 Min Read Read More

Recommended Courses

Introduction to Machine Learning in PHP

Introduction to Machine Learning in PHP

Learn to Build Different Machine Learning Models Easily ...

PHP Tutorial Beginner to Advanced

PHP Tutorial Beginner to Advanced

Learn everything you need to start a successful career as a PHP developer ...