git remote add <name> <url>
git push -u origin master
# display all remote repos that currently connected with
git remote -v
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
``` | |
git checkout feature | |
git rebase master | |
# if conflicts occur, resolve them and then run | |
git rebase --continue | |
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
``` | |
# Add the missing files from the previous commit | |
git add missing-file.txt | |
# Modify the last commit with new file added and/or new commit message | |
git commit --amend | |
``` | |
`git commit --amend` can only be used when you forgot files from the last commit. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
``` | |
git config --global core.editor vim|emacs|nano | |
# Add flag --wait for your favorite editor in order to tell git | |
# to wait until I quit atom for the action to be completed | |
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
``` | |
git commit -m "title" -m "longer descriptions" | |
# or | |
git commit # an editor will be opened and you will be able to type your commit title and descriptions there | |
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Lambda | |
Syntax: ```lambda arguments: expression``` | |
__Example__ | |
``` | |
# Regular way of creating a function | |
def add(x, y): | |
return x+y | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Preorder traversal: node -> node.left -> node.right | |
public void preorder(TreeNode root) { | |
Stack<TreeNode> stack = new Stack<>(); | |
TreeNode current = root; | |
while (stack.size > 0 || current != null) { | |
if (current != null) { | |
visit(current); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// node.left -> node -> node.right | |
public void inorder(TreeNode root) { | |
Stack<Integer> stack = new Stack<>(); | |
TreeNode current = root; | |
while (!stack.empty() || current != null) { | |
if (current != null) { | |
stack.push(current); |
OlderNewer