background preloader

Git cheat sheets

Git cheat sheets
Related:  Ruby Development

A few git tips you didn't know about Notice: some of these commands or flags require git version 1.7.2. On OS X, upgrade easily with Homebrew: brew install git Show branches, tags in git log $ git log --oneline --decorate 7466000 (HEAD, mislav/master, mislav) fix test that fails if current dir is not "hub" 494a414 fix cherry-pick of a commit URL 4277848 (origin/master, origin/HEAD, master) whoops d270fae bugfix: git init -g 9307af3 test deps 8ccc17e 64bb19c bugfix: variable name 546726a dont need you 3a8d7af (tag: v1.3.1) v1.3.1 197f429 (tag: v1.3.0) v1.3.0 a1e1a50 not important 3c6af16 magic `cherry-pick` supports GitHub commit URLs and "user@sha" notation Diff by highlighting inline word changes instead of whole lines $ git diff --word-diff # Returns a Boolean. def command? This flag works with other git commands that take diff flags such as git log -p and git show. Short status output $ git status -sb M ext/fsevent/fsevent_watch.c ?? Push a branch and automatically set tracking

Don't write on the whiteboard :: Joseph Perla I recently interviewed at a major technology company. I won't mention the name because, honestly, I can't remember whether I signed an NDA, much less how strong it was. I did well. Mostly because of luck. I normally step over myself when I interview. 1. When I interviewed at Palantir around 5 years ago, I had a lot of trouble with this. Most people think you have to write on the whiteboard. The interviewer started by asking me to code up a simple recursive calculation, using any language I wanted. The interviewers don't care. 2. So I asked for some paper and a pen. You should always have paper and pen anyway to write down ideas. Some of the best programmers figure out the high-level overview on paper before they write a single line of new code. 3. Even if you are a C++ systems guru. You will waste a lot of time writing string manipulation code and initialization code that you can do in one line of Python. All I had was a post-it note, a tiny amount of space. 4. 5. 6. 7. 8. 9. 10. 11.

gitignore Dev Center | Collaborating with Others cli collaboration Table of Contents Adding collaborators Other developers (identified by email address) can be invited to collaborate on your app: heroku sharing:add joe@example.com Adding joe@example.com to myapp collaborators... done When you invite a collaborator, they’ll be sent an email to let them know they were granted access to the app. Collaborator privileges All actions are supported for collaborators as they are for app owners except for the following, which are only support for app owners: Adding or removing paid add-onsDeleting or renaming the appViewing invoices These are the only actions that are restricted. Accessing an app as a collaborator When someone grants you access to an app, you will receive an email with the app name and some other information to help you get started: Next you should clone the app locally. At this point you can use git push heroku to deploy local commits. Viewing collaborators Use the heroku sharing command to see the list of current collaborators:

$ command line cheat sheets 高飞鸟 – Highbird » Git One of the difficult things for a git beginner to understand is how remote branches work. Basically, as git is a distributed version control system, every developer has a full and independent repository. So, how can you pass changes around? In the examples below, we'll consider a remote repository, that we'll call origin, and a local one (that we'll call local). The remote repository has one branch, called master, that has been cloned as origin/master on the local repository. Moreover, the local repository has one local branch, called master as well (but it doesn't need to be), which is set up to track changes that happen on origin/master. The fetch operation (command git fetch) copies the latest commits from the master on origin to origin/master, and updates the HEAD of the origin/master branch: git fetch origin The circles on the schema (click for a larger version) represent commits, and the arrows are the parent->child relationship between commits. git merge origin/master

Java Anti-Patterns This page collects some bad code that may not look so obviously bad to beginners. Beginners often struggle with the language syntax. They also have little knowledge about the standard JDK class library and how to make the best use of it. In fact I have collected all examples from everyday junior code. Some of these may seem like micro-optimization, premature optimization without profiling or constant factor optimizations. If you are interested in how to pogram compiler friendly, look at the JDK Performance Wiki. In the end a lot of your application's performance depends on the overall quality of your code. Compare these scenarios (assume 100MB young generation): In the slower scenario the transaction duration is 10 times longer. String concatenation String s = ""; for (Person p : persons) { s += ", " + p.getName(); } s = s.substring(2); //remove first comma This is a real memory waster. Lost StringBuffer performance This looks like optimized code, but it isn't optimal yet. char is not int

jsmits/github-cli Heroku | Cloud Application Platform Git - Fast Version Control System 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. 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. It is also possible to jump over the stage and check out files directly from the history or commit files without staging first. Diff Reset

Vimcasts - free screencasts about the text editor Vim Git FAQ What is Git? Git is a distributed version control system developed by Junio Hamano and Linus Torvalds. Git does not use a centralized server. Git runs on Linux, BSD, Solaris, Darwin, Windows, Android and other operating systems. Why the 'Git' name? Quoting Linus: "I'm an egotistical bastard, and I name all my projects after myself. ('git' is British slang for "pig headed, think they are always correct, argumentative"). Alternatively, in Linus' own words as the inventor of Git: "git" can mean anything, depending on your mood: Random three-letter combination that is pronounceable, and not actually used by any common UNIX command. How do I report a bug in Git? Bug reports can be sent to the Git mailing list: git@vger.kernel.org Please put "[BUG]" in the subject line. What's the difference between fetch and pull? The short definition is: Fetch: Download (new) objects and a head from another repository. Pull: Fetch (as defined above), and then merge what was downloaded with the current development. No.

Related:  GithubVersion ControlNormal