Skip to content

Example Git repository for the Softhouse Git workshop.

License

Notifications You must be signed in to change notification settings

Softhouse/git-workshop

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Softhouse

Example Git repository for the Softhouse Git Workshop.

Initialize workspace

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.

Initializing First Workspace

$ 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 "first.user@softhouse.se"
$ cd ..

Initializing Second Workspace

$ 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 "second.user@softhouse.se"
$ cd ..

Command lines

We will use the following command list:

SET UP

  • Set up your user name
$ git config user.name "Your Name"
  • Set up your email
$ git config user.email "your.email@domain.com"

CREATE

  • Clone a repository into a new directory from $URL Link
$ git clone $URL

BROWSE

  • Show the working tree status Link
$ git status
  • Show changes between commits, commit and working tree, etc. Link
$ git diff
  • Show commit logs Link
$ git log

COMMIT

  • Add file $FILE to staging files Link
$ git add $FILE
  • Stage file $FILE for deletion Link
$ git rm $FILE
  • Record changes to the repository Link
$ git commit [-m "message"]

BRANCH

  • Switch to branch $BRANCH Link
$ git checkout $BRANCH
  • Create and switch to a new branch $BRANCH Link
$ git checkout -b $BRANCH

REVERT

  • Undo uncommit changes of $FILE Link
$ git checkout -- $FILE
  • Reset to last checked in state (can't undo) Link
$ git reset --hard

STASH

  • Stash the changes in a dirty working directory away Link
$ git stash
  • Return back the last changes stashed Link
$ git stash apply

PUBLISH

  • Tag commit as $TAG Link
$ git tag -a $TAG -m "message"
  • Publish to remote repository branch $BRANCH Link
$ git push origin $BRANCH
  • Publish the tag $TAG to remote.
$ git push origin $TAG

REMOTE

  • Fetch latest changes from remote and tracking branches Link
$ git fetch
  • Pull (fetch and merge) from remote $BRANCH Link
$ git pull origin $BRANCH

More info

git-scm.com

About

Example Git repository for the Softhouse Git workshop.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages