Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Git in Control, Version Control and How it Can ...

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.

Rachell Calhoun

July 20, 2016
Tweet

More Decks by Rachell Calhoun

Other Decks in Technology

Transcript

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

    up Git 4. Basic Commands 5. Tricky Stuff 6. Gitiquette
  2. Git in Control 1. $whoami 2. Version control 3. Setting

    up Git 4. Basic Commands 5. Tricky Stuff 6. Gitiquette
  3. Git in Control 1. $whoami 2. Version control 3. Setting

    up Git 4. Basic Commands 5. Tricky Stuff 6. Gitiquette
  4. Git in Control 1. $whoami 2. Version control 3. Setting

    up Git 4. Basic Commands 5. Tricky Stuff 6. Gitiquette
  5. $ 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. Git in Control 1. $whoami 2. Version control 3. Setting

    up Git 4. Basic Commands 5. Tricky Stuff 6. Gitiquette
  7. Undo local commits $ git reset HEAD~2 $ git reset

    --hard HEAD~2 $ git reset --hard 234jk3
  8. Edit a Commit Message $ git commit --amend $ git

    commit --amend -m "New message that sounds like I know what I’m doing!"
  9. Add a Forgotten File $ git add forgotten_file $ git

    commit --amend $ git diff --stat --cached origin/master
  10. Git in Control 1. $whoami 2. Version control 3. Setting

    up Git 4. Basic Commands 5. Tricky Stuff 6. Gitiquette
  11. Gidiquette - Check issues - Branch naming - Keep changes

    small - Respect the coding style - Play nice with others
  12. 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