/git-101

Git + GitHub for Beginners

MIT LicenseMIT

Git + GitHub for Beginners

Steps we'll be taking

  1. Clone this repository
$ git clone https://github.com/karissademi/git-101.git
  1. Add a .txt file in the /users directory. In the file, include
  • your name
  • job title
  • most recent project
  • favorite animal
  1. Name the file your-name.txt

  2. Enter the directory on your computer

$ cd git-101
  1. Checkout a new branch e.g. task/your-name
$ git checkout -b task/karissa-demi
  1. Check the status of the working directory
$ git status
  1. Add the file in git
$ git add karissa-demi.txt
  1. Check the status again
$ git status
  1. Create a commit message
$ git commit -m "Add my file"
  1. Create the remote branch and push your changes to the origin
$ git push --set-upstream origin task/sample-user
  1. Open a pull request for your branch in the GitHub interface

  2. Check the pull request that appears under your own.

  3. Provide feedback.

  4. Check your original pull request to see if you need to make a change. Even if you don't have any commits, add your favorite food to the file.

  5. Make the change and commit.

$ git add <file-name>
$ git commit -m "A commit message that explains the change you made" 
  1. Push the changes
$ git push
  1. Merge the orginal pull request.

  2. Switch back to the master branch

$ git checkout master
  1. Get all the changes we've been making on your local copy
$ git pull 
  1. See all the changes
$ git log
  1. Delete your branch
$ git branch -D <branch-name>

Forgot your branch name?

$ git branch