├── README.md
├── amend
├── README.md
├── file.txt
└── setup.sh
├── feature-select
├── README.md
└── feature.txt
├── gitignore
├── .idea
│ ├── .gitignore
│ ├── hw1.iml
│ ├── modules.xml
│ └── vcs.xml
└── README.md
└── merge-conflict
├── README.md
└── story.md
/README.md:
--------------------------------------------------------------------------------
1 | # Git Practical Assignment (from IE Course)
2 |
3 | There are 4 exercises; for each one, you need to `checkout` to its branch specified in `{problem_name}/README.md`. After that, complete the tasks in **the same branch**.
4 |
5 | Make sure to `checkout main` after finishing the problems.
6 |
7 | ## Submission
8 | You must set up a **private** clone of this repository and complete the tasks. After the deadline, you will be asked to add the TAs as collaborators for grading.
9 |
10 |
11 | ## Acknowledgement
12 | These challenges are inspired by [https://gitexercises.fracz.com](https://gitexercises.fracz.com/). We strongly suggest you try all exercises from there.
13 |
--------------------------------------------------------------------------------
/amend/README.md:
--------------------------------------------------------------------------------
1 | # Amend
2 |
3 | ```shell
4 | git checkout amend && ./setup.sh
5 | ```
6 |
7 | ## Tasks
8 | **Amending public commits (those which are pushed to the remote repository) can be catastrophic. Avoid it in real-life use cases.**
9 |
10 | - There is a typo in the bottom of this text, fix it without adding a **new commit**.
11 | - In some point back in history, an incorrect sentence was added to `file.txt`. amend the incorrect commit to fix it.
12 | - hint: you must use `git rebase --interactive` for this.
--------------------------------------------------------------------------------
/amend/file.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/1995parham-teaching/git-exercise/ffa82624c6c668215d854e4fa6a99d8f85125340/amend/file.txt
--------------------------------------------------------------------------------
/amend/setup.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | echo -e "\nthis is a tpyo" >> README.md
4 |
5 | git commit -a -m "Add typo message"
--------------------------------------------------------------------------------
/feature-select/README.md:
--------------------------------------------------------------------------------
1 | # Feature Select
2 |
3 | ```shell
4 | git checkout feature-select
5 | ```
6 |
7 | ## Tasks
8 | - There are 3 branches with syntax `feature-A|B|C`. without editing the code directly (exept for merge conflicts). Add A,B and C feature to `feature.txt`
9 | - You must do this in a `Add feature A B C` commit.
10 | - It is better to reference feature commit hashes in commit description.
--------------------------------------------------------------------------------
/feature-select/feature.txt:
--------------------------------------------------------------------------------
1 | This project Can Do awesome things
--------------------------------------------------------------------------------
/gitignore/.idea/.gitignore:
--------------------------------------------------------------------------------
1 | # Default ignored files
2 | /shelf/
3 | /workspace.xml
4 | # Editor-based HTTP Client requests
5 | /httpRequests/
6 | # Datasource local storage ignored files
7 | /dataSources/
8 | /dataSources.local.xml
9 |
--------------------------------------------------------------------------------
/gitignore/.idea/hw1.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/gitignore/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/gitignore/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/gitignore/README.md:
--------------------------------------------------------------------------------
1 | # gitignore
2 |
3 | ```shell
4 | git checkout gitignore
5 | ```
6 |
7 | ## Tasks
8 | - There is a `.idea` folder here. Remove it from history and write a gitignore in root of the project such that `.idea` is no longer considered for `git add`.
9 | - Using [this tool](https://www.toptal.com/developers/gitignore), fill your gitignore such that it ignores `python` applications in `linux`and `mac`.
--------------------------------------------------------------------------------
/merge-conflict/README.md:
--------------------------------------------------------------------------------
1 | # Merge conflict resolution
2 |
3 | ```shell
4 | git checkout {merge-explicit|merge-implicit}
5 | ```
6 |
7 | ## Tasks
8 | - Merge branch `story-modification` with `merge-explicit` in a way that the story in `story.md` makes sense.
9 | - **Merge using explicit strategies (with explicit merge commits)**.
10 | - Merge the branch `story-modification` with `merge-implicit` with `fast-forward`/`rebase` strategy.
11 | - With this strategy there mustn't be an explicit merge commit in history.
12 |
13 | Merge branches in a way that the final story be:
14 | ```text
15 | Ye marde kheyli seft mikhore be narde,
16 | vali bar nemigarde.
17 | ```
--------------------------------------------------------------------------------
/merge-conflict/story.md:
--------------------------------------------------------------------------------
1 | # Super khafan story
2 |
3 | Ye marde mikhore be narde,
4 | barmigarde.
--------------------------------------------------------------------------------