Skip to content

Instantly share code, notes, and snippets.

View Resethel's full-sized avatar
🙂

Raphaël Ollando Resethel

🙂
  • SnT, University of Luxembourg
  • Luxembourg
View GitHub Profile

Introduction

  • C-a == Ctrl-a
  • M-a == Alt-a

General

:q        close
:w        write/saves
:wa[!]    write/save all windows [force]
:wq       write/save and close
@Resethel
Resethel / git_cheat_sheet.md
Last active August 5, 2019 14:35 — forked from akras14/Getting-Cheat-Sheet.md
[GIT cheatsheet] A git cheatsheet by alexkras

Git Cheat Sheet

Commands

Getting Started

git init

or

git clone url

@Resethel
Resethel / revert-a-commit.md
Last active July 27, 2019 16:08 — forked from gunjanpatel/revert-a-commit.md
[Revert a Git commit]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: