Git is a free & open source, distributed version control system designed to handle everything from small to very large projects with speed and efficiency.

learn more… | top users | synonyms

58
votes
9answers
4k views

Tips for putting ~ under source control

I want to put my home directory (~) under source control (git, in this case), as I have many setting files (.gitconfig, .gitignore, .emacs, etc.) in there I would like to carry across machines, and ...
39
votes
4answers
17k views

How to colorize output of git?

Is there a way to color output for git (or any command)? Consider: baller@Laptop:~/rails/spunky-monkey$ git status # On branch new-message-types # Changes not staged for commit: # (use "git add ...
35
votes
2answers
735 views

How did `git pull` eat my homework?

I feel like a kid in the principal's office explaining that the dog ate my homework the night before it was due, but I'm staring some crazy data loss bug in the face and I can't figure out how it ...
27
votes
3answers
32k views

GUI for GIT similar to SourceTree

Is there a similar piece of software to SourceTree, a GUI for git, for Linux? I know about Giggle, git cola, etc. I'm looking for a beautiful, easy to use GUI for git.
22
votes
6answers
3k views

Are there pitfalls to putting $HOME in git instead of symlinking dotfiles?

I have for many years had my entire $HOME directory checked into subversion. This has included all my dotfiles and application profiles, many scripts, tools and hacks, my preferred basic home ...
21
votes
9answers
3k views

How to keep track of changes in /etc/

I would like to keep track of changes in /etc/ Basically I'd like to know if a file was changed, by yum update or by a user and roll it back if I don't like the chage. I thought of using a VCS like ...
19
votes
4answers
4k views

How can I create an alias for a git [action] command (which includes spaces)?

Most of my my aliases are of this form: alias p='pwd' I want to alias git commit so that it does git commit -v But trying to create an alias with a space gives an error: $ alias 'git commit'='git ...
18
votes
3answers
187 views

How did the Linux Kernel project track bugs in the Early Days?

We all know that Linus Torvalds created Git because of issues with Bitkeeper. What is not known (at least to me) is, how were issues/tickets/bugs tracked up until then? I tried but didn't get anything ...
15
votes
1answer
14k views

How to remove a file from the git index

How do I remove a file from a git repositorie's index without removing the file from the working tree? If I had a file ./notes.txt that was being tracked by git, I could run git rm notes.txt. But ...
15
votes
1answer
2k views

git diff displays colors incorrectly

In order to get coloured output from all git commands, I set the following: git config --global color.ui true However, this produces an output like this for git diff, git log whereas commands ...
14
votes
4answers
7k views

How can I solve this ssh-agent problem?

I'm using Linux Mint, and have not been able to get gnome-keyring to unlock automatically at login, it seems. A symptom of my problem is as follows: $ ssh-add Identity added: /home/me/.ssh/id_rsa ...
13
votes
3answers
2k views

Given a git patch id, how to find out which kernel release contains it?

Assume I have some issue that was fixed by a recent patch to the official Linux git repository. I have a work around, but I’d like to undo it when a release happens that contains my the fix. I know ...
13
votes
1answer
10k views

Ignore whitespaces changes in all git commands

I've found tons of sites that explain how to have git warn you when you're changing line endings, or miscellaneous other techniques to prevent you from messing up an entire file. Assume it's too late ...
12
votes
3answers
7k views

Answer yes in a bash script

I'm trying to do a git clone trough a bash script, but the first time that I run the script and the server is not known yet the script fails. I have something like this: yes | git clone ...
12
votes
3answers
13k views

git pull from remote but no such ref was fetched?

I have a git mirror on my disk and when I want to update my repo with git pull it gives me error message: Your configuration specifies to merge with the ref '3.5/master' from the remote, but no such ...
11
votes
3answers
17k views

How can I update to a newer version of Git using apt-get?

I've just set up a new machine with Ubuntu Oneiric 11.10 and then run apt-get update apt-get upgrade apt-get install git Now if I run git --version it tells me I have git version 1.7.5.4 but on my ...
11
votes
7answers
2k views

