Beyond git add/commit/push
Speaker: Jorge Vargas and Victor Orozco
@edivargas and @tuxtor
Full deck: http://www.jorgevargas.mx/wp-content/uploads/2018/10/Git-SCM-en-v5.pdf
For more blog posts, see The Oracle Code One table of contents
Review
- add – puts in to staging area (from working directory)
- commit – puts in local repo
- push – puts in remote repo
- reset hash – override working directory with local repo
- fetch – get from remote repo to local repo
- pull – fetch + merging into your local branch
- clone – get from remote repo to working dir
Workflow
- select a workflow – varies by project, but all team members should know what using
- Common workflows
- Centralized – all commits to master. Usually for new git users.
- Feature branch – do feature in a branch and then merge in.
- Gitflow – do changes in branch and merge into develop. Then merge development into master. Only commit to master for hotfixes or when develop ready for release
- Forking – copy of repo and merge in
- Recommendations
- No one workflow to rule them all.
- Code in master should be complete and functional at all times
- Create short lived branches
- Use meaningful names for branches
Advanced Git commands
- stash – a quick save of your working directory
Demo
- git init – to create repo
- git status – showed file in staging area
- git commit – add file
- Edit .gitignore – to omit .class files
- git log – see actual commit
- git log –oneline –graph –all – list commits one line per commit so easier to read. Shows which branch the change is in
- git checkout -b newBranch – create new branch and switch to it
- git branches – list all branches
- git checkout master – switch to master
- git checkout -b branch2 – create a second branch off master
- git merge newBranch – first merge smooth
- git merge branch2 – created merge conflict. Fix manually
- git branch -d newBranch – delete branch
My take: I had trouble understanding their accents at first, but then it got easier. The content itself was good. I was also a little distracted getting ready for my session next. I like that they did a live demo. I thought the content was going to be more advanced. The mention of stash was a good one. But then the demo was easy. To be fair, a bunch of people in the room didn’t raise their hands for using git. They got to the advanced part right when they ran out of time. I look forward to reading the rest of the deck at least.