background preloader

Nick Farina - Git Is Simpler Than You Think

Nick Farina - Git Is Simpler Than You Think
It was about one year ago that we switched to Git. Previously, we used Subversion, through the Mac app Versions, which (rightly) holds an Apple Design Award. I made the executive decision to leave our comfy world of Versions because it seemed clear that Git was winning the Internet. There was much grumbling from my teammates, who were busy enough doing actual work thank you very much. But I pressed forward. We signed up for accounts on Github. It might as well have printed PC LOAD LETTER. “Not currently on any branch?!” Maintenance Required Git is not a Prius. By now we all know how to drive Git. Did you know the top result for “git tutorial” is this manpage on So instead let’s pull over, open the hood up, and poke around. The Basics We’ll run through some basic commands to make a repository for our examples: Now we have a git repository with one file and one commit, that is to say, one “version”. ~/mysite$ echo "<center>Cats are cute. With me so far? The Repository User Interface

Learn.GitHub - Git Tagging Create signed, unsigned, or lightweight tags to permanantly mark important points in your project history Like most VCSs, Git has the ability to ‘tag’ specific points in history as being important - generally people use this to mark release points (‘v1.0’, etc). In this lesson we will learn how to list the available tags, how to create new tags, and what the different types of tags in Git are. Simply listing the available tags in Git is very straightforward. $ git tag v0.1 v1.3 This will just list them in alphabetical order, so there is no real importance in what order they list out in. You can also search for tags with a particular pattern. $ . There are a two main types of tags in Git - lightweight and annotated. Creating an annotated tag in Git is very simple. $ git tag -a v1.4 -m 'version 1.4' $ git tag v0.1 v1.3 v1.4 The ‘-m’ specifies a tagging message, which is stored with the tag. You can see the tag data along with the commit that was tagged by using the ‘git show’ command:

Java, Compilando pelo prompt | Richard Ikeda Hoje vou mostrar como compilar um programinha em java pelo prompt de comando do Windows. Pra quem não conhece ou não está familiarizado é essa tela abaixo. Antes de usar o prompt devemos fazer algumas configurações primeiro . Você deve ter instalado o SDK do Java que pode ser baixado aqui. Após ter o SDK instalado você precisará anotar alguns caminhos, que servirão de variável para as configurações. Por padrão seria C:\Arquivos de programas\Java\ Procure a versão do sdk que foi instalada no meu caso foi o ‘jdk1.6.0_04‘ acesse esta pasta. Copie em um bloco de notas o caminho até esta pastaC:\Arquivos de programas\Java\jdk1.6.0_04\ dentro dela haverá outras, dentre elas, a pasta lib e a bin você deve anotar esses caminhos também. Pastas Java (Clique na imagem para Ampliar) Agora você deverá acessar seu painel de controle, clicar na opção Sistema, aba Avançado, botão Variáveis de Ambiente. Propriedades do Sistemas Variáveis de Ambiente Após isso abrirá esta janela: Nova Variável de Usuário

git - the simple guide - no deep shit! git - the simple guide just a simple guide for getting started with git. no deep shit ;) by Roger Dudler credits to @tfnico, @fhd and Namics this guide in deutsch, español, français, indonesian, italiano, nederlands, polski, português, русский, türkçe, မြန်မာ, 日本語, 中文, 한국어 Vietnamese please report issues on github Infuse analytics everywhere with the AI-powered embedded analytics platform. setup Download git for OSX Download git for Windows Download git for Linux create a new repository create a new directory, open it and perform a git init to create a new git repository. checkout a repository create a working copy of a local repository by running the command git clone /path/to/repository when using a remote server, your command will be git clone username@host:/path/to/repository workflow add & commit You can propose changes (add it to the Index) using git add <filename> git add * This is the first step in the basic git workflow. pushing changes branching update & merge tagging log useful hints guides

How do I edit an incorrect commit message in Git JavaBrasil{Compilando Conhecimentos} 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^

