Skip to content

Commit 403f9e8

Browse files
committed
add git collaborating task
1 parent 2615dee commit 403f9e8

1 file changed

Lines changed: 52 additions & 0 deletions

File tree

git-collaboration/README.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Git Collaboration
2+
3+
## Learning Objectives
4+
5+
<!--{{<objectives>}}>-->
6+
7+
- [ ] Use HTML and CSS to build a simple website
8+
- [ ] Collaborate with colleagues using Git
9+
<!--{{<objectives>}}>-->
10+
11+
It's very unlikely that you will be the only person working with a Git repository. We have already practised creating branches and merging on our own during the prep, now we will do it with another person.
12+
13+
**You will need to find a partner for this exercise**. If you have an odd number of people in your cohort you can work in a three, the important thing is that you work on a different repository for parts 1 and 2.
14+
15+
## Instructions
16+
17+
### Part 1 - Creating the repository
18+
19+
1. Create a new directory called `animal-website` and an `index.html` file inside it.
20+
2. Initialise a Git repository and commit the empty file.
21+
3. Create a repository on GitHub and link it to your local repository
22+
4. Populate `index.html` file with some information about your favourite animal. You should include:
23+
- A title
24+
- Two or three sentences about the animal. You can copy something from the internet if you like.
25+
- A picture of the animal
26+
- An unordered list with three facts about the animal, eg. its habitat, its diet, etc
27+
5. Remember to commit your changes often!
28+
6. When you have built the site push the changes to GitHub and send the repository's url to your partner.
29+
7. You will need to add your partner as a collaborator on your repository before they can push to it. Click the `Settings` tab on the repository page then go to the `Collaborators and teams` page, then click `Add people` and enter your partners username. They will get an invite which they need to accept.
30+
31+
### Part 2 - Collaborating
32+
33+
1. Accept the invitation to collaborate from your partner
34+
2. Clone the repository to your computer
35+
3. Create a branch called `add-css`. Check that you are now working on your new branch.
36+
4. Create a `styles.css` file and add it to `index.html` using a `<link>` element.
37+
5. Add the following styling to the page:
38+
- Change the background colour
39+
- Change the font
40+
- Center the title
41+
- Add a border to the image
42+
6. Remember to commit after each change!
43+
7. Push your branch to GitHub
44+
8. Create a pull request asking to merge your branch to `main`
45+
46+
### Part 3 - Merging
47+
48+
1. At this point your partner should have created a pull request. Merge the changes into your `main` branch.
49+
2. **If you see a message about merge conflicts stop here**. That means something has gone wrong somewhere in this process. Post a message in Slack to ask for help.
50+
3. You can **pull** the changes to your laptop to see what's different in the website. Click the three dots next to teh repository name in the source control tab and click "pull".
51+
52+
If you see your partner's changes in your browser then everything has worked, well done! If not then you can post in Slack and ask for help, or speak to a volunteer in class. You should definitely speak to your partner and make sure nobody missed anything while working through the exercise.

0 commit comments

Comments
 (0)