-
Notifications
You must be signed in to change notification settings - Fork 2
Git and Github
- Git Best Practices
- The Gitflow Workflow
- Managing Merge Conflicts
- Version Control for Designers - Notes
- Git Hooks
- How to prune unwanted git branches
- Archiving Old Branches
https://github.com/hackalog/bus_number/wiki/Github-Workflow-Cheat-Sheet
git branch # What branch am I currently on? e.g. {my_branch}
git status # anything I forgot to commit? If so...
git commit ... # Commit work in progress
git checkout master # leave whatever branch I was on
git fetch origin --prune # Check for something new
git merge origin/master # If updates available, update!
git checkout master
git fetch upstream --prune # grab latest changes from upstream repo
git merge upstream/master # merge them into local copy of my form
git push origin master # push latest upstream changes to my forked repo
git branch --merged master # check for any merged branches that can be safely deleted
git branch -d {name_of_merged_branch} # delete any fully merged branches
Now that master is up to date, you should merge whatever happened in master into your development branch:
git checkout {my_branch}
git merge master # merges master->{my_branch}
git push origin {my_branch} # Let Github know about the merge
Configure Git to use a proxy
For error unable to access '...' Couldn't resolve host '...'
git config --global http.proxy http://proxyUsername:proxyPassword@proxy.server.com:port
Formatting Git logs with simple output:
git log --pretty=format:"%h - %an, %ar : %s"
Find version ID with git log and checkout old version:
git log index.html
git checkout <version ID> index.html
git init
git add .
git commit -m "initial git setup in <my-project>"
Clone an existing git repository:
git clone <url>
Clone a single branch from a remote git repository:
git clone -b <my-branch> --single-branch git@<remote-repo>
git fetch origin
A simple way to clean up your git project branches
git checkout -b [name_of_new_branch]
git checkout -- <filename>
Rename your local branch (More steps)
git branch -m new-name
git push -u origin [name_of_new_branch]
git remote set-url origin git@github.com:USERNAME/REPOSITORY.git # SSH
git remote set-url origin https://github.com/USERNAME/REPOSITORY.git # HTTPS
git checkout --track origin/development
git branch -vv
git checkout development
git pull
git checkout development_joe
git merge development
git merge --abort
git checkout master
git checkout development README.md
git commit -m 'Merging updated README.md file'
git log -5 --pretty=format:"%h - %an, %ad : %s" --date=local
-
How to Git PR From The Command Line - Tips from Hackernoon
This is a little tricky and necessary to learn. The basic syntax is:
git request-pull [-p] <start> <url> [<end>]
-
-p
— Running request-pull without that option will output a summary of changed files. -p is more verbose and will output all changes that have been made from the split commit to the end one. -
<start>
— Is the starting point you want to merge to. Most of the time we will give it the master branch and git will calculate the start commit on its own. The start commit is the common ancestor from which the feature branch split. -
<url>
— Is the repository to compare to. It can be a local repository and it can be a remote one. -
<end>
— The end point we want to stop comparing to. Usually we won’t state the end commit because we would like to merge all recent changes.
Steps:
git checkout -b <feature_branch>
git request-pull master ./
# Run a comparison from feature branch to master.
git push origin development_joe
git branch -d the_local_branch
Configure Git Settings on your computer:
git config --global user.name "Your UserName"
git config --global user.email "yourname@email.com"
Check config settings on your machine:
git config user.name
git config user.email
View remote repositories:
git remote -v
Tell Git to use osxkeychain helper using the global credential.helper config:
git config --global credential.helper osxkeychain
# Add a single file
git add my_notebook.ipynb
# Add all changed files, reviewing changed files first
git status
git add .
git blame <filename>
git mv file1.txt file-newname.txt
touch .gitignore
# Add rock as a submmodule of slingshot
git submodule add https://github.com/<user>/rock rock
# Download contents of the submodule rock
git submodule update --init --recursive
Git Credential Manager for Mac and Linux on Azure
What are Git hooks?
Git hooks are scripts that Git executes before or after events such as: commit, push, and receive. Git hooks are a built-in feature - no need to download anything. Git hooks are run locally.
githooks.com - the missing manual
Autohook - Autohook is a very, very small Git hook manager with focus on automation.
A collection of useful .gitignore templates
10 Git Commands You Should Know - Jeff Hale, Feb. 28, 2019
Git tip: How to "merge" specific files from another branch
GitHub Forking Workflow
Git Official Docs
Understanding the GitHub Workflow
Git quick reference
Official gittutorial Manual Page
Gitref.org - Git reference site & tutorial
How to undo almost anything with Git
Git Immersion Guided Tour
Git for Designers - My [Notes] (https://github.com/BKJackson/BKJackson_Wiki/wiki/Version-Control-for-Designers-%7C-Notes)
Git for Computer Scientists
Git Ready: Learn git one commit at a time
Git-SCM Useful links
A List Apart - Getting Started with Git: See notes for this article here.
Atlassian Git Tutorials
Understanding the GitHub Flow 5 minute read.
Github Help
Github - Bootcamp
Learn GitHub.com
Introduction to Git and GitHub for Python Developers
MIT Git Intro Dhruv Jain
Version Control with Git From Software Carpentry (~3 hour lesson plan)
A git Primer Daniel Miessler
Updating Git on Mac OS X
git-it A workshop for learning Git and GitHub. Based on this guide Git-it.
Version Control Best Practices
Get the Most Out of Git: 7 Best Practices for Budding Developers
Software Carpentry: Version Control with Git
Err the Blog - Git Cheat Sheet
Everyday GIT with ~20 Commands Manual Page
Pro Git Videos
Hitler is Informed That He Uses Git
GitHub Pages Home - Includes instructions for getting set up.
Using Jekyll as a static site generator with GitHub Pages - For customizing GitHub pages.
Jekyll templates
Creating a GitHub Pages site with the Jekyll Theme Chooser
Creating and Hosting a Personal Site on GitHub - Step-by-step beginner's guide.
Cayman Jekyll Theme
Flush DNS cache when Github freezes Safari windows:
http://osxdaily.com/2015/11/16/howto-flush-dns-cache-os-x-elcap/
Reference: OSX 10.10.1 Safari freezing when browsing Github.com (And some other cases)
https://discussions.apple.com/thread/6687771?start=0&tstart=0
Getting Started with Git | Notes Old notes.