0% found this document useful (0 votes)
28 views7 pages

Git Cheatsheet - James Gibbard's Workshop

Uploaded by

Technical Novice
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
28 views7 pages

Git Cheatsheet - James Gibbard's Workshop

Uploaded by

Technical Novice
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 7
41302019 {Git Cheatsheet - James Gibbare's Workshop Git Cheatsheet 8 2018-01-21 (httpsi/wwwgibbard.me/git/) & James Gibbard (https://www.gibbard.me/author/james- gibbard/) @ Computers (https://wwwgibbard.me/category/computers/) Dear future self, if you are reading this it looks like you have forgotten how to do something in Git again... Don’t worry, it happens; this page has been created just for you! Creating and cloning a repository Clone an existing repository from a URL git clone https://urlToRepo..com/repoNane.git Clone an existing repository from a file and checkout a specific branch git clone /path/to/repo/repoName.git -b branchNane Set up a new git repository in the current directory git init Staging files Stage all new, modified, and deleted files git add -A Stage all modified and deleted files but not new (untracked) ones git add -u itpsawww gidbare meg 419072019 {Git Cheatsheet — James Gibbard's Workshop N.B. In git version 2.0 onwards git add -A and git add -u will operate on the entire working tree and not just the current path. Stage a specific file or set of files git add path/to/filer.txt File2.txt N.B. In git version 1.x using git add will only add new and modified files within the specified path-spec. From version 2.0 onwards git add will also stage files that have been deleted within the path-spec. Stage new and modified files in a specific directory (and deleted files in git version 2.x+) git add path/to/dir Stage new, modified, and deleted files in a specific directory (in version 1.x) git add -A path/to/dir Delete a file and stage the change in git git rm path/to/file.txt Delete a directory and its contents and stage the change in git git rm -r path/to/dir Committing ‘Commit staged files with a short commit message git commit -m "Commit message” ‘Commit stages files with a custom author itpsawww gidbare meg 41302019 {Git Cheatsheet - James Gibbara's Workshop git commit --author="John Doe " -m "Commit message” Viewing repository status View status of repository git status View abbreviated status of the repository git status -s The left column is the status of files in the staging area and the right column is the status of files in the working tree. M = Modified, A = Added, D = Deleted, R = Renamed, ? = Untracked files. Viewing repository history Show the last 10 commit logs git log -n 10 Show commit logs in a text graph format, eit log --graph Undoing mistakes Change the last commit message git commit --amend Change the author of the last commit itpsawww gidbare meg air 41302019 {Git Cheatsheet - James Gibbara's Workshop git commit --amend --author="John Doe " -m "Commit message" Branches Create a new branch and switch to it git checkout -b name_of_new_branch List all branches (including remote branches) git branch -: Checkout an existing branch git checkout name_of_existing branch Delete a branch git branch -d name_of_branch Remove local remote tracking branches that have been removed on the remote repository git renote prune origin Git Ignore The gitignore file specifies files that you don't what to include as part of your git repository itpsawww gidbare meg air 41302019 {Git Cheatsheet - James Gibbara's Workshop 4 Ignore .bak files in all directories * bak 4 Ignore any files in a log/ directory log/ # Tgnore log/*.txt (but not log/foo/*. txt Log/*.txt 4# Ignore all .txt Files in a log directory on any of its sub directories Log/**/*. txt Git Configuration Set the committer name and email address globally git config --global user.nane “John Doe" git config --global user.email john@doe.com Set the committer name and email address for the current repository git config user.nane “John Doe" git config user.enail john@doe.com Set the default text editor to nano git config --global core.editor "nano" Share this: ‘(https gibbard.me/giv/2share=twitter&nb=1) Ej (https: /wwwen gibbard.me/git/?share=facebook&inb=1) G+ (hetps://wmw gibbard.me/git/?share=google-plus-1&nb=1) itpsawww gidbare meg on aon019 Git Cheatsheet James Gibarts Workshop (htpsiwmwgibbard.mertag/computers!) 6 (htpsv/www gibbard me/tag/git {nctps/tenwgibbard.mertag/software/) (https gibbard.me/tag/software-development/) (https/wwew gibbard.me/tag/software-engineering/) LEAVE A REPLY Enter your comment here... Using Git Offline (https://mwwgibbard.me/using-git-offline/) Cascaded integrator-comb (CIC) filters > (https://mmw.gibbard.me/cic-fiters/) Search. RECENT POSTS Cascaded integrator-comb (CIC) filters (https://www.gibbard.me/cic-filters/) Git Cheatsheet (https://www.gibbard.me/git/) Using Git Offiine (https://wwnw gibbard.me/using-git-offline/) Building a Robotic Arm—Part 2 (https://www.gibbard.me/building-a-robotic-arm-part-2/) Building a Robotic Arm—Part 1 (https://www.gibbard.me/building-a-robotic-arm-part-1/) Strandbeest Model (https://www.gibbard.me/strandbeest-model/) One Day Builds— Enigma Machine Emulator (https://www.gibbard.me/one-day-bullds-enigma- machine-emulator/) ‘One Day Builds—FPGA Pong (https:/Awww. gibbard.me/one-day-builds-fpga-pong/) Beginners Guide to I2¢ (https://www.gibbard.me/beginners-guide-toi2c/) Cheap LED Torch Repair (https://www.gibbard.me/cheap-led-torch-repair/) itpsww.gidbare mel en 41302019 Git Cheatsheet — James Gibbare's Workshop TAGS (nttps:/iwenn.gibbard.me/tag/arduino/) (https:/hwen.gibbard.me/tag/bluetooth/) (https/iwww gibbard.me/tag/computers/) Di (hitps:/www.gibbard.me/tag/diy/) (nttps:viwww gibbard.me/tagyelectronics/) (nitpsviwww gibbard.me/tag/tfpgaN) (nttps:/imw gibbard. meltag/frisbee/) (https//wwwgibbard.me/tag/games/) (https:rtwwwgibbard.me/tag/giv) {https://wwvwgibbard.me/tag/hardware/) (https:stwww gibbard.me/tag/kindle/) (http://www gibbard.me/tag/microcontrollers/) (https:stwww gibbard.me/tag/one-day-build/) (oetps:/Awe gibbard. me/tag/passwords/) {https://wwwgibbard.me/tag/programming/) (ottps:/Amwwgibbard.me/tagyrepair/) {https:i/wwwgibbard.me/tag/robatics/) (huups:/imww gibbard.me/tag/security/) (http://www gibbard.me/tap/software/) (https:/iwww gibbard.me/tag/software-developmenti) (https://mww gibbard.me/tag/software-engineering/) (https:z/mww gibbard.me/tagyteardown/) (nttps:/iwn gibbard.me/tag/techy) (http://www gibbard.me/tag/tutorial) (https:/wwew.gibbard.me/tagivndl/) (https:/twww gibbard.me/tag/wind-energy/) CATEGORIES Electronics (https://www.gibbard.me/category/electronics/) 9 Computers (https://www-gibbard.me/category/computers/) 5 Uncategorized (https://www.gibbard.me/category/uncategorized/) 1 (HTTPSi/GITHUB.COM/GIBBARD) (HTTPS: WWW. YOUTUBE.COM/C/JAMESGIBBARD#20) Copyright © 2017 James Gibbard - Theme by Colorlib (http://colorlib.com/ Powered by WordPress (http://wordpress.org/) itpsiww.gidbare mel oo

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy