Git — Branch,Develop,Add,Commit,Merge

Kablumndl
3 min readSep 8, 2021

CR:- We need a second factor authentication using OTP via SMS on mobile.
We need to work on smsfeature branch and then commit our changes once it is approved then it is merge with the develop branch. All the testing once done then it will merged with the master branch, to acheive this,What are the basic git command required here:-

git branch develop
git branch sms-feature
git checkout sms-feature
git log
git status

Kablu@LAPTOP-41ADSALF MINGW64 /d/spring-boot-cloud/git-repository (sms-feature)
$ echo “SMS Feature Developed and Ready For Testing” > sms.txt
Kablu@LAPTOP-41ADSALF MINGW64 /d/spring-boot-cloud/git-repository (sms-feature)
$ git status
On branch sms-feature
Untracked files:
(use “git add <file>…” to include in what will be committed)
sms.txt
nothing added to commit but untracked files present (use “git add” to track)Kablu@LAPTOP-41ADSALF MINGW64 /d/spring-boot-cloud/git-repository (sms-feature)
$ git add .
warning: LF will be replaced by CRLF in sms.txt.
The file will have its original line endings in your working directory
Kablu@LAPTOP-41ADSALF MINGW64 /d/spring-boot-cloud/git-repository (sms-feature)
$ git status
On branch sms-feature
Changes to be committed:
(use “git restore — staged <file>…” to unstage)
new file: sms.txt
Kablu@LAPTOP-41ADSALF MINGW64 /d/spring-boot-cloud/git-repository (sms-feature)
$ git commit -m “Commited SMS Feature from sms-feature branch”
[sms-feature bd752a0] Commited SMS Feature from sms-feature branch
Author: Kablu <kablumndl546@gmail.com>
1 file changed, 1 insertion(+)
create mode 100644 sms.txt
Kablu@LAPTOP-41ADSALF MINGW64 /d/spring-boot-cloud/git-repository (sms-feature)
$ git status
On branch sms-feature
nothing to commit, working tree clean
Kablu@LAPTOP-41ADSALF MINGW64 /d/spring-boot-cloud/git-repository (sms-feature)
$ git checkout develop
Switched to branch ‘develop’
Kablu@LAPTOP-41ADSALF MINGW64 /d/spring-boot-cloud/git-repository (develop)
$ git merge sms-feature
Updating 1aa052f..bd752a0
Fast-forward
3.txt | 1 +
sms.txt | 1 +
2 files changed, 2 insertions(+)
create mode 100644 3.txt
create mode 100644 sms.txt
Kablu@LAPTOP-41ADSALF MINGW64 /d/spring-boot-cloud/git-repository (develop)
$ git log
commit bd752a043b31bf273288756157473c9b72b82f0f (HEAD -> develop, sms-feature)
Author: Kablu <kablumndl546@gmail.com>
Date: Wed Sep 8 09:31:10 2021 +0530
Commited SMS Feature from sms-feature branchcommit a921919ba2328435c4490b697cfa1edabb02eed0 (master)
Merge: 527562b 1aa052f
Author: Kablu <kablumndl546@gmail.com>
Date: Wed Sep 8 09:19:15 2021 +0530
Merge branch ‘develop’ into feature1Kablu@LAPTOP-41ADSALF MINGW64 /d/spring-boot-cloud/git-repository (develop)
$ git checkout master
Switched to branch ‘master’
Kablu@LAPTOP-41ADSALF MINGW64 /d/spring-boot-cloud/git-repository (master)
$ git merge develop
Updating a921919..bd752a0
Fast-forward
sms.txt | 1 +
1 file changed, 1 insertion(+)
create mode 100644 sms.txt

$ git log
commit bd752a043b31bf273288756157473c9b72b82f0f (HEAD -> master, sms-feature, develop)
Author: Kablu <kablumndl546@gmail.com>
Date: Wed Sep 8 09:31:10 2021 +0530
Commited SMS Feature from sms-feature branchcommit a921919ba2328435c4490b697cfa1edabb02eed0
Merge: 527562b 1aa052f
Author: Kablu <kablumndl546@gmail.com>
Date: Wed Sep 8 09:19:15 2021 +0530
Merge branch ‘develop’ into feature1

========= Learning Makes Feel Good ================

--

--

Kablumndl

Java Developer, Software Engineer, Spring, Spark, MicroService, PostgresSQL