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

Git/Github Workshop

Git/Github Workshop

Git/Github workshop given at Charlotte Front-End Developers. The workshop covers getting GIT installed on Mac/Windows/Linux the digs through the bare necessity that you'll need to work with GIT. Towards the end it covered workflow, how to work with Github and these magical things called pull requests.

Bermon Painter

March 31, 2014
Tweet

More Decks by Bermon Painter

Other Decks in Programming

Transcript

  1. $ git status Status Check List all of the changes

    that have  been made but not committed.
  2. $ git add <filename>.txt Add Changes Adds an individual file

    and stores them in the Index until you’re ready to commit.
  3. $ git log --pretty=oneline Logs Lists the recent history of

    a repo in a slightly more readable format.
  4. $ git log --pretty=format:'%h %ad | %s%d [%an]' --graph --date=short

    Logs Lists the recent history of a repo in  an extremely more readable format.
  5. $ git log --graph -- pretty=format:'%Cred%h%Creset - %C(yellow)%d%Creset %s %Cgreen(%cr)

    %C(bold blue)<%an> %Creset'--abbrev-commit -- date=relative Logs Lists the recent history of a repo in  an extremely more readable format.
  6. $ git remote add origin <server url> Adding Remotes Useful

    for adding a remote to a new GIT repo.
  7. $ git remote add <remote name> <server url> Adding Multiple

    Remotes Creates another remote that  you can pull and push too.
  8. $ git push origin master Push Your Changes Pushes your

    changes to the remote. Typically a server or service like Github. Origin is an alias to a URL. Master is simply the default branch.
  9. $ git pull origin master Pulling Changes A pull is

    two GIT commands in one. It will fetch changes from the remote, then attempt to merge them into your local repo.
  10. $ git checkout master $ git merge <branch name> Branches

    Merge a branch back into your master branch.
  11. $ git checkout -b <branch-name> <id00000> Revert Commits Detach you

    from what’s in HEAD and create a new branch
  12. $ git stash $ git reset --hard <id000000> $ git

    stash pop Revert Commits Stash your current changes and then reset.
  13. $ pico ~/.gitconfig Aliases Aliases are stored in a global

     .gitconfig file in your $HOME folder.
  14. [alias] ci = commit cm = commit -am br =

    branch co = checkout lp = log -p who = shortlog -n -s --no-merges undo = reset --hard lc = log ORIG_HEAD.. --stat --no-merges lg = log --graph --pretty=format:'%Cred%h%Creset - %C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative lf = log --pretty=fuller cleanup = !git gc && git remote prune origin fork = remote add -f Aliases