Git is a free & open source, distributed version control system designed to handle everything from small to very large projects with speed and efficiency.
44
votes
10answers
3k 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 ...
19
votes
9answers
863 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 ...
18
votes
3answers
3k 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 ...
12
votes
4answers
748 views
How can I create an alias for a command that includes a space?
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 ...
12
votes
3answers
3k 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 ...
11
votes
4answers
707 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 ...
10
votes
4answers
2k 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 ...
9
votes
2answers
364 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 ...
9
votes
1answer
4k 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 ...
8
votes
1answer
8k 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 ...
8
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
3answers
355 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 ...
7
votes
2answers
145 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
8answers
6k views
Error installing git on CentOS 6
After I run yum install git
it shows the error
Error: Package: git-1.7.6.1-1.el5.rf.i386 (rpmforge)
Requires: libcurl.so.3
You could try using --skip-broken to work around the problem
You ...
5
votes
2answers
525 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.
5
votes
4answers
126 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
3answers
113 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
2k 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 ...
5
votes
1answer
96 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?
5
votes
2answers
928 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
93 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
593 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
511 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
140 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
53 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 ...
4
votes
1answer
102 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
1answer
63 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
79 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
153 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 ...
4
votes
1answer
214 views
What's the fastest (CPU time) way to get my current git branch?
I'm trying to improve the performance of my fish prompt, and since my prompt includes my current git branch, I'm wondering if there may be a way to make it faster.
Right now I'm using git ...
4
votes
1answer
272 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 ...
3
votes
2answers
1k 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?
3
votes
2answers
148 views
place the aliased version of an existing command in /usr/bin/
I use Vim a lot, and I know how I can start vim in insert mode. So I have an alias named vii in my .bash_aliases file.
On other hand I use Git a lot too, and I have this line in my .gitconfig:
...
3
votes
3answers
496 views
For what purpose would perl* be excluded in yum.conf?
I am not an Unix/Linux admin.
I was attempting to install git on our server, and after much googling and trial and error, I discovered that perl* is excluded in our yum.conf file, preventing perl-Git ...
3
votes
3answers
690 views
How can I pass output of one command as an argument to another
A similar question has been asked, but since I am new to Unix the answer was not clear to me due to the context. What I want to do is to pass the output of one command as an argument to another. I am ...
3
votes
3answers
2k views
I am failing to clone a git repo when behind a proxy
When I run git clone git://git.gnome.org/tracker, I get:
Cloning into tracker...
git.gnome.org[0: 209.132.180.173]: errno=Connection refused
fatal: unable to connect a socket (Connection refused)
...
3
votes
1answer
3k views
Unable to git clone over ssh
I created a bare git repository and pushed to as root. Then I ran su myuser and ran the following commands:
$ whoami
myuser
$ mkdir t
$ cd t
$ git clone ssh://myuser@mybox.net:1234/git3
Cloning into ...
3
votes
3answers
3k views
Install Git on CentOS 5.5
I have added EPEL repo and here goes...
# yum install git-core
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* addons: mirror.team-cymru.org
* base: yum.singlehop.com
* ...
3
votes
1answer
530 views
git grep colors differ from grep custom colors
I've setup grep colors in my ~/.bashrc :
export GREP_COLORS='ms=01;34:mc=01;34:sl=:cx=:fn=35:ln=32:bn=32:se=36'
They work for
grep --color=auto
grep --color=always
Unfortunately, those custom ...
3
votes
2answers
207 views
Specifying which git repo to use
I have a bash script, called cgit, that acts as git for one specific git repo (located at /.git):
#!/bin/bash
cd /;
sudo git $@ > /dev/stdout
I use it to keep track of imporant system files:
...
3
votes
1answer
130 views
Bash script with quotes and spaces
I'm trying to get some nice output out of git:
FORMAT='%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset'
LOG_PARAMS="--color --pretty=format:$FORMAT --abbrev-commit ...
3
votes
1answer
75 views
Hosting Git Repositories as per GitHub [closed]
I'm wondering how exactly GitHub does what they do as far as hosting Git repositories goes. For example, I'm assuming that they manage repository push permissions based on values in some SQL table ...
3
votes
1answer
266 views
Git - remove deleted files
I'm using this simple git alias
rmdel = "!git rm $(git ls-files -d)"
meant "remove deleted", i.e. to remove from the staging area all files deleted from the file system. It works fine except ...
3
votes
1answer
72 views
Excluding files in etckeeper with .gitignore doesen'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 ...
3
votes
3answers
93 views
Mail cron output only when Git throws a real error
There exists a Git repo that is on one server, we want to generate doxygen output for it on a different server. The following command works for me but has the downside of sending a mail everytime the ...
3
votes
1answer
746 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 ...
3
votes
2answers
123 views
create pseudo shell for a command
I feel like this should be straighforward to some degree...
Basically, for some command, I want to be able to invoke another command that will scope all params to that command. so...
git commit -am ...
3
votes
1answer
198 views
How to stage part of hunk with added newline at EOF?
Is there some way to stage individual lines of a file which has just been changed to include newline at EOF? I tried add -p, but it wouldn't split the relevant hunk into small enough parts, and it's ...
3
votes
5answers
756 views
Configure permissions
I'm sharing a git repository with a friend over SSH. He pushes from and pulls to his git repository using my machine's SSH server, where the shared git repository is.
Problem is that when he pushes a ...
3
votes
1answer
2k 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.