Branching
git branch -D Branch name # untuk hapus local branch
git push origin --delete Branch name # untuk hapus remote branch
git switch -c Branch name
git checkout -b branch name # nama branch baru
git merge "other branch"
git pull origin branch name
Stash
git stash list # list stash yang di simpan
git stash save "message" # simpan perubahan tanpa di commit
git stash apply "index stash" # mengambil stash yang di simpan
Directory
rm -rf
mv current /to
mkdir
cat
cd
cd ..
File
touch filename
nano filename
grep "error" log.txt # Cari text dalam file
grep "kata" *.txt # Cari di semua file dalam folder
du -hs # size directory
du -hs * # size file/folder
du -h # specific file size
Variables/Constants
var myVariable = 23
let myConstant = 33
var typedVariable: Type
let typedConstant: Type
Functions
func functionName(intput: Type) -> Type {
// Do someting
return theOutput
}
Data Types
Int 23
Float 4.5
Double 3.323234
Bool true/false
String "abc"
Array [1, 4, 5]
Dictionary [key: value]
Structures
struct MyStruct {
}
Classes
class myClass: SuperClass {
}
IF Statement
if condition {
// do X
} elseif otherCondition {
// do Y
} else {
// do Z
}
Switch Statement
switch someVariable {
case 1:
// do X
case 2:
// do X
default:
// do X
}
Loops
for variable in low...height {
}
for item in array {
}
while condition {
}