Tag Info

Hot answers tagged

61

You can create a section [color] in your ~/.gitconfig with e.g. the following content [color] diff = auto status = auto branch = auto interactive = auto ui = true pager = true You can also fine control what you want to have coloured in what way, e.g. [color "status"] added = green changed = red bold untracked = magenta bold [color ...


56

You probably want to use git config --global color.ui auto The auto part says that git will only try and use color on terminals that support it, and you will not get ANSI sequences if you redirect output of git commands to a file for example. Setting it to true is same as auto, and this is also the default since Git 1.8.4. The color.ui is a meta ...


54

I have $HOME under git. The first line of my .gitignore file is /* The rest are patterns to not ignore using the ! modifier. This first line means the default is to ignore all files in my home directory. Those files that I want to version control go into .gitignore like this: !/.gitignore !/.profile [...] A trickier pattern I have is: !/.ssh /.ssh/* ...


35

Here are the commands you need to run, if you just want to get it done: sudo add-apt-repository ppa:git-core/ppa -y sudo apt-get update sudo apt-get install git git --version As of Dec 2014, I get git 2.2.0 that way, while the version in the Ubuntu Trusty repositories is 1.9.1. Note that add-apt-repository is installed via: sudo apt-get install ...


30

You could just use git rm --cached notes.txt. This will keep the file but remove it from the index.


28

You're seeing the escape sequences that tell the terminal to change colors displayed with the escape character shown as ESC, whereas the desired behavior would be that the escape sequences have their intended effect. Commands such as git diff and git log pipe their output into a pager, less by default. Git tries to tell less to allow control characters to ...


27

A nice alternative is SmartGit. It has some very similar features to SourceTree and has built in 3-column conflict resolution, visual logs, pulling, pushing, merging, syncing, tagging and all things git :)


27

Not a direct answer to your question (since aliases can only be one word), but you should be using git-config instead: git config --global alias.civ commit -v This creates a git alias so that git civ runs git commit -v. Unfortunately, AFAIK there is no way to override existing git commands with aliases. However, you can always pick a suitable alias name ...


26

One obvious answer is etckeeper by Joey Hess of Debian, which manages files under /etc using version control. It supports subversion, git and mercurial.


25

Since you're using CentOS 5, the default package manager is yum, not apt-get. To install a program using it, you'd normally use the following command: $ sudo yum install <packagename> However, when trying to install git this way, you'll encounter the following error on CentOS 5: $ sudo yum install git Setting up Install Process Parsing package ...


24

Parsing the output of git status is a bad idea because the output is intended to be human readable, not machine-readable. There's no guarantee that the output will remain the same in future versions of Git or in differently configured environments. UVVs comment is on the right track, but unfortunately the return code of git status doesn't change when there ...


23

You have several options: Either wait until the version you need is present in the repository you use. Compile your own version and create a deb. Find a repository that provides the version you need for your version of your distribution(e.g. Git PPA). If you don't need any particular feature from the newer version, stay with the old one. If a newer ...


20

What I do (with the same objectives) is to put my configuration files in a subdirectory ~/lib and have symbolic links in my home directory, e.g., .emacs -> lib/emacs/dot.emacs. I only keep configuration files that I wrote explicitly under version control; my home directory contains plently of automatically-created dot files that are not under version ...


19

Add the following to your ~/.ssh/config file: Host github.com StrictHostKeyChecking no Anything using the open-ssh client to establish a remote shell (with the git client does) should skip the key checks to github.com. This is actually a bad idea since any form of skipping the checks (whether you automatically hit yes or skip the check in the first ...


18

Check the branch you are on (git branch), check the configuration for that branch (in .../.git/config), you probably are on the wrong branch or your configuration for it tells to merge with a (now?) non-existent remote branch.


15

There's no way to express this regular expression with the patterns that gitignore supports. The problem is not the lack of capture groups (in fact, you are not using capture groups as such), the problem is the lack of a | operator. You need to break this into four lines. BigState-[0-9]*.csv SmallState-[0-9]*.csv BigCity-[0-9]*.csv SmallCity-[0-9]*.csv ...


15

You're talking about a command that includes a space, but here the command is git and there's no space in there. To call a git commit command, you'd need to write it git\ commit ... 'git commit' ... "git commit" ... Generally commands don't have space in their names for that reason that it is cumbersome to call them in a shell, so I don't think you'll ...


14

The -- is commonly used in command to indicate the end of options. This is useful if your filename begins with a "-" or your input is unknown. Here is an example of its use: git diff --stat -- --file1 --file2 --file1 is treated as a filename rather than another option.


14

In the beginning, if you had something to contribute (a patch or a bug report), you mailed it to Linus. This evolved into mailing it to the list (which was linux-kernel@vger.rutgers.edu before kernel.org was created). There was no version control. From time to time, Linus put a tarball on the FTP server. This was the equivalent of a "tag". The available ...


12

As mentioned on LWN, the easiest is: git describe --contains f3a1ef9cee4812e2d08c855eb373f0d83433e34c If you don't want a local clone, gitweb's "plain" formatted commit contains the same info in the X-Git-Tag header. Unfortunately kernel.org switched over to cgit which apparently does not disclose this information. Previously it was possible to find it ...


12

Just add an explicit exclude for .git: rsync -a --exclude='.git/' --include='*.c' --include='*.sh' --include='*/' --exclude='*' ~/c/ ~/Dropbox/Public/c Another option is to create ~/.cvsignore containing the following line along with any other directories you'd like to exclude: .git/


12

See the Content Limitations section of the git Wiki: git does not track file ownership, group membership, doesn't track most permission bits, ACLs, access and modification times, etc. Git tracks contents, and doesn't care much about pretty much everything else.


12

Git uses isatty() to check whether stdout is a tty: this is used to see if a pager must be used (pager.c) as well as colors (color.c).


11

For diff, there's git diff --ignore-space-at-eol, which should be good enough. For diff and blame, you can ignore all whitespace changes with -w: git diff -w, git blame -w. For git apply and git rebase, the documentation mentions --ignore-whitespace. For merge, it looks like you need to use an external merge tool. You can use this wrapper script ...


11

Have a look first at git help archive. archive is a git command that allows to make archives containing only git tracked files. Probably what you are looking for. One example listed at the end of the man page: git archive --format=tar --prefix=git-1.4.0/ v1.4.0 | gzip >git-1.4.0.tar.gz


11

I wouldn't want my entire home directory checked into version control simply because it means every subdirectory I go into would have the version-control context of my home dir. Commands like git checkout would have an actual action in that case, causing issues if I accidentally run something from the wrong directory, whether that something is git itself or ...


10

You can do it all from your existing repository (no need to clone the fork into a new (local) repository, create your branch, copy your commits/changes, etc.). Get your commits ready to be published. Refine any existing local commits (e.g. with git commit --amend and/or git rebase --interactive). Commit any of your uncommitted changes that you want to ...


10

In my case, my local branch was not set to track the remote branch. I had to manually run: git pull origin remotebranch Then next time you do a push do "git push -u" to set up correct tracking.


10

Q#1: Can you set up a RAID system using USB sticks as the storage media You should be able to use any block storage devices in a RAID. Any standard directions for setting up a RAID using SATA HDD's should be applicable when using USB storage as well. You'll have to set it up so that the USB devices are assembled as members of the RAID array. Q#2: ...


10

The processes used news groups (USENET), and (predominantly) email. A bug "existed" as a thread, putting "[BUG REPORT]" or "LINUX BUG REPORT" in the subject was a common convention. There were no bug IDs. Given the typical user-base, a bug report often came with a patch. There was one long-forgotten software tool used: ibug (see below), other than that ...



Only top voted, non community-wiki answers of a minimum length are eligible