Skip to content

Instantly share code, notes, and snippets.

View output.txt
#Creating a new tag
git tag <tagname>
#Creating an annotated tag
git tag -a <tagname>
#Listing git tags
git tag
#pushing a tag to remote
git push origin <tag_name>
#checking out tag
View output.txt
#status command is in frequent use when a working with Git and during a merge it will help identify conflicted files.
git status
#Passing the --merge argument to the git log command will produce a log with a list of commits that conflict between the merging branches.
git log --merge
#diff helps find differences between states of a repository/files. This is useful in predicting and preventing merge conflicts.
git diff
#checkout can be used for undoing changes to files, or for changing branches
git checkout
#reset can be used to undo changes to the working directory and staging area.
git reset --mixed
View output.txt
git status
On branch master
You have unmerged paths.
(fix conflicts and run "git commit")
(use "git merge --abort" to abort the merge)
Unmerged paths:
(use "git add <file>..." to mark resolution)
both modified: test.txt
View output.txt
#When you use --soft parameter: Git will reset all uncommitted changes. But changes are left staged (index).
git reset --soft
#When you use --mixed (default)parameter: Git will reset all uncommitted changes as well as unstaged changes. But changes are left in working tree.
git reset --mixed
#When you use --hard parameter: Git will reset all uncommitted changes, unstaged ones, as well as deleted changes, nothing's left.
git reset --hard
View output.txt
#Below command prints only two logs on the master branch
git log master -n=2
or
git log master --max-count=2
#Below command skips to print two logs on the master branch
git log master --skip=2
#Below command prints only the last two weeks logs of master branch
git log master --since="2 week ago"
#Below command prints the logs till yesterday
git log master --until="yesterday"
View output.txt
#The below command prints the logs on the master branch
git log master
#Below command prints the logs in remote master branch
git log origin/master
#The below command prints the logs in v1.0.0 branch
git log v1.0.0
#The below command all the commits on impl but not on master
git log impl..master
#The below command prints all the commits of impl and master
git log impl...master
View output.txt
#This is the default log command
#The command listing out all the commit log.
#The log information contains commit ID, Author and date.
git log
#The below command will print each logs in a single line
git log --oneline
#The below command will prints files which modified on each commit
git log --stat
#The below command prints logs including each changes in the file
git log --patch
View output.txt
$ git push origin test
$ git pull
You asked me to pull without telling me which branch you
want to merge with, and 'branch.test.merge' in
your configuration file does not tell me, either. Please
specify which branch you want to use on the command line and
try again (e.g. 'git pull <repository> <refspec>').
See git-pull(1) for details.
If you often merge with the same branch, you may want to
View output.txt
Field myShapeOne in com.lici.spring.bean.shape.ShapeService required a single bean, but 2 were found:
....
Field myShapeTwo in com.lici.spring.bean.shape.ShapeService required a single bean, but 2 were found:
View UserController.java
@RestController
@RequestMapping("/user")
public class UserController {
@RequestMapping(value={"/find", "/search*","/get/*","**/findall"}, method = RequestMethod.GET)
public String findAllUsers() {
return "GettingUsers";
}
}