2. PM -> track working
PM -> control the team
PM -> interact with the process.
PM -> know wich issues is the team working on.
DEV -> co-work
DEV -> rollback
DEV -> manipulate changes
DEV -> parallel versions
SUP -> know what code is deployed
SUP -> see which are the latest changes
SUP -> pull request some easy issues
Why Git ?
5. Commit often
Git can control only the code you commit, so commit
early and often, that's the way to have your code under
control and backed up.
6. Be reversible
Make commits atomically, use all the git potencial, to
make commits clear, by feature and reversible.
Git has all you need to commit changes grouped by
each, fix/feature you code.
7. Make clear and useful commit msgs
Besides making reversible, and atomic commits, ship
they with descriptive messages, so other teammates can
know exactly what each commit is about (especially
under stress)
8. Divide and conquer
If your code goes too large, divide it in repos by modules
or something depending on the software architecture
you are on.
You can use either submodules or separate repositories.
11. Be ware of changing public history
Git allows you to change the published history, but it can
be an annoyance for your teammates.
Better, fix the things by doing commits, maybe by revert,
or patching, etc. But going forward.
12. Don't freak
All your code is under control, any change is rollback-
able, any non - recursive merge, can be done with ease.
keep calm, things can look nasty, but belive me, is
simple.
13. Use a custom prompt
Use a custom unix prompt, that shows you info about
the repo you are working with, the branch you are, the
status and more things.
export PS1='[u@h W$(__git_ps1 " (%s)")]$ '
git has some ps1 variables and functions you can set up,
and if you prefer something more sophisticated take a
look at:
● https://github.com/nojhan/liquidprompt
● https://github.com/bpinto/oh-my-fish
14. Maintain your repo
Do some maintenance, sure someone has versioned a
mysql dump, and your repo is growing insanely. Take
care of that, and maintain the repo often.
Repack, delete weight files, and put order.
15. Rtfm!
and take some practice.
● http://pcottle.github.io/learnGitBranching/
● http://git-scm.com/book/ch3-4.html
● https://www.codeschool.com/courses/try-git
● https://confluence.atlassian.com/display/BITBUCKET/Bitbucket+101
18. Where we are
git remote show will show all your remotes
git remote show origin show information for remote named origin
git remote add [name] [url] add a remote named [name] with url [url]
git remote rm [name] removes a remote named [name]
git status show git status
git status -sb summarized status
git branch show list of local branches
git branch --all show list of local and remote branches
git fetch fetch a remote origin/branch
git checkout [-b new_branch] checks out to a existing branch, or new branch if
-b is used
19. Commiting
git add add files to the commit
git add -p to add partial files
git add --all to add deleted files
git rm remove a tracked file
git rm --cached remove only the file track
git commit makes a commit
git commit -m "message" creates a commit with the spec. message
git commit -am "message" add all tracked files and commit with the message
git commit --ammend if you forgot to add something to the last commit
git reset
20. What is happening
git status
git log shows you the git log
git log --graph --abbrev-commit --decorate --
date=relative --format=format:'%C(bold
blue)%h%C(reset) - %C(bold green)(%ar)%C
(reset) %C(white)%s%C(reset) %C(dim white)
- %an%C(reset)%C(bold yellow)%d%C(reset)'
--all
Pretty log !
git diff
git whatchanged file
git blame file
21. Git pull, git push
git pull origin master pulls branch master from remote origin to local
branch master
git push bitbucket master:dev git pushes the local branch dev to remote
branch master at origin bitbucket
22. Git pull, git push
git pull origin master pulls branch master from remote origin to local
branch master
git push bitbucket master:dev git pushes the local branch dev to remote
branch master at origin bitbucket
23. Git stash (get ride of your local changes)
git stash stashes your local changes
git stash list show stashes
git stash apply | pop <stash> re - apply a stash
git stash drop <stash> deletes a stash
git stash branch <stash>
Read More at http://git-scm.com/docs/git-stash