You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: version-control/command-line/tutorial.md
+24-24Lines changed: 24 additions & 24 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,21 +1,20 @@
1
1
---
2
2
layout: page
3
-
title: Introduction to the git command line
3
+
title: Introduction to the Git command line
4
4
---
5
5
6
6
## Introduction to the Git command line
7
7
8
8
**PREREQUISITE:** Basic understanding of the command line.
9
9
10
-
Git is an easy to share and collaborate tool that keeps our code tracked and safe.
11
-
With the following examples we understand how to deal with the daily usage of the tool.
10
+
Git is a tool that makes sharing code and collaborating with other developers really easy. It also keeps our code tracked and safe. The following examples will help you understand how to use this tool on a daily basis.
12
11
13
12
## Before you begin
14
-
Install command line git for your operating system ([OS X](http://code.google.com/p/git-osx-installer), [Windows](http://msysgit.github.com/) or [Linux](http://git-scm.com/download/linux)) and open your terminal / command prompt.
13
+
Install command line Git for your operating system ([OS X](http://sourceforge.net/projects/git-osx-installer/), [Windows](http://msysgit.github.com/) or [Linux](http://git-scm.com/download/linux)) and open your terminal / command prompt.
15
14
16
15
Create a directory where you will be storing all your projects. You can call it `code` or `projects`.
You need an ssh key so you don't have to authenticate every time you want to commit to git.
26
+
An SSH key is used to identify trusted computers, without entering a password.
27
+
[Instructions on how to generate an SSH key](https://git-scm.com/book/en/v2/Git-on-the-Server-Generating-Your-SSH-Public-Key)
28
28
29
29
30
30
## Example 1: Everyday commands
31
31
32
32
33
-
### Create and add your project in git
33
+
### Create and add your project in Git
34
34
35
35
```bash
36
36
$ mkdir practising-git
@@ -44,15 +44,15 @@ $ git init
44
44
$ echo"<h1>Learning git</h1>"> index.html
45
45
```
46
46
47
-
> The above command will output `<h1>Learning git</h1>` and store it in `index.html`. Open up the file and have a look.
47
+
> The above command will output `<h1>Learning Git</h1>` and store it in `index.html`. Open up the file and have a look.
48
48
49
-
### Check the git repository status.
49
+
### Check the Git repository status.
50
50
51
51
```bash
52
52
$ git status
53
53
```
54
54
55
-
> The above command will tell you what files in the current directory have been changed, what files have not yet been added to the git repository and so on.
55
+
> The above command will tell you which files in the current directory have been changed, which files have not yet been added to the Git repository and so on.
56
56
57
57
### Add your file on the repository and commit your changes.
58
58
@@ -64,7 +64,7 @@ $ git commit -m 'this is my first command-line commit!'
64
64
65
65
> `.` will add all the files in the current directory and subdirectories. You should only use it when initialising your repository. Rest of the time you can specify the file names to be added.
66
66
67
-
### Check the git commit history.
67
+
### Check the Git commit history.
68
68
69
69
```bash
70
70
$ git log
@@ -127,9 +127,9 @@ Update the `index.html` file and then commit and push the changes
127
127
<body>
128
128
<h1> Learning Git </h1>
129
129
<dl>
130
-
<dt>Initialise a git repository</dt>
130
+
<dt>Initialise a Git repository</dt>
131
131
<dd>git init</dd>
132
-
<dt>Add files to git</dt>
132
+
<dt>Add files to Git</dt>
133
133
<dd>git add filename</dd>
134
134
</dl>
135
135
</body>
@@ -152,7 +152,7 @@ $ git commit -m 'updated to include the commands I learned today'
152
152
$ git push origin master
153
153
```
154
154
155
-
### Check the repository git history
155
+
### Check the repository Git history
156
156
157
157
```bash
158
158
$ git log
@@ -175,9 +175,9 @@ Update `index.html`
175
175
<body>
176
176
<h1> Learning Git </h1>
177
177
<dl>
178
-
<dt>Initialise a git repository</dt>
178
+
<dt>Initialise a Git repository</dt>
179
179
<dd>git init</dd>
180
-
<dt>Add files to git</dt>
180
+
<dt>Add files to Git</dt>
181
181
<dd>git add <filename></dd>
182
182
<dt>Checking file changes</dt>
183
183
<dd>git status</dd>
@@ -196,7 +196,7 @@ $ git diff
196
196
The -/+ indications you can see mean
197
197
198
198
**-** indicates lines removed from the code.
199
-
199
+
200
200
**+** indicates lines added to the code.
201
201
202
202
```bash
@@ -244,7 +244,7 @@ Changes not staged for commit:
244
244
(use "git add <file>..." to update what will be committed)
245
245
(use "git checkout -- <file>..." to discard changes in working directory)
246
246
247
-
modified: index.html
247
+
modified: index.html
248
248
249
249
no changes added to commit (use "git add" and/or "git commit -a")
250
250
```
@@ -382,10 +382,10 @@ git push origin master
382
382
383
383
# Extras
384
384
385
-
Following are some good resources to to help you set up git.
385
+
Following are some good resources to to help you set up Git.
386
386
https://help.github.com/articles/set-up-git
387
387
388
-
## Configuring your git environment
388
+
## Configuring your Git environment
389
389
390
390
Create the file `.gitconfig` in your root directory and add the following configuration
391
391
@@ -405,7 +405,7 @@ Create the file `.gitconfig` in your root directory and add the following config
405
405
406
406
> Can you think of another command that you would find handy to shorten down?
407
407
408
-
### Telling git to try and fix whispace issues before committing
408
+
### Telling Git to try and fix whitespace issues before committing
409
409
410
410
```
411
411
[apply]
@@ -419,7 +419,7 @@ Create the file `.gitconfig` in your root directory and add the following config
419
419
excludesfile = ~/.gitignore
420
420
```
421
421
422
-
To apply this you need to create a .gitignore file in your root path. There you can add either specific files or extentions that you always want excluded. This is a handy list to help you start
422
+
To apply this you need to create a .gitignore file in your root path. There you can add either specific files or extensions that you always want excluded. This is a handy list to help you start
423
423
424
424
```
425
425
*.DS_Store
@@ -433,9 +433,9 @@ To apply this you need to create a .gitignore file in your root path. There you
433
433
> Do you know what these files are? You normally wouldn't want to commit logs or packages.
434
434
435
435
436
-
### Pimping your log historyr
436
+
### Pimping your log history
437
437
438
-
In your aliases add this as an alias for viewing git logs
438
+
In your aliases add this as an alias for viewing Git logs
0 commit comments