Skip to content

Instantly share code, notes, and snippets.

@leahgarrett
Created March 25, 2019 06:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save leahgarrett/556d75b690bf00397f27f5ccd4379314 to your computer and use it in GitHub Desktop.
Save leahgarrett/556d75b690bf00397f27f5ccd4379314 to your computer and use it in GitHub Desktop.
Git practice

Reviewing git commands

The below steps must be done in order

  • Create a directory called hello_git
  • Create an index.rb file inside the directory, and puts “Hello world!” in this file
  • Change into the hello_git directory and run ‘git status’
  • It says it is not a git repository. Initialise this directory as a repo
  • Add everything in your directory to your GitHub repo
  • Commit these changes - be sure to write a meaningful message
  • Push this commit to GitHub
  • Create a new branch with whatever name you’d like
  • Create a new file called README.md and put an explanation of your project into this file
  • Add, commit and push this branch
  • Go to Github and merge the pull request
  • Back on your local machine, change back to your master branch and pull these new changes down
  • When successful, delete the branch you created, so you should only have master left
  • Add another file called this_was_a_mistake.rb and add some text into it
  • You should never push to master, so take your changes with you and create another branch with a new name
  • Add, commit, push these changes
  • Back on GitHub, complete a pull request
  • On your local machine, change back to master, delete your old branch, and pull down the changes
  • Oh drat! We don’t want the file this_was_a_mistake.rb! Rollback to your previous commit!
  • Turn to the person next to you, follow them on GitHub and work out how you can clone their repository (and let them clone yours)
  • Make some modifications to their repo, and add, commit and push up
  • Turn to the person on the other side and fork their repo
  • Make some changes, and add, commit and push up
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment