Public repositories Cost based on number of users Cost based on number of repositories Supports git and hg Supports git only • Codeplane, Githost, Assembla, Cloudforge, Gitorious • Bitbucket Username - arulmurugan E-Mail - [email protected]
files / last commit • git log #Shows history of commits in the current branch • git log --oneline --abbrev-commit #Shows one line commit history with short commit id • git log --graph --pretty --oneline --abbrev-commit #Shows the history as graph • git diff-tree --name-only -r <commit_id> #Shows files changed in the commit • git show <commit_id> #Shows changes in the commit
the file • git log -p [filename] #Shows commits for the file with changes • git log --follow -p [filename] #Shows commits for the file including renames • git blame [filename] #Shows author and commit per line of the file • git blame -L 1,3 [filename] #Shows author and commit from line 2 to line 3 • git commit --amend -m "More changes - now correct" #To amend changes to previous commit before pushing
and checkout the last committed revision. • Allows you to pull in the latest changes without conflicts. • Afterwards you can restore the stashed changes, which will apply the changes to the current version of the source code.
save uncommited changes as stash • git stash list #To view list of saved stashes #stash@{0}: On master: Title changed • git stash apply stash@{0} #To apply the particular stash • git stash drop stash@{0} #To drop particular stash • git stash clear #To drop all saved stashes • git stash pop #To apply most recent stash and delete it from list of stashes
certain commit. • These branches can be changed independently from each other. • The default branch is called master. • Untracked files remain unchanged and are available in the new branch. This allows you to create a branch for unstaged and uncommitted changes at any point in time.
branch -a #List available branches including remote branches • git branch -r #List remote branches only • git branch <branch_name> #To create new branch • git checkout <branch_name> #To switch to a branch • git checkout -b <branch_name> #To create a branch and switch to it
a file # [reference] can be a branch, tag, HEAD or commit ID • git show [reference]:[filename] > [filename_copy] #To copy a file • git log -- [filename] #To see commit history of a file, even if deleted
• git config --global alias.st 'git status' #Set command "st" for git status #Now git st can be used instead of git status • git config --global alias.acm '!git add . -A && git commit' #Set command "acm" for git add . and git commit #Now you can use git acm "message" for commits #Not supported in windows*
another Git repository into a Git repository • git submodule add [URL to Git repo] #To add submodule to your repo • After cloning a repo with submodules ◦ git submodule init #Creates local configuration file for submodules ◦ git submodule update #To clone submodules