Changing Git History This document describes how to modify commit messages in Git after the fact. Changing the Last Commit Message If you only want to modify your last commit message, it is very simple. Just run $ git commit --amend That will drop you into your text exitor and let you change the last commit message. Changing Multiple Commit Messages Now let's assume that you want to modify either multiple commit messages, or a commit message several commits back. If you want to change the last 3 commit messages, or any of the commit messages up to that point, supply 'HEAD~3' to the git rebase -i command. $ git rebase -i HEAD~3 Warning: every commit you see in this list will be re-written, whether you change the message or not. Running this command will give you a list of commits in your text editor that looks something like this: Change the word 'pick' to the work 'edit' for each of the commits you want to change the message for. These instructions tell you exactly what to do. $ git rebase --continue

gitglossary(7) alternate object database Via the alternates mechanism, a repository can inherit part of its object database from another object database, which is called "alternate". bare repository A bare repository is normally an appropriately named directory with a .git suffix that does not have a locally checked-out copy of any of the files under revision control. That is, all of the git administrative and control files that would normally be present in the hidden .git sub-directory are directly present in the repository.git directory instead, and no other files are present and checked out. blob object Untyped object, e.g. the contents of a file. branch A "branch" is an active line of development. cache Obsolete for: index. chain A list of objects, where each object in the list contains a reference to its successor (for example, the successor of a commit could be one of its parents). changeset BitKeeper/cvsps speak for "commit". checkout cherry-picking clean commit commit object core git Directed acyclic graph.

Using Git to manage a web site The HTML source for my (i.e., this) web site lives in a Git repository on my local workstation. This page describes how I set things up so that I can make changes live by running just "git push web". The one-line summary: push into a remote repository that has a detached work tree, and a post-receive hook that runs "git checkout -f". The local repository It doesn't really matter how the local repository is set up, but for the sake of argument, let's suppose you're starting one from scratch. $ mkdir website && cd website $ git init Initialized empty Git repository in /home/ams/website/.git/ $ echo 'Hello, world!' Anyway, however you got there, you have a repository whose contents you want to turn into a web site. The remote repository I assume that the web site will live on a server to which you have ssh access, and that things are set up so that you can ssh to it without having to type a password (i.e., that your public key is in ~/.ssh/authorized_keys and you are running ssh-agent locally).

Git Basics So, what is Git in a nutshell? This is an important section to absorb, because if you understand what Git is and the fundamentals of how it works, then using Git effectively will probably be much easier for you. As you learn Git, try to clear your mind of the things you may know about other VCSs, such as Subversion and Perforce; doing so will help you avoid subtle confusion when using the tool. Git stores and thinks about information much differently than these other systems, even though the user interface is fairly similar; understanding those differences will help prevent you from becoming confused while using it. Snapshots, Not Differences The major difference between Git and any other VCS (Subversion and friends included) is the way Git thinks about its data. Figure 1-4. Git doesn’t think of or store its data this way. Figure 1-5. This is an important distinction between Git and nearly all other VCSs. Nearly Every Operation Is Local Git Has Integrity Git Generally Only Adds Data

Git Submodules It often happens that while working on one project, you need to use another project from within it. Perhaps it’s a library that a third party developed or that you’re developing separately and using in multiple parent projects. A common issue arises in these scenarios: you want to be able to treat the two projects as separate yet still be able to use one from within the other. Here’s an example. Git addresses this issue using submodules. Starting with Submodules Suppose you want to add the Rack library (a Ruby web server gateway interface) to your project, possibly maintain your own changes to it, but continue to merge in upstream changes. $ git submodule add rack Initialized empty Git repository in /opt/subtest/rack/.git/ remote: Counting objects: 3181, done. remote: Compressing objects: 100% (1534/1534), done. remote: Total 3181 (delta 1951), reused 2623 (delta 1603) Receiving objects: 100% (3181/3181), 675.42 KiB | 422 KiB/s, done. Superprojects

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. 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. Conventions In the rest of this document, we will use graphs of the following form. Diff Commit

GIT commands Here you will find a list with the major commands, their short descriptions and exemplary usage. For a detailed description of all the GIT commands please visit git config Sets configuration values for your user name, email, gpg key, preferred diff algorithm, file formats and more. Example: git config --global "My Name" git config --global "" cat ~/.gitconfig [user] name = My Name email = git init Initializes a git repository – creates the initial ‘.git’ directory in a new or in an existing project.