GIT

Bare repository

cd /opt/git
mkdir project
cd project
git --bare init

cd myproject
git init
git add .
git commit -m 'initial commit'
git remote add origin /opt/git/project
git push origin master

4.4 Git on the Server – Setting Up the Server


GIT команди

git status - списък със staged files
git tree - списък с short commits (alias)
git add -A - stage за commit
git commit -m "message"
git ac -m "message"

git pull origin master - дърпа от repository origin
git push origin (master)
git push --force origin (ако съм гитнал преди този commit)

git branch - показва колко бранча има
git branch newbranch - създава branch newbranch
git checkout newbranch - активен branch става newbranch
git merge newbranch - събира newbranch към актуалния branch

git rm --cached js/j.js - маха директно от гит-а
git diff - промени от последния commit, които не са stage-нати
git diff --name-status ****** ****** - променени файлове
git diff-tree --name-only -r  **********
git log - лог
git show **********
git show --pretty="format:" --name-only **********
git reset - без параметри - unstage (soft, mixed, hard параметри)

Git Alias – git add -A and git commit in one command

/home/fill/.gitconfig

[alias]
        ac = !git add -A && git commit
        tree = log --graph --all --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n''          %C(white)%s%C(reset) %C(bold white)— %an%C(reset)' --abbrev-commit
        co = checkout
[user]
        email = i_fillipoff@yahoo.com
        name = Ivan Filipov
[color]
        diff = always
        status = always
[core]
        autocrlf = false
        whitespace = cr-at-eol
        sharedRepository = group

Project folder .git/config

[core]
        repositoryformatversion = 0
        filemode = false
        bare = false
        logallrefupdates = true
        sharedrepository = 1
        autocrlf = true
[receive]
        denyNonFastforwards = true
[branch "master"]
[remote "origin"]
        url = /opt/git/project/
        fetch = +refs/heads/*:refs/remotes/origin/*

vim: i, esc, :wq, dd