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

57
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 ...
29
votes
4answers
11k 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 ...
21
votes
9answers
2k 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 ...
21
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 ...
20
votes
2answers
23k views

Similar software 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.
15
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 ...
13
votes
1answer
12k 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 ...
13
votes
3answers
1k 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 ...
12
votes
3answers
6k 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
4answers
6k 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 ...
11
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 ...
11
votes
1answer
8k 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 ...
10
votes
2answers
795 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 ...
10
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 ...
7
votes
2answers
11k 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 ...
7
votes
1answer
166 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
2answers
8k 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 ...
7
votes
2answers
365 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
43k 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
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.
6
votes
1answer
4k 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 ...
6
votes
1answer
117 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
3answers
1k 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 ...
6
votes
1answer
790 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
2answers
1k 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 ...
5
votes
4answers
143 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
239 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
237 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
6answers
1k 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 ...
5
votes
3answers
775 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
744 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
2answers
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 ...
5
votes
1answer
1k 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
1answer
2k 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 ...
5
votes
1answer
405 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 ...
5
votes
3answers
734 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
1answer
51 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
62 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
215 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
149 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
12k 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 ...
4
votes
2answers
109 views

Extract given tarball and retar it exactly

My versioned project uses the contents of an upstream tarball. I would like to extract the contents in such a way as to be able to recreate the original tarball exactly. The reason is that I don't ...
4
votes
1answer
171 views

How does this git alias work?

Usually, git aliases are confined to a single command: git config --global alias.ci commit So, instead of git commit you could do git ci But it seems you can insert a function in there as well: ...
4
votes
2answers
4k views

git push fails with remote: error: hook declined to update refs/heads/master

I'm recently trying to start my own project on a community git repo, and I've been having some complications. I'm new to git, but here's what I've been trying to do to just test it. I run the ...
4
votes
1answer
108 views

Invoke git without loading user gitconfig

A git-interfaced tool written in Python breaks because of some settings in my local ~/.gitconfig, namely diff.noprefix=True. I know that I can use something like git -c diff.noprefix=False diff in ...
4
votes
1answer
217 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 ...
4
votes
1answer
74 views

How do I find a tag that contains a commit?

I have the SHA ID of a commit that I am interested in and would like to know how to find the first tag that contains it.
4
votes
1answer
730 views

SSH: “Permission denied” after changing user shell

I have an SSH server running on my Raspberry PI with ALARM (up to date). My user "gitroot" is meant to use the git-shell. However, when i set /usr/bin/git-shell as shell for gitroot in /etc/passwd, i ...
4
votes
1answer
349 views

How can I git diff markdown (.md) files

I have some markdown files but I can't git diff them. No result at the command line and not supported in gitg (visual git) Is that possible with the files as they are, without converting them to ...