Commit 7694830a authored by Ricardo Avila's avatar Ricardo Avila
Browse files

Add notes on git

parent d81b297b
---
layout: notes
title: Elasticsearch
aside:
toc: true
sidebar:
nav: notes-nav
---
......@@ -38,3 +38,9 @@ Re-creating an environment from a file:
```
conda env create -f environment.yml
```
Removing an environment
```
conda env remove -n ENV_NAME
```
......@@ -15,7 +15,7 @@ sidebar:
# Imports
Add a folder to path. Usefule to call a module that is in a parent directory:
Add a folder to path. Useful to call a module that is in a parent directory:
```python
import sys
......
......@@ -14,6 +14,8 @@ sidebar:
* [Submodules](#submodules)
* [Staging and Commits](#staging-and-commits)
* [Branching](#branching)
* [Workflows](#workflows)
* [Fetch a PR for local testing](#fetch-a-pr-for-local-testing)
<!-- vim-markdown-toc -->
......@@ -30,6 +32,11 @@ git push github
git push gitlab
```
Listing remotes:
```
git remote -v
```
Overloading origin with another remote:
```
......@@ -42,6 +49,13 @@ Deleting a remote:
git remote remove origin
```
Synchronizing a local fork with remote:
```
git remote add upstream https://github.com/OriginalRepo/OriginalProject.git
git merge upstream/master
git push origin master
```
## Submodules
Creating submodules in an existing repo:
......@@ -80,6 +94,12 @@ Deleting a remote branch:
push --delete remote_name branch
```
Fetch all branches from a remote:
```
git fetch --all
```
Checkout specific files from another branch:
```
......@@ -94,7 +114,7 @@ git checkout origin/master -- file
Merge a specific commit to current branch:
```
```bash
git cherry-pick 63344f2
```
......@@ -109,3 +129,26 @@ Restore branch changes:
```
git stash apply
```
## Workflows
### Fetch a PR for local testing
Checkout PR into a new branch.
```
git fetch upstream pull/{PR-NUMBER}/head:test-branch-name
```
Merge PR into local master branch, and test.
```
git checkout master
git merge test-branch-name
```
If code was bad, revert to previous commit.
```
git reset --hard HEAD@{1}
```
......@@ -17,7 +17,7 @@ sidebar:
## Networking
Find which process is listening on a given port:
Find out which process is listening on a given port:
[sudo] lsof -i :6600
......
......@@ -8,12 +8,15 @@ sidebar:
nav: notes-nav
---
This is a collection of Markdown documents with notes about various topics.
{%- if page.sidebar.nav -%}
{%- assign _sidebar_nav = site.data.navigation[page.sidebar.nav] -%}
{%- if _sidebar_nav -%}
{%- for _item in _sidebar_nav -%}
<h2>{{ _item.title }}</h2>
{%- if _item.children -%}
<ul>
{%- for _child in _item.children -%}
{%- include snippets/get-nav-url.html path=_child.url -%}
{%- assign _nav_url = __return -%}
......@@ -26,6 +29,7 @@ sidebar:
{%- endif -%}
{%- endfor -%}
{%- endif -%}
</ul>
{%- endfor -%}
{%- endif -%}
{%- endif -%}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment