starts a cleanup of the fracz exercize.md file

This commit is contained in:
waldek 2021-04-10 13:05:48 +02:00
parent 275092d220
commit 01a7cdf3ef
1 changed files with 49 additions and 16 deletions

View File

@ -1,51 +1,71 @@
# FRACZ
# [Git Exercises](https://gitexercises.fracz.com/) Fracz is a good excercize to learn basic and advanced git command.
Go to the [website](https://gitexercises.fracz.com/) and follow the instructions to start the game.
Make sure you have git installed onto the machine you want to do the excercize on.
## 1. Exercise: Push a commit you have made ## 1. Exercise: Push a commit you have made
### Instructions
The first exercise is to push a commit that is created when you run the git start command.
### Instructions
The first exercise is to push a commit that is created when you run the git start command.
Just try git verify after you have initialized the exercises and be proud of passing the first one :-) Just try git verify after you have initialized the exercises and be proud of passing the first one :-)
### commands ### Commands
>git push ```bash
git push
```
## 2. Exercise: Commit one file ## 2. Exercise: Commit one file
### Instructions ### Instructions
There are two files created in the root project directory - **A.txt** and **B.txt**. There are two files created in the root project directory - **A.txt** and **B.txt**.
The goal is to commit only one of them. The goal is to commit only one of them.
NOTE: Remember that you can submit your solutions with **git verify** command instead of **git push**. NOTE: Remember that you can submit your solutions with **git verify** command instead of **git push**.
### The easiest solution ### The easiest solution
**TODO**
#### Further info #### Further info
You prepare changes to be committed with **git add <file>** command. It adds files from working area to staging area. Only files that are in staging area will be included in the commit when you run the **git commit** command. You prepare changes to be committed with **git add <file>** command. It adds files from working area to staging area. Only files that are in staging area will be included in the commit when you run the **git commit** command.
Remember that you can **git add -A** to add all changed files to staging area. You can also do this in air with **-a** option for **git commit**, e.g. Remember that you can **git add -A** to add all changed files to staging area. You can also do this in air with **-a** option for **git commit**, e.g.
### commands ### Commands
>git commit -am "Some Commit Message" ```bash
git commit -am "Some Commit Message"
```
## 3. Commit one file of two currently staged ## 3. Commit one file of two currently staged
Instructions ### Instructions
There are two files created in the root project directory - **A.txt** and **B.txt**. They are both added to the staging area.
There are two files created in the root project directory - **A.txt** and **B.txt**. They are both added to the staging area.
The goal is to commit only one of them. The goal is to commit only one of them.
## The easiest solution ### The easiest solution
**TODO**
### Further info ### Further info
When you have added too many changes to staging area, you can undo them with **git reset <file>** command before the **git commit**. When you have added too many changes to staging area, you can undo them with **git reset <file>** command before the **git commit**.
## The easiest solution ### The easiest solution
**TODO**
### Further info ### Further info
When you have added too many changes to staging area, you can undo them with **git reset <file>** command before the **git commit**. When you have added too many changes to staging area, you can undo them with **git reset <file>** command before the **git commit**.
### commands ### Commands
```bash ```bash
$ git status $ git status
@ -65,6 +85,7 @@ $ git restore --staged B.txt
## 4. Ignore unwanted files ## 4. Ignore unwanted files
### Instructions ### Instructions
It is often good idea to tell Git which files it should track and which it should not. Developers almost always do not want to include generated files, compiled code or libraries into their project history. It is often good idea to tell Git which files it should track and which it should not. Developers almost always do not want to include generated files, compiled code or libraries into their project history.
Your task is to create and commit configuration that would ignore: Your task is to create and commit configuration that would ignore:
@ -76,7 +97,9 @@ the whole **libraries** directory
Sample files are generated for you. Sample files are generated for you.
### The easiest solution ### The easiest solution
### Further info ### Further info
A **.gitignore** file specifies intentionally untracked files that Git should ignore. A **.gitignore** file specifies intentionally untracked files that Git should ignore.
To ignore all files with specific string inside filename, just type it in, i.e. **dumb** To ignore all files with specific extension use wildcard, i.e. **.exe** To ignore the whole directories, put a slash in the end of the rule, i.e. **libraries/** To specify full path from the **.gitignore** location start rule with slash, i.e. **/libraries** To ignore all files with specific string inside filename, just type it in, i.e. **dumb** To ignore all files with specific extension use wildcard, i.e. **.exe** To ignore the whole directories, put a slash in the end of the rule, i.e. **libraries/** To specify full path from the **.gitignore** location start rule with slash, i.e. **/libraries**
@ -286,7 +309,9 @@ It's also worth to read the [Basic Branching and Merging](http://git-scm.com/boo
``` ```
## 7. Saving your work ## 7. Saving your work
### Instructions ### Instructions
You are working hard on a regular issue while your boss comes in and wants you to fix a bug. State of your current working area is a total mess so you don't feel comfortable with making a commit now. However, you need to fix the found bug ASAP. You are working hard on a regular issue while your boss comes in and wants you to fix a bug. State of your current working area is a total mess so you don't feel comfortable with making a commit now. However, you need to fix the found bug ASAP.
Git lets you to save your work on a side and continue it later. Find appropriate Git tool and use it to handle the situation appropriately. Git lets you to save your work on a side and continue it later. Find appropriate Git tool and use it to handle the situation appropriately.
@ -327,7 +352,8 @@ Last thing to remember is that stashes are only local - you can't push them to r
See Stashing in the Git Book. See Stashing in the Git Book.
# commands # Commands
```bash ```bash
149 **git stash** 149 **git stash**
150 **git pull** 150 **git pull**
@ -352,10 +378,13 @@ See Stashing in the Git Book.
``` ```
## 8. Change branch history ## 8. Change branch history
### Instructions ### Instructions
You were working on a regular issue while your boss came in and told you to fix recent bug in an application. Because your work on the issue hasn't been done yet, you decided to go back where you started and do a bug fix there. You were working on a regular issue while your boss came in and told you to fix recent bug in an application. Because your work on the issue hasn't been done yet, you decided to go back where you started and do a bug fix there.
Your repository look like this: Your repository look like this:
``` ```
HEAD HEAD
@ -368,7 +397,9 @@ A <----- B
| |
hot-bugfix hot-bugfix
``` ```
Now you realized that the bug is really annoying and you don't want to continue your work without the fix you have made. You wish your repository looked like you started after fixing a bug. Now you realized that the bug is really annoying and you don't want to continue your work without the fix you have made. You wish your repository looked like you started after fixing a bug.
``` ```
HEAD HEAD
@ -379,7 +410,9 @@ A <----- C <----- B
| |
hot-bugfix hot-bugfix
``` ```
Achieve that. Achieve that.
### Hint ### Hint
You need to use [git rebase](https://git-scm.com/docs/git-rebase) command. You need to use [git rebase](https://git-scm.com/docs/git-rebase) command.