GIT Exercise 02
GIT Exercise 02
In this exercise you will get familiar with some basic Git commands. At the end of this exercise you will be able to:
1 <!DOCTYPE html>
2 <html>
3 <head></head>
4
5 <body>
6 <h1>This is a Header</h1>
7 </body>
8 </html>
Go to the git-test folder in your cmd window/terminal and type the following at the prompt to initialize the folder
as a Git repository:
1 git init
Type the following at the prompt to check your Git repository's status:
1 git status
https://www.coursera.org/learn/bootstrap-4/supplement/cgWKo/exercise-instructions-basic-git-commands 1/4
2/10/2021 Exercise (Instructions): Basic Git Commands | Coursera
1 git add .
1 <!DOCTYPE html>
2 <html>
3 <head></head>
4
5 <body>
6 <h1>This is a Header</h1>
7 <p>This is a paragraph</p>
8 </body>
9 </html>
Add a sub-folder named templates to your git-test folder, and then add a file named test.html to the templates
folder. Then set the contents of this file to be the same as the index.html file above.
Then check the status and add all the files to the staging area.
Then do the second commit to your repository
Now, modify the index.html file as follows:
https://www.coursera.org/learn/bootstrap-4/supplement/cgWKo/exercise-instructions-basic-git-commands 2/4
2/10/2021 Exercise (Instructions): Basic Git Commands | Coursera
1 <!DOCTYPE html>
2 <html>
3 <head></head>
4
5 <body>
6 <h1>This is a Header</h1>
7 <p>This is a paragraph</p>
8 <p>This is a second paragraph</p>
9 </body>
10 </html>
Now add the modified index.html file to the staging area and then do a third commit.
You can also use git reset to reset the staging area to the last commit without disturbing the working directory.
Conclusions
At the end of this exercise you should have learnt some basic Git commands. Experiment with these commands until
you fully understand how to use Git.
https://www.coursera.org/learn/bootstrap-4/supplement/cgWKo/exercise-instructions-basic-git-commands 3/4
2/10/2021 Exercise (Instructions): Basic Git Commands | Coursera
https://www.coursera.org/learn/bootstrap-4/supplement/cgWKo/exercise-instructions-basic-git-commands 4/4