Sometimes you may want to undo a whole commit with all changes. Instead of going through all the changes manually, you can simply tell git to revert a commit, which does not even have to be the last one. Reverting a commit means to create a new commit that undoes all changes that were made in the bad commit. Just like above, the bad commit remains there, but it no longer affects the the current master and any future commits on top of it.
git revert {commit_id}
Deleting the last commit is the easiest case. Let's say we have a remote origin with branch master that currently points to commit dd61ab32. We want to remove the top commit. Translated to git terminology, we want to force the master branch of the origin remote repository to the parent of dd61ab32:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var colors = { | |
0: "\033[0;30m", /* 00 BLACK 0x30 */ | |
1: "\033[0;34m", /* 01 BLUE 0x31 */ | |
2: "\033[0;32m", /* 02 GREEN 0x32 */ | |
3: "\033[0;36m", /* 03 CYAN 0x33 */ | |
4: "\033[0;31m", /* 04 RED 0x34 */ | |
5: "\033[0;35m", /* 05 PURPLE 0x35 */ | |
6: "\033[0;33m", /* 06 GOLD 0x36 */ | |
7: "\033[0;37m", /* 07 GREY 0x37 */ | |
8: "\033[1;30m", /* 08 DGREY 0x38 */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var http = require('http'); | |
var url = require('url'); | |
var path = require('path'); | |
var fs = require('fs'); | |
var base = path.join(process.cwd(), process.argv[2] || ''); | |
var port = process.argv[3] || 8888; | |
var extensionRegex = /\.([0-9a-z]+)(?:[\?#]|$)/i; | |
var contentTypeMap = { | |
html: 'text/html', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# delete local tag '12345' | |
git tag -d 12345 | |
# delete remote tag '12345' (eg, GitHub version too) | |
git push origin :refs/tags/12345 | |
# alternative approach | |
git push --delete origin tagName | |
git tag -d tagName |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var doctors = [ | |
{ number: 1, actor: "William Hartnell", begin: 1963, end: 1966 }, | |
{ number: 2, actor: "Patrick Troughton", begin: 1966, end: 1969 }, | |
{ number: 3, actor: "Jon Pertwee", begin: 1970, end: 1974 }, | |
{ number: 4, actor: "Tom Baker", begin: 1974, end: 1981 }, | |
{ number: 5, actor: "Peter Davison", begin: 1982, end: 1984 }, | |
{ number: 6, actor: "Colin Baker", begin: 1984, end: 1986 }, | |
{ number: 7, actor: "Sylvester McCoy", begin: 1987, end: 1989 }, | |
{ number: 8, actor: "Paul McGann", begin: 1996, end: 1996 }, | |
{ number: 9, actor: "Christopher Eccleston", begin: 2005, end: 2005 }, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// A very simple example about how to use concurrent-safe SETs (using string as keys) in GO | |
package main | |
import ( | |
"fmt" | |
"sync" | |
) | |
type Set struct { | |
m map[string]bool |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.PlayPause" XF86AudioPlay | |
"dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Stop" XF86AudioStop | |
"dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Next" XF86AudioNext | |
"dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Previous" XF86AudioPrevious |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package test | |
import ( | |
"fmt" | |
"labix.org/v2/mgo" | |
"labix.org/v2/mgo/bson" | |
"testing" | |
) | |
const INSERT_COUNT int = 10000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml"> | |
<head> | |
<meta http-equiv="content-type" content="text/html; charset=utf-8"/> | |
<script type="text/javascript" src="jquery-1.7.1.min.js"></script> | |
<script type="text/javascript"> | |
$(document).ready(function () { | |
$.getJSON('estados_cidades.json', function (data) { |
NewerOlder