Skip to content

Instantly share code, notes, and snippets.

View TheFern2's full-sized avatar

Fernando B TheFern2

View GitHub Profile
@TheFern2
TheFern2 / Update-branch.md
Created September 28, 2019 02:37 — forked from santisbon/Update-branch.md
Bring your feature branch up to date with master. Deploying from Git branches adds flexibility. Bring your branch up to date with master and deploy it to make sure everything works. If everything looks good the branch can be merged. Otherwise, you can deploy your master branch to return production to its stable state.

Updating a feature branch

First we'll update your local master branch. Go to your local project and check out the branch you want to merge into (your local master branch)

$ git checkout master

Fetch the remote, bringing the branches and their commits from the remote repository. You can use the -p, --prune option to delete any remote-tracking references that no longer exist in the remote. Commits to master will be stored in a local branch, remotes/origin/master

@TheFern2
TheFern2 / Local PR test and merge.md
Created September 28, 2019 04:54 — forked from adam-p/Local PR test and merge.md
Testing a pull request, then merging locally; and avoiding TOCTOU

It's not immediately obvious how to pull down the code for a PR and test it locally. But it's pretty easy. (This assumes you have a remote for the main repo named upstream.)

Getting the PR code

  1. Make note of the PR number. For example, Rod's latest is PR #37: Psiphon-Labs/psiphon-tunnel-core#37

  2. Fetch the PR's pseudo-branch (or bookmark or rev pointer whatever the word is), and give it a local branch name. Here we'll name it pr37:

$ git fetch upstream pull/37/head:pr37
@TheFern2
TheFern2 / post-checkout
Created September 28, 2019 07:47
Git Scripts
#! /bin/sh
# Start from the repository root.
cd ./$(git rev-parse --show-cdup)
# Delete .pyc files and empty directories.
# These files become a problem when switching branches
# if pycache is there with pyc even as an empty folder it will show up
# on another branch under vscode, this fixes that.
# @kodaman2
@TheFern2
TheFern2 / Merge-Workflow.md
Last active September 28, 2019 23:53
Pull Request - Merge Worfklow

NB: Merging is safer with cmd line, than github web interface. If a commiter makes a last minute change, you could possibly merge code that hasn't been reviewed.

https://help.github.com/en/articles/checking-out-pull-requests-locally

Modifying an active pull request locally

On the PR itself, at the bottom is a bottom for command line instructions.

@TheFern2
TheFern2 / cmder_vscode.md
Last active October 26, 2019 17:28
Cmder

This embeds cmder within vscode.

"terminal.integrated.shell.windows": "C:\\WINDOWS\\sysnative\\cmd.exe", 
"terminal.integrated.shellArgs.windows" : ["/K","C:\\cmder\\vendor\\init.bat"]
$ git remote rm origin
$ git remote add origin [email protected]:aplikacjainfo/proj1.git
$ git config master.remote origin
$ git config master.merge refs/heads/master
@TheFern2
TheFern2 / global-gitignore.md
Created October 8, 2019 09:58 — forked from subfuzion/global-gitignore.md
Global gitignore

There are certain files created by particular editors, IDEs, operating systems, etc., that do not belong in a repository. But adding system-specific files to the repo's .gitignore is considered a poor practice. This file should only exclude files and directories that are a part of the package that should not be versioned (such as the node_modules directory) as well as files that are generated (and regenerated) as artifacts of a build process.

All other files should be in your own global gitignore file. Create a file called .gitignore in your home directory and add anything you want to ignore. You then need to tell git where your global gitignore file is.

Mac

git config --global core.excludesfile ~/.gitignore

Windows

git config --global core.excludesfile %USERPROFILE%\.gitignore
@TheFern2
TheFern2 / Reset-Branch.md.txt
Created October 10, 2019 12:15
Reset Branch
git fetch upstream
git reset --hard upstream/master
@TheFern2
TheFern2 / Custom-Keyboard.md
Last active October 29, 2019 00:31
Keyboard-Building-Guide

Guide to building my custom keyboard

I wanted to build my keyboard just because, nowadays is almost as expensive to build one than buy one, but given that I have 3D printer, I could print the case and plate easily with some minor modifications.

Create Layout

www.keyboard-layout-editor

Create Cad for Plate and Case

@TheFern2
TheFern2 / jupyter-install.md
Created October 26, 2019 10:34
Jupyter-Docs
  • Install jupyter with pip
python3 -m pip install jupyter
jupyter notebook
  • Install ijavascript with npm
pip3 install --upgrade pip