From f451c7eb71eac4277498af43f99521afba8c2f67 Mon Sep 17 00:00:00 2001 From: doron Date: Mon, 9 May 2022 13:34:21 +0300 Subject: [PATCH 1/5] created preliminaries --- 07_git_exercises/dorondollev_ex1/README | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 07_git_exercises/dorondollev_ex1/README diff --git a/07_git_exercises/dorondollev_ex1/README b/07_git_exercises/dorondollev_ex1/README new file mode 100644 index 00000000..e69de29b From 5775dab22baa58c397bd3ecf384b8f792a2fe6b0 Mon Sep 17 00:00:00 2001 From: doron Date: Thu, 19 May 2022 21:44:46 +0300 Subject: [PATCH 2/5] answered part of README --- 07_git_exercises/dorondollev_ex1/README | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/07_git_exercises/dorondollev_ex1/README b/07_git_exercises/dorondollev_ex1/README index e69de29b..482e05cb 100644 --- a/07_git_exercises/dorondollev_ex1/README +++ b/07_git_exercises/dorondollev_ex1/README @@ -0,0 +1,7 @@ +1. echo 1 > abc.txt +2. git status, shows the red color +3. git add abc.txt. + git status, shows the green color +4. echo 2 >>abc.txt +5. git status, shows the red color again +6. \ No newline at end of file From 198a3f2ef40d18654dfe6af651df30f7d2131745 Mon Sep 17 00:00:00 2001 From: doron Date: Sun, 22 May 2022 21:33:59 +0300 Subject: [PATCH 3/5] answered Git Basics --- 07_git_exercises/dorondollev_ex1/README | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/07_git_exercises/dorondollev_ex1/README b/07_git_exercises/dorondollev_ex1/README index 482e05cb..b3172be6 100644 --- a/07_git_exercises/dorondollev_ex1/README +++ b/07_git_exercises/dorondollev_ex1/README @@ -2,6 +2,19 @@ 2. git status, shows the red color 3. git add abc.txt. git status, shows the green color + git commit -m "Committing 1 to abc.txt" abc.txt + git status, shows the blue color 4. echo 2 >>abc.txt 5. git status, shows the red color again -6. \ No newline at end of file +6. git diff main +7. abc.txt file is not indexed yet +8. stage2 is ambiguous argument +9. git add abc.txt +10. git diff shows the difference between the index and the working tree + Since the changes in abc.txt indexed, it print's nothing +11. git diff main +12. echo 3 >>abc.txt +13. git diff --staged, prints upto the second row which is indexed + git diff main, prints all tracked changes from local repository to workspace +14. The first row is green colored and added to index + The second row is red colored since the file is in workspace \ No newline at end of file From a3b90b55801e197adba04adaba2aac96bb025c72 Mon Sep 17 00:00:00 2001 From: doron Date: Sun, 22 May 2022 22:36:40 +0300 Subject: [PATCH 4/5] answered 2 from Resolve conflicts --- 07_git_exercises/dorondollev_ex1/README | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/07_git_exercises/dorondollev_ex1/README b/07_git_exercises/dorondollev_ex1/README index b3172be6..1c7112c5 100644 --- a/07_git_exercises/dorondollev_ex1/README +++ b/07_git_exercises/dorondollev_ex1/README @@ -17,4 +17,24 @@ 13. git diff --staged, prints upto the second row which is indexed git diff main, prints all tracked changes from local repository to workspace 14. The first row is green colored and added to index - The second row is red colored since the file is in workspace \ No newline at end of file + The second row is red colored since the file is in workspace + +Resolve conflicts +================= +1. +$ git branch --all + bugfix/fix_readme_typo + bugfix/open_kibana_port + dev + feature/data_retention_policy + feature/elasticsearch_helm_chart + feature/upgrade_angular_version + feature/version1 + feature/version2 +* main + reset_question + +2. +$ git checkout -b feature/lambda_migration +Switched to a new branch 'feature/lambda_migration' + From e640eeb10298ad75c647452f3c28e0977b59c628 Mon Sep 17 00:00:00 2001 From: doron Date: Mon, 23 May 2022 16:02:52 +0300 Subject: [PATCH 5/5] Finished Git and Pycharm ex-1 --- 07_git_exercises/dorondollev_ex1/README | 74 +++++++++++++++++++++++++ 1 file changed, 74 insertions(+) diff --git a/07_git_exercises/dorondollev_ex1/README b/07_git_exercises/dorondollev_ex1/README index 1c7112c5..70dbdc41 100644 --- a/07_git_exercises/dorondollev_ex1/README +++ b/07_git_exercises/dorondollev_ex1/README @@ -1,3 +1,5 @@ +Git Basics (commit, diff, branches) +=================================== 1. echo 1 > abc.txt 2. git status, shows the red color 3. git add abc.txt. @@ -38,3 +40,75 @@ $ git branch --all $ git checkout -b feature/lambda_migration Switched to a new branch 'feature/lambda_migration' +3. +$ git merge feature/version1 +Updating d4e8424..1639247 +Fast-forward + .env | 0 + app.py | 4 ++-- + config.json | 0 + 3 files changed, 2 insertions(+), 2 deletions(-) + create mode 100644 .env + create mode 100644 config.json + +6. Especailly pay attention to the resolved commit which is the last +$ git log --name-status HEAD^..HEAD +commit a64bfcd066f4a3fa06da749b7d7d0842053befe2 (HEAD -> feature/lambda_migr +ation) +Merge: 1639247 37b1550 +Author: doron +Date: Mon May 23 10:23:23 2022 +0300 + + Merge branch 'feature/version2' into feature/lambda_migration + + # Conflicts: + # app.py + +commit 37b15501505367b8f4a8f8aaea549b134f82e445 (feature/version2) +Author: Narayan Nadella +Date: Mon May 23 09:25:47 2022 +0300 + + Nayaran's changes for app.py + +M app.py + +Cherry picking +============== +4. .env and config.json +5. The answer is yes. + There may be some kind of dependency. + for example, if you'll pick a commit that is in progress and it was first introduced in an unpicked commit, + it won't apply until you'll fix the unordered pick + +Changes in working tree and switch branches +=========================================== +2. +$ echo "write some lines in it and add it to the index" >take.txt + +3. The message suggests that I'll make a commit or stash +$ 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, this is what it outputs: +KLITA@DESKTOP-4D3V75O MINGW64 ~/PycharmProjects/myGitEx/07_git_exercises (featur +e/lambda_migration2) +$ cat take.txt +a +b +c + +6. No the file is erased + Force Checkout clears index and working area from uncommitted changes. + +Reset +===== +2. + 1. git resets the last commit, in our case .env changed + 2. git resets the index but not the working tree, it means that the files .env and config.json are unadded to index. + 3. git resets the index and working tree. any untracked files or directories in the way of writing any tracked files are simply deleted + in our case, init.sh has been deleted and app.py showed. + 4. git reverts the changes in the last commit in HEAD and create a new commit with the reverted changes +3. Changes HEAD according to last history log \ No newline at end of file