GithubHelp home page GithubHelp logo

juaalta / gitincouples Goto Github PK

View Code? Open in Web Editor NEW

This project forked from delapuente/gitincouples

0.0 1.0 0.0 42 KB

An introductory and practical exercise for Git and GitHub

geekshubs-devops-bootcamp-2019

gitincouples's Introduction

Git in Couples

Git in couples is an introductory and practical exercise for using Git and GitHub. It is intended to be done in couples where one of you performs as Alice, the owner of a repository and the other as Bob, a collaborator.

Through the exercise, Alice and Bob will evolve a basic JavaScript version of the Mars Rover Kata to a more sophisticated implementation.

Prerequisites

You must have git installed on your system and it must be properly configured to be used from a command line or terminal.

In addition, you should know a little bit about Git, here you have some interesting lectures:

How to follow the exercise

Once in couples, one of you assumes the role of Alice and the other one is Bob. Alice should follow the text in alice.md while Bob should follow the text in bob.md.

Alice and Bob have fake GitHub accounts:

You must replace alice or bob with your username accordingly to the role you're performing.

From time to time, the text reads Wait Alice... or Tell Bob.... Obviously interactions with Git and GitHub are not synchronous at all and that is the interesting part of a SCM, of course, but for the sake of better learning, we will keep this way.

Once finished, delete both repositories from Alice and Bob and the local ones and start over switching your roles.

Recommendations

It is possible I made mistakes writing the exercise or you made something worng or simply, something goes wrong during the exercise. Don't panic and try to apply some of these solutions:

  • You need to interrupt your work and attend other things in another branch. Use the stash:
$ git stash

This saves your current modifications on the top of the stash stack.

$ git stash apply

This applies the last changes saved in the stash stack.

  • You have messed up your working tree but not commited and want to discard all your changes.
$ git checkout .
  • You want to undo a commit already published.

The safe answer is you can not but you can revert the changes you made with the last commit. Locate the commit hash for what you want to revert and do:

$ git revert <hash>
  • You want the commits from the remote repository discarding yours.
$ git pull <remote> <branch>
$ git reset --hard <remote>/<branch>

Replace <remote> and <branch> accordingly.

Remember you always have reflog. Type:

$ git reflog

You can see a list of recent changes, switches from one commit to another, from one branch to another... Simply locate the moment you want to recover and do a checkout there using the HASH or the alias (first or second column).

You have more FAQ and tricks in the FAQ file.

The workflow

The workflow proposed in Git in Couples is the Forking Workflow and Alice's repository is the official one. Alice and Bob will integrate their changes by the use of pull requests.

The Mars Rover Kata

FYI, here is the kata formulation:

  • Develop an api that moves a rover around on a grid.
  • You are given the initial starting point (x,y) of a rover and the direction (N,S,E,W) it is facing.
  • The rover receives a character array of commands.
  • Implement commands that move the rover forward/backward (f,b).
  • Implement commands that turn the rover left/right (l,r).
  • Implement wrapping from one edge of the grid to another. (planets are spheres after all)
  • Implement obstacle detection before each move to a new square. If a given sequence of commands encounters an obstacle, the rover moves up to the last possible point and reports the obstacle.

Example: The rover is on a 100x100 grid at location (0, 0) and facing NORTH. The rover is given the commands "ffrff" and should end up at (2, 2)

Adittional resources

Yo have a complete list of common git commands. The guide points out the different places of a git repositroy. When you click on an area, commands reading or modifying that area appear as arrows. If you click on a command, an explanation appears below. The direction of the arrow depicts the direction of the change. I.e. commit -a goes from workspace to local repository by adding modified files to the repository.

Messing up with Git is easy but fixing it is easy as well. Just remember, don't push! What happens in the local repository, stays in the local repository. Check this workflow from Git Pretty to help yourself to deal with Git calamities.

gitincouples's People

Contributors

delapuente avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.