Thursday, June 23, 2016

Docker

https://jpetazzo.github.io/2014/06/23/docker-ssh-considered-evil/



docker logs

docker logs -f

docker run -d -p

docker run -it

docker attach

docker port webserver 80

docker diff webserver

docker cp

docker inspect webserver

docker rm -f $(docker ps -aq)
-------------------------------

docker search postgres
docker pull postgres:latest

Thursday, June 16, 2016

Git


always safe : git checkout -b new_branch

git reset --cached
git rm --cached
git reset -- tracking.txt
git rm
git mv

git add -A
git add -a
git add -u

git add --update
git add --all

git init
git clone
git --version


.git
hooks/
info/exclude

git clone --bare
git log --abbrev-commit --abbrev=4 --pretty=oneline -10
git log --author="John Resig"
git log --pretty=oneline --since="2012-12-20" --until="2013-01-01" -5
git log --pretty=format:"%an --- %H"
Joe Doe --- 123456...

git log --pretty=oneline | wc -l
 git shortlog -s | wc -l

git log --pretty=format:%cd --date=short | uniq | wc -l

 du -h -s .git
du -h -s --exclude=.git

git alias

git stat
git info

git shortlog -n -s

[core]
    bare = true

git status -s -b

username different for every repo
global vs local config

git init

git reflog
git reset --hard HEAD@{1}
git chekcout -b new_branch

git reflog expire --all --expire=now
git prune --dry-run

2 status
conflicts

git rm
git mv
git rm --cached
--------------
reset,checkout,revert
------
git log --oneline --graph --decorate --all
----
git show info^{tree}
---
git show SHA-1^{tree}
----
git branch -v -> latest revision in every branch
---
git pack-refs --all
---
git internal files
cat .git/refs/heads/new_one
cat .git/HEAD
cat .git/packed-refs

------------
git branch -vv
git remote -v
---------
ordinary local branches
local tracking
remote tracking
------------
different pull push urls
-----------
git branch -a
git branch -r

--------------
create branch : git branch doc
switch branch : git checkout doc
show branches : git branch
git checkout -b new-branch existing-branch
git checkout -b new-branch HEAD
Show all branches : 
git branch -a -vv
git branch -r : remote
--------------------
Ordinary local branches 
Local tracking branches 
Remote tracking branches 
git remote rm origin
-----------------
list-remote-branches = "!listRemoteBranches() {
    git branch -r | sed \"/->/d; s/  origin\\///g\";
}; listRemoteBranches"
 
checkout-remote-branches = "!checkoutRemoteBranches() {
    for name in `git list-remote-branches`; do
        git checkout $name;
    done;
}; checkoutRemoteBranches"

clone-with-branches = "!cloneWithBranches() {
    git clone $1 $2;
    cd $2;
    git checkout-remote-branches;
    git remote rm origin
}; cloneWithBranches"
----------------
git remote -v
For untracked filed : 
git clean -f
git clean -n
---------------
git pack-refs
----
git cherry-pick <rev> -> creates a new rev
---
git branch -d
git branch -D
----
git branch --merged
git branch --no-merged
------------
branch rename
git branch -m info information
git branch -M info information
-----------
checkout file from a different revision/branch
git checkout info -- i1.txt
git show doc:m1.txt
-------------
git clone won't preserve reflog, cp will
---
 git merge --ff-only feature : merge only if fast forward case
git log --oneline --merges : show only merge commits
git log --oneline --no-merges : show only no merge commits
git log --oneline --max-parents=X --min-parents=Y
------------
 git merge --no-ff feature : force creation of merge commit even if fast forward is possible
----------
git log --oneline --graph --all
----
git merge a b c d
-----------
git rebase
----
git rev-parse master
---
git checkout `git rev-parse master` : to enter detached HEAD
--
rebase alternative : git checkout `git rev-parse master`; git am *.patch; git checkout -B feature 
-----------
rebase can also be done with cherry-pick
---------



Thursday, June 9, 2016

git

git log --graph --all --oneline --decorate

git

git merge --squash feature : commit all the pending commits of branch
<feature> in current branch


$ git checkout --ours [filename]
$ git checkout --theirs [filename]

git checkout --merge [filename]

git checkout --conflict=diff3 numbers.txt

git commit --no-edit

git merge --abort

echo "numbers.txt binary" > .gitattributes

Wednesday, June 8, 2016

git

git log --format="%h" --grep=XXX --all

git log --oneline
master feature brave-idea
^`git merge-base master feature`
^`git merge-base feature brave-idea`


Partial rebase
git rebase --onto a b c

git commit --amend

git rebase -i HEAD∼3 for Squash,reordering commits,removing commits

git

git merge-base feature brave-idea : common ancestor of 2 branches

git merge-base --octopus feature brave-idea master : common ancestor
of more than 2 branches

diff of branches : git log --oneline master..brave-idea

revisions included in a, b, or c and excluded from d, e, and f

git log a b c --not d --not e --not f

git log a b c ^d ^e ^f

Blog Archive