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>
Wednesday, July 21, 2021
Command 'git merge'
Labels:
GitHub,
Technology
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment