Git workshop @ codehub
Attending a git & github workshop run by CodeHub Bristol presented by Andrew Nesbit, from github.com. Whilst I already use git every day, always nice to go along to a session to pick up new tips and be able to help out with others newer to the subject being taught. @CodeHubBs are a inclusive and varied tech meetup, http://www.meetup.com/CodeHub-Bristol/events/182732292/.
Notes to follow:
Creating my first github page: ta5ae.github.io
He was using Atom editor github
Local commits are all in .git unless you push changes
Don’t forget you can use offline
Think of being able to push / share changes with other repos. I do think very much of just master.
You can add your email to your git commits, if you set in the git configuration setting.
git show SHA
– in past always git diff SHA file
git add . - everything
git add foldername
git add *.html
git add folder/*.html
git commit -a -m
– Commit and add all changes plus add a commit – skipping the staging step – will not add new untracked files
Think of using git’s history to bug fix
git revert SHA
– Used to reverse that commit – Applying the diff of the commit in reverse
After you send a pull request, subsequent commits on the forked repo are automatically added to the request, until the merge is accepted or you stop committing ;)
Am I ready for the world to see my changes. Create a development branch vs committing early on master.
You can merge into master later or abandon it, delete it
– lists available branches
git checkout -b branch-name
– creates a new branch and switches to it
git checkout master
git checkout branch-name
Wow – make a new branch for everything you work on! Get inspired!
origin – where you cloned from
git remote show origin
– find out where origin is
git push origin branch-name
– otherwise defaults to master
Look up ghpages – for normal route for github pages for normal repos
git makes the user decide in conflict situations – when changes on the same line occur in a remote repo and your local repo.
HEAD – is local repo
Post manually merging after a conflict
git add file-with-conflict
– default message is normally enough
He uses client for publishing branches
Merging changes back into master
git checkout master
git merge branch-name
NB: You may have conflicts to deal with
No limit on number of branches
You can merge into branches other than master
Other tools for repo visualisers
Aborting a merge
git reset ...