-
Notifications
You must be signed in to change notification settings - Fork 0
Getting Started With Git
If you are on Ubuntu, you can just run the following commands to get the git package from the Ubuntu Package Repository
$ sudo apt-get update
$ sudo apt-get install gitVisit git-scm. Download. Install.
==============
To verify if git has installed correctly
$ git --versionThis should display the git version.
Cool. Now that we have git on our systems, let's dive into some simple commands to get started!
Ok. Let's talk about commits for a second. Git works on the concept of snapshots. If the history of file changes is a video then a snapshot is a screenshot taken anywhere from that video. Committing is the act of creating this snapshot. That's it! =)
To start things off, let's create a folder to hold our files, shall we?
$ cd ~
$ mkdir project_folder
$ cd project_folderExecuting that will create a folder called project_folder in our home directory and move us into that folder.
A repository is a place that holds all those snapshots we create of our files. To initialise this folder to be a repository we run the following
$ git initOnce you run that, you'll notice that the folder now contains a .git folder. We won't go into a lot of detail on what it contains, but just think of it as housing all those snapshots in it. =)
And that's that...your folder is now a Git Repository. Woohoo!
Let's create a file in your folder now and add some stuff to it.
$ touch file1.txt
$ cat >> file1.txt
Hello WorldThis creates a file called file1.txt in your project directory and adds the line Hello World to it.
Now let's see what Git is seeing of our project folder.
$ git status
- What is Version Control?
- [What is Git?] (https://github.com/campvanilla/introduction-to-github/wiki/What-is-Git%3F)
- [Getting Started with Git] (https://github.com/campvanilla/introduction-to-github/wiki/Getting-Started-with-Git)
- Installation
- First Commit
- The Next Step
- Fixing Mistakes Using VCS
- Plugging Git To Github