Sunday, July 5, 2015

Git

Git server
http://git-scm.com/book/en/v2/Git-on-the-Server-Setting-Up-the-Server

cd ~

git config --global merge.ff false

mkdir repos
cd repos
mkdir ur_project.git
cd ur_project.git
git init --bare


Local machine

git remote add <urid>  git@your_ip:repos/ur_project.git
git remote -v


#To see the added url

git remote show origin


Git Cheat Sheet
ref: http://git.or.cz

Remember: git command --help

Global Git configuration is stored in $HOME/.gitconfig (git config --help)

Create
From existing data
cd ~/projects/myproject
git init
git add .

From existing repo
git clone ~/existing/repo ~/new/repo
git clone git://host.org/project.git
git clone ssh://you@host.org/proj.git

Show

Files changed in working directory
git status

Changes to tracked files
git diff

What changed between $ID1 and $ID2
git diff $id1 $id2

History of changes
git log

History of changes for file with diffs
git log -p $file $dir/ec/tory

Who changed what and when in a file
git blame $file

A commit identified by $ID
git show $id

A specific file from a specific $ID
git show $id:$file

All local branches
git branch

List remote
git remote -v

git remote --help


Git Repo Browser
git instaweb --httpd webrick

Log
git log
git reflog

Youtube video:
  https://www.youtube.com/watch?v=sevc6668cQ0


http://stackoverflow.com/questions/6565357/git-push-requires-username-and-password
A common mistake is cloning using the default (HTTPS) instead of SSH. You can correct this by going to your repository, clicking the ssh button left to the URL field and updating the URL of your origin remote like this:
git remote set-url origin git@github.com:username/repo.git

No comments:

Post a Comment