Git Branching Ben Strategy - sumanksp/reference GitHub Wiki
suman at suman in ~ [01:28:55 PM] $ dt
suman at suman in ~/Desktop [01:28:57 PM] $ mkdir git
suman at suman in ~/Desktop [01:29:00 PM] $ cd git/
suman at suman in ~/Desktop/git [01:29:02 PM] $ git clone [email protected]:sumanksp/test-repo.git Cloning into 'test-repo'... warning: You appear to have cloned an empty repository.
suman at suman in ~/Desktop/git [01:29:04 PM] $ ls test-repo
suman at suman in ~/Desktop/git [01:29:07 PM] $ cd test-repo/
suman at suman in ~/Desktop/git/test-repo on main [01:29:09 PM] $ cat readme.txt cat: readme.txt: No such file or directory
suman at suman in ~/Desktop/git/test-repo on main [01:29:13 PM] $ vim readme.txt
suman at suman in ~/Desktop/git/test-repo on main [?] [01:29:23 PM] $ git add readme.txt
suman at suman in ~/Desktop/git/test-repo on main [+] [01:29:25 PM] $ git commit -m "first commit" [main (root-commit) 8013daa] first commit 1 file changed, 1 insertion(+) create mode 100644 readme.txt
suman at suman in ~/Desktop/git/test-repo on main [01:29:33 PM] $ git checkout -b development Switched to a new branch 'development'
suman at suman in ~/Desktop/git/test-repo on development [01:29:50 PM] $ git checkout -b release Switched to a new branch 'release'
suman at suman in ~/Desktop/git/test-repo on release [01:29:54 PM] $ git push -u origin development Enumerating objects: 3, done. Counting objects: 100% (3/3), done. Writing objects: 100% (3/3), 301 bytes | 301.00 KiB/s, done. Total 3 (delta 0), reused 0 (delta 0), pack-reused 0 To github.com:sumanksp/test-repo.git
- [new branch] development -> development Branch 'development' set up to track remote branch 'development' from 'origin'.
suman at suman in ~/Desktop/git/test-repo on release [01:30:03 PM] $ git push -u origin release Total 0 (delta 0), reused 0 (delta 0), pack-reused 0 remote: remote: Create a pull request for 'release' on GitHub by visiting: remote: https://github.com/sumanksp/test-repo/pull/new/release remote: To github.com:sumanksp/test-repo.git
- [new branch] release -> release Branch 'release' set up to track remote branch 'release' from 'origin'.
suman at suman in ~/Desktop/git/test-repo on release [01:30:07 PM] $ git checkout -b dev-1 Switched to a new branch 'dev-1'
suman at suman in ~/Desktop/git/test-repo on dev-1 [01:31:57 PM] $
suman at suman in ~/Desktop/git/test-repo on dev-1 [01:31:57 PM] $ git status On branch dev-1 nothing to commit, working tree clean
suman at suman in ~/Desktop/git/test-repo on dev-1 [01:32:00 PM] $ vim hello.c
suman at suman in ~/Desktop/git/test-repo on dev-1 [?] [01:32:23 PM] $ gcc hello.c hello.c:1:10: fatal error: stdio.h: No such file or directory 1 | #include <stdio.h> | ^~~~~~~~~ compilation terminated.
suman at suman in ~/Desktop/git/test-repo on dev-1 [?] [01:32:28 PM] $ vim hello.c
suman at suman in ~/Desktop/git/test-repo on dev-1 [?] [01:32:40 PM] $ gcc hello.c hello.c:1:10: fatal error: stdio.h: No such file or directory 1 | #include "stdio.h" | ^~~~~~~~~ compilation terminated.
suman at suman in ~/Desktop/git/test-repo on dev-1 [?] [01:32:43 PM] $ gcc gcc: fatal error: no input files compilation terminated.
suman at suman in ~/Desktop/git/test-repo on dev-1 [?] [01:32:45 PM] $ vim hello.c
suman at suman in ~/Desktop/git/test-repo on dev-1 [?] [01:33:06 PM] $ gcc gcc: fatal error: no input files compilation terminated.
suman at suman in ~/Desktop/git/test-repo on dev-1 [?] [01:33:07 PM] $ gcc hello.c hello.c:1:9: fatal error: stdio.h: No such file or directory 1 | #include<stdio.h> | ^~~~~~~~~ compilation terminated.
suman at suman in ~/Desktop/git/test-repo on dev-1 [?] [01:33:09 PM] $
suman at suman in ~/Desktop/git/test-repo on dev-1 [?] [01:33:09 PM] $ git status On branch dev-1 Untracked files: (use "git add ..." to include in what will be committed) hello.c
nothing added to commit but untracked files present (use "git add" to track)
suman at suman in ~/Desktop/git/test-repo on dev-1 [?] [01:33:15 PM] $ git add hello.c
suman at suman in ~/Desktop/git/test-repo on dev-1 [+] [01:33:24 PM] $ git commit -m "[FEATURE] first commit for #1" [dev-1 0df8d90] [FEATURE] first commit for #1 1 file changed, 6 insertions(+) create mode 100644 hello.c
suman at suman in ~/Desktop/git/test-repo on dev-1 [01:35:11 PM] $ git push -u origin de dev-1 development
suman at suman in ~/Desktop/git/test-repo on dev-1 [01:35:11 PM] $ git push -u origin dev-1 Enumerating objects: 4, done. Counting objects: 100% (4/4), done. Delta compression using up to 12 threads Compressing objects: 100% (3/3), done. Writing objects: 100% (3/3), 456 bytes | 456.00 KiB/s, done. Total 3 (delta 0), reused 0 (delta 0), pack-reused 0 remote: remote: Create a pull request for 'dev-1' on GitHub by visiting: remote: https://github.com/sumanksp/test-repo/pull/new/dev-1 remote: To github.com:sumanksp/test-repo.git
- [new branch] dev-1 -> dev-1 Branch 'dev-1' set up to track remote branch 'dev-1' from 'origin'.
suman at suman in ~/Desktop/git/test-repo on dev-1 [01:35:19 PM] $ vim hello.c
suman at suman in ~/Desktop/git/test-repo on dev-1 [!] [01:41:00 PM] $ vim hello.c
suman at suman in ~/Desktop/git/test-repo on dev-1 [!] [01:41:17 PM] $ git add hello.c
suman at suman in ~/Desktop/git/test-repo on dev-1 [+] [01:41:19 PM] $ git commit -m "[MINOR] Fixes PR remarks #1" [dev-1 1923c36] [MINOR] Fixes PR remarks #1 1 file changed, 3 insertions(+), 1 deletion(-)
suman at suman in ~/Desktop/git/test-repo on dev-1 [01:41:49 PM] $ git push origin de dev-1 development
suman at suman in ~/Desktop/git/test-repo on dev-1 [01:41:49 PM] $ git push origin dev-1 Enumerating objects: 5, done. Counting objects: 100% (5/5), done. Delta compression using up to 12 threads Compressing objects: 100% (3/3), done. Writing objects: 100% (3/3), 485 bytes | 485.00 KiB/s, done. Total 3 (delta 0), reused 0 (delta 0), pack-reused 0 To github.com:sumanksp/test-repo.git 0df8d90..1923c36 dev-1 -> dev-1
suman at suman in ~/Desktop/git/test-repo on dev-1 [01:41:56 PM] $ git
suman at suman in ~/Desktop/git/test-repo on dev-1 [01:41:56 PM] $ git pull remote: Enumerating objects: 4, done. remote: Counting objects: 100% (4/4), done. remote: Compressing objects: 100% (3/3), done. remote: Total 3 (delta 0), reused 2 (delta 0), pack-reused 0 Unpacking objects: 100% (3/3), 813 bytes | 813.00 KiB/s, done. From github.com:sumanksp/test-repo 8013daa..0b9ffe8 development -> origin/development Already up to date.
suman at suman in ~/Desktop/git/test-repo on dev-1 [01:43:49 PM] $ git tree WARNING: You called a Git command named 'tree', which does not exist. Continuing in 0.1 seconds, assuming that you meant 'mktree'. ^C
suman at suman in ~/Desktop/git/test-repo on dev-1 [01:44:10 PM] $ gitk Command 'gitk' not found, but can be installed with: sudo apt install gitk
suman at suman in ~/Desktop/git/test-repo on dev-1 [01:44:17 PM] $ sudo apt install gitk [sudo] password for suman: Reading package lists... Done Building dependency tree... Done Reading state information... Done The following packages were automatically installed and are no longer required: libcamhal-ipu6ep-common libflashrom1 libftdi1-2 libia-aiq-file-debug-ipu6ep0 libipu6ep libllvm13 Use 'sudo apt autoremove' to remove them. The following additional packages will be installed: libtk8.6 tk tk8.6 Suggested packages: git-doc The following NEW packages will be installed: gitk libtk8.6 tk tk8.6 0 upgraded, 4 newly installed, 0 to remove and 3 not upgraded. Need to get 946 kB of archives. After this operation, 4,314 kB of additional disk space will be used. Do you want to continue? [Y/n] Y Get:1 http://us.archive.ubuntu.com/ubuntu jammy/main amd64 libtk8.6 amd64 8.6.12-1build1 [784 kB] Get:2 http://us.archive.ubuntu.com/ubuntu jammy/main amd64 tk8.6 amd64 8.6.12-1build1 [12.8 kB] Get:3 http://us.archive.ubuntu.com/ubuntu jammy/main amd64 tk amd64 8.6.11+1build2 [3,058 B] Get:4 http://us.archive.ubuntu.com/ubuntu jammy-updates/universe amd64 gitk all 1:2.34.1-1ubuntu1.10 [146 kB] Fetched 946 kB in 2s (577 kB/s) Selecting previously unselected package libtk8.6:amd64. (Reading database ... 266887 files and directories currently installed.) Preparing to unpack .../libtk8.6_8.6.12-1build1_amd64.deb ... Unpacking libtk8.6:amd64 (8.6.12-1build1) ... Selecting previously unselected package tk8.6. Preparing to unpack .../tk8.6_8.6.12-1build1_amd64.deb ... Unpacking tk8.6 (8.6.12-1build1) ... Selecting previously unselected package tk. Preparing to unpack .../tk_8.6.11+1build2_amd64.deb ... Unpacking tk (8.6.11+1build2) ... Selecting previously unselected package gitk. Preparing to unpack .../gitk_1%3a2.34.1-1ubuntu1.10_all.deb ... Unpacking gitk (1:2.34.1-1ubuntu1.10) ... Setting up libtk8.6:amd64 (8.6.12-1build1) ... Setting up tk8.6 (8.6.12-1build1) ... Setting up tk (8.6.11+1build2) ... Setting up gitk (1:2.34.1-1ubuntu1.10) ... Processing triggers for man-db (2.10.2-1) ... Processing triggers for libc-bin (2.35-0ubuntu3.4) ...
suman at suman in ~/Desktop/git/test-repo on dev-1 [01:44:28 PM] $
suman at suman in ~/Desktop/git/test-repo on dev-1 [01:44:28 PM] $ gitk
^C
suman at suman in ~/Desktop/git/test-repo on dev-1 [01:44:48 PM] $ git fetch --all Fetching origin
suman at suman in ~/Desktop/git/test-repo on dev-1 [01:45:01 PM] $ gitk
suman at suman in ~/Desktop/git/test-repo on dev-1 [01:45:13 PM] $ git pull --rebase Already up to date.
suman at suman in ~/Desktop/git/test-repo on dev-1 [01:45:24 PM] $ gitk --all
^C
suman at suman in ~/Desktop/git/test-repo on dev-1 [01:45:46 PM] $ git checkout development Switched to branch 'development' Your branch is behind 'origin/development' by 1 commit, and can be fast-forwarded. (use "git pull" to update your local branch)
suman at suman in ~/Desktop/git/test-repo on development [01:45:55 PM] $ git pull --rebase Updating 8013daa..0b9ffe8 Fast-forward hello.c | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 hello.c
suman at suman in ~/Desktop/git/test-repo on development [01:46:01 PM] $ gitk --all ^C
suman at suman in ~/Desktop/git/test-repo on development [01:46:26 PM] $ git remote prune origin Pruning origin URL: [email protected]:sumanksp/test-repo.git
- [pruned] origin/dev-1
suman at suman in ~/Desktop/git/test-repo on development [01:46:48 PM] $ gitk --all
suman at suman in ~/Desktop/git/test-repo on development [01:46:59 PM] $ git branch -D dev-1 Deleted branch dev-1 (was 1923c36).
suman at suman in ~/Desktop/git/test-repo on development [01:47:14 PM] $ gitk --all& [1] 15837
suman at suman in ~/Desktop/git/test-repo on development [01:47:23 PM] $ git branch -a
- development main release remotes/origin/development remotes/origin/release
suman at suman in ~/Desktop/git/test-repo on development [01:52:33 PM] $
suman at suman in ~/Desktop/git/test-repo on development [01:52:33 PM] $ git checkout -b feature-2 Switched to a new branch 'feature-2'
suman at suman in ~/Desktop/git/test-repo on feature-2 [01:52:48 PM] $ git status On branch feature-2 nothing to commit, working tree clean
suman at suman in ~/Desktop/git/test-repo on feature-2 [01:52:51 PM] $ ls hello.c readme.txt
suman at suman in ~/Desktop/git/test-repo on feature-2 [01:52:54 PM] $ vim add.c
suman at suman in ~/Desktop/git/test-repo on feature-2 [?] [01:53:58 PM] $ git add add.c
suman at suman in ~/Desktop/git/test-repo on feature-2 [+] [01:54:01 PM] $ git commit -m "[FEATURE] first commit for #2" [feature-2 2b034e4] [FEATURE] first commit for #2 1 file changed, 11 insertions(+) create mode 100644 add.c
suman at suman in ~/Desktop/git/test-repo on feature-2 [01:54:20 PM] $ git push -u origin feature-2 Enumerating objects: 4, done. Counting objects: 100% (4/4), done. Delta compression using up to 12 threads Compressing objects: 100% (3/3), done. Writing objects: 100% (3/3), 565 bytes | 565.00 KiB/s, done. Total 3 (delta 0), reused 0 (delta 0), pack-reused 0 remote: remote: Create a pull request for 'feature-2' on GitHub by visiting: remote: https://github.com/sumanksp/test-repo/pull/new/feature-2 remote: To github.com:sumanksp/test-repo.git
- [new branch] feature-2 -> feature-2 Branch 'feature-2' set up to track remote branch 'feature-2' from 'origin'.
suman at suman in ~/Desktop/git/test-repo on feature-2 [01:54:28 PM] $ git checkout development Switched to branch 'development' Your branch is up to date with 'origin/development'.
suman at suman in ~/Desktop/git/test-repo on development [01:56:13 PM] $ git pull --all Fetching origin remote: Enumerating objects: 4, done. remote: Counting objects: 100% (4/4), done. remote: Compressing objects: 100% (3/3), done. remote: Total 3 (delta 0), reused 2 (delta 0), pack-reused 0 Unpacking objects: 100% (3/3), 861 bytes | 861.00 KiB/s, done. From github.com:sumanksp/test-repo 0b9ffe8..b7e6212 development -> origin/development Updating 0b9ffe8..b7e6212 Fast-forward add.c | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 add.c
suman at suman in ~/Desktop/git/test-repo on development [01:56:19 PM] $ git remote prune origin Pruning origin URL: [email protected]:sumanksp/test-repo.git
- [pruned] origin/feature-2
suman at suman in ~/Desktop/git/test-repo on development [01:56:54 PM] $ git branch -D feature-2 Deleted branch feature-2 (was 2b034e4).
suman at suman in ~/Desktop/git/test-repo on development [01:57:02 PM] $ gitk --all& [2] 16381 [1] Done gitk --all
suman at suman in ~/Desktop/git/test-repo on development [01:57:18 PM] $ git checkout release Switched to branch 'release' Your branch is up to date with 'origin/release'. [2]+ Done gitk --all
suman at suman in ~/Desktop/git/test-repo on release [01:58:16 PM] $ git merge development Updating 8013daa..b7e6212 Fast-forward add.c | 11 +++++++++++ hello.c | 8 ++++++++ 2 files changed, 19 insertions(+) create mode 100644 add.c create mode 100644 hello.c
suman at suman in ~/Desktop/git/test-repo on release [01:58:27 PM] $ git push origin release Total 0 (delta 0), reused 0 (delta 0), pack-reused 0 To github.com:sumanksp/test-repo.git 8013daa..b7e6212 release -> release
suman at suman in ~/Desktop/git/test-repo on release [01:58:37 PM] $ git tag 1.0.0
suman at suman in ~/Desktop/git/test-repo on release [01:59:16 PM] $ git push --tags Total 0 (delta 0), reused 0 (delta 0), pack-reused 0 To github.com:sumanksp/test-repo.git
- [new tag] 1.0.0 -> 1.0.0
suman at suman in ~/Desktop/git/test-repo on release [01:59:27 PM] $ gitk --all
suman at suman in ~/Desktop/git/test-repo on release [02:00:03 PM] $