background preloader

Git

Facebook Twitter

Index • Git Cheatsheet • NDP Software. Stash workspace index local repository upstream repository status Displays paths that have differences between the index file and the current HEAD commit, paths that have differences between the workspace and the index file, and paths in the workspace that are not tracked by git. diff Displays the differences not added to the index. diff commit or branch View the changes you have in your workspace relative to the named <em>commit</em>. Add file... or dir... Adds the current content of new or modified files to the index, thus staging that content for inclusion in the next commit.

Add -u Adds the current content of modified (NOT NEW) files to the index. Rm file(s)... Remove a file from the workspace and the index. mv file(s)... Move file in the workspace and the index. commit -a -m 'msg' Commit all files changed since your last commit, except untracked files (ie. all files that are already listed in the index). Checkout files(s)... or dir Updates the file or directory in the workspace. Reset --soft HEAD^ A Visual Git Reference. If the images do not work, you can try the Non-SVG version of this page. SVG images have been disabled. (Re-enable SVG) This page gives brief, visual reference for the most common commands in git. Once you know a bit about how git works, this site may solidify your understanding. If you're interested in how this site was created, see my GitHub repository. Also recommended: Visualizing Git Concepts with D3 Contents Basic Usage The four commands above copy files between the working directory, the stage (also called the index), and the history (in the form of commits). git add files copies files (at their current state) to the stage. git commit saves a snapshot of the stage as a commit. git reset -- files unstages files; that is, it copies files from the latest commit to the stage.

You can use git reset -p, git checkout -p, or git add -p instead of (or in addition to) specifying particular files to interactively choose which hunks copy. Conventions Commands in Detail Diff Commit Checkout Reset Merge. Git ready » learn git one commit at a time. Preface. Git is a version control Swiss army knife. A reliable versatile multipurpose revision control tool whose extraordinary flexibility makes it tricky to learn, let alone master. As Arthur C. Clarke observed, any sufficiently advanced technology is indistinguishable from magic. This is a great way to approach Git: newbies can ignore its inner workings and view Git as a gizmo that can amaze friends and infuriate enemies with its wondrous abilities.

Rather than go into details, we provide rough instructions for particular effects. After repeated use, gradually you will understand how each trick works, and how to tailor the recipes for your needs. I’m humbled that so many people have worked on translations of these pages. Dustin Sallings, Alberto Bertogli, James Cameron, Douglas Livingstone, Michael Budde, Richard Albury, Tarmigan, Derek Mahar, Frode Aannevik, Keith Rarick, Andy Somerville, Ralf Recker, Øyvind A. François Marier maintains the Debian package originally created by Daniel Baumann. Git Workflows and Tutorials.

Version control - Git for beginners: The definitive practical guide.