You have divergent branches and need to specify out of three options (merge, rebase, fast-forward) how to reconcile them. What to do?Let's experiment and figure out what these three reconciling strategies do.
Clone a Server Copy
(base) ashish@ashish-Lenovo-ideapad-130-15IKB:~/Desktop/git_practical/server/repo_for_testing$ git pull Username for 'https://github.com': ashishjain1547@gmail.com Password for 'https://ashishjain1547@gmail.com@github.com': Already up to date. (base) ashish@ashish-Lenovo-ideapad-130-15IKB:~/Desktop/git_practical/server/repo_for_testing$ git log commit b20128a7b6148aa7ed668cfe2531a54418e61097 (HEAD -> main, origin/main, origin/HEAD) Author: Ashish Jain <ashishjain1547@gmail.com> Date: Thu Sep 15 23:21:37 2022 +0530 20220915Clone Three Local Copies
Local Copy 1
(base) ashish@ashish-Lenovo-ideapad-130-15IKB:~/Desktop/git_practical/local 1$ git clone https://github.com/ashishjain1547/repo_for_testing.git Cloning into 'repo_for_testing'... Username for 'https://github.com': ashishjain1547@gmail.com Password for 'https://ashishjain1547@gmail.com@github.com': remote: Enumerating objects: 39, done. remote: Counting objects: 100% (39/39), done. remote: Compressing objects: 100% (24/24), done. remote: Total 39 (delta 13), reused 23 (delta 4), pack-reused 0 Receiving objects: 100% (39/39), 8.45 KiB | 4.23 MiB/s, done. Resolving deltas: 100% (13/13), done.Local Copy 2
(base) ashish@ashish-Lenovo-ideapad-130-15IKB:~/Desktop/git_practical/local 2$ git clone https://github.com/ashishjain1547/repo_for_testing.git Cloning into 'repo_for_testing'... Username for 'https://github.com': ashishjain1547@gmail.com Password for 'https://ashishjain1547@gmail.com@github.com': remote: Enumerating objects: 39, done. remote: Counting objects: 100% (39/39), done. remote: Compressing objects: 100% (24/24), done. remote: Total 39 (delta 13), reused 23 (delta 4), pack-reused 0 Receiving objects: 100% (39/39), 8.45 KiB | 2.82 MiB/s, done. Resolving deltas: 100% (13/13), done.Local Copy 3
(base) ashish@ashish-Lenovo-ideapad-130-15IKB:~/Desktop/git_practical/local 3$ git clone https://github.com/ashishjain1547/repo_for_testing.git Cloning into 'repo_for_testing'... Username for 'https://github.com': ashishjain1547@gmail.com Password for 'https://ashishjain1547@gmail.com@github.com': remote: Enumerating objects: 39, done. remote: Counting objects: 100% (39/39), done. remote: Compressing objects: 100% (24/24), done. remote: Total 39 (delta 13), reused 23 (delta 4), pack-reused 0 Receiving objects: 100% (39/39), 8.45 KiB | 2.82 MiB/s, done. Resolving deltas: 100% (13/13), done. (base) ashish@ashish-Lenovo-ideapad-130-15IKB:~/Desktop/git_practical/local 3$Update the Server Copy
(base) ashish@ashish-Lenovo-ideapad-130-15IKB:~/Desktop/git_practical/server/repo_for_testing$ echo " " > 20220915_2336.html (base) ashish@ashish-Lenovo-ideapad-130-15IKB:~/Desktop/git_practical/server/repo_for_testing$ git add -A (base) ashish@ashish-Lenovo-ideapad-130-15IKB:~/Desktop/git_practical/server/repo_for_testing$ git commit -m "20220915 II" [main 80b40f5] 20220915 II 1 file changed, 1 insertion(+) create mode 100644 20220915_2336.html (base) ashish@ashish-Lenovo-ideapad-130-15IKB:~/Desktop/git_practical/server/repo_for_testing$ git push Username for 'https://github.com': ashishjain1547@gmail.com Password for 'https://ashishjain1547@gmail.com@github.com': Enumerating objects: 3, done. Counting objects: 100% (3/3), done. Delta compression using up to 4 threads Compressing objects: 100% (2/2), done. Writing objects: 100% (2/2), 248 bytes | 248.00 KiB/s, done. Total 2 (delta 1), reused 0 (delta 0), pack-reused 0 remote: Resolving deltas: 100% (1/1), completed with 1 local object. To https://github.com/ashishjain1547/repo_for_testing.git b20128a..80b40f5 main -> mainRun Git Push Command on Local Copies Without Doing a Git Pull First.
Local Copy 1
(base) ashish@ashish-Lenovo-ideapad-130-15IKB:~/Desktop/git_practical/local 1$ cd repo_for_testing/ (base) ashish@ashish-Lenovo-ideapad-130-15IKB:~/Desktop/git_practical/local 1/repo_for_testing$ echo " " > 20220915_2340.txt (base) ashish@ashish-Lenovo-ideapad-130-15IKB:~/Desktop/git_practical/local 1/repo_for_testing$ git add -A (base) ashish@ashish-Lenovo-ideapad-130-15IKB:~/Desktop/git_practical/local 1/repo_for_testing$ git commit -m "20220915 Update on local copy 1" [main a01092f] 20220915 Update on local copy 1 1 file changed, 1 insertion(+) create mode 100644 20220915_2340.txt (base) ashish@ashish-Lenovo-ideapad-130-15IKB:~/Desktop/git_practical/local 1/repo_for_testing$ git push Username for 'https://github.com': ashishjain1547@gmail.com Password for 'https://ashishjain1547@gmail.com@github.com': To https://github.com/ashishjain1547/repo_for_testing.git ! [rejected] main -> main (fetch first) error: failed to push some refs to 'https://github.com/ashishjain1547/repo_for_testing.git' hint: Updates were rejected because the remote contains work that you do hint: not have locally. This is usually caused by another repository pushing hint: to the same ref. You may want to first integrate the remote changes hint: (e.g., 'git pull ...') before pushing again. hint: See the 'Note about fast-forwards' in 'git push --help' for details. (base) ashish@ashish-Lenovo-ideapad-130-15IKB:~/Desktop/git_practical/local 1/repo_for_testing$ (base) ashish@ashish-Lenovo-ideapad-130-15IKB:~/Desktop/git_practical/local 1/repo_for_testing$ git status On branch main Your branch is ahead of 'origin/main' by 1 commit. (use "git push" to publish your local commits) nothing to commit, working tree clean (base) ashish@ashish-Lenovo-ideapad-130-15IKB:~/Desktop/git_practical/local 1/repo_for_testing$ git pull Username for 'https://github.com': ashishjain1547@gmail.com Password for 'https://ashishjain1547@gmail.com@github.com': remote: Enumerating objects: 3, done. remote: Counting objects: 100% (3/3), done. remote: Compressing objects: 100% (1/1), done. remote: Total 2 (delta 1), reused 2 (delta 1), pack-reused 0 Unpacking objects: 100% (2/2), 228 bytes | 228.00 KiB/s, done. From https://github.com/ashishjain1547/repo_for_testing b20128a..80b40f5 main -> origin/main hint: You have divergent branches and need to specify how to reconcile them. hint: You can do so by running one of the following commands sometime before hint: your next pull: hint: hint: git config pull.rebase false # merge (the default strategy) hint: git config pull.rebase true # rebase hint: git config pull.ff only # fast-forward only hint: hint: You can replace "git config" with "git config --global" to set a default hint: preference for all repositories. You can also pass --rebase, --no-rebase, hint: or --ff-only on the command line to override the configured default per hint: invocation. fatal: Need to specify how to reconcile divergent branches. (base) ashish@ashish-Lenovo-ideapad-130-15IKB:~/Desktop/git_practical/local 1/repo_for_testing$ (base) ashish@ashish-Lenovo-ideapad-130-15IKB:~/Desktop/git_practical/local 1/repo_for_testing$ git status On branch main Your branch and 'origin/main' have diverged, and have 1 and 1 different commits each, respectively. (use "git pull" to merge the remote branch into yours) nothing to commit, working tree clean (base) ashish@ashish-Lenovo-ideapad-130-15IKB:~/Desktop/git_practical/local 1/repo_for_testing$ (base) ashish@ashish-Lenovo-ideapad-130-15IKB:~/Desktop/git_practical/local 1/repo_for_testing$ git log commit a01092fe6048d236bb71b1ea95d80e6084a340aa (HEAD -> main) Author: Ashish Jain <ashishjain1547@gmail.com> Date: Thu Sep 15 23:41:11 2022 +0530 20220915 Update on local copy 1 commit b20128a7b6148aa7ed668cfe2531a54418e61097 Author: Ashish Jain <ashishjain1547@gmail.com> Date: Thu Sep 15 23:21:37 2022 +0530 20220915 (base) ashish@ashish-Lenovo-ideapad-130-15IKB:~/Desktop/git_practical/local 1/repo_for_testing$ git pull Username for 'https://github.com': ashishjain1547@gmail.com Password for 'https://ashishjain1547@gmail.com@github.com': hint: You have divergent branches and need to specify how to reconcile them. hint: You can do so by running one of the following commands sometime before hint: your next pull: hint: hint: git config pull.rebase false # merge (the default strategy) hint: git config pull.rebase true # rebase hint: git config pull.ff only # fast-forward only hint: hint: You can replace "git config" with "git config --global" to set a default hint: preference for all repositories. You can also pass --rebase, --no-rebase, hint: or --ff-only on the command line to override the configured default per hint: invocation. fatal: Need to specify how to reconcile divergent branches. (base) ashish@ashish-Lenovo-ideapad-130-15IKB:~/Desktop/git_practical/local 1/repo_for_testing$ git config pull.rebase false (base) ashish@ashish-Lenovo-ideapad-130-15IKB:~/Desktop/git_practical/local 1/repo_for_testing$ git pull Username for 'https://github.com': ashishjain1547@gmail.com Password for 'https://ashishjain1547@gmail.com@github.com': Merge made by the 'ort' strategy. 20220915_2336.html | 1 + 1 file changed, 1 insertion(+) create mode 100644 20220915_2336.html (base) ashish@ashish-Lenovo-ideapad-130-15IKB:~/Desktop/git_practical/local 1/repo_for_testing$ ls -l total 64 -rw-rw-r-- 1 ashish ashish 29 Sep 15 23:31 20210528_test_branch.txt -rw-rw-r-- 1 ashish ashish 16 Sep 15 23:31 202107141543.txt -rw-rw-r-- 1 ashish ashish 16 Sep 15 23:31 202107141608.txt -rw-rw-r-- 1 ashish ashish 16 Sep 15 23:31 202107211228.txt -rw-rw-r-- 1 ashish ashish 12 Sep 15 23:31 202110111920.txt -rw-rw-r-- 1 ashish ashish 2 Sep 15 23:47 20220915_2336.html -rw-rw-r-- 1 ashish ashish 2 Sep 15 23:40 20220915_2340.txt -rw-rw-r-- 1 ashish ashish 2 Sep 15 23:31 20220915.txt -rw-rw-r-- 1 ashish ashish 7 Sep 15 23:31 Archana.txt -rw-rw-r-- 1 ashish ashish 45 Sep 15 23:31 Ashish -rw-rw-r-- 1 ashish ashish 11357 Sep 15 23:31 LICENSE -rw-rw-r-- 1 ashish ashish 10 Sep 15 23:31 newFile.txt -rw-rw-r-- 1 ashish ashish 36 Sep 15 23:31 README.md -rw-rw-r-- 1 ashish ashish 22 Sep 15 23:31 test_file_20210528.txt (base) ashish@ashish-Lenovo-ideapad-130-15IKB:~/Desktop/git_practical/local 1/repo_for_testing$ git log commit a24385b836c5e877571693b5e15a5a44512c1053 (HEAD -> main) Merge: a01092f 80b40f5 Author: Ashish Jain <ashishjain1547@gmail.com> Date: Thu Sep 15 23:47:47 2022 +0530 Merge branch 'main' of https://github.com/ashishjain1547/repo_for_testing commit a01092fe6048d236bb71b1ea95d80e6084a340aa Author: Ashish Jain <ashishjain1547@gmail.com> Date: Thu Sep 15 23:41:11 2022 +0530 20220915 Update on local copy 1 commit 80b40f50dcfebbcc39766c30ae5cb5b253f6d0ba (origin/main, origin/HEAD) Author: Ashish Jain <ashishjain1547@gmail.com> Date: Thu Sep 15 23:37:45 2022 +0530 20220915 IILocal copy is ahead of server by two commits.
(base) ashish@ashish-Lenovo-ideapad-130-15IKB:~/Desktop/git_practical/local 1/repo_for_testing$ git status On branch main Your branch is ahead of 'origin/main' by 2 commits. (use "git push" to publish your local commits) nothing to commit, working tree clean (base) ashish@ashish-Lenovo-ideapad-130-15IKB:~/Desktop/git_practical/local 1/repo_for_testing$ (base) ashish@ashish-Lenovo-ideapad-130-15IKB:~/Desktop/git_practical/local 1/repo_for_testing$ git push Username for 'https://github.com': ashishjain1547@gmail.com Password for 'https://ashishjain1547@gmail.com@github.com': Enumerating objects: 6, done. Counting objects: 100% (6/6), done. Delta compression using up to 4 threads Compressing objects: 100% (4/4), done. Writing objects: 100% (4/4), 529 bytes | 529.00 KiB/s, done. Total 4 (delta 2), reused 0 (delta 0), pack-reused 0 remote: Resolving deltas: 100% (2/2), completed with 1 local object. To https://github.com/ashishjain1547/repo_for_testing.git 80b40f5..a24385b main -> main (base) ashish@ashish-Lenovo-ideapad-130-15IKB:~/Desktop/git_practical/local 1/repo_for_testing$ git status On branch main Your branch is up to date with 'origin/main'. nothing to commit, working tree cleanLocal Copy 2
$ git config pull.rebase true # rebase
(base) ashish@ashish-Lenovo-ideapad-130-15IKB:~/Desktop/git_practical/local 2$ cd repo_for_testing/ (base) ashish@ashish-Lenovo-ideapad-130-15IKB:~/Desktop/git_practical/local 2/repo_for_testing$ ls -l total 56 -rw-rw-r-- 1 ashish ashish 29 Sep 15 23:33 20210528_test_branch.txt -rw-rw-r-- 1 ashish ashish 16 Sep 15 23:33 202107141543.txt -rw-rw-r-- 1 ashish ashish 16 Sep 15 23:33 202107141608.txt -rw-rw-r-- 1 ashish ashish 16 Sep 15 23:33 202107211228.txt -rw-rw-r-- 1 ashish ashish 12 Sep 15 23:33 202110111920.txt -rw-rw-r-- 1 ashish ashish 2 Sep 15 23:33 20220915.txt -rw-rw-r-- 1 ashish ashish 7 Sep 15 23:33 Archana.txt -rw-rw-r-- 1 ashish ashish 45 Sep 15 23:33 Ashish -rw-rw-r-- 1 ashish ashish 11357 Sep 15 23:33 LICENSE -rw-rw-r-- 1 ashish ashish 10 Sep 15 23:33 newFile.txt -rw-rw-r-- 1 ashish ashish 36 Sep 15 23:33 README.md -rw-rw-r-- 1 ashish ashish 22 Sep 15 23:33 test_file_20210528.txt (base) ashish@ashish-Lenovo-ideapad-130-15IKB:~/Desktop/git_practical/local 2/repo_for_testing$ (base) ashish@ashish-Lenovo-ideapad-130-15IKB:~/Desktop/git_practical/local 2/repo_for_testing$ git status On branch main Your branch is up to date with 'origin/main'. nothing to commit, working tree clean (base) ashish@ashish-Lenovo-ideapad-130-15IKB:~/Desktop/git_practical/local 2/repo_for_testing$ (base) ashish@ashish-Lenovo-ideapad-130-15IKB:~/Desktop/git_practical/local 2/repo_for_testing$ echo "local copy 2" > 20220915_local_copy_2.txt (base) ashish@ashish-Lenovo-ideapad-130-15IKB:~/Desktop/git_practical/local 2/repo_for_testing$ git add -A (base) ashish@ashish-Lenovo-ideapad-130-15IKB:~/Desktop/git_practical/local 2/repo_for_testing$ git commit -m "local copy 2" [main 824f879] local copy 2 1 file changed, 1 insertion(+) create mode 100644 20220915_local_copy_2.txt (base) ashish@ashish-Lenovo-ideapad-130-15IKB:~/Desktop/git_practical/local 2/repo_for_testing$ git push Username for 'https://github.com': ashishjain1547@gmail.com Password for 'https://ashishjain1547@gmail.com@github.com': To https://github.com/ashishjain1547/repo_for_testing.git ! [rejected] main -> main (fetch first) error: failed to push some refs to 'https://github.com/ashishjain1547/repo_for_testing.git' hint: Updates were rejected because the remote contains work that you do hint: not have locally. This is usually caused by another repository pushing hint: to the same ref. You may want to first integrate the remote changes hint: (e.g., 'git pull ...') before pushing again. hint: See the 'Note about fast-forwards' in 'git push --help' for details. (base) ashish@ashish-Lenovo-ideapad-130-15IKB:~/Desktop/git_practical/local 2/repo_for_testing$ (base) ashish@ashish-Lenovo-ideapad-130-15IKB:~/Desktop/git_practical/local 2/repo_for_testing$ git status On branch main Your branch is ahead of 'origin/main' by 1 commit. (use "git push" to publish your local commits) nothing to commit, working tree clean (base) ashish@ashish-Lenovo-ideapad-130-15IKB:~/Desktop/git_practical/local 2/repo_for_testing$ git pull Username for 'https://github.com': ashishjain1547@gmail.com Password for 'https://ashishjain1547@gmail.com@github.com': remote: Enumerating objects: 7, done. remote: Counting objects: 100% (7/7), done. remote: Compressing objects: 100% (4/4), done. remote: Total 6 (delta 4), reused 4 (delta 2), pack-reused 0 Unpacking objects: 100% (6/6), 623 bytes | 311.00 KiB/s, done. From https://github.com/ashishjain1547/repo_for_testing b20128a..a24385b main -> origin/main hint: You have divergent branches and need to specify how to reconcile them. hint: You can do so by running one of the following commands sometime before hint: your next pull: hint: hint: git config pull.rebase false # merge (the default strategy) hint: git config pull.rebase true # rebase hint: git config pull.ff only # fast-forward only hint: hint: You can replace "git config" with "git config --global" to set a default hint: preference for all repositories. You can also pass --rebase, --no-rebase, hint: or --ff-only on the command line to override the configured default per hint: invocation. fatal: Need to specify how to reconcile divergent branches. (base) ashish@ashish-Lenovo-ideapad-130-15IKB:~/Desktop/git_practical/local 2/repo_for_testing$ git status On branch main Your branch and 'origin/main' have diverged, and have 1 and 3 different commits each, respectively. (use "git pull" to merge the remote branch into yours) nothing to commit, working tree clean (base) ashish@ashish-Lenovo-ideapad-130-15IKB:~/Desktop/git_practical/local 2/repo_for_testing$ (base) ashish@ashish-Lenovo-ideapad-130-15IKB:~/Desktop/git_practical/local 2/repo_for_testing$ git config pull.rebase true (base) ashish@ashish-Lenovo-ideapad-130-15IKB:~/Desktop/git_practical/local 2/repo_for_testing$ git pull Username for 'https://github.com': ashishjain1547@gmail.com Password for 'https://ashishjain1547@gmail.com@github.com': Successfully rebased and updated refs/heads/main. (base) ashish@ashish-Lenovo-ideapad-130-15IKB:~/Desktop/git_practical/local 2/repo_for_testing$ (base) ashish@ashish-Lenovo-ideapad-130-15IKB:~/Desktop/git_practical/local 2/repo_for_testing$ ls -l total 68 -rw-rw-r-- 1 ashish ashish 29 Sep 15 23:33 20210528_test_branch.txt -rw-rw-r-- 1 ashish ashish 16 Sep 15 23:33 202107141543.txt -rw-rw-r-- 1 ashish ashish 16 Sep 15 23:33 202107141608.txt -rw-rw-r-- 1 ashish ashish 16 Sep 15 23:33 202107211228.txt -rw-rw-r-- 1 ashish ashish 12 Sep 15 23:33 202110111920.txt -rw-rw-r-- 1 ashish ashish 2 Sep 16 00:00 20220915_2336.html -rw-rw-r-- 1 ashish ashish 2 Sep 16 00:00 20220915_2340.txt -rw-rw-r-- 1 ashish ashish 13 Sep 16 00:00 20220915_local_copy_2.txt -rw-rw-r-- 1 ashish ashish 2 Sep 15 23:33 20220915.txt -rw-rw-r-- 1 ashish ashish 7 Sep 15 23:33 Archana.txt -rw-rw-r-- 1 ashish ashish 45 Sep 15 23:33 Ashish -rw-rw-r-- 1 ashish ashish 11357 Sep 15 23:33 LICENSE -rw-rw-r-- 1 ashish ashish 10 Sep 15 23:33 newFile.txt -rw-rw-r-- 1 ashish ashish 36 Sep 15 23:33 README.md -rw-rw-r-- 1 ashish ashish 22 Sep 15 23:33 test_file_20210528.txt (base) ashish@ashish-Lenovo-ideapad-130-15IKB:~/Desktop/git_practical/local 2/repo_for_testing$ git status On branch main Your branch is ahead of 'origin/main' by 1 commit. (use "git push" to publish your local commits) nothing to commit, working tree clean (base) ashish@ashish-Lenovo-ideapad-130-15IKB:~/Desktop/git_practical/local 2/repo_for_testing$ git log commit 858945ca963a48977eea5682e6dc54eb1f87eba1 (HEAD -> main) Author: Ashish Jain <ashishjain1547@gmail.com> Date: Thu Sep 15 23:58:20 2022 +0530 local copy 2 commit a24385b836c5e877571693b5e15a5a44512c1053 (origin/main, origin/HEAD) Merge: a01092f 80b40f5 Author: Ashish Jain <ashishjain1547@gmail.com> Date: Thu Sep 15 23:47:47 2022 +0530 Merge branch 'main' of https://github.com/ashishjain1547/repo_for_testing commit a01092fe6048d236bb71b1ea95d80e6084a340aa Author: Ashish Jain <ashishjain1547@gmail.com> Date: Thu Sep 15 23:41:11 2022 +0530 20220915 Update on local copy 1 commit 80b40f50dcfebbcc39766c30ae5cb5b253f6d0ba Author: Ashish Jain <ashishjain1547@gmail.com> Date: Thu Sep 15 23:37:45 2022 +0530 20220915 II commit b20128a7b6148aa7ed668cfe2531a54418e61097 Author: Ashish Jain <ashishjain1547@gmail.com> Date: Thu Sep 15 23:21:37 2022 +0530 20220915 (base) ashish@ashish-Lenovo-ideapad-130-15IKB:~/Desktop/git_practical/local 2/repo_for_testing$ (base) ashish@ashish-Lenovo-ideapad-130-15IKB:~/Desktop/git_practical/local 2/repo_for_testing$ git status On branch main Your branch is ahead of 'origin/main' by 1 commit. (use "git push" to publish your local commits) nothing to commit, working tree clean (base) ashish@ashish-Lenovo-ideapad-130-15IKB:~/Desktop/git_practical/local 2/repo_for_testing$ git push Username for 'https://github.com': ashishjain1547@gmail.com Password for 'https://ashishjain1547@gmail.com@github.com': Enumerating objects: 4, done. Counting objects: 100% (4/4), done. Delta compression using up to 4 threads Compressing objects: 100% (2/2), done. Writing objects: 100% (3/3), 305 bytes | 305.00 KiB/s, done. Total 3 (delta 1), reused 0 (delta 0), pack-reused 0 remote: Resolving deltas: 100% (1/1), completed with 1 local object. To https://github.com/ashishjain1547/repo_for_testing.git a24385b..858945c main -> main (base) ashish@ashish-Lenovo-ideapad-130-15IKB:~/Desktop/git_practical/local 2/repo_for_testing$ git status On branch main Your branch is up to date with 'origin/main'. nothing to commit, working tree clean (base) ashish@ashish-Lenovo-ideapad-130-15IKB:~/Desktop/git_practical/local 2/repo_for_testing$Local Copy 3
$ git config pull.ff only # fast-forward only
(base) ashish@ashish-Lenovo-ideapad-130-15IKB:~/Desktop/git_practical/local 3$ cd repo_for_testing/ (base) ashish@ashish-Lenovo-ideapad-130-15IKB:~/Desktop/git_practical/local 3/repo_for_testing$ git status On branch main Your branch is up to date with 'origin/main'. nothing to commit, working tree clean (base) ashish@ashish-Lenovo-ideapad-130-15IKB:~/Desktop/git_practical/local 3/repo_for_testing$ ls -l total 56 -rw-rw-r-- 1 ashish ashish 29 Sep 15 23:34 20210528_test_branch.txt -rw-rw-r-- 1 ashish ashish 16 Sep 15 23:34 202107141543.txt -rw-rw-r-- 1 ashish ashish 16 Sep 15 23:34 202107141608.txt -rw-rw-r-- 1 ashish ashish 16 Sep 15 23:34 202107211228.txt -rw-rw-r-- 1 ashish ashish 12 Sep 15 23:34 202110111920.txt -rw-rw-r-- 1 ashish ashish 2 Sep 15 23:34 20220915.txt -rw-rw-r-- 1 ashish ashish 7 Sep 15 23:34 Archana.txt -rw-rw-r-- 1 ashish ashish 45 Sep 15 23:34 Ashish -rw-rw-r-- 1 ashish ashish 11357 Sep 15 23:34 LICENSE -rw-rw-r-- 1 ashish ashish 10 Sep 15 23:34 newFile.txt -rw-rw-r-- 1 ashish ashish 36 Sep 15 23:34 README.md -rw-rw-r-- 1 ashish ashish 22 Sep 15 23:34 test_file_20210528.txt (base) ashish@ashish-Lenovo-ideapad-130-15IKB:~/Desktop/git_practical/local 3/repo_for_testing$ (base) ashish@ashish-Lenovo-ideapad-130-15IKB:~/Desktop/git_practical/local 3/repo_for_testing$ echo "local copy 3" > 20220915_local_copy_3.txt (base) ashish@ashish-Lenovo-ideapad-130-15IKB:~/Desktop/git_practical/local 3/repo_for_testing$ git add -A (base) ashish@ashish-Lenovo-ideapad-130-15IKB:~/Desktop/git_practical/local 3/repo_for_testing$ git commit -m "#" [main 5c8d1ff] # 1 file changed, 1 insertion(+) create mode 100644 20220915_local_copy_3.txt (base) ashish@ashish-Lenovo-ideapad-130-15IKB:~/Desktop/git_practical/local 3/repo_for_testing$ git push Username for 'https://github.com': ashishjain1547@gmail.com Password for 'https://ashishjain1547@gmail.com@github.com': To https://github.com/ashishjain1547/repo_for_testing.git ! [rejected] main -> main (fetch first) error: failed to push some refs to 'https://github.com/ashishjain1547/repo_for_testing.git' hint: Updates were rejected because the remote contains work that you do hint: not have locally. This is usually caused by another repository pushing hint: to the same ref. You may want to first integrate the remote changes hint: (e.g., 'git pull ...') before pushing again. hint: See the 'Note about fast-forwards' in 'git push --help' for details. (base) ashish@ashish-Lenovo-ideapad-130-15IKB:~/Desktop/git_practical/local 3/repo_for_testing$ (base) ashish@ashish-Lenovo-ideapad-130-15IKB:~/Desktop/git_practical/local 3/repo_for_testing$ git status On branch main Your branch is ahead of 'origin/main' by 1 commit. (use "git push" to publish your local commits) nothing to commit, working tree clean (base) ashish@ashish-Lenovo-ideapad-130-15IKB:~/Desktop/git_practical/local 3/repo_for_testing$ git pull Username for 'https://github.com': ashishjain1547@gmail.com Password for 'https://ashishjain1547@gmail.com@github.com': remote: Enumerating objects: 10, done. remote: Counting objects: 100% (10/10), done. remote: Compressing objects: 100% (6/6), done. remote: Total 9 (delta 5), reused 6 (delta 2), pack-reused 0 Unpacking objects: 100% (9/9), 875 bytes | 437.00 KiB/s, done. From https://github.com/ashishjain1547/repo_for_testing b20128a..858945c main -> origin/main hint: You have divergent branches and need to specify how to reconcile them. hint: You can do so by running one of the following commands sometime before hint: your next pull: hint: hint: git config pull.rebase false # merge (the default strategy) hint: git config pull.rebase true # rebase hint: git config pull.ff only # fast-forward only hint: hint: You can replace "git config" with "git config --global" to set a default hint: preference for all repositories. You can also pass --rebase, --no-rebase, hint: or --ff-only on the command line to override the configured default per hint: invocation. fatal: Need to specify how to reconcile divergent branches. (base) ashish@ashish-Lenovo-ideapad-130-15IKB:~/Desktop/git_practical/local 3/repo_for_testing$ git status On branch main Your branch and 'origin/main' have diverged, and have 1 and 4 different commits each, respectively. (use "git pull" to merge the remote branch into yours) nothing to commit, working tree clean (base) ashish@ashish-Lenovo-ideapad-130-15IKB:~/Desktop/git_practical/local 3/repo_for_testing$ (base) ashish@ashish-Lenovo-ideapad-130-15IKB:~/Desktop/git_practical/local 3/repo_for_testing$ (base) ashish@ashish-Lenovo-ideapad-130-15IKB:~/Desktop/git_practical/local 3/repo_for_testing$ git config pull.ff only (base) ashish@ashish-Lenovo-ideapad-130-15IKB:~/Desktop/git_practical/local 3/repo_for_testing$ ls -l total 60 -rw-rw-r-- 1 ashish ashish 29 Sep 15 23:34 20210528_test_branch.txt -rw-rw-r-- 1 ashish ashish 16 Sep 15 23:34 202107141543.txt -rw-rw-r-- 1 ashish ashish 16 Sep 15 23:34 202107141608.txt -rw-rw-r-- 1 ashish ashish 16 Sep 15 23:34 202107211228.txt -rw-rw-r-- 1 ashish ashish 12 Sep 15 23:34 202110111920.txt -rw-rw-r-- 1 ashish ashish 13 Sep 16 00:14 20220915_local_copy_3.txt -rw-rw-r-- 1 ashish ashish 2 Sep 15 23:34 20220915.txt -rw-rw-r-- 1 ashish ashish 7 Sep 15 23:34 Archana.txt -rw-rw-r-- 1 ashish ashish 45 Sep 15 23:34 Ashish -rw-rw-r-- 1 ashish ashish 11357 Sep 15 23:34 LICENSE -rw-rw-r-- 1 ashish ashish 10 Sep 15 23:34 newFile.txt -rw-rw-r-- 1 ashish ashish 36 Sep 15 23:34 README.md -rw-rw-r-- 1 ashish ashish 22 Sep 15 23:34 test_file_20210528.txt (base) ashish@ashish-Lenovo-ideapad-130-15IKB:~/Desktop/git_practical/local 3/repo_for_testing$ (base) ashish@ashish-Lenovo-ideapad-130-15IKB:~/Desktop/git_practical/local 3/repo_for_testing$ (base) ashish@ashish-Lenovo-ideapad-130-15IKB:~/Desktop/git_practical/local 3/repo_for_testing$ git status On branch main Your branch and 'origin/main' have diverged, and have 1 and 4 different commits each, respectively. (use "git pull" to merge the remote branch into yours) nothing to commit, working tree clean (base) ashish@ashish-Lenovo-ideapad-130-15IKB:~/Desktop/git_practical/local 3/repo_for_testing$ git log commit 5c8d1ff9d1e3d40daabf2b7cbcdc9f9b4e9003b3 (HEAD -> main) Author: Ashish Jain <ashishjain1547@gmail.com> Date: Fri Sep 16 00:14:43 2022 +0530 # commit b20128a7b6148aa7ed668cfe2531a54418e61097 Author: Ashish Jain <ashishjain1547@gmail.com> Date: Thu Sep 15 23:21:37 2022 +0530 20220915 commit 335cb1656a8b862733936531d0e00da92cea7f8f (origin/test_branch) Author: Ashish Jain <ashishjain1547@gmail.com> Date: Mon Oct 11 19:39:46 2021 +0530 Create Ashish commit 99da43ac015c1ed065796b4681ce2fdfd34d426c Author: unknown <ashishjain1547@gmail.com> Date: Mon Oct 11 19:37:33 2021 +0530 We will push this code with new file named Archana. commit be275fd83426869e3d8a27f8346ab903d6343faa Author: unknown <ashishjain1547@gmail.com> Date: Mon Oct 11 19:20:28 2021 +0530 20211011 1920 commit 9f1b42fe6b2cf1fbc3781cdb463b284f871ad291 Merge: d210505 087a5ca Author: unknown <ashishjain1547@gmail.com> Date: Wed Jul 21 12:41:37 2021 +0530 Merge branch 'test_branch' into main commit 087a5ca85b88f7303d025e8770183a6eabbeca7a Author: unknown <ashishjain1547@gmail.com> Date: Wed Jul 21 12:29:09 2021 +0530 20210721 1229 commit d2105058469fdb461a61578f8672e769d4426d79 Merge: daa4600 9017804 Author: Ashish Jain <ashishjain1547@gmail.com> Date: Wed Jul 14 16:25:29 2021 +0530 Merge pull request #1 from ashishjain1547/test_branch Test branch commit 901780465a07e7ce78932226db29a0898a07f4a2 Author: unknown <ashishjain1547@gmail.com> (base) ashish@ashish-Lenovo-ideapad-130-15IKB:~/Desktop/git_practical/local 3/repo_for_testing$ (base) ashish@ashish-Lenovo-ideapad-130-15IKB:~/Desktop/git_practical/local 3/repo_for_testing$ git pull Username for 'https://github.com': ashishjain1547@gmail.com Password for 'https://ashishjain1547@gmail.com@github.com': remote: Support for password authentication was removed on August 13, 2021. remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication. fatal: Authentication failed for 'https://github.com/ashishjain1547/repo_for_testing.git/' (base) ashish@ashish-Lenovo-ideapad-130-15IKB:~/Desktop/git_practical/local 3/repo_for_testing$ git pull Username for 'https://github.com': ashishjain1547@gmail.com Password for 'https://ashishjain1547@gmail.com@github.com': fatal: Not possible to fast-forward, aborting. (base) ashish@ashish-Lenovo-ideapad-130-15IKB:~/Desktop/git_practical/local 3/repo_for_testing$ (base) ashish@ashish-Lenovo-ideapad-130-15IKB:~/Desktop/git_practical/local 3/repo_for_testing$ git status On branch main Your branch and 'origin/main' have diverged, and have 1 and 4 different commits each, respectively. (use "git pull" to merge the remote branch into yours) nothing to commit, working tree clean (base) ashish@ashish-Lenovo-ideapad-130-15IKB:~/Desktop/git_practical/local 3/repo_for_testing$ git log commit 5c8d1ff9d1e3d40daabf2b7cbcdc9f9b4e9003b3 (HEAD -> main) Author: Ashish Jain <ashishjain1547@gmail.com> Date: Fri Sep 16 00:14:43 2022 +0530 # commit b20128a7b6148aa7ed668cfe2531a54418e61097 Author: Ashish Jain <ashishjain1547@gmail.com> Date: Thu Sep 15 23:21:37 2022 +0530 20220915 commit 335cb1656a8b862733936531d0e00da92cea7f8f (origin/test_branch) Author: Ashish Jain <ashishjain1547@gmail.com> Date: Mon Oct 11 19:39:46 2021 +0530 Create Ashish commit 99da43ac015c1ed065796b4681ce2fdfd34d426c Author: unknown <ashishjain1547@gmail.com> Date: Mon Oct 11 19:37:33 2021 +0530 We will push this code with new file named Archana. commit be275fd83426869e3d8a27f8346ab903d6343faa Author: unknown <ashishjain1547@gmail.com> Date: Mon Oct 11 19:20:28 2021 +0530 20211011 1920 commit 9f1b42fe6b2cf1fbc3781cdb463b284f871ad291 Merge: d210505 087a5ca Author: unknown <ashishjain1547@gmail.com> Date: Wed Jul 21 12:41:37 2021 +0530 Merge branch 'test_branch' into main commit 087a5ca85b88f7303d025e8770183a6eabbeca7a Author: unknown <ashishjain1547@gmail.com> Date: Wed Jul 21 12:29:09 2021 +0530 20210721 1229 commit d2105058469fdb461a61578f8672e769d4426d79 Merge: daa4600 9017804 Author: Ashish Jain <ashishjain1547@gmail.com> Date: Wed Jul 14 16:25:29 2021 +0530 Merge pull request #1 from ashishjain1547/test_branch Test branch commit 901780465a07e7ce78932226db29a0898a07f4a2 Author: unknown <ashishjain1547@gmail.com> (base) ashish@ashish-Lenovo-ideapad-130-15IKB:~/Desktop/git_practical/local 3/repo_for_testing$ (base) ashish@ashish-Lenovo-ideapad-130-15IKB:~/Desktop/git_practical/local 3/repo_for_testing$ (base) ashish@ashish-Lenovo-ideapad-130-15IKB:~/Desktop/git_practical/local 3/repo_for_testing$
Thursday, September 15, 2022
You have divergent branches and need to specify out of three options (merge, rebase, fast-forward) how to reconcile them. What to do?
Thursday, August 26, 2021
Command 'git stash'
(base) C:\Users\Ashish Jain\OneDrive\Desktop\(1)\repo_for_testing>git stash No local changes to save (base) C:\Users\Ashish Jain\OneDrive\Desktop\(1)\repo_for_testing>git status On branch main Your branch is up to date with 'origin/main'. nothing to commit, working tree clean (base) C:\Users\Ashish Jain\OneDrive\Desktop\(1)\repo_for_testing> echo "20210826" > 20210826.txt (base) C:\Users\Ashish Jain\OneDrive\Desktop\(1)\repo_for_testing>git status On branch main Your branch is up to date with 'origin/main'. Untracked files: (use "git add <file>..." to include in what will be committed) 20210826.txt nothing added to commit but untracked files present (use "git add" to track) (base) C:\Users\Ashish Jain\OneDrive\Desktop\(1)\repo_for_testing>git stash No local changes to save (base) C:\Users\Ashish Jain\OneDrive\Desktop\(1)\repo_for_testing>git add -A (base) C:\Users\Ashish Jain\OneDrive\Desktop\(1)\repo_for_testing>git status On branch main Your branch is up to date with 'origin/main'. Changes to be committed: (use "git restore --staged <file>..." to unstage) new file: 20210826.txt (base) C:\Users\Ashish Jain\OneDrive\Desktop\(1)\repo_for_testing>git stash Saved working directory and index state WIP on main: 9f1b42f Merge branch 'test_branch' into main (base) C:\Users\Ashish Jain\OneDrive\Desktop\(1)\repo_for_testing>git branch * mainNo changes appear in "Git Log"
1: Here we have stashed changes. (base) C:\Users\Ashish Jain\OneDrive\Desktop\(1)\repo_for_testing>git log commit 9f1b42fe6b2cf1fbc3781cdb463b284f871ad291 (HEAD -> main, origin/test_branch, origin/main, origin/HEAD) Merge: d210505 087a5ca Author: unknown <ashishjain1547@gmail.com> Date: Wed Jul 21 12:41:37 2021 +0530 Merge branch 'test_branch' into main commit 087a5ca85b88f7303d025e8770183a6eabbeca7a Author: unknown <ashishjain1547@gmail.com> Date: Wed Jul 21 12:29:09 2021 +0530 20210721 1229 2: C:\Users\Ashish Jain\OneDrive\Desktop\(2)\repo_for_testing>git log commit 9f1b42fe6b2cf1fbc3781cdb463b284f871ad291 (HEAD -> main, origin/test_branch, origin/main, origin/HEAD) Merge: d210505 087a5ca Author: unknown <ashishjain1547@gmail.com> Date: Wed Jul 21 12:41:37 2021 +0530 Merge branch 'test_branch' into main commit 087a5ca85b88f7303d025e8770183a6eabbeca7a Author: unknown <ashishjain1547@gmail.com> Date: Wed Jul 21 12:29:09 2021 +0530 20210721 1229Now We Apply Our Stashaed Changes Again
C:\Users\Ashish Jain\OneDrive\Desktop\(1)\repo_for_testing>git status On branch main Your branch is up to date with 'origin/main'. nothing to commit, working tree clean C:\Users\Ashish Jain\OneDrive\Desktop\(1)\repo_for_testing>dir Volume in drive C is Windows Volume Serial Number is 8139-90C0 Directory of C:\Users\Ashish Jain\OneDrive\Desktop\(1)\repo_for_testing 08/26/2021 06:05 PM <DIR> . 08/26/2021 06:05 PM <DIR> .. 08/26/2021 04:15 PM 368 .gitignore 08/26/2021 04:15 PM 30 20210528_test_branch.txt 08/26/2021 04:15 PM 17 202107141543.txt 08/26/2021 04:15 PM 17 202107141608.txt 08/26/2021 04:15 PM 17 202107211228.txt 08/26/2021 04:15 PM 11,558 LICENSE 08/26/2021 04:15 PM 11 newFile.txt 08/26/2021 04:15 PM 38 README.md 08/26/2021 04:15 PM 23 test_file_20210528.txt 9 File(s) 12,079 bytes 2 Dir(s) 66,473,070,592 bytes free C:\Users\Ashish Jain\OneDrive\Desktop\(1)\repo_for_testing>git stash list stash@{0}: WIP on main: 9f1b42f Merge branch 'test_branch' into main C:\Users\Ashish Jain\OneDrive\Desktop\(1)\repo_for_testing>git show commit 9f1b42fe6b2cf1fbc3781cdb463b284f871ad291 (HEAD -> main, origin/test_branch, origin/main, origin/HEAD) Merge: d210505 087a5ca Author: unknown <ashishjain1547@gmail.com> Date: Wed Jul 21 12:41:37 2021 +0530 Merge branch 'test_branch' into main C:\Users\Ashish Jain\OneDrive\Desktop\(1)\repo_for_testing>git stash apply On branch main Your branch is up to date with 'origin/main'. Changes to be committed: (use "git restore --staged <file>..." to unstage) new file: 20210826.txt C:\Users\Ashish Jain\OneDrive\Desktop\(1)\repo_for_testing>git status On branch main Your branch is up to date with 'origin/main'. Changes to be committed: (use "git restore --staged <file>..." to unstage) new file: 20210826.txt C:\Users\Ashish Jain\OneDrive\Desktop\(1)\repo_for_testing>dir Volume in drive C is Windows Volume Serial Number is 8139-90C0 Directory of C:\Users\Ashish Jain\OneDrive\Desktop\(1)\repo_for_testing 08/26/2021 06:16 PM <DIR> . 08/26/2021 06:16 PM <DIR> .. 08/26/2021 04:15 PM 368 .gitignore 08/26/2021 04:15 PM 30 20210528_test_branch.txt 08/26/2021 04:15 PM 17 202107141543.txt 08/26/2021 04:15 PM 17 202107141608.txt 08/26/2021 04:15 PM 17 202107211228.txt 08/26/2021 06:16 PM 13 20210826.txt 08/26/2021 04:15 PM 11,558 LICENSE 08/26/2021 04:15 PM 11 newFile.txt 08/26/2021 04:15 PM 38 README.md 08/26/2021 04:15 PM 23 test_file_20210528.txt 10 File(s) 12,092 bytes 2 Dir(s) 66,475,622,400 bytes free C:\Users\Ashish Jain\OneDrive\Desktop\(1)\repo_for_testing> C:\Users\Ashish Jain\OneDrive\Desktop\(1)\repo_for_testing> C:\Users\Ashish Jain\OneDrive\Desktop\(1)\repo_for_testing>git stash show 20210826.txt | 1 + 1 file changed, 1 insertion(+) C:\Users\Ashish Jain\OneDrive\Desktop\(1)\repo_for_testing>git stash list stash@{0}: WIP on main: 9f1b42f Merge branch 'test_branch' into main C:\Users\Ashish Jain\OneDrive\Desktop\(1)\repo_for_testing>git stash clear C:\Users\Ashish Jain\OneDrive\Desktop\(1)\repo_for_testing>git stash list C:\Users\Ashish Jain\OneDrive\Desktop\(1)\repo_for_testing>git stash show No stash entries found. C:\Users\Ashish Jain\OneDrive\Desktop\(1)\repo_for_testing> Ref: git-scm Tags: Technology,GitHub,
Command 'git config'
Git config variables can be stored in 3 different levels. Each level overrides values in the previous level. --global use global config file --system use system config file --local use repository config file - - - - - - - - - - (base) CMD> git config usage: git config [<options>] Config file location --global use global config file --system use system config file --local use repository config file --worktree use per-worktree config file -f, --file <file> use given config file --blob <blob-id> read config from given blob object Action --get get value: name [value-regex] --get-all get all values: key [value-regex] --get-regexp get values for regexp: name-regex [value-regex] --get-urlmatch get value specific for the URL: section[.var] URL --replace-all replace all matching variables: name value [value_regex] --add add a new variable: name value --unset remove a variable: name [value-regex] --unset-all remove all matches: name [value-regex] --rename-section rename section: old-name new-name --remove-section remove a section: name -l, --list list all -e, --edit open an editor --get-color find the color configured: slot [default] --get-colorbool find the color setting: slot [stdout-is-tty] Type -t, --type <> value is given this type --bool value is "true" or "false" --int value is decimal number --bool-or-int value is --bool or --int --path value is a path (file or directory name) --expiry-date value is an expiry date Other -z, --null terminate values with NUL byte --name-only show variable names only --includes respect include directives on lookup --show-origin show origin of config (file, standard input, blob, command line) --show-scope show scope of config (worktree, local, global, system, command) --default <value> with --get, use default value when missing entry - - - - - - - - - - (base) CMD> git config --list http.sslcainfo=E:/programfiles/Git/mingw64/ssl/certs/ca-bundle.crt http.sslbackend=openssl diff.astextplain.textconv=astextplain filter.lfs.clean=git-lfs clean -- %f filter.lfs.smudge=git-lfs smudge -- %f filter.lfs.process=git-lfs filter-process filter.lfs.required=true credential.helper=manager add.interactive.usebuiltin=true core.editor="E:\\programfiles\\Microsoft VS Code\\Code.exe" --wait core.autocrlf=true core.fscache=true core.symlinks=true pull.rebase=false user.email=ashishjain1547@gmail.com filter.lfs.required=true filter.lfs.clean=git-lfs clean -- %f filter.lfs.smudge=git-lfs smudge -- %f filter.lfs.process=git-lfs filter-process* - - - - - - - - - - (base) C:\Users\Ashish Jain\OneDrive\Desktop>git config --get user.email ashishjain1547@gmail.com If a variable is not set, it returns empty line and fails silently. (base) C:\Users\Ashish Jain\OneDrive\Desktop>git config --get user.name (base) C:\Users\Ashish Jain\OneDrive\Desktop> - - - - - - - - - -Check Global Configurations:
(base) C:\Users\Ashish Jain>cd C:\Users\Ashish Jain (base) C:\Users\Ashish Jain>dir .gitconfig Volume in drive C is Windows Volume Serial Number is 8139-90C0 Directory of C:\Users\Ashish Jain 05/03/2021 09:52 PM 167 .gitconfig 1 File(s) 167 bytes 0 Dir(s) 66,402,430,976 bytes free ~~~ (base) C:\Users\Ashish Jain>type .gitconfig [user] email = ashishjain1547@gmail.com [filter "lfs"] required = true clean = git-lfs clean -- %f smudge = git-lfs smudge -- %f process = git-lfs filter-process - - - - - - - - - -How to view all settings?
Run git config --list, showing system, global, and (if inside a repository) local configs Run git config --list --show-origin, also shows the origin file of each config item (base) C:\Users\Ashish Jain>git config --list --show-origin file:E:/programfiles/Git/etc/gitconfig http.sslcainfo=E:/programfiles/Git/mingw64/ssl/certs/ca-bundle.crt file:E:/programfiles/Git/etc/gitconfig http.sslbackend=openssl file:E:/programfiles/Git/etc/gitconfig diff.astextplain.textconv=astextplain file:E:/programfiles/Git/etc/gitconfig filter.lfs.clean=git-lfs clean -- %f file:E:/programfiles/Git/etc/gitconfig filter.lfs.smudge=git-lfs smudge -- %f file:E:/programfiles/Git/etc/gitconfig filter.lfs.process=git-lfs filter-process file:E:/programfiles/Git/etc/gitconfig filter.lfs.required=true file:E:/programfiles/Git/etc/gitconfig credential.helper=manager file:E:/programfiles/Git/etc/gitconfig add.interactive.usebuiltin=true file:E:/programfiles/Git/etc/gitconfig core.editor="E:\\programfiles\\Microsoft VS Code\\Code.exe" --wait file:E:/programfiles/Git/etc/gitconfig core.autocrlf=true file:E:/programfiles/Git/etc/gitconfig core.fscache=true file:E:/programfiles/Git/etc/gitconfig core.symlinks=true file:E:/programfiles/Git/etc/gitconfig pull.rebase=false file:C:/Users/Ashish Jain/.gitconfig user.email=ashishjain1547@gmail.com file:C:/Users/Ashish Jain/.gitconfig filter.lfs.required=true file:C:/Users/Ashish Jain/.gitconfig filter.lfs.clean=git-lfs clean -- %f file:C:/Users/Ashish Jain/.gitconfig filter.lfs.smudge=git-lfs smudge -- %f file:C:/Users/Ashish Jain/.gitconfig filter.lfs.process=git-lfs filter-process - - - - - - - - - -When We Are in a Repository:
(base) C:\Users\Ashish Jain>cd C:\Users\Ashish Jain\OneDrive\Desktop\repo_for_testing (base) C:\Users\Ashish Jain\OneDrive\Desktop\repo_for_testing> (base) C:\Users\Ashish Jain\OneDrive\Desktop\repo_for_testing>cd C:\Users\Ashish Jain\OneDrive\Desktop\repo_for_testing (base) C:\Users\Ashish Jain\OneDrive\Desktop\repo_for_testing>git config --list --show-origin file:E:/programfiles/Git/etc/gitconfig http.sslcainfo=E:/programfiles/Git/mingw64/ssl/certs/ca-bundle.crt file:E:/programfiles/Git/etc/gitconfig http.sslbackend=openssl file:E:/programfiles/Git/etc/gitconfig diff.astextplain.textconv=astextplain file:E:/programfiles/Git/etc/gitconfig filter.lfs.clean=git-lfs clean -- %f file:E:/programfiles/Git/etc/gitconfig filter.lfs.smudge=git-lfs smudge -- %f file:E:/programfiles/Git/etc/gitconfig filter.lfs.process=git-lfs filter-process file:E:/programfiles/Git/etc/gitconfig filter.lfs.required=true file:E:/programfiles/Git/etc/gitconfig credential.helper=manager file:E:/programfiles/Git/etc/gitconfig add.interactive.usebuiltin=true file:E:/programfiles/Git/etc/gitconfig core.editor="E:\\programfiles\\Microsoft VS Code\\Code.exe" --wait file:E:/programfiles/Git/etc/gitconfig core.autocrlf=true file:E:/programfiles/Git/etc/gitconfig core.fscache=true file:E:/programfiles/Git/etc/gitconfig core.symlinks=true file:E:/programfiles/Git/etc/gitconfig pull.rebase=false file:C:/Users/Ashish Jain/.gitconfig user.email=ashishjain1547@gmail.com file:C:/Users/Ashish Jain/.gitconfig filter.lfs.required=true file:C:/Users/Ashish Jain/.gitconfig filter.lfs.clean=git-lfs clean -- %f file:C:/Users/Ashish Jain/.gitconfig filter.lfs.smudge=git-lfs smudge -- %f file:C:/Users/Ashish Jain/.gitconfig filter.lfs.process=git-lfs filter-process file:.git/config core.repositoryformatversion=0 file:.git/config core.filemode=false file:.git/config core.bare=false file:.git/config core.logallrefupdates=true file:.git/config core.ignorecase=true file:.git/config remote.origin.url=https://github.com/ashishjain1547/repo_for_testing.git file:.git/config remote.origin.fetch=+refs/heads/*:refs/remotes/origin/* file:.git/config branch.main.remote=origin file:.git/config branch.main.merge=refs/heads/main - - - - - - - - - -Check Which Entries Are At Which Level
(base) C:\Users\Ashish Jain\OneDrive\Desktop\repo_for_testing>git config --list --show-scope --show-origin system file:E:/programfiles/Git/etc/gitconfig http.sslcainfo=E:/programfiles/Git/mingw64/ssl/certs/ca-bundle.crt system file:E:/programfiles/Git/etc/gitconfig http.sslbackend=openssl system file:E:/programfiles/Git/etc/gitconfig diff.astextplain.textconv=astextplain system file:E:/programfiles/Git/etc/gitconfig filter.lfs.clean=git-lfs clean -- %f system file:E:/programfiles/Git/etc/gitconfig filter.lfs.smudge=git-lfs smudge -- %f system file:E:/programfiles/Git/etc/gitconfig filter.lfs.process=git-lfs filter-process system file:E:/programfiles/Git/etc/gitconfig filter.lfs.required=true system file:E:/programfiles/Git/etc/gitconfig credential.helper=manager system file:E:/programfiles/Git/etc/gitconfig add.interactive.usebuiltin=true system file:E:/programfiles/Git/etc/gitconfig core.editor="E:\\programfiles\\Microsoft VS Code\\Code.exe" --wait system file:E:/programfiles/Git/etc/gitconfig core.autocrlf=true system file:E:/programfiles/Git/etc/gitconfig core.fscache=true system file:E:/programfiles/Git/etc/gitconfig core.symlinks=true system file:E:/programfiles/Git/etc/gitconfig pull.rebase=false global file:C:/Users/Ashish Jain/.gitconfig user.email=ashishjain1547@gmail.com global file:C:/Users/Ashish Jain/.gitconfig filter.lfs.required=true global file:C:/Users/Ashish Jain/.gitconfig filter.lfs.clean=git-lfs clean -- %f global file:C:/Users/Ashish Jain/.gitconfig filter.lfs.smudge=git-lfs smudge -- %f global file:C:/Users/Ashish Jain/.gitconfig filter.lfs.process=git-lfs filter-process local file:.git/config core.repositoryformatversion=0 local file:.git/config core.filemode=false local file:.git/config core.bare=false local file:.git/config core.logallrefupdates=true local file:.git/config core.ignorecase=true local file:.git/config remote.origin.url=https://github.com/ashishjain1547/repo_for_testing.git local file:.git/config remote.origin.fetch=+refs/heads/*:refs/remotes/origin/* local file:.git/config branch.main.remote=origin local file:.git/config branch.main.merge=refs/heads/main Tags: Technology,GitHub,
Tuesday, August 24, 2021
Using Git commands on Android Phone
Step 1: Install "Termux" App from Play Store. Step 2: Open "Termux" App and run "apt update". Step 3: Install "git" using command "pkg install git". Step 4: Trying out "git clone" on a Public Repository hosted on GitHub. Step 5: Viewing the files. Step 6: Allowing "Storage Access" for "Termux" via "Android Settings". Step 7: Moving public repository files here and there for easy access outside of Termux.Viewing files in 'Downloads' on Lenovo Moto Phone
Redme MIUI Does Not Allow Viewing Termux Files via Downloads App Opening Termux files via "Downloads App" on Lenovo Moto C Plus. 1.a. Open "Downloads App" 1.b. 2. Select "Termux" in the "Left Sidebar Panel Menu". 3. Now you are in the "Termux" home directory. Technology,GitHub,
Wednesday, July 21, 2021
Command 'git merge'
Code Legend: Black: main branch Dark gray: test_branchPart 1: "git clone -b test_branch"
~\git_exp\test_branch>git clone -b test_branch https://github.com/ashishjain1547/repo_for_testing.git Cloning into 'repo_for_testing'... remote: Enumerating objects: 23, done. remote: Counting objects: 100% (23/23), done. remote: Compressing objects: 100% (14/14), done. remote: Total 23 (delta 7), reused 14 (delta 3), pack-reused 0 Unpacking objects: 100% (23/23), 6.72 KiB | 5.00 KiB/s, done. ~\git_exp\test_branch>cd repo_for_testing ~\git_exp\test_branch\repo_for_testing>git branch * test_branch ~\git_exp\test_branch\repo_for_testing>dir Volume in drive C is Windows Volume Serial Number is 8139-90C0 Directory of ~\git_exp\test_branch\repo_for_testing 07/21/2021 12:26 PM <DIR> . 07/21/2021 12:26 PM <DIR> .. 07/21/2021 12:26 PM 368 .gitignore 07/21/2021 12:26 PM 30 20210528_test_branch.txt 07/21/2021 12:26 PM 17 202107141543.txt 07/21/2021 12:26 PM 17 202107141608.txt 07/21/2021 12:26 PM 11,558 LICENSE 07/21/2021 12:26 PM 11 newFile.txt 07/21/2021 12:26 PM 38 README.md 07/21/2021 12:26 PM 23 test_file_20210528.txt 8 File(s) 12,062 bytes 2 Dir(s) 56,473,489,408 bytes freePart 2: "git clone" Default
~\git_exp\main>git clone https://github.com/ashishjain1547/repo_for_testing.git Cloning into 'repo_for_testing'... remote: Enumerating objects: 23, done. remote: Counting objects: 100% (23/23), done. remote: Compressing objects: 100% (14/14), done. remote: Total 23 (delta 7), reused 14 (delta 3), pack-reused 0 Unpacking objects: 100% (23/23), 6.72 KiB | 5.00 KiB/s, done. ~\git_exp\main>cd repo_for_testing ~\git_exp\main\repo_for_testing>git status On branch main Your branch is up to date with 'origin/main'. nothing to commit, working tree clean ~\git_exp\main\repo_for_testing>git branch -a * main remotes/origin/HEAD -> origin/main remotes/origin/main remotes/origin/test_branchPart 3: Create new file in "test_branch"
~\git_exp\test_branch\repo_for_testing>echo "202107211228" > 202107211228.txt ~\git_exp\test_branch\repo_for_testing>dir Volume in drive C is Windows Volume Serial Number is 8139-90C0 Directory of ~\git_exp\test_branch\repo_for_testing 07/21/2021 12:28 PM <DIR> . 07/21/2021 12:28 PM <DIR> .. 07/21/2021 12:26 PM 368 .gitignore 07/21/2021 12:26 PM 30 20210528_test_branch.txt 07/21/2021 12:26 PM 17 202107141543.txt 07/21/2021 12:26 PM 17 202107141608.txt 07/21/2021 12:28 PM 17 202107211228.txt 07/21/2021 12:26 PM 11,558 LICENSE 07/21/2021 12:26 PM 11 newFile.txt 07/21/2021 12:26 PM 38 README.md 07/21/2021 12:26 PM 23 test_file_20210528.txt 9 File(s) 12,079 bytes 2 Dir(s) 56,473,849,856 bytes free ~\git_exp\test_branch\repo_for_testing>git status On branch test_branch Your branch is up to date with 'origin/test_branch'. Untracked files: (use "git add <file>..." to include in what will be committed) 202107211228.txt nothing added to commit but untracked files present (use "git add" to track) ~\git_exp\test_branch\repo_for_testing>git add -A ~\git_exp\test_branch\repo_for_testing>git commit -m "20210721 1229" [test_branch 087a5ca] 20210721 1229 1 file changed, 1 insertion(+) create mode 100644 202107211228.txt ~\git_exp\test_branch\repo_for_testing>git push Enumerating objects: 4, done. Counting objects: 100% (4/4), done. Delta compression using up to 4 threads Compressing objects: 100% (2/2), done. Writing objects: 100% (3/3), 289 bytes | 289.00 KiB/s, done. Total 3 (delta 1), reused 0 (delta 0), pack-reused 0 remote: Resolving deltas: 100% (1/1), completed with 1 local object. To https://github.com/ashishjain1547/repo_for_testing.git 9017804..087a5ca test_branch -> test_branch ~\git_exp\test_branch\repo_for_testing>git status On branch test_branch Your branch is up to date with 'origin/test_branch'. nothing to commit, working tree cleanPart 4: Git Metadata About the Files and the Use of 'git pull origin' to Update this Metadata
~\git_exp\main\repo_for_testing>git branch -a * main remotes/origin/HEAD -> origin/main remotes/origin/main remotes/origin/test_branch ~\git_exp\main\repo_for_testing>git checkout test_branch Switched to a new branch 'test_branch' Branch 'test_branch' set up to track remote branch 'test_branch' from 'origin'. ~\git_exp\main\repo_for_testing>git branch -a main * test_branch remotes/origin/HEAD -> origin/main remotes/origin/main remotes/origin/test_branch ~\git_exp\main\repo_for_testing>git checkout main Switched to branch 'main' Your branch is up to date with 'origin/main'. ~\git_exp\main\repo_for_testing>git merge test_branch Already up to date.Part 5: 'git pull origin' and then 'git merge'
~\git_exp\main\repo_for_testing>git pull origin remote: Enumerating objects: 4, done. remote: Counting objects: 100% (4/4), done. remote: Compressing objects: 100% (1/1), done. remote: Total 3 (delta 1), reused 3 (delta 1), pack-reused 0 Unpacking objects: 100% (3/3), 269 bytes | 0 bytes/s, done. From https://github.com/ashishjain1547/repo_for_testing 9017804..087a5ca test_branch -> origin/test_branch Already up to date. ~\git_exp\main\repo_for_testing>git branch -D test_branch Deleted branch test_branch (was 9017804). ~\git_exp\main\repo_for_testing>git checkout test_branch Switched to a new branch 'test_branch' Branch 'test_branch' set up to track remote branch 'test_branch' from 'origin'. ~\git_exp\main\repo_for_testing>git checkout main Switched to branch 'main' Your branch is up to date with 'origin/main'. ~\git_exp\main\repo_for_testing>git merge test_branch Merge made by the 'recursive' strategy. 202107211228.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 202107211228.txt ~\git_exp\main\repo_for_testing>git push Enumerating objects: 1, done. Counting objects: 100% (1/1), done. Writing objects: 100% (1/1), 231 bytes | 231.00 KiB/s, done. Total 1 (delta 0), reused 0 (delta 0), pack-reused 0 To https://github.com/ashishjain1547/repo_for_testing.git d210505..9f1b42f main -> main The above step puts "main" branches ahead by two commits.Part 6: Bringing 'test_branch' on level with 'main' branch using 'git merge'
~\git_exp\test_branch\repo_for_testing>git branch * test_branch ~\git_exp\test_branch\repo_for_testing>git branch -a * test_branch remotes/origin/HEAD -> origin/main remotes/origin/main remotes/origin/test_branch ~\git_exp\test_branch\repo_for_testing>git pull origin remote: Enumerating objects: 1, done. remote: Counting objects: 100% (1/1), done. remote: Total 1 (delta 0), reused 1 (delta 0), pack-reused 0 Unpacking objects: 100% (1/1), 211 bytes | 1024 bytes/s, done. From https://github.com/ashishjain1547/repo_for_testing d210505..9f1b42f main -> origin/main Already up to date. ~\git_exp\test_branch\repo_for_testing> ~\git_exp\test_branch\repo_for_testing>git checkout main Switched to a new branch 'main' Branch 'main' set up to track remote branch 'main' from 'origin'. ~\git_exp\test_branch\repo_for_testing>git checkout test_branch Switched to branch 'test_branch' Your branch is up to date with 'origin/test_branch'. ~\git_exp\test_branch\repo_for_testing>git merge main Updating 087a5ca..9f1b42f Fast-forward ~\git_exp\test_branch\repo_for_testing>git status On branch test_branch Your branch is ahead of 'origin/test_branch' by 2 commits. (use "git push" to publish your local commits) nothing to commit, working tree clean ~\git_exp\test_branch\repo_for_testing>git push Total 0 (delta 0), reused 0 (delta 0), pack-reused 0 To https://github.com/ashishjain1547/repo_for_testing.git 087a5ca..9f1b42f test_branch -> test_branch ~\git_exp\test_branch\repo_for_testing> ~\git_exp\test_branch\repo_for_testing>git branch -a main * test_branch remotes/origin/HEAD -> origin/main remotes/origin/main remotes/origin/test_branch ~\git_exp\test_branch\repo_for_testing> Labels: Technology,GitHub,
Wednesday, June 23, 2021
Tor Browser, Anonymity and Your IP Address
1 - What is my IP Address When I Use Tor Browser URL: WhatIsMyIPAddress.com 2 - GitHub Security Logs for IP Address on Tor Browser 3 - What is my IP address as reported by Google Search 4 - IP Address Lookup for 'whatIsMyIPAddress.com' 5 - IP Address Lookup for IP Address showed by Google search Tags: Technology,Cyber Security,Web Development,Web Scraping,GitHub,
This is a Tor Exit Router: 156.146.58.134
Most likely you are accessing this website because you had some issue with the traffic coming from this IP. This router is part of the Tor Anonymity Network, which is dedicated to providing privacy to people who need it most: average computer users. This router IP should be generating no other traffic, unless it has been compromised.
Tor sees use by many important segments of the population, including whistle blowers, journalists, Chinese dissidents skirting the Great Firewall and oppressive censorship, abuse victims, stalker targets, the US military, and law enforcement, just to name a few. While Tor is not designed for malicious computer users, it is true that they can use the network for malicious ends. In reality however, the actual amount of abuse is quite low. This is largely because criminals and hackers have significantly better access to privacy and anonymity than do the regular users whom they prey upon. Criminals can and do build, sell, and trade far larger and more powerful networks than Tor on a daily basis. Thus, in the mind of this operator, the social need for easily accessible censorship-resistant private, anonymous communication trumps the risk of unskilled bad actors, who are almost always more easily uncovered by traditional police work than by extensive monitoring and surveillance anyway.
In terms of applicable law, the best way to understand Tor is to consider it a network of routers operating as common carriers, much like the Internet backbone. However, unlike the Internet backbone routers, Tor routers explicitly do not contain identifiable routing information about the source of a packet, and no single Tor node can determine both the origin and destination of a given transmission.
As such, there is little the operator of this router can do to help you track the connection further. This router maintains no logs of any of the Tor traffic, so there is little that can be done to trace either legitimate or illegitimate traffic (or to filter one from the other). Attempts to seize this router will accomplish nothing.
Furthermore, this machine also serves as a carrier of email, which means that its contents are further protected under the ECPA. 18 USC 2707 explicitly allows for civil remedies ($1000/account plus legal fees) in the event of a seizure executed without good faith or probable cause (it should be clear at this point that traffic with an originating IP address of nyc-exit.privateinternetaccess.com should not constitute probable cause to seize the machine). Similar considerations exist for 1st amendment content on this machine.
If you are a representative of a company who feels that this router is being used to violate the DMCA, please be aware that this machine does not host or contain any illegal content. Also be aware that network infrastructure maintainers are not liable for the type of content that passes over their equipment, in accordance with DMCA "safe harbor" provisions. In other words, you will have just as much luck sending a takedown notice to the Internet backbone providers. Please consult EFF's prepared response for more information on this matter.
For more information, please consult the following documentation:
That being said, if you still have a complaint about the router, you may email the maintainer. If complaints are related to a particular service that is being abused, I will consider removing that service from my exit policy, which would prevent my router from allowing that traffic to exit through it. I can only do this on an IP+destination port basis, however. Common P2P ports are already blocked.
You also have the option of blocking this IP address and others on the Tor network if you so desire. The Tor project provides a web service to fetch a list of all IP addresses of Tor exit nodes that allow exiting to a specified IP:port combination, and an official DNSRBL is also available to determine if a given IP address is actually a Tor exit server. Please be considerate when using these options. It would be unfortunate to deny all Tor users access to your site indefinitely simply because of a few bad apples.
Friday, June 11, 2021
Quick Setup Tips by GitHub itself
Wednesday, June 2, 2021
Command 'git clone'
Cloning a repository with only the URL
(base) ~\ws>git clone https://github.com/ashishjain1547/repo_for_testing.git Cloning into 'repo_for_testing'... Logon failed, use ctrl+c to cancel basic credential prompt. Username for 'https://github.com': ashishjain1547@gmail.com Password for 'https://ashishjain1547@gmail.com@github.com': remote: Enumerating objects: 16, done. remote: Counting objects: 100% (16/16), done. remote: Compressing objects: 100% (9/9), done. remote: Total 16 (delta 5), reused 10 (delta 3), pack-reused 0 Unpacking objects: 100% (16/16), 5.70 KiB | 12.00 KiB/s, done. (base) ~\ws>tree /f Folder PATH listing for volume Windows Volume serial number is 8139-90C0 C:. └───repo_for_testing .gitignore LICENSE newFile.txt README.md test_file_20210528.txt (base) ~\ws>cd repo_for_testing (base) ~\ws\repo_for_testing>git branch * main (base) ~\ws\repo_for_testing>git branch -a * main remotes/origin/HEAD -> origin/main remotes/origin/main remotes/origin/test_branch (base) ~\ws\repo_for_testing>git branch -r origin/HEAD -> origin/main origin/main origin/test_branch (base) ~\ws\repo_for_testing>git branch -D fatal: branch name requiredCloning a repository with URL and branch name.
(base) ~\ws_diff_branch>git clone --branch test_branch https://github.com/ashishjain1547/repo_for_testing.git Cloning into 'repo_for_testing'... remote: Enumerating objects: 16, done. remote: Counting objects: 100% (16/16), done. remote: Compressing objects: 100% (9/9), done. remote: Total 16 (delta 5), reused 10 (delta 3), pack-reused 0 Unpacking objects: 100% (16/16), 5.70 KiB | 8.00 KiB/s, done. (base) ~\ws_diff_branch>cd repo_for_testing (base) ~\ws_diff_branch\repo_for_testing>git branch * test_branch (base) ~\ws_diff_branch\repo_for_testing>git branch -a * test_branch remotes/origin/HEAD -> origin/main remotes/origin/main remotes/origin/test_branch (base) ~\ws_diff_branch\repo_for_testing>git branch -r origin/HEAD -> origin/main origin/main origin/test_branchNotes From Bitbucket
#1 Cloning to a specific folder git clone <repo> <directory> Clone the repository located at <repo> into the folder called ~<directory>! on the local machine. #2 Cloning a specific tag git clone --branch <tag> <repo> Clone the repository located at <repo> and only clone the ref for <tag>. #3 Shallow clone git clone -depth=1 <repo> Clone the repository located at <repo> and only clone the history of commits specified by the option depth=1. In this example a clone of <repo> is made and only the most recent commit is included in the new cloned Repo. Shallow cloning is most useful when working with repos that have an extensive commit history. An extensive commit history may cause scaling problems such as disk space usage limits and long wait times when cloning. A Shallow clone can help alleviate these scaling issues. Ref: Bitbucket [20210602] Tags: Technology,GitHub,Cloud,Windows CMD,