We must first learn how to initialize a Git repository before learning any Git subcommands.
Let's create one a project called fun-project, and move into it by typing the following:
$ mkdir fun-project $ cd fun-project
Once we're in our directory, we can initialize Git with the
$ git init
Initialized empty Git repository in /Users/johndoe/test/fun-project/.git/
Great! You just created your first Git repository! By running the
init subcommand, you have created a hidden folder in the current directory called .git. This folder, along with any of its contents, should not be edited or removed.
If you're more interested in someone else's work and want to look at their source code, or just want to download a cool application off of Github, we can use the
Here, we're obtaining source code from Heng Li, a renowned bioinformaticist who has contributed heavily on Next Generation Sequence data analysis. We'll pull in
wgsim, an artificial reads generator. Although this project has been retired and is no longer maintained, it's good enough for demonstration purposes. Simply copy the URL on the side (click the clipboard button) and paste it after the
$ git clone https://github.com/lh3/wgsim
Cloning into 'wgsim'... remote: Counting objects: 43, done. remote: Total 43 (delta 0), reused 0 (delta 0), pack-reused 43 Unpacking objects: 100% (43/43), done. Checking connectivity... done.
This command will download all the project contents into your local hard drive. You may now go ahead and tweak the files or use the program without affecting the main repository online.
One of the most frequent and informative subcommands you'll use is
status. With this, you can check which files are in the staging area (ready to be placed in the next commit), and what is and is not being tracked.
$ git status
On branch master Initial commit nothing to commit (create/copy files and use "git add" to track)
We can see that we're on the branch master, which is the default git branch. We also see that we have nothing to commit (yet). Considering we have not created any files yet, this is true and expected. Let's now create some files and add it to our repository!
If you're looking to learn the elements of Agile development and Scrum, this is the book for you. This book has been reviewed by many, and sought after as a must-read for anyone who works in agile. The book is brief, with no anecdotes nor reiterations. Just pure content to help you graph what Scrum is in no time.$ Check price
Stretch out your back and relieve your back muscles with inversion therapy. This device counteracts the forces of gravity on the body by decompressing and elongating the spine. By using this product just ten minutes a day, you can be well on your way to improved circulation and posture while relieving muscle aches, back pain and stress.$$ Check price