Github Readme Cheat Sheet



Cheat sheets can be really helpful when you’re trying a set of exercises related to a specific topic, or working on a project. Because you can only fit so much information on a single sheet of paper, most cheat sheets are a simple listing of syntax rules. This set of cheat sheets aims to remind you of syntax rules, but also remind you of. Emoji codes used by GitHub, Basecamp, Slack and other services., Ello, Twemoji Awesome, Got Chosen, Flow, ReadMe.io, esa. Your simple emoji cheat sheet tutorial. GitHub Gist: instantly share code, notes, and snippets. Summary: This is a Git cheat sheet (Git command summary) I've created, featuring many Git command examples. As I've begun to set up my own private Git hosting repository (see Private Git hosting services, and My A2 Hosting Git repository using SSH), it's time to cram all these Git commands back into my head again.

Basic commands

Github Readme Cheat Sheet

git initCreates a new git repository in the directory

git add <file name>Adds a specific file to staging

git add . or git add -AAdds the full directory and its contents to staging

git commit -m 'Commit message here'Commits the file changes in staging and provides a description for the commit

git diff **Analyze the differences between old files and ones that have been added to staging **

Branching

git branchView all local branches

git checkout -b <branch name>Create a new branch and check into it

git branch -avView all branches local and remote

git checkout <branch name>Switch into the specified branch

git branch -d <branch name>Delete a specific branch

git push origin <branch name>Push a branch to a remote repository

