Skip to content

Instantly share code, notes, and snippets.

View fernandez's full-sized avatar
🐱

Alex Fernandez fernandez

🐱
  • GitHub
  • Portland, OR
View GitHub Profile
@mklaber
mklaber / !README.md
Last active December 19, 2018 01:33
GitHub Pull Request against the current branch

README

GitHub helpfully prompts you to create a pull request after pushing a new branch. Unhelpfully, it always suggests PRing against master (or develop or whatever your main branch is). This Tampermonkey/ Greasemonkey script adds a "Compare & pull request (current branch)" button that will bring you to the PR creation page already comparing against the branch you're currently on.

image

How To:

  1. Install the Tampermonkey extension for Chrome or Greasemonkey extension for Firefox
@gunjanpatel
gunjanpatel / revert-a-commit.md
Last active July 5, 2024 06:54
Git HowTo: revert a commit already pushed to a remote repository

Revert the full commit

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}

About History Rewriting

Delete the last commit

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:

@evantoli
evantoli / GitConfigHttpProxy.md
Last active July 20, 2024 03:29
Configure Git to use a proxy

Configure Git to use a proxy

In Brief

You may need to configure a proxy server if you're having trouble cloning or fetching from a remote repository or getting an error like unable to access '...' Couldn't resolve host '...'.

Consider something like:

@btoone
btoone / curl.md
Last active June 29, 2024 16:01
A curl tutorial using GitHub's API

Introduction

An introduction to curl using GitHub's API.

The Basics

Makes a basic GET request to the specifed URI

curl https://api.github.com/users/caspyin