How do I encrypt git on my server?

Heres the closest I've gotten: I installed gitolite in the /Private folder using ecryptfs-utils (sudo apt-get install ecryptfs-utils adduser git ecryptfs-setup-private then the rest was configuring ...
10
votes
2answers
1k views

Can git configuration be set across multiple repositories?

Git seems to support configuration values at three levels: Per-system global settings (stored in /etc/git-core) Per-user global settings (stored in ~/.gitconfig) Per-repository local settings ...
8
votes
2answers
6k views

adding SSL certificate for Github only (not all certificates from ca-certificates package)

I get the following error when accessing Github over HTTPS: error: server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crt CRLfile: none This is because I don't have any ...
7
votes
2answers
2k views

What does “--” mean in Linux/Unix command line? [duplicate]

Possible Duplicate: What does “--” (double-dash) mean? git diff [options] [<commit>] [--] [<path>…] In here, how should I understand what [--] means? And when should I use it.
7
votes
3answers
634 views

Git pager is less, but what is causing the output coloring?

less itself isn't capable of doing syntax highlighting, according to this thread. However, git diff nicely shows colored output in less, its default pager. When I redirect the output of git diff ...
7
votes
1answer
215 views

Does git contain information about used id / group id changes?

I have googling awhile, but can not find such information. Looks like git doesn't contain users and groups, only permissions. Am I right?
7
votes
1answer
5k views

What is the .gitignore pattern equivalent of the regex (Big|Small)(State|City)-[0-9]*\.csv

I have a regex I stuck in my .gitignore similar to: (Big|Small)(State|City)-[0-9]*\.csv It didn't work so I tested it against RegexLab.NET. I then found the gitignore man page which led me to ...
7
votes
1answer
565 views

Excluding files in etckeeper with .gitignore doesn't work

I use etckeeper for changes in my configfiles (on debian squeeze) Since I also have an ircdeamon running, there are some files, that change every minute in the folder /etc/hybserv/ I don't want to ...
7
votes
2answers
435 views

Git do not overwrite symlinked directory on branch checkout

How can I make directory read-only with git? The situation is - in project, I have a symlink to shared framework. I don't want it to be overwritten/changed in any way (not even mtime or atime). How ...
6
votes
2answers
55k views

Installing git “sudo: apt-get: command not found”

I am trying to install git. I run the following command: sudo apt-get install git-core git-gui git-doc But receive the following error: sudo: apt-get: command not found What should I do?
6
votes
2answers
4k views

How to use rsync to backup a directory without git subdirectory

I want to copy my c directory with all subdirectories excluding ./git subdirectory. I do it using rsync : echo "copy c and sh files " rsync -a --include='*.c' --include='*.sh' --include='*/' ...
6
votes
7answers
2k views

How to sort (by whatever key) BibTex entries in `.bib` file?

I work with LaTeX and do versioning with Git. For bibliography management I use Mendeley. The problem is that each time Mendeley synchronizes it's .bib exports, they are in different order, what ...
6
votes
1answer
120 views

How to show all files git knows about?

How can I produce a list of filenames (incl. paths) that git knows about over the course of the whole history?
6
votes
1answer
3k views

Github adding a repository as a fork from an existing clone

So I have a git repository that I cloned from an upstream source on ghithub. I made a few changes to to it (that are uncommitted and in the master branch). What I want to do is push my changes onto my ...
6
votes
3answers
2k views

Passing SSH options to git-clone

I connect to my server using SSH: ssh user@server -p 2224 -zZ abcd I also have a git repository on my server. The only way I know to clone is: git clone ssh://user@server.com:2224/path/to/repo ...
6
votes
1answer
1k views

Multiple installed versions of git - centos

I manually installed git 1.6 a year or two ago. I noticed today that the 1.7 version is available in yum, and installed it (package git-all) I now get the following output: [root@ovz5197 ~]# git ...
6
votes
1answer
559 views

Git hanging while cloning source

