The beginners guide to Git & GitHub

In the example above, all three cards represent different versions of the same file. We can select which version of the file we want to use at any point of time. So I can jump to and fro to any version of the file in the git time continuum. If you want to get started on learning about Git technology, you’ve come to the right place.

If we are part of the software developers’ world, it is expected that we know Git. So, having a good grasp of Git is very beneficial for us to get into a lucrative career. So in the above example, files like __pycache__, .DS_Store are used by the system to store information for faster access. So we can tell git to ignore them by adding a .gitignore file. Follow this link.Now, locate to the folder you want to place under git in your terminal. A repository a.k.a. repo is nothing but a collection of source code.


A commit in Git is a saved chunk of work, but it’s a little different from the same save you would use to save a text file in a text editor. Don’t let this list intimidate you, we’ll go step by step. There’s definitely a lot more to Git than is presented here, but these are things you’ll learn as you work with it over time. We’ll work through a series of examples to build a from-the-ground-up understanding of how to use Git and ultimately collaborate with your teammates.

If you’d like to learn how to use Git, check out my top 10 favorite Git tutorials for beginners. Git can be used for any type of industry from restaurants to colleges, so it is an important part of web design. This means you see the project history almost instantly. Instead, Git thinks of its data more like a series of snapshots of a miniature filesystem. With Git, every time you commit, or save the state of your project, Git basically takes a picture of what all your files look like at that moment and stores a reference to that snapshot. To be efficient, if files have not changed, Git doesn’t store the file again, just a link to the previous identical file it has already stored.

Type 2: Work on your project locally then create the repository on GitHub and push it to remote.

Once we start to understand it, we’ll be more and more comfortable and confident in using the commands, and eventually, we’ll start enjoying it. Besides, there is always a geeky pleasure in knowing the internals. Until now, we learned that branches are simply mutable references to commits, that’s why we can move a branch pointer at any time. We want to apply the fix branch into the current (main) branch, a.k.a perform a git merge fix.

This will again prompt you for a message describing the change, and then
record a new version of the project. You’ve now initialized the working directory—​you may notice a new
directory created, named .git. This tutorial explains how to import a new project into Git, make
changes to it, and share changes with other developers.

Why is Git Used?

The working tree is a single checkout of one version of the project. These files are pulled out of the compressed database in the Git directory and placed on disk for you to use or modify. In our ProjectGit master branch, we did branching and committing. But after the branching, the master branch had not encountered any more commits. It helps both programmers and non-programmers keep track of the history of their project files by storing different versions of them. When you use git pull, Git tries to automatically do your work for you.

  • Now that we have learned how to create a branch and work on it, let us take a look at the merge feature in Git by merging the branch we created to the master branch.
  • With some practice you will be able to remember these terms and what they do.
  • The next thing we’ll do is create a new repository in Github.
  • As branches represent the update-ref command, the commit hash can change at any time, that is, a branch reference is mutable.
  • This repo has all of the finished steps of this tutorial already in it, so if you want to you can always use it as a reference.

Will show the list of commits made on the stable branch but not
the master branch. This operation is safe even if Alice has uncommitted local changes. The range notation HEAD..FETCH_HEAD means «show everything that is reachable
from the FETCH_HEAD but exclude anything that is reachable from HEAD».

Deja un comentario

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *