Browse Source

Update assigment with slides

Bastian 3 years ago
  1. 153


@ -1,56 +1,103 @@ @@ -1,56 +1,103 @@
# Assignments
## Assignment 1: Create a repository
1. Create your own new repository
2. Add a .gitignore file
3. Why you would like a gitignore file
- Not pushing sensitive files
- Not pushing environment files
4. Add a
## Assignment 2: Your first commit
0. Clone repository
0. Edit README file
0. Create a new file(s) and add information
0. Stage README and your file(s)
0. Commit README and your file(s)
## Assignment 3: Merge conflicts
0. Go to the How to Git started repository
0. Add to your repository
0. Choose a partner
0. Add him/her as a collaborator
0. Make the partner clone your repository
0. Let both of you edit the same line in the code file
0. Let one of you stage and push the changes
0. Solve the merge conflict
## Assignment 5: Branching
0. Go to the How to Git started repository
0. Add index.html to your shared repository.
0. Let person A create a new branch called header
0. Let person B create a new branch called footer
0. Let person A edit the header of index.html
0. Let person B edit the footer of index.html
0. Stage and push the changes
0. Pull the latest changes
0. Track the branch of your partner
## Assignment 6: Merge branches (Or Rebase)
0. Go to your master branch
0. Merge it with the header branch
0. Commit the merge
0. Merge it with the footer branch
0. Commit the merge
0. Push the changes
0. Delete your old branches
## Assignment 7: Pull requests
0. Let one of you create a new repository (do not add collaborators)
0. Stage and commit a file
0. Let the other person fork the repository and clone it
0. Let him/her change the file and push it
0. Let him/her create a new pull request via the GUI
0. Let the other approve and merge the request
0. Let the other pull the latest changes
## Assignment 1: Create a folder using the CLI
0. Use the command line to navigate to your desktop folder
0. Create a folder called `CIT`
0. Move inside the `CIT` folder
0. Check to see your current working directory
## Assignment 2: Setup git
1. Set the default git text editor (e.g. nano)
2. Set your username
3. set your email address
## Assignment 3: Create a local repository
1. Go into your `CIT` directory
2. Initialize it as a local git repository
## Assignment 4: Create a file
1. Make sure you are still in your local repo
2. Create a file using the CLI and name it `git_workshop.txt`
3. Check the status of your repo
## Assignment 5: Add a file to staging
1. Tell git to track the just created file `git_workshop.txt`
2. Check the status of your repo
## Assignment 6: Commit changes
1. Check the status of your repo. Make sure the changes listed respresent exactly what you want to commit.
2. Commit the change with a message that explaind and describes what changes you made.
## Assignment 7: Check the progress
1. Now check the progress of the repo
2. Exit the log afterwards
## Assignment 8: Undoing modified/tracked changes
1. Open `git_workshop.txt`
2. Add some changes to it
3. Undo these changes using git
## Assignment 9: Unstage a file
1. Add a new file to your repo
2. Stage the file
3. Unstage the just staged file
## Assignment 10: Uncommit and keep all changes
1. Add changes to the `git_workshop.txt` file
2. Stage and commit the changes
3. Uncommit your commit
## Assignment 11: Uncommit without keeping all the changes
1. Stage and commit the change
2. Uncommit your commit without keeping all the changes
## Assignment 12: Create a remote repository
1. Go to
2. Create your own remote repository
3. Add a `.gitignore` file
4. Add a ``
## Assignment 13: Your first push
1. Clone your repository
2. Edit your `` file
3. Create a new file(s) and add something to it
4. Stage `` and your file(s)
5. Commit `` and your file(s)
6. Push your commit
## Assignment 14: Create a new branch
1. Create a new file file with some content
2. Stage, commit and push it
3. Create a new branch
4. Checkout the new branch
5. Edit the just created file and push it into the new branch
## Assignment 15: Check the logs
1. Checkout the master branch
2. Check the logs
3. Checkout the just created branch
4. Check the logs
## Assignment 16: Merge the branches
1. Checkout the master branch
2. Merge it with the other branch
3. Check the logs
4. Delete the other branch
## Assignment 17: Work together in pairs
1. Person A adds person B as collaborator
2. Person A creates a file called `share.txt` and adds some text
3. Person B clones the shared repository
4. Person A and B change the same line of text within `share.txt`
5. Person B commits and pushes the changes
6. Person A pull the changes
7. Solve the merge conflict