Skip to content

Instantly share code, notes, and snippets.

View nickfloyd's full-sized avatar
🎯
Taking on problems one byte at a time

Nick Floyd nickfloyd

🎯
Taking on problems one byte at a time
View GitHub Profile
#ignore thumbnails created by windows
Thumbs.db
#Ignore files build by Visual Studio
*.obj
*.exe
*.pdb
*.user
*.aps
*.pch
*.vspscc
@nickfloyd
nickfloyd / recipe: cherry-pick tags
Created December 13, 2010 17:40
To cherry pick from head and commit back into a tag
-from master in working branch
>> git branch [new branch] [tag]
>> git checkout [branch]
-pull commit out and add it to the commit at the top of the tag
>> git cherry-pick [commit] or git cherry-pick [firstcommit]^..[lastcommit] if you have a range
-resolve conflicts
-delete the local tag
>> git git tag -d [tag]
-add a new tag at the head of the old one
>> git tag [tag]
@nickfloyd
nickfloyd / recipe: explicit push
Created December 13, 2010 17:51
When having a remote the same name as the branch then you have to "fully qualify" the push
>> git push [remote] [fork]:[branch]
ex.
git push dev1 ftdev1:master
@nickfloyd
nickfloyd / recipe: deleting branches
Created December 13, 2010 17:56
To delete local and remote branches
-delete the remote
>> git push [remote] :[branch]
-delete the local
>> git branch -d [branch]
ex.
git push origin :dev1
git branch -d dev1
@nickfloyd
nickfloyd / create_merge_branches
Created December 21, 2010 17:32
To create and then merge changes into a branch
ex.
git checkout origin master
git pull origin master
--create branch and track master
git checkout -b f1-1234 origin/master
--make changes
--resolve conflicts, DO NOT PUSH branch, the merge is just to resolve conflicts
@nickfloyd
nickfloyd / create_branch_from_tag
Created January 27, 2011 05:38
To create a branch from a tag
-Go to the starting point of the project
>> git checkout origin master
-fetch all objects
>> git fetch origin
-Make the branch from the tag
>> git branch new_branch tag_name
-Checkout the branch
>> git checkout new_branch
-Push the branch up
>> git push origin new_branch
@nickfloyd
nickfloyd / Remove the last pushed commit
Created February 3, 2011 14:48
For all of us boneheads out there that push accidental commits
git push -f origin HEAD\^:master
so commit history in the remote looks like:
Had to clean up some things from the merge
nickfloyd (author)
January 26, 2011
commit 4bcce9878c454ba5583c
tree e6f4cffa47b1301a4cfc
@nickfloyd
nickfloyd / local site
Created February 5, 2011 04:01
When passenger prefpane stops working and you have to add a host manually in OSX 10.6.x
#create a passenger host config file
touch /etc/apache2/passenger_pane_vhosts/[site].local.vhost.conf
#contents ++++++++++++++++++
<VirtualHost *:80>
ServerName site.local
DocumentRoot "/Users/nfloyd/code/rails/site/public"
RackEnv development
<Directory "/Users/nfloyd/code/rails/site/public">
@nickfloyd
nickfloyd / gist:978109
Created May 18, 2011 07:00
Running rails on port 80
sudo rails -s -p80
using rvm
rvmsudo rails server -p80
@nickfloyd
nickfloyd / gist:1046526
Created June 25, 2011 14:11
Powershell basic authentication
//This returns a 404 not found - powershell; I expected a 401 if my creds were bad
$Url = "https://github.com/api/v2/xml/commits/list/fellowshiptech/portal/Portal_2011.6.23_15-26"
$webclient = new-object system.net.webclient
$webclient.credentials = new-object system.net.networkcredential("user", "password")
$result = $webclient.DownloadString($Url)
$result
//This returns the data I want via terminal
curl -u user:password https://github.com/api/v2/xml/commits/list/fellowshiptech/portal/Portal_2011.6.23_15-26