Get detail about a particular commit
To get the details about particular commit, you can do it easily with the help of show but for that you need to remember the the commit number for that particular commit .
git show 9da581d910c9c4ac93557ca48767f5caf5169
If you run git show without an explicit commit number, it simply shows the details of
the most recent commit.
Checking Commit Differences
If you want to check differences between the two revisions of particular file recall both full commit
ID names and run git diff \
git diff 9da581d910c9c4ac93557ca4859e767f5caf5169 \ec232cddfb94e0dfd5b5855af8ded7f5eb5c90d6
Removing files from Repository
Removing a file from a repository is analogous to adding a file but uses git rm.
git rm index.html
git commit -m "Removed filed index.html"
Renaming files in Repository
you can rename it more quickly and directly with git mv.
git mv foo.html bar.html
git commit -m "Moved foo to bar"
Creating new Branch
Once you have identified the commit from which a branch should start, simply use the
git branch command. Thus, to create a new branch off the HEAD of your current branch.3
git branch name-of-branch
git branch node1 (Press Enter)
Using the “git branch” command lists all of our branches (and the “-v” flag provides us with a little more data than usual)
git branch -v
Switching to Branch
To start working on a different branch, issue the git checkout command.
Given a branch name, git checkout makes the branch the new, current working branch.
It changes your working tree file and directory structure to match the state of the given branch.
git checkout name-of-branch
git checkout node1 (Press Enter)
From now on, all of our changes and commits will only impact this very context – until we switch it again by using the “checkout” command to make a different branch active.
Creating new file
To create new file like txt , doc, pdf, xls use tough filename.extension touch abc.doc , It will create new doc file with name abc.
Switching to master
To switch to master from any branch just type below code
git checkout master
Merging any branch to master
Git is not mandating that all branches be merged into the master branch before they can be deleted. Remember, a branch is simply a name or pointer to a commit that has actual content. Instead, Git is keeping you from accidentally losing content from the branch to be deleted that is not merged into your current branch.
If the content from the deleted branch is already present on another branch, checking that branch out and then requesting the branch deletion from that context would work.
In Git, a merge must occur within a single repository—that is, all the branches to be merged must be present in the same repository.
First you have to switch to master branch then type below code.
git merge name-of-branch
git merge node1
node1 branch will get merged into master branch.
Java 11 features What's New in JDK 11 - New …
The choice between Selenium and Protractor should be based on …
How to Download & Install Java 32 bit This Java Development …
How to Download & Install Java 64 bit This Java Development …