- What is source control and why is it important.
- Touch on other source control options and hosts.
- Source control is one aspect of professional deploy cycle -- works hand in hand with continuous integration and the code review process.
- It's more than just checking in code, it's leaving a breadcrumb trail for ourselves and our partners to understand how and why we constructed things the way we did.
- Review of basic git idiom
- Companion to existing best practices around "test a little, write a little."
- Gets stuff off your machine!
- Build your portfolio for interviewing!
Git Command | Summary |
---|---|
git status |
see status of local repo, what's changed, what's committed, what's new |
git pull |
get most recent commits from the branch you are on |
git add <filename> |
this file or all changes in this file to staging |
git commit -m |
combine all things in staging into a commit bundle with this message on my local machine |
git push |
push all of my local commits up to the remote branch on the remote repo |
Git Command | Summary |
---|---|
git add -p |
cycle though all tracked files and inspect changes one at a time |
git diff |
show me, line by line, what has changed in tracked files that aren't added |
git diff --cached |
show me, line by line, what has changed in added files |
git commit --amend |
alter the commit message of a staged commit |
- Check out the log, see that you've left yourself some notes
- Gives you lots of break points. 'git reset' to previous working commit.
Git Command | Summary |
---|---|
git log |
show long form commit info |
git log --pretty=oneline |
show short form commit info |
git reset --hard <some commit id> |
turn back time on my local machine to some previous commit id |
git reset --hard HEAD~{<number of commits back>} |
turn back time on my local machine to some number of commits back |
- Requires a plan, communication, and requirements beforehand. Usually branches and pull requests are small and centered on a specific goal like implementing a feature
Git Command | Summary |
---|---|
git remote -v |
see the verbose name of my remote |
git remote show <shortname> |
detailed info on your remote |
git remote add <shortname> <url> |
explicitly add a remote and assign a name |
git fetch <remote> |
contribute to a specific remote |
Git Command | Summary |
---|---|
git branch <some branch name> |
create a branch on your local machine |
git push -u origin <some branch name> |
push your local branch to the remote, set remote upstream |
git branch |
see all my local branches |
git checkout <some branch name> |
switch to a local branch |
Git Command | Summary |
---|---|
git branch -a |
see my local and remote branches |
git checkout --track origin/<some remote branch name> |
get a remote branch on your local machine |
git branch -d <some local branch name> |
delete the local branch |
git branch -D <some local branch name> |
force delete the local branch |
git push origin :<some remote branch name> |
delete a remote branch |
- See github documentation for the hows
- Hallmarks of a good PR conversation:
- PRs are opened with meaningful titles and descriptions where needed.
- Reviewers are specific when requesting changes.
- Addresses both the trivial (style, naming) and non-trivial (logic and architecture).
- Nice! Remember, this person is trying to make your code better.
- Every concern is at least discussed.
- Resolved quickly. Try to not pick up new work until your PR is merged.
Git Command | Summary |
---|---|
git merge <some local branch name> |
apply commits from some other the local branch to the current branch you are in |
Git Command | Summary |
---|---|
git stash |
put any tracked changes into stash |
git stash save "<some note about what is stashed>" |
leave yourself a note about what you are stashing |
git stash list |
see a list of what is stashed |
git stash pop |
take the first item off the top of the stash |
git stash clear |
wipe out the stash |
Git Command | Summary |
---|---|
git rebase <some local branch name> |
alter history. replay all of my commits on top of current local version of some other branch. Must git push -f (force push to commit to remote) to apply this to the remote |
Git Command | Summary |
---|---|
git rebase -i <some local branch name or commit id> |
alter history. combine commits, delete commits, reword commit messages. Must git push -f (force push to commit to remote) to apply this to the remote |
Git Command | Summary |
---|---|
git reflog --all |
see the history of branches across the whole repo |
- Branches are used to manage not just feature creation, but also the life cycle and continued development of many projects.
- Shout out to open source projects like the development of Rust and Ember http://2016.phillyemergingtech.com/session/stability-without-stagnation-lessons-learned-shipping-ember/.
- It's a handy, essential tool that you can use today to improve your development experience.
- [https://try.github.io/](Try Git, an interactive git game)
- [https://git-scm.com/doc](SCM documentation, authoritative docs)
- [https://github.com/robbyrussell/oh-my-zsh](zshell, theme used is eastwood)
- [https://www.sublimetext.com/](sublime text editor)
- [https://travis-ci.org/](travis CI)