git merge <branch name>Merge branch into master branch (ensure that you're inside the master branch)

Stashing

git stashStashes changes in the .git file for temporaily hiding changed elements (make sure to run git add prior to stashing

git stash applyReturns the stashed items

View History

git logView previous commits, their messages, and ids

git log <file name>View who changed a specific file

git blame <file name>View who changed a specific file

Reverting

git reset --hard HEADRemove all changes and revert to the previous commit

git checkout <file name>Remove changes made to a specific file, reverting it back to the previous commit

Merge Conflicts

When you encounter a merge conflict, first... don't freak out. This just means you're being given the ability to choose which code you want to choose to go with.

Sample Conflict

  • You run git pull on a repo that has changes that conflict with your local copy.
  • You're presented with the following error message:

Natural Response

How to Fix a Merge Conflict

It's actually not that hard to fix merge conflicts, simply run git status and it will show you where the conflict exists. An example conflict might look like this:

The <<<<<<< HEAD, , and >>>>>>> symbols are simply showing you where the conflict is. You have the choice to pick what you want to keep, what you want to remove, etc. After picking out the implementation that you want you can run:

  • git add .
  • git commit -m 'some commit message'
  • git push

And you will be good to go.

Cloning

git clone <link to repo>Clone a repository from a remote source, such as GitHub

Rebase

git rebase masterWhile working on a branch you can bring in committed changes from another branch. This is helpful for ensuring that your feature branch can be cleanly merged with the master branch

🍿 3 min. read

Github Markdown Cheat Sheet

GitHub recently released a feature that allows users to create a profile-level README to display prominently on their GitHub profile. This article walksthrough how to access this new feature. I'll also be sharing some fun GitHub profiles I've seen so far. I'd love it if you shared yours with me on Twitter @indigitalcolor.

The above GIF shows what my README looks like at the time of this writing. You may notice I was recently selected to be GitHub star!

Table of Contents

Why READMEs?

The GitHub profile-level README feature allows more content than the profile bio, supports markdown which means you can play around with the content more visually (Did someone say GIFs!?) and the README is significantally more visible as it is placed above pinned repositories and takes up as much space above the fold of the webpage as you like.

A solid README is a core-component of well-documented software and often encourages collaboration by sharing helpful context with contributors. In my opinion, a profile-level README seems like a great extension of a convention a lot of GitHub users are already familiar with. If you're looking to make project-level READMEs more awesome and helpful check out matiassingers/awesome-readme for resources and examples of compelling READMEs.

How do I create a profile README?

The profile README is created by creating a new repository that’s the same name as your username. For example, my GitHub username is m0nica so I created a new repository with the name m0nica. Note: at the time of this writing, in order to access the profile README feature, the letter-casing must match your GitHub username.

Already have a repo-named username/username?

If you are interested in setting up a profile-level README then you can rename the repositoryor repurpose its existing README based on what makes the most sense in your particular situation.

  1. Create a new repository with the same name (including casing) as your GitHub username: https://github.com/new

  2. Create a README.md file inside the new repo with content (text, GIFs, images, emojis, etc.)

  3. Commit your fancy new README!

    • If you're on GitHub's web interface you can choose to commit directly to the repo's main branch (i.e., master or main) which will make it immediately visible on your profile)
  4. Push changes to GitHub (if you made changes locally i.e., on your computer and not github.com)

Fun READMEs

The GitHub README profiles are written in Markdown which means you aren't just limited to texts and links, you can include GIFs and images. Need to brush up on Markdown Syntax? Check out this Markdown Cheatsheet.

Cheat sheet recipes

hey, check out the new @github profile README! this is a really nice addition — I love that we can add some context (and/or nonsense) to our GitHub profiles now 😍
see mine: https://t.co/Cvrch1DVFD
thanks to @cassidoo for the heads up that this went live! pic.twitter.com/xMTeBgRLh0

— Jason Lengstorf (@jlengstorf) July 9, 2020

It's not as creative as @sudo_overflow's readme, but here's what I came up with. I also plan on adding some text below the image with links to my resume, etc. pic.twitter.com/C6b8tNDo1z

Github Readme Markup Cheat Sheet

CheatGithub Readme Cheat Sheet— donavon 'wyld' west (@donavon) July 9, 2020

Is this how we suppose use github's readme? pic.twitter.com/XvLvCUC6iD

— Pouya (@Saadeghi) July 9, 2020

If you're really ambitious you can use GitHub actions or other automation like bdougieYO or simonw to dynamically pull data into your README:

Check it out. I made MySpace but on @github.https://t.co/p4DWP4DxRR - My list is power by a GitHub Action workflow 😏 pic.twitter.com/PN80mFCqOE

— bdougie on the internet (@bdougieYO) July 10, 2020

Made myself a self-updating GitHub personal README! It uses a GitHub Action to update itself with my latest GitHub releases, blog entries and TILs https://t.co/Eve7FOrwYKpic.twitter.com/oJPXLtFdgM

— Simon Willison (@simonw) July 10, 2020

Serverless functions can also be used to dynamically generate information (for example your current Spotify activity):

Markdown cheatsheet github

I embedded a @Spotify Now Playing widget in my @github profile README!
It's an SVG rendered on the fly via @vercel serverless function, included in the README via <img> tag.
Supremely over-engineered, but I discovered lots of fun hacks in the process.https://t.co/Z8TBE9WxRypic.twitter.com/wdKw0maPKp

— Nate Moore (@n_moore) July 12, 2020

I'm a huge proponent that folks should maintain a website they have complete ownership over (even if it's a no-code website solution) but this is tempting...

I just created my @github profile README as well with a bunch of badges. This is really a brilliant idea. We may no longer need to maintain our personal website. We can write blogs as issues, manage Wiki and task board, free traffic analytics and CI/CD. https://t.co/zSXZKT6a20pic.twitter.com/mK9OWXG9iH

— Yuan Tang (@TerryTangYuan) July 10, 2020

hey, so we heard ya & are trying out a thing where you CAN have a readme on your @github profile... @mikekavouras built it btw! re: https://t.co/UC6q3qHjjRpic.twitter.com/kB0kafgovY

— kathy ☁️ (@pifafu) May 27, 2020

I've been inspired by the creative READMEs I've seen so far and am looking forward to seeing all kinds of profiles in the upcoming months.

This article was published on July 11, 2020.

Webmentions

482167