Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions 07_git_exercises/kostalubarsky_ex1/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
Git Basics (commit, diff, branches)
1. echo 1 > abc.txt
2. Red
3. git add abc.txt (green color). git commit -m "add 1 to abc.txt commit"
4. echo 2 >> abc.txt
5. Blue
6. git diff main
7. It's no git commit yet.
8. no branch named 'stage2'.
9. git add abc.txt
10.doesn't print anything
11. git diff --cached. Shows the changes between the index and the HEAD\main
12. echo 3 >> abc.txt
13. NO.
14. first after commit (green). second in the working tree (red)
15. git reset

Resolve conflicts
1. git branch
bugfix/fix_readme_typo
bugfix/open_kibana_port
dev
feature/data_retention_policy
feature/elasticsearch_helm_chart
feature/lambda_migration (my new branch)
feature/upgrade_angular_version
feature/version1
feature/version2
6. YES.

Cherry picking
4. two files
a. config.json b. .env
5. YES . If we go back to older commit the new one will not be available.

Changes in working tree and switch branches
2. echo take it > take.txt
3. git add take.txt
4. git checkout dev
error: Your local changes to the following files would be overwritten by checkout:
take.txt
Please commit your changes or stash them before you switch branches.
Aborting
5. No. There is "a b c"
6. git checkout feature/lambda_migration2
no file take.txt.
Force Checkout overwrites uncommited changes




Reset
2.1. git reset --soft HEAD~1 - Removes last commit and keeps changes on Index.
2.2. git reset --mixed HEAD~1 - Similar to 'soft' but doesn't keep chamges on Index.
2.3. git reset --hard HEAD~1 - Remove all uncomitted and untrackked files.
2.4. git revert HEAD~1 - Revert changes.

3. HEAD~1 - Moving back in generations linear.