... | @@ -142,14 +142,79 @@ Let's get your code from the server to your local machine. |
... | @@ -142,14 +142,79 @@ Let's get your code from the server to your local machine. |
|
Resolving deltas: 100% (215/215), done.
|
|
Resolving deltas: 100% (215/215), done.
|
|
````
|
|
````
|
|
|
|
|
|
If you have successfully gotten your code onto your local PC, well done!
|
|
If you have successfully gotten your code onto your local PC, well done! You should see a new folder within the directory you created with the same name as your project name.
|
|
|
|
|
|
Otherwise, if something went wrong, make a note of the error you encountered and ask a demi for help.
|
|
Otherwise, if something went wrong, make a note of the error you encountered and ask a demi for help.
|
|
|
|
|
|
|
|
#### Make a local change
|
|
|
|
Let's create a file in your git folder and see how this change is shown in git.
|
|
|
|
|
|
|
|
1. First "cd" into your newly cloned repo. For example following from above:
|
|
|
|
````bash
|
|
|
|
$ cd ~/git/netbot/
|
|
|
|
````
|
|
|
|
2. Now create a new empty file using the "touch" command.
|
|
|
|
````
|
|
|
|
# First we "ls" to list what is in the directory
|
|
|
|
$ ls
|
|
|
|
|
|
|
|
# We see there is nothing. So let's create a file called "fred.txt"
|
|
|
|
$ touch fred.txt
|
|
|
|
|
|
|
|
# Now if we "ls" again we see that fred.txt exists
|
|
|
|
$ ls
|
|
|
|
fred.txt
|
|
|
|
````
|
|
|
|
3. Now let's ask git what has changed in the repo with "git status":
|
|
|
|
````
|
|
|
|
$ git status
|
|
|
|
On branch master
|
|
|
|
Your branch is up to date with 'origin/master'.
|
|
|
|
|
|
|
|
Untracked files:
|
|
|
|
(use "git add <file>..." to include in what will be committed)
|
|
|
|
|
|
|
|
fred.txt
|
|
|
|
|
|
|
|
nothing added to commit but untracked files present (use "git add" to track)
|
|
|
|
````
|
|
|
|
We see that there is a file called "fred.txt" that is not yet in the Index, or in the repo.
|
|
|
|
4. Let's do as suggested as add the file with `git add fred.txt`.
|
|
|
|
5. If we `git status` again we see:
|
|
|
|
````
|
|
|
|
On branch master
|
|
|
|
Your branch is up to date with 'origin/master'.
|
|
|
|
|
|
|
|
Changes to be committed:
|
|
|
|
(use "git reset HEAD <file>..." to unstage)
|
|
|
|
|
|
|
|
new file: fred.txt
|
|
|
|
````
|
|
|
|
Now we see that there are local changes that have not been committed, but are being tracked.
|
|
|
|
|
|
|
|
Do step 2 to 4 again with a new file called "java.txt".
|
|
|
|
|
|
|
|
Now when we `git status` we see:
|
|
|
|
````
|
|
|
|
On branch master
|
|
|
|
Your branch is up to date with 'origin/master'.
|
|
|
|
|
|
|
|
Changes to be committed:
|
|
|
|
(use "git reset HEAD <file>..." to unstage)
|
|
|
|
|
|
|
|
new file: fred
|
|
|
|
new file: java.txt
|
|
|
|
````
|
|
|
|
6. Once you have made all the changes you want for a certain piece of work, you can commit them all together after adding them.
|
|
|
|
> This is as if you are saying "this is a group of changes that belong together and that I am finished with for now".
|
|
|
|
|
|
|
|
We commit these changes with the command `git commit`. Once you issue this command, you will be prompted with a text editor of your choice so that you can add a comment to this set of changes. [see here](#setup). Ask a demi to help you change editors if need be.
|
|
|
|
|
|
|
|
In this message you will also see a summary of changes. You should see both "fred.txt" and "java.txt".
|
|
|
|
|
|
#### Sending code back into GitLab
|
|
#### Sending code back into GitLab
|
|
[TODO]
|
|
[TODO]
|
|
|
|
|
|
### Understanding the `git` workflow
|
|
|
|
|
|
|
|
All commands need to be executed within the directory of your git repo.
|
|
All commands need to be executed within the directory of your git repo.
|
|
|
|
|
... | | ... | |