CS代写 CMT302 – Lab 1 – Worksheet

Lab Objectives:
CMT302 – Lab 1 – Worksheet
Cardiff University

School of Computer Science & Informatics Dr , Dr Daniela Tsaneva

Copyright By PowCoder代写 加微信 powcoder

CMT302 ‘E-Commerce & Innovation’
SPRING – LAB 1
– To learn how to use Git and GitLab
Assumption:
– Git should be already installed and ready for you to complete today’s task. If it isn’t, please contact IT Service Desk (our network support officers).
Instructions:
– Complete all tasks. Use the accompanying handout to help you with this.
– Write down the git commands you use for each task.
– When a task asks you to modify a file, just type a short phrase, e.g. “change 1”, “change 2”, etc. Insert and keep a newline at the end of each file (some commands, e.g. git diff, don’t like
se “commit X” 1 , or some other short phrase that will help remember what each particular commit was for.
files without a newline at the end of the file).
When you perform each commit, u
– Before you start the lab exercises, familiarise yourself with MS-DOS commands. Using these is more productive/ efficient that using file Explorer/other GUI. Full list of the commands is found here: https://docs.microsoft.com/en-us/windows-server/ administration/windows-commands/windows-commands. But you can find a variety of other website that provide a quick reference/ cheatsheets for the commands.
– Git, like some other systems, requires SSH Key pair. If you have not set this up yet, see the instructions in the separate handout, or here : https://docs.cs.cf.ac.uk/notes/using- gitlab/
Part 1: Git commands
1. Create a directory CMT302_git_lab on your H: drive. (Hint: you can use mkdir command to create this directory using the command prompt.)
3. Start tracking CMT302_git_lab.
git command:
1 Where ‘X’ represents the consecutive number of each commit Page 1 of 4
Using command prompt, create 5 empty files in this directory: README.txt, TODO.txt,
hidden.txt, module1.txt, and removeme.txt
✓ Using command prompt, check that you now have .git folder in CMT302_git_lab (Hint: try attrib or another command to list the contents of the current directory – including hidden files. ls -a command might also work – this is a Linux command, but it works on some Windows-based systems.)

CMT302 – Lab 1 – Worksheet
4. Run git status. What is the status of the files in the CMT302_git_lab directory?
5. Stage README.txt and TODO.txt files.
git commands:
What is the status of the two files?
Modify README.txt by adding a line of text, and save the file.
a. Use “short” status to check the current state of your git repo.
git command:
b. Interpret the output:
7. Tell git to ignore hidden.txt file. Check this file is no longer listed.
What actions do you need to do and what git commands do you need to run do to accomplish this?
8. Modify TODO.txt, stage and commit the changes. git command(s):
✓ Itisagoodideatorungitstatusoftentocheckyourfiles’status.
Modify TODO.txt file again, and commit the changes without staging this file first (i.e. skip the git add command).
git command:
Run git status.
What is the status of your repo?
Page 2 of 4

CMT302 – Lab 1 – Worksheet
Modify TODO.txt again. Run git diff command. Interpret the output:
a. Stage removeme.txt file. Run git status.
What is the status of removeme.txt?
b. Remove removeme.txt from git, but keep it the directory (i.e. do not delete it
completely). Rungitstatus. git command:
What is the status of removeme.txt now? View the history of the commits you made so far.
git command:
How many commits have you made so far? 13.
a. Create the tag “ex13a”. Modify README.txt. Commit the changes. git command(s):
a. Try the git log –oneline –all command.
What does this command do?
What does this command do?
What is the difference between this command and the one in 13 (a)?
Display the data associated with the ex13a tag.
git command:
Try the git log –oneline –decorate –graph –all command.
Create alias pretty for the command in 13 (b). Check that it works as intended. (Hint:
it might be necessary to use single quotes for the command that is used for the alias) git command:

Page 3 of 4

CMT302 – Lab 1 – Worksheet
Part 2: Working with remotes
For this part, we will be using our School’s Gitlab server.
15. Createaproject”CMT302_git_lab_remote”onGitlab.(Seehttp://docs.cs.cf.ac.uk/notes/ using-gitlab/ on how to set it up).
16. Create a short name for the remote (e.g. see slide 56 of our Lecture 3).
17. Copy (push) the local repo to the remote. The remote repo needs to be an exact clone of your
local one (i.e. all branches, commits, etc.).
(For this task, you should only have one branch, master. But later on, when you start using branching, you would need to copy all your branches one by one.)
git command(s):
18. Make some changes to a local file, stage, commit and push the changes to your remote project. Check the file has been updated in your remote project.
git command(s):
Page 4 of 4

程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com