Skip to content

Latest commit

 

History

History
75 lines (45 loc) · 2.8 KB

Git_Basics_pt2.md

File metadata and controls

75 lines (45 loc) · 2.8 KB

Learn Git and Github

Learn Git and Github

On this lesson you’ll learn how to:

  • Start a new branch.
  • Make changes to a file.
  • Some Git commands that would help you start your first repository. (git log, git diff)

0x1.1 : Add a New branch

As you have seen on the lesson 0x0 on how to create a repository,and learned some cool new git commands on lesson 0x1 Chapter 2, you can now start using them.

If you do remember what we did on the last lesson, now you know how to create a folder, initialize it and create your first file.

After doing that, create a file add it to the staging area and commit it.

Now Follow these steps :

  • 1 - Do some changings to that file, open the file with any editor you want, and add the following text :

    Coding with DzCode, let's start the Algerian Open Source Community Together.
    

  • 2 - add your file to the staging area and commit it again :

  • 3 - now type git log

    • This command will inform you with all the commit istory, more simpley it will show you the previous commits that you have done each with its own comment that you used.

    We have used this command on the previous chapter but I didn't really expplain it.

    And as expected, here you can see 2 different commits, with their commit ID, Name of the contributor and the date.

  • 4 - Now modify the file again, by adding what ever text you want. After doing that type git diff

    • This command will show you all the modifications and changes you did or your team did on that file, by showing what was added, removed or modified.

      In other words! it will show the differences between your working directory and the staging area.

      OH! Did just Git gave you the exact text you added ? That's right!

And that is it 😀 for the git basics part 2



0x1 Assignements :



  • Create a file called Dzcode.txt.
  • Add it to the staging area.
  • Write "Hello DzCode!" in Dzcode.txt and save your changes.
  • Show the differences between your Working Directory and Staging Area
  • Add Dzcode.txt to your Staging Area
  • Show the differences between your Staging Area and your Repository
  • Commit Dzcode.txt to your repoository

Once you have completed these steps, take a screenshot of your command line, with the steps above, and upload your screenshot to a new Issue titled 0x1 Assignements - Part 2

© 2020 - DzCode - Sofiane Hamlaooui - Making the world a better place 🌎