I am cloning firmware source using git clone but during the operation my Internet connection went down. I immediately restored the connection, but now the git clone process is hanging. Can I kill ...
6
votes
1answer
415 views

Using git to manage /etc?

I am thinking on a system, where /etc were tracked on a remote git repository. I am thinking on a git workflow, where every host machine where a different branch. Every previous versions on every ...
5
votes
1answer
522 views

Determine if Git working directory is clean from a script

I have a script which runs rsync with a Git working directory as destination. I want the script to have different behavior depending on if the working directory is clean (no changes to commit), or ...
5
votes
4answers
145 views

Change command-line “environment” to programs command

In a console, is it possible to change into a commands "environment"? To explain, I take "git" as an example. While programming and using a git repository, I change to the repos path and then do many ...
5
votes
2answers
402 views

Git commit from within a Makefile

I have a Makefile for a Latex project I'm working on. Makefiles aren't my forte, but is there a way to do something like: make git "My comment" And have the makefile execute: git commit -m "My ...
5
votes
2answers
292 views

Bash commands with spaces in them (git config or git-config?)

Please forgive me if this seems easy, but I only started learning Unix 2 days ago. Basically, I have been taught that when typing a command into the terminal it needs to be of the form: [command ...
5
votes
3answers
16k views

How to grant read/write to specific user in any existent or future subdirectory of a given directory?

I'm a complete newbie in system administration and I'm doing this as a hobby. I host my own git repository on a VPS. Let's say my user is john. I'm using the ssh protocol to access my git ...
5
votes
3answers
1k views

git command not found

I had to install git from source on RHEL. After installation the git command is shown to be in /usr/local/bin/git when trying the whereis command.This path is available in $PATH also. When I type ...
5
votes
1answer
897 views

Git auto-complete

I am using Git as many of you do. Also, I don't use any GUI for that — just CLI. So I was wondering: are there any way to make Git commands (git status, git checkout etc.) complete themselves when ...
5
votes
1answer
2k views

How to recover broken/partially deleted git repository

I accidently ran an rm -r on my .git directory. Luckly rm stopped when it got to a write-protected file, but I've still lost several things in my .git. Files I still have: FETCH_HEAD ORIG_HEAD ...
5
votes
3answers
3k views

Installing Git, Curl, and Expat from Source

I have a RHEL 6.4 VM provisioned by my companies internal KVM. We are having some trouble using yum (Cannot retrieve repository metadata, which Ive confirmed in this case is peculiar to my company's ...
5
votes
3answers
844 views

extracting “tag” information from git with a shell script

The vc bundle is a neat little package that extracts information about a git repo for easy insertion into a LaTeX document. It doesn't currently extract information about whether the current commit is ...
5
votes
2answers
108 views

How can I pipe stdout to another program?

I'm trying to setup a linter for my code and I only want to lint the coffeescript files that have changed in the current branch. So, I generate the list of files using git: git diff --name-only ...
5
votes
2answers
238 views

How do I set Zsh autocompletion rules for second argument (of function) to an existing command's rules?

I have a custom Zsh function g: function g() { # Handle arguments [...] } Within it, I handle short arguments that execute Git commands. For example: g ls # Executes git ls-files ... g g # ...
5
votes
1answer
245 views

Custom bash autocomplete for git breaks other git autocomplete features

I am trying to add autocompletion to git commit upon hitting TabTab. The autocomplete feature I am working on is based on a branch-naming convention. The convention is to append the PivotalTracker ...
4
votes
2answers
3k views

Tar a folder without .git files?

If I tar a folder that is a git repository, can I do so without including the .git related files? If not, how would I go about doing that via a command?
4
votes
2answers
152 views

Is it possible to restrict certain commands from being run in a directory?

I have two directories: src and projects. I would like to prevent myself from running git ... unless I am specifically inside src or projects. Is this possible?
4
votes
3answers
3k views

Fetch a specific branch using git

I want to download source code from the master-next branch using git as described in the Xilinx wiki. I tried this: #git clone git://github.com/Xilinx/u-boot-xlnx/tree/master-next.git Initialized ...