- ls | wc -l (number of files in a folder)
- $ find . -iname 'Courses.json' -> find in the current folder and subfolders the file 'Courses.json'
- $ grep MemTotal /proc/meminfo
- $find . -type f -name '*.DS_Store*' -delete
giovedì, aprile 23, 2015
Linux/Unix useful commands
mercoledì, aprile 01, 2015
git useful commands
################ git commands ################
$ git config --global user.name "Enrico Giurin"
$ git init --> creates local repo /users/enrico/store/.git
$ git add xxx
$ git commit -m ".." .
$ git status
$ git add --all .
branch: master
$ git add --all
creates snapshot
$ git log
##############################
$ git diff
$ git reset
$ git reset --hard - undo local changes since that revision
$ git checkout -- (blow way all changes since last commit)
$ git commit -a -m "xxx" add & commit
$ git reset --soft HEAD undo last commit
$ git commit --amend -m "..." changed the last commit
$ git reset --hard HEAD^ undo last commit and all changes
$ git reset --hard HEAD^^ undo last 2 commits and all changes
$ git push
$ git pull
- origin: name of the remote repository
$ git remote add origin https.//github.com/egch/xxx
$ git remote -v
$ git push -u origin master (origin: remote / master: local)
##############################
$ git clone
$ git clone yourName
$ git remote -v
$ git branch (cat)
$ git checkout cat
$ git checkout master
$ git merge cat
$ git branch -d cat (removing branch cat)
$ git checkout -b admin (switch and create a new branch)
--> go back to master
$ git checkout master
(fix something in the master and now we merge the admin)
$ git merge admin
vi editor
git log ( a message log related to the merge)
##############################
$ git pull (fetch)
$ git push
$ git commit -a -m "merged"(after merge)
<<<<< my version
>>>>> their version
##############################
$ git checkout -b shopping_cart
$ git push origin shopping_cart
$ git push
[jane] $ git pull
$ git branch
$ git branch -r (remote branches)
$ git checkout shopping_cart
$ git remote show origin
$ git push origin :shopping_cart (to delete the remote branch)
$ git branch -d shopping_cart (trying to delete local branch)
$ git branch -D shopping_cart (force to delete local branch)
$ git remote prune origin (to cleanup delete remote branches)
$ git tag (list all tags)
$ git checkout v0.0.1 (checkout code at commit)
$ git tag -a v0.0.3 -m "version" (to create a new tag)
$ git push --tags (to push the tags)
########################################
$ git log
$ git config --global color.ui true
$ git log --pretty=oneline
$ gitl log --pretty=format: "%h %ad- %s [%an]"
(ad=author date, an=author name,h=SSH hash, s=subject,d=ref names)
$ git log --online -p
$ git log --online --stat
$ git log --online --graph
$ git log --since=2000-02-02 --until=2003-10-10
$ git diff
$ git diff HEAD~5 (5 commits ago)
$ git diff master bird
$ git diff --since=1.month.ago --until=2.minutes.ago
$ git blame list.html --date short
.git/info/exlude : to esclude some files from commit
pattern: logs/*.log
.gitignore (logs/*.log)
$ git rm README.txt
$ git rm --cached mylog.log
$ git config --global core.editor notepad++
ALIASES
$ git config --global alias.mylog "log --pretty=format:'%h %s [%an]' --graph"
$ git myLog
$ git config --global user.name "Enrico Giurin"
$ git init --> creates local repo /users/enrico/store/.git
$ git add xxx
$ git commit -m ".." .
$ git status
$ git add --all .
branch: master
$ git add --all
creates snapshot
$ git log
##############################
$ git diff
$ git reset
$ git commit -a -m "xxx" add & commit
$ git reset --soft HEAD undo last commit
$ git commit --amend -m "..." changed the last commit
$ git reset --hard HEAD^ undo last commit and all changes
$ git reset --hard HEAD^^ undo last 2 commits and all changes
$ git push
$ git pull
- origin: name of the remote repository
$ git remote add origin https.//github.com/egch/xxx
$ git remote -v
$ git push -u origin master (origin: remote / master: local)
##############################
$ git clone
$ git clone
$ git remote -v
$ git branch
$ git checkout cat
$ git checkout master
$ git merge cat
$ git branch -d cat (removing branch cat)
$ git checkout -b admin (switch and create a new branch)
--> go back to master
$ git checkout master
(fix something in the master and now we merge the admin)
$ git merge admin
vi editor
git log ( a message log related to the merge)
##############################
$ git pull (fetch)
$ git push
$ git commit -a -m "merged"(after merge)
<<<<< my version
>>>>> their version
##############################
$ git checkout -b shopping_cart
$ git push origin shopping_cart
$ git push
[jane] $ git pull
$ git branch
$ git branch -r (remote branches)
$ git checkout shopping_cart
$ git remote show origin
$ git push origin :shopping_cart (to delete the remote branch)
$ git branch -d shopping_cart (trying to delete local branch)
$ git branch -D shopping_cart (force to delete local branch)
$ git remote prune origin (to cleanup delete remote branches)
$ git tag (list all tags)
$ git checkout v0.0.1 (checkout code at commit)
$ git tag -a v0.0.3 -m "version" (to create a new tag)
$ git push --tags (to push the tags)
########################################
$ git log
$ git config --global color.ui true
$ git log --pretty=oneline
$ gitl log --pretty=format: "%h %ad- %s [%an]"
(ad=author date, an=author name,h=SSH hash, s=subject,d=ref names)
$ git log --online -p
$ git log --online --stat
$ git log --online --graph
$ git log --since=2000-02-02 --until=2003-10-10
$ git diff
$ git diff HEAD~5 (5 commits ago)
$ git diff master bird
$ git diff --since=1.month.ago --until=2.minutes.ago
$ git blame list.html --date short
.git/info/exlude : to esclude some files from commit
pattern: logs/*.log
.gitignore (logs/*.log)
$ git rm README.txt
$ git rm --cached mylog.log
$ git config --global core.editor notepad++
ALIASES
$ git config --global alias.mylog "log --pretty=format:'%h %s [%an]' --graph"
$ git myLog
Iscriviti a:
Post (Atom)