mirror of
https://github.com/donnemartin/data-science-ipython-notebooks.git
synced 2024-03-22 13:30:56 +08:00
Added IPython Notebook for git commands.
This commit is contained in:
parent
ee4d38ae71
commit
b0fe318517
|
@ -36,6 +36,7 @@ IPython Notebooks demonstrating spark and HDFS functionality.
|
|||
IPython Notebooks demonstrating various command lines for AWS, Unix, etc.
|
||||
|
||||
* [linux commands](http://nbviewer.ipython.org/github/donnemartin/ipython-data-notebooks/blob/master/commands/linux.ipynb)
|
||||
* [git commands](http://nbviewer.ipython.org/github/donnemartin/ipython-data-notebooks/blob/master/commands/git.ipynb)
|
||||
* [jekyll commands](http://nbviewer.ipython.org/github/donnemartin/ipython-data-notebooks/blob/master/commands/jekyll.ipynb)
|
||||
|
||||
## matplotlib
|
||||
|
|
111
commands/git.ipynb
Normal file
111
commands/git.ipynb
Normal file
|
@ -0,0 +1,111 @@
|
|||
{
|
||||
"metadata": {
|
||||
"name": "",
|
||||
"signature": "sha256:91888bafb93a628d3ffb4feed9832ca3dcde26dd4768026e7fec862afbffe99b"
|
||||
},
|
||||
"nbformat": 3,
|
||||
"nbformat_minor": 0,
|
||||
"worksheets": [
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"# Git Commands"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"collapsed": false,
|
||||
"input": [
|
||||
"# Configure git\n",
|
||||
"git config --global user.name 'First Last'\n",
|
||||
"git config --global user.email 'name@domain.com'\n",
|
||||
"git init\n",
|
||||
"\n",
|
||||
"# View status and log\n",
|
||||
"git status\n",
|
||||
"git log\n",
|
||||
"\n",
|
||||
"# Add or remove from staging area\n",
|
||||
"git add [target]\n",
|
||||
"git reset [target]\n",
|
||||
"\n",
|
||||
"# Automatically stage tracked files, including deleting the previously tracked files\n",
|
||||
"git add -u\n",
|
||||
"\n",
|
||||
"# Delete files and stage them\n",
|
||||
"git rm [target]\n",
|
||||
"\n",
|
||||
"# Commit\n",
|
||||
"git commit -m \u201cAdd commit message here\u201d\n",
|
||||
"\n",
|
||||
"# Add new origin\n",
|
||||
"git remote add origin https://github.com/donnemartin/ipython-data-notebooks.git\n",
|
||||
"\n",
|
||||
"# Set to new origin\n",
|
||||
"git remote set-url origin https://github.com/donnemartin/pydatasnippets.git\n",
|
||||
" \n",
|
||||
"# Push to master, -u saves config so you can just do \"git push\" afterwards\n",
|
||||
"git push -u origin master\n",
|
||||
"git push\n",
|
||||
"\n",
|
||||
"# Pull down from master\n",
|
||||
"git pull origin master\n",
|
||||
"\n",
|
||||
"# Diff files\n",
|
||||
"git diff HEAD\n",
|
||||
"git diff --staged\n",
|
||||
"git diff --cached\n",
|
||||
"\n",
|
||||
"# Undo a file that has not been added\n",
|
||||
"git checkout \u2014 [target]\n",
|
||||
"\n",
|
||||
"# Create a branch\n",
|
||||
"git branch [branch]\n",
|
||||
"\n",
|
||||
"# Check branches\n",
|
||||
"git branch\n",
|
||||
"\n",
|
||||
"# Switch branches\n",
|
||||
"git checkout [branch]\n",
|
||||
"\n",
|
||||
"# Merge branch to master\n",
|
||||
"git merge [branch]\n",
|
||||
"\n",
|
||||
"# Delete branch\n",
|
||||
"git branch -d [branch]\n",
|
||||
"\n",
|
||||
"# Clone\n",
|
||||
"git clone git@github.com:repo folder-name\n",
|
||||
"git clone https://donnemartin@bitbucket.org/donnemartin/tutorial.git\n",
|
||||
"\n",
|
||||
"# Create a file containing a patch\n",
|
||||
"# git format-patch are like normal patch files, but they also carry information \n",
|
||||
"# about the git commit that created the patch: the author, the date, and the \n",
|
||||
"# commit log message are all there at the top of the patch.\n",
|
||||
"git format-patch origin/master\n",
|
||||
"\n",
|
||||
"# GitHub tutorial:\n",
|
||||
"http://try.github.io/levels/1/challenges/9\n",
|
||||
"\n",
|
||||
"# BitBucket Setup\n",
|
||||
"cd /path/to/my/repo\n",
|
||||
"git init\n",
|
||||
"git remote add origin https://donnemartin@bitbucket.org/donnemartin/repo.git\n",
|
||||
"git push -u origin --all # pushes up the repo and its refs for the first time\n",
|
||||
"git push -u origin --tags # pushes up any tags\n",
|
||||
"\n",
|
||||
"# Open Hatch missions\n",
|
||||
"git clone https://openhatch.org/git-mission-data/git/dmartin git_missions"
|
||||
],
|
||||
"language": "python",
|
||||
"metadata": {},
|
||||
"outputs": []
|
||||
}
|
||||
],
|
||||
"metadata": {}
|
||||
}
|
||||
]
|
||||
}
|
Loading…
Reference in New Issue
Block a user