Git in Control, Version Control and How it Can Save Your Life

Git in Control, Version Control and How it Can Save Your Life

“You can’t break GitHub, don’t worry.” Maybe you can’t break it but you can sure get yourself into a labyrinth of git commands. Version control can be a headache but it can also save your project.

There are certain pitfalls to avoid when using Git, I’ve probably found most of them and stumbled my way out. While my goal is to help you avoid them altogether, I also want to give you the skills to work through these pitfalls so you can make it out alive and with your project intact.

Whether you’re working on your own project, or collaborating with others you can learn how to git survive anything. We’ll discuss the benefits version control has for your own projects as well as projects with others.

For all of you awesome collaborators working with others on a project, we’ll go over important steps to take while handling others’ code and ‘gitiquette’ so you can save yourself the embarrassment of faux pas in the git world.

This will give you an overview of Github flow, provide solutions for potential problems you may encounter, and help you feel more comfortable with version control.

66658347c90b0d70e175e54949d3ff93?s=128

Rachell Calhoun

July 20, 2016
Tweet

Transcript

  1. 2.

    Git in Control 1. $whoami 2. Version control 3. Setting

    up Git 4. Basic Commands 5. Tricky Stuff 6. Gitiquette
  2. 5.

    Git in Control 1. $whoami 2. Version control 3. Setting

    up Git 4. Basic Commands 5. Tricky Stuff 6. Gitiquette
  3. 9.

    Git in Control 1. $whoami 2. Version control 3. Setting

    up Git 4. Basic Commands 5. Tricky Stuff 6. Gitiquette
  4. 14.

    Git in Control 1. $whoami 2. Version control 3. Setting

    up Git 4. Basic Commands 5. Tricky Stuff 6. Gitiquette
  5. 16.

    $ git status On branch branchname Untracked files: (use "git

    add <file>..." to include in what will be committed) list_of_passwords passwords2 nothing added to commit but untracked files present (use "git add" to track)
  6. 25.
  7. 27.
  8. 33.
  9. 36.
  10. 38.
  11. 43.

    Git in Control 1. $whoami 2. Version control 3. Setting

    up Git 4. Basic Commands 5. Tricky Stuff 6. Gitiquette
  12. 50.

    Undo local commits $ git reset HEAD~2 $ git reset

    --hard HEAD~2 $ git reset --hard 234jk3
  13. 53.
  14. 54.
  15. 55.

    Edit a Commit Message $ git commit --amend $ git

    commit --amend -m "New message that sounds like I know what I’m doing!"
  16. 56.

    Add a Forgotten File $ git add forgotten_file $ git

    commit --amend $ git diff --stat --cached origin/master
  17. 57.

    Git in Control 1. $whoami 2. Version control 3. Setting

    up Git 4. Basic Commands 5. Tricky Stuff 6. Gitiquette
  18. 58.

    Gidiquette - Check issues - Branch naming - Keep changes

    small - Respect the coding style - Play nice with others
  19. 59.

    To Summarize: git config --global user.name git config --global user.email

    git init git remote add origin git clone git status git add git commit -m “...” git push git checkout -b branchname git branch -d branchname git push origin branchname git branch git fetch origin git merge branchname git pull Forking Compare and Pull Request git remote add upstream path/to/rep Git pull upstream master git stash git stash -u git stash apply git stash drop git stash pop git stash branch branchname git reset HEAD~2 git reset --hard HEAD~2 git reset --hard 234jk3 git rm list_of_passwords git reset list_of_passwords git commit --amend -m “...” git add forgotten_file git diff --stat --cached origin/master