Skip to content

Instantly share code, notes, and snippets.

public class AmazonS3Example {
private static final String ACCESS_KEY="<your access key here>";
private static final String SECRET_KEY="<your secret key here>";
private static final String SUFFIX = "/";
private AmazonS3 initS3Client() {
AWSCredentials credentials = new BasicAWSCredentials(
ACCESS_KEY,
SECRET_KEY);
return new AmazonS3Client(credentials);
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.lici.aws</groupId>
<artifactId>java-s3-example</artifactId>
<version>0.0.1-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>com.amazonaws</groupId>
#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
#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
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
#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
#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"
#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
#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
$ 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