From 690232ad8ea33d935d23f5ff74721a8a36619951 Mon Sep 17 00:00:00 2001 From: Valentyn Vasylevskyy Date: Sun, 15 Dec 2024 17:22:01 +0200 Subject: [PATCH] update docs --- tech questions/GIT.js | 102 -------------------- tech questions/GIT.md | 139 ++++++++++++++++++++++++++++ tech questions/WEB | 27 ------ tech questions/general-questions.md | 53 +++++++++++ 4 files changed, 192 insertions(+), 129 deletions(-) delete mode 100644 tech questions/GIT.js create mode 100644 tech questions/GIT.md delete mode 100644 tech questions/WEB create mode 100644 tech questions/general-questions.md diff --git a/tech questions/GIT.js b/tech questions/GIT.js deleted file mode 100644 index 8ff7220..0000000 --- a/tech questions/GIT.js +++ /dev/null @@ -1,102 +0,0 @@ -(/* GIT experience */) => { - /* - - //Core - git init - git clone - git status - git branch - git branch feature - git checkout master - git checkout -b feature - - //Staging, Commiting, Pushing - git add . - git commit -m "initial commit" - git commit -am "initial commit" - git push - - //Merging (development ->master) - git checkout master - git merge development - - //Rebasing - git checkout development - git rebase master - git rebase -i HEAD~3 - git rebase --abort - git rebase --continue - - //Stashing - git stash - git stash pop - -git stash pop stash@{1} - git stash apply - git stash list - git stash -u - git stash -a - git stash drop - git stash drop tash@{1} - - //.gitignore - //readme.md - - _________________How do I undo things in Git?___________________ - //https://www.atlassian.com/git/tutorials/undoing-changes - - - -----------------Undo Uncommitted Changes----------------- - - - Delete all not commited changes (both staged/unstaged) aka reset to last (~HEAD) commit: - git reset --hard - - Unstage all staged changes: - git reset - - Unstage specific file: - git reset 1.txt - git reset -- 1.txt - - Discard all unstaged changes: - git checkout . - - Discard specific unstaged file: - git checkout 1.txt - git checkout -- 1.txt - - -----------------Undo Committed Changes----------------- - - - Change msg of last commit: - git commit --amend -m “This is changed commit msg” - - Add missing changes to last commit: - git add . - git commit --amend -m “This is updated commit msg” - - Rollback file to a certain commit in history (rollback changes are staged): - git checkout path/to/the/file.txt - - Creates new commit with reverted chancges from specific commit (conflicts may occure): - //prefer to use on public repos to avoid confusion - git revert - - Reset working HEAD to specific commit. All commits after this commit will be removed from history - // prefer to use on local/private branch - git reset --hard //use --keep instead of --hard to keep local changes - - - - - - - ----------------------------------- - git branch - - git log - git log --oneline - git log --branches=* - - */ -}; diff --git a/tech questions/GIT.md b/tech questions/GIT.md new file mode 100644 index 0000000..af3ec85 --- /dev/null +++ b/tech questions/GIT.md @@ -0,0 +1,139 @@ +# GIT (Global Information Tracker) + +## General recommendations + +- Keep origin branch history clean (avoid mess) for readability purposes + - `squash` commits during MR/PR via GitLab/GitHub/BitBucket OR + - `squash` local commits using `git rebase -i` (before `git push` or after `git push` using `git push -f` to force override) +- Don't rebase public branches that you do not own (at least without confirmation) +- Consider using `git pull --rebase` as a default approach (depends on what you want) +- Don't push directly into master/dev if you work in a team, instead create MR/PR. +- Don't force push `git push -f` to public branches until it is discussed with a team. + +## Core + +- `git init` +- `git clone` +- `git status` +- `git branch` +- `git branch feature` +- `git checkout ` +- `git checkout -` +- `git checkout -b ` +- `git switch` (= `git checkout`) +- `git switch -c` (= `git checkout -b`) + +## Branching + +### Switch to other branch + +- `git checkout ` +- `git switch ` + +### Switch to previous branch + +- `git checkout -` +- `git switch -` + +### Create and switch to new branch + +- `git checkout -b ` (same as `git branch && git checkout `) +- `git checkout -b ` +- `git switch -c ` + +### Delete branch + +- `git branch -d ` delete \ locally (should not be current one) +- `git push origin --delete ` delete \ on remote + +### Rename local branch + +- `git branch -m ` +- `git branch -m ` + +## Stage + +- `git add .` + +## Unstage + +- `git restore --staged .` +- `git reset` + +## Discard unstaged changes + +- `git checkout .` +- `git checkout FILE_NAME` (or `git checkout -- FILE_NAME` if same as existing branch) + +## Discard both staged/unstaged changes + +- `git restore .` +- `git reset --hard` +- `git reset --hard ` use `--keep` instead of `--hard` to keep local changes + +## Commit + +- `git commit -m 'initial commit'` +- `git commit -am 'initial commit'` +- `git commit --amend -m 'New commit msg'` Change msg of last commit +- `git add . && git commit --amend -m 'New commit msg'` Add missing changes to last commit + +## Push + +- `git push` +- `git push -u origin BRANCH_NAME` + +## Merge (dev -> feat) (will try to fast-forward if possible) + +- `git merge dev` // while on feat + +## Rebase (dev -> feat) + +- `git rebase dev` // while on feat + +## Rebase (local commits, using interactive rebase) + +1. `git rebase -i HEAD~3` to rebase the last 3 commits +2. setup, close file to proceed +3. rebase process starts, commits will be rebased by order +4. - if no conflicts, it will finish + - if conflicts: + 1. rebase process will pause before rebasing problematic commit + 2. fix conflicts locally + 3. `git add .` to mark resolved files as staged + 4. - `git rebase --continue` to continue rebase process OR + - `git rebase --abort` to cancel rebase process, and return to the state before rebase + +## Stash + +- `git stash` +- `git stash pop` +- `git stash pop stash@{1}` +- `git stash apply` +- `git stash list` +- `git stash -u` +- `git stash -a` +- `git stash drop` +- `git stash drop stash@{1}` + +## How do I undo things in Git? + +https://www.atlassian.com/git/tutorials/undoing-changes + +## Rollback file to a certain commit in history (rollback changes are staged) + +- `git checkout file.txt` + +## Creates new commit with reverted changes from specific commit (conflicts may occur, prefer using on public repos to avoid confusion) + +- `git revert ` + +## Reset working HEAD to specific commit. All commits after this commit will be removed from history (prefer using on local/private branch) + +- `git reset --hard ` (use `--keep` instead of `--hard` to keep local changes) + + + +git log +git log --oneline +git log --branches=* diff --git a/tech questions/WEB b/tech questions/WEB deleted file mode 100644 index e06d99f..0000000 --- a/tech questions/WEB +++ /dev/null @@ -1,27 +0,0 @@ -How Internet Works? - -How to debug -Chrome dev tools -Gulp / frameworks / webpack experience -terminal experience - -REST API - -CORS - -Performance & Optimization - - Code Optimization - - cleanup subscriptions on destroy - - use better algorithms - - follow best practices - - know what is good and bad approach in current situation - - use less DOM manipulation - - Server & Client communication - - cache - - some business logic on Client Side - - reduce XHR calls (SPA) - - graphQL (ask only what you need) - - positive result expectation, free up UI - - Images Optimization - - reduce size - - use css sprites \ No newline at end of file diff --git a/tech questions/general-questions.md b/tech questions/general-questions.md new file mode 100644 index 0000000..dafc4be --- /dev/null +++ b/tech questions/general-questions.md @@ -0,0 +1,53 @@ +# General questions + +## Web + +- How Internet Works? What happens when you open a web-site? +- REST (Representational State Transfer) +- HTTP (Hypertext Transfer Protocol) +- CORS (Cross-Origin Resource Sharing) + +## Browser + +- Dev tools + +## Frameworks + +- Frontend frameworks + - React + - Angular + - Vue + - Svelte + +## Tools + +- Webpack (module bundler) +- Gulp (task runner) +- Terminal / Shell +- Redux / NgRx / alternatives (Store) +- RxJS (Streams, Observables, Subjects, Operators, Marble, UT, _Maps) +- GIT (Global Information Tracker) + +## Other + +- How to debug code + +## Performance & Optimization + +- Code Optimization + - cleanup subscriptions on destroy + - use better algorithms + - follow best practices + - know what is good and bad approach in current situation + - use less DOM manipulation + +- Server & Client communication + - cache + - some business logic on Client Side + - reduce XHR calls (SPA) + - graphQL (request only what you need) + - positive result expectation, free up UI + +- Images Optimization + - reduce size + - use css sprites