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
+12-11Lines changed: 12 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -40,7 +40,7 @@ To check the state of our working directory and the Staging area (where we hold
40
40
$ git status
41
41
```
42
42
43
-
> The above command will tell you which files in the current directory have been changed and stqged, which haven't and which files aren't being tracked by Git.
43
+
> The above command will tell you which files in the current directory have been changed and staged, which haven't and which files aren't being tracked by Git.
44
44
45
45
### Add your file to the local repository and commit your changes
46
46
When we create new files or change existing ones, we 'add' them to an index of items to be committed to the local repository. The 'commit' command saves our changes into the local repository.
@@ -51,10 +51,10 @@ $ git status
51
51
$ git commit -m 'this is my first command-line commit!'
52
52
```
53
53
54
-
> `.` will add **all** the files in the current directory and subdirectories. You should only use it when initialising your repository. The rest of the time you should specify the individual file names to be added.
54
+
> `.` will add **all** the files in the current directory and subdirectories. You should only use it when initialising your repository. The rest of the time it's recommended that you specify the individual file names to be added.
55
55
56
56
### Check the Git commit history
57
-
It's easy to check a list of commits in a repository by using the `log` command.
57
+
To check a list of commits in a repository use the `log` command.
58
58
59
59
```bash
60
60
$ git log
@@ -66,18 +66,19 @@ $ git log
66
66
67
67
Before we can add files to a remote repository, we need to have created an account with a service that is hosting that repository. If you've not done that yet, head over to our tutorial: Get set-up with [Git and GitHub](../set-up/tutorial.html).
68
68
69
-
If you've already done that, then great - simply run the commands below, adding in the correct remote repository URL, such as `https://github.com/codebar/tutorials.git`.
69
+
If you've already done that, then great - just run the commands below, adding in the correct remote repository URL, such as `https://github.com/codebar/tutorials.git`.
70
70
71
71
```bash
72
72
$ git remote add origin <repository-url>
73
73
$ git push -u origin master
74
74
```
75
75
76
-
> This is worth repeating: We first add the location of a remote repository, in our case the remote repo is on Github and we've callled it 'origin' as it's the original repository we cloned down to our system. Then we 'push' our changes to the origin's 'master' branch. When there, we can raise a new 'pull Request' (PR) to get the changes 'merged' into the live code. Check out 'Get set-up with [Git and GitHub]'(../set-up/tutorial.html) tutorial for full details around this.
76
+
> This is worth repeating: We first add the location of a remote repository, in our case the remote repo is on Github and we've callled it 'origin' as it's the original repository we cloned down to our system. Then we 'push' our changes to the origin's 'master' branch. When there, we can raise a new 'Pull Request' (PR) to get the changes 'merged' into the live code. Check out 'Get set-up with [Git and GitHub]'(../set-up/tutorial.html) tutorial for full details around this.
77
77
78
78
#### What is `remote`?
79
79
80
-
`remote` is simply the URL of your repository in any online repository hosting service, such as GitHub. The command `git remote` lists all the remote repositories you have configured. You could have the same repository stored in many places like GitHub and GitLab or Heroku and in such cases you will add a remote repository reference to you local machine, as we did above, for each of the remote repositories you have.
80
+
`remote` is the URL of your repository in any online repository hosting service, such as GitHub. The command `git remote` lists all the remote repositories you have configured. You could have the same repository stored in many places like GitHub and GitLab or Heroku and in such cases you will add a remote repository reference to you local machine, as we did above, for each of the remote repositories you have.
81
+
`remote` is the URL of your repository in any online repository hosting service, such as GitHub. The command `git remote` lists all the remote repositories you have configured. You could have the same repository stored in many places like GitHub and GitLab or Heroku and in such cases you will add a remote repository reference to you local machine, as we did above, for each of the remote repositories you have.
81
82
82
83
The structure of the command to add a new `remote` is `git remote <add|remove> <name of remote> <url of remote>`.
83
84
@@ -378,9 +379,9 @@ $ git push origin master
378
379
379
380
380
381
### Creating a Git Config file
382
+
Git allows us to define configuration settings that affect either just the repository we're working with, such as the URL of the remote repository location, or global settings such as Aliases for common commands (see below). There's a great example over at [https://gist.github.com/pksunkara/988716](https://gist.github.com/pksunkara/988716)
381
383
382
-
Create a file called `.gitconfig` in the root directory (parent folder) of your local Git repo by typing
383
-
`git touch .gitconfig` in the terminal window. Now practise adding the following configuration items.
384
+
Create a file called `.gitconfig` in the root directory (parent folder) of your local Git repo by typing `git touch .gitconfig` in the terminal window. Though it may look odd, this file doesn't have an extension such as `.txt` like typical files. Now let's practise modifying this file by adding the following configuration items.
384
385
385
386
### User name and email
386
387
If you didn't add your name and email address in the Set-up tutorial, add them now. These are added to each Git commit so it's clear who made the commit to the repo.
If you want to just edit the `.gitconfig` file directly then add the following:
394
+
If you want to just edit the `.gitconfig` file directly then look for it in your root folder, open in your favourite text editing software add the following:
394
395
395
396
```
396
397
[user]
@@ -487,7 +488,7 @@ Try it out by running `git lg` in a terminal window. If the log is very long, yo
487
488
## Bonus
488
489
### Store commands in your history
489
490
490
-
On the commandline you can use the up and down arrows to cycle back over the Git commands you've typed before. This can save time when retrying certain commands or allow you to fix them without retyping the whole command. We can add Add HISTSIZE and HISTFILESIZE to your `.bashrc` file to make sure plenty of commands are stored beyond the default 500.
491
+
On the command line you can use the up and down arrows to cycle back over the Git commands you've typed before. This can save time when retrying certain commands or allow you to fix them without retyping the whole command. We can Add HISTSIZE and HISTFILESIZE to your `.bashrc` file to make sure plenty of commands are stored beyond the default 500.
491
492
- **HISTSIZE** is the number of commands stored in memory when you are using the terminal.
492
493
- **HISTFILESIZE** is the number of commands stored in memory for future sessions.
493
494
@@ -502,7 +503,7 @@ After typing a couple of commands in the terminal to generate some history, try
502
503
503
504
## The next step
504
505
505
-
Get learning JavaScript, HTML, CSS, Ruby and more on [Codebar](http://tutorials.codebar.io/).
506
+
Get learning JavaScript, HTML, CSS, Ruby and more on [codebar](http://tutorials.codebar.io/).
506
507
507
508
-----
508
509
This ends **Introduction to the Git command line** tutorial. Is there something you don't understand? Try and go through the provided resources with your coach. If you have any feedback, or can think of ways to improve this tutorial [send us an email](mailto:[email protected]) and let us know.
Copy file name to clipboardExpand all lines: version-control/introduction/tutorial.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -70,7 +70,7 @@ There are a number of reasons we chose Git and Github, namely;
70
70
- Github makes online collaboration easy. Open source code is a big part of today's life. By being able to retrieve and help existing projects, you can also contribute to them
71
71
72
72
### Projects on Github
73
-
Once you've worked through the Git and Github tutorials here at Codebar, there are an incredible range of projects that you'll be able to access for free. These projects include operating systems, games, programming languages, books and more.
73
+
Once you've worked through the Git and Github tutorials here at codebar, there are an incredible range of projects that you'll be able to access for free. These projects include operating systems, games, programming languages, books and more.
74
74
75
75
- Go retro with a **Windows 95** simulation: [https://github.com/felixrieseberg/windows95](https://github.com/felixrieseberg/windows95)
76
76
@@ -89,7 +89,7 @@ To find more projects, just enter a search in Github and see what comes back!
89
89
90
90
## Key Terms and Definitions for Git
91
91
92
-
As with any technology and related tool, there's a lot of terminology realted to Git and Github. Here's some of the most common terms and their definitions:
92
+
As with any technology and related tool, there's a lot of terminology related to Git and Github. Here's some of the most common terms and their definitions:
93
93
94
94
-**Repository**: A repository is where code is stored, it can be a local or remote repository. Also called a 'repo'
95
95
@@ -113,7 +113,7 @@ As with any technology and related tool, there's a lot of terminology realted to
113
113
114
114
### Aim for small and focused changes
115
115
116
-
When using version control, you should commit every time you do a small piece of work, rather than working for hours in a row, changing too many things and then committing them is a great way to introduce issues that are hard to track down. What's more, it makes it harder to review changes you made and need merging into the current code base.
116
+
When using version control, you should commit every time you do a small piece of work, rather than working for hours in a row. Changing too many things and then committing them is a common way to introduce issues that are hard to track down. What's more, it makes it harder to review changes you made and need merging into the current code base.
117
117
118
118
For example, if you want to change the position of an element, the colour of all the links on your page and the font size dimensions of all paragraphs, you should do three commits, using messages that describe what you are doing each time.
Copy file name to clipboardExpand all lines: version-control/set-up/tutorial.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -123,7 +123,7 @@ We need to copy to the clipboard the contents of the `id_rsa_pub` file we create
123
123
```bash
124
124
pbcopy <~/.ssh/id_rsa.pub
125
125
```
126
-
Now return back to the broswer where your Github account is open. Give the SSH key a `Title` and paste the file contents into the `Key` field. When done, hit the `Add SSH Key` button. You may be prompted for your password, if so enter it and hit `Confirm Password` to complete this step.
126
+
Now return back to the browser where your Github account is open. Give the SSH key a `Title` and paste the file contents into the `Key` field. When done, hit the `Add SSH Key` button. You may be prompted for your password, if so enter it and hit `Confirm Password` to complete this step.
127
127
128
128

0 commit comments