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
51 changes: 51 additions & 0 deletions 07_git_exercises/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
1. create file
2. red
3.after git add (index ) - green color
# 4. writing git commit -m "add 1 to abc.txt file"
5.blue
6.git diff main
7. because i didn't stages (git add "files") files after last commit
8. stage2 is fail argument
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a valid argument, but there is no branch called stage2

10. doesn't print anything, because git diff shows the difference in between the index and the working tree.
11. git diff --cached
13.no, git diff --staged --> only show changes to files in the "staged" area
git diff main ---> show all changes to tracked files

14. first time we see abc.txt after commited (green)
second time we see abc.txt working tree (red)

--------------------Resolve conflicts----------------
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good


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
* main
reset_question

6. Yes - we have commits Marge branch

--------------------------cherry-pick-------------------
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good

4. (1) config.json (2) .env
5. yes, this is important because commits can be related to each other

-----------------------Changes in working tree and switch branches-------------
3. git checkout problem - 1. Force checkout 2. Smart checkout 3. Don't checkout
5. No
6. No , remove my changes in indexing and working tree

------------------------Reset-----------------------
2.1 git reset --soft HEAD~1 - remove the last commit from the current branch, but the file changes will stay in your working tree
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and it stays in the index as well

2.2 git reset --mixed HEAD~1 - remove the last commit from the current branch but still keep the changes in your working tree but not on the index
2.3 git reset --hard HEAD~1 - lose all uncommited changes and all untracked files

2.4 git revert HEAD~1 - If you have already made your commits public, you will want to create a new commit which will "revert" the changes you made in "one" commits before HEAD.

3. HEAD~1 means that you want to reset the HEAD (the last commit) to one commit before in the log history.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great