Example Git repository for the Softhouse Git Workshop.
To be able to perform the whole workflow -including the publish commands- without having collateral damages or unexpected behavior, we are going to make our machine works also as the remote repository.
$ git clone --mirror https://github.com/Softhouse/git-workshop.git git-workshop-upstream.git
git-workshop-upstream.git
will be out remote repository.
For the excersice section we will clone our remote repository two times, so we will create two workspaces and we will also configure two different users.
$ git clone git-workshop-upstream.git git-workshop-workspace-1 $ cd git-workshop-workspace-1 $ git config user.name "First User" $ git config user.email "[email protected]" $ cd ..
$ git clone git-workshop-upstream.git git-workshop-workspace-2 $ cd git-workshop-workspace-2 $ git config user.name "Second User" $ git config user.email "[email protected]" $ cd ..
We will use the following command list:
- Set up your user name
$ git config user.name "Your Name"
- Set up your email
$ git config user.email "[email protected]"
$ git clone $URL
$ git status
$ git diff
$ git log
$ git add $FILE
$ git rm $FILE
$ git commit [-m "message"]
$ git checkout $BRANCH
$ git checkout -b $BRANCH
$ git checkout -- $FILE
$ git reset --hard
$ git stash
$ git stash apply
$ git tag -a $TAG -m "message"
$ git push origin $BRANCH
- Publish the tag
$TAG
to remote.
$ git push origin $TAG
$ git fetch
$ git pull origin $BRANCH