I will continue to add some of the git cli- command , concepts and relevant references, which are relevant to my work.
git tag -a 1.0.1 -m
"First Release"
git push --tags
How to check the conflict of two branch, but not need to merge them?
Suppose you are on the master
branch and you would like to test if the dev
branch can be merged without conflict into the master
.
# In the master branch
git merge dev --no-ff --no-commit
After that, you will be able to know if there’s a conflict or not.
To return in a normal situation, just abort the merge:
git merge --abort
After that create a branch from base,
Do cherry- pick the change on it
Fix the conflicts
and then create a new Pull request ,
It should work
List All Tags
root@BlockChainHLF:~/work/hlfgit/fabric-samples# git tag
v1.0.2
v1.0.6
v1.1.0
v1.1.0-alpha
v1.1.0-preview
v1.1.0-rc1
Pull Request Tutorial
https://yangsu.github.io/pull-request-tutorial/
Git Command Line
Creating a branch, and then changing code on that branch , push to that branch and then create a pull request to later merge that branch to master
http://dont-be-afraid-to-commit.readthedocs.io/en/latest/git/commandlinegit.html
What is Squashing commits on Git
Squashing commits keyword hear to be confusing in the beginning, below reference provide very clear explanation
Squashing a commit means, from an idiomatic point of view, to move the changes introduced in said commit into its parent so that you end with one commit out of twos.
If you repeat this process multiple times, you can reduce n commit to a single one.
https://stackoverflow.com/questions/35703556/what-is-squashing-commits-in-git
https://www.devroom.io/2011/07/05/git-squash-your-latests-commits-into-one/
Delete an Existing Local Branch :
Switch to some other branch and delete Test_Branch
, as follows:
$ git checkout master
$ git branch -d Test_Branch
https://stackoverflow.com/questions/41492254/i-need-help-deleting-a-local-branch-with-git
How to apply 2FA to your new phone for GitHub
You can update your 2FA on your new phone by following the steps found here:
Clone the repository
git clone <repository_url>
Configure your Email and Name
eSumit@Sumits-MacBook-Pro:~$ git config –global –list
eSumit@Sumits-MacBook-Pro:~$ git config –global user.name “Sumit Arora”
eSumit@Sumits-MacBook-Pro:~$ git config –global user.email “esumit@github.com”

diff between head and any commit
git diff commit_id HEAD
Clone a Specific Branch
eSumit@Sumits-MacBook-Pro:~/Documents/March2018/zc$ git clone -b support-5.7 --single-branch https://github.com/eSumit/TestProject.git Cloning into 'TestProject'... remote: Counting objects: 68783, done. remote: Compressing objects: 100% (249/249), done. remote: Total 68783 (delta 149), reused 304 (delta 120), pack-reused 68414 Receiving objects: 100% (68783/68783), 94.63 MiB | 1.35 MiB/s, done. Resolving deltas: 100% (51197/51197), done.
eSumit@Sumits-MacBook-Pro:~/Documents/March2018/zc/TestProject$ git status
On branch support-5.7 Your branch is up to date with 'origin/support-5.7'. nothing to commit, working tree clean
How can I solve a conflict in a pull request?
$ git checkout master
[ OR git checkout -b resolve-conflicts-branch]
$ git pull origin release/2
<resolve merge conflicts and commit>
$ git push
Combined various commits into one
git rebase -i HEAD~5
It will open a text file with pick and commit liners , changes all the pick to f and keep the first one or use r to change the comment as well
exit from file, then do the below to push to remote
git push origin ZMDS4275 –force
git log –oneline
Renaming an old branch
Old Branch Name : ENG-4754
New Branch Name : ENG-4839
Step-1 :
#move branch name
git branch -m ENG-4754 ENG-4839
Step-2:
#checkout new branch
git checkout ENG-4839
Step-3:
#push new branch to remote
git push origin ENG-4839
Step-4:
#delete old one
git push origin –delete ENG-4754
Step-5 : Check the status and list of branches
git status
git branch -a
Refer :
Git diff In between two branches :
– git diff master branch-name
– git diff branch-1 branch-2
Merge master into a branch
Checkout the branch
git merge master
Restore the Branch // Never Do this
Since you’re doing a git checkout .
, it looks like you are trying to restore your branch back to the last commit state.
You can achieve this with a git reset HEAD --hard
Warning: Doing this may remove all your latest modifications and unstage your modifications, e.g., you can lose work. It may be what you want, but check out the docs to make sure.
List all branches
git branch -a