Git is an open source distributed version control system originally designed and written by Linus Torvalds. It is generally used to keep track of source code for software projects. As a DVCS, Git provides powerful help with branching, merging, and distributed development.

learn more… | top users | synonyms

96
votes
9answers
156k views

How can I roll back 1 commit?

I have 2 commits that I did not push: $ git status # On branch master # Your branch is ahead of 'faves/master' by 2 commits. How can I roll back my first one (the oldest one), but keep the second ...
86
votes
3answers
65k views

Tell git which private key to use

ssh has the -i option to tell it which private key file to use when authenticating: -i identity_file Selects a file from which the identity (private key) for RSA or DSA authentication is ...
81
votes
7answers
59k views

How do I ensure Git doesn't ask me for my GitHub username and password?

I am working with a repo on GitHub and everytime I try to push something, it asks for my GitHub username and password. I don't want it doing that. I tried the instructions on setting your email in ...
65
votes
12answers
39k views

How to get git-completion.bash to work on Mac OS X?

I have followed http://blog.bitfluent.com/post/27983389/git-utilities-you-cant-live-without to add git-completion.bash to my /opt/local/etc/bash_completion.d/git-completion and I put ...
56
votes
4answers
15k views

Forward SSH traffic through a middle machine

SSH tunneling is very confusing to me. I am wondering if I can do this in Linux. I have 3 machines.. A. My local machine at home. B. Machine at work that I can SSH into (middle man). C. My desktop ...
53
votes
3answers
40k views

Using Multiple SSH Public Keys

I have a personal account and a company account on Unfuddle. On Unfuddle SSH keys can only be used on a single account, so I need to create a seperate SSH key on my laptop for both accounts. I ran ...
41
votes
2answers
9k views

Git Bash Here in ConEmu

How do I create a right-click context menu entry to open Git Bash at a given folder within ConEmu? See Git Bash Here in Console2 for the equivalent question for Console2.
41
votes
4answers
10k views

Git Bash Here in Console2?

MSysGit installs a context menu item that opens a Git Bash prompt at the currently selected folder; however, this opens a cmd.exe window and I would like it to open in Console2 instead. What ...
37
votes
4answers
40k views

How to reset master to origin/master?

Can I do following in a simpler way? git checkout origin/master git branch -D master git branch master git checkout master
32
votes
7answers
30k views

How should I set the PATH variable on my Mac so the Hombrew-installed tools are found?

Trying to set up Homebrew on a new Mac (on previous Macs I would install packages from source). The first package I tried to install was Git: $ brew install git Installation went OK, but which ...
31
votes
2answers
14k views

Git - List all files currently under source control?

Is there a way to list all files currently under source control in git? (Not just those that have been modified).
30
votes
1answer
23k views

GIT merge master into a branch

I have been developing a new feature on a new branch, on the side I have committed quite a few changes on my master branch. I would like to know if it's possible to merge the master branch in my new ...
25
votes
5answers
10k views

Can you specify git-shell in .ssh/authorized_keys to restrict access to only git commands via ssh?

I'd like to be able to use a ssh key for authentication, but still restrict the commands that can be executed over the ssh tunnel. With Subversion, I've achieved this by using a .ssh/authorized_keys ...
23
votes
2answers
7k views

Can't remove remote branch in git

I'm trying to remove a remote branch with git: rpinson@rpinson:~/dev/charismanie$ git remote show origin * remote origin Fetch URL: git@github.com:raphink/Charismanie.git Push URL: ...
22
votes
7answers
22k views

git push fatal failed

I somehow deleted the whole directory of my code branch. I cloned a new one. It worked fine except pushing. ~/workspace/wtf (mybranch)]$ git push origin mybranch error: Cannot access URL [my url], ...
22
votes
10answers
23k views

How to upgrade Git on Ubuntu Hardy?

I have Git version 1.5.4.3 installed, but I think this must be an old version. I'm running Ubuntu Hardy 8.04. I need to install at least version 1.6 to get a Git GUI to work. How do I upgrade my ...
21
votes
2answers
6k views

Tmux and ZSH custom prompt : bug with window name

I have customized my ZSH prompt with oh-my-zsh to make it more readable and add information about git if I'm in a repository. Example : bob@inf [~/docs] % bob@inf [~/src/nicest] master % (in a git ...
19
votes
2answers
5k views

git “ping”: check if remote repository exists

I'd like to know whether a remote repository exists. Here's what I came up with: git ls-remote "$REPO_URL" &> /dev/null Is there any better way?
18
votes
1answer
20k views

Terminal Command To Find What Version Of Git I Have Installed?

What is the terminal command to find what version of Git is currently installed on my system?
17
votes
1answer
9k views

Git vs. Portable git

I don't do my system reinstalls that often, and the last time I looked there was only "regular" git on the download list. Now I see they pushed out the portable variant as well ... only I haven't been ...
15
votes
2answers
18k views

Install Git under OSX Mavericks

I've just completed a fresh install of Mavericks. Then I went to git-scm.com and downloaded the Mac installer and installed Git from that. Now whenever I go into the terminal and type git I get this: ...
15
votes
4answers
13k views

I can't uninstall Git

I was researching Git so I downloaded the Windows version to test it out on a repository on GitHub. After about 30 minutes I couldn't work out how to use it, so I decided I probably wouldn't need a ...
15
votes
2answers
1k views

Is there a git-like file system?

Git stores content uniquely in its repo based on the calculated hash of any file. Thus, if my directory has two copies of the same file somewhere inside it, git will only actually store it once. I ...
14
votes
1answer
9k views

Why can't I push an empty commit?

git commit --amend --allow-empty then git push origin master the git said that ! [rejected] master -> master (non-fast-forward) error: failed to push some refs to 'remoteurl' To ...
14
votes
1answer
4k views

Which fork of GitX is the most active? [closed]

I've been using the original GitX but I've noticed it hasn't had any updates for quite a while. Which version of GitX is the most active, in terms of updates/stability/features? The original ...
14
votes
1answer
331 views

EGit (Eclipse) wrongly interpreting file names with non-ASCII characters?

I recently switched to using a Git repository within Eclipse (Juno SR2), using EGit. In our project, some file names contains umlauts and other special non-ASCII-characters. On the command line, git ...
13
votes
2answers
14k views

How do Git branches work? Can I remove the master branch?

I have a project that has 2 branches, development and production. I'm not using the master branch and each time I write git status it tells me how far ahead my branch is from the master. When I try ...
13
votes
5answers
19k views

How do I backup a git repo?

I am planning to switch from SVN to git. With svn I just copy my repo folder when I want to back it up. However git doesn't have one so what do I do? Should I create a clone on a separate drive and ...
13
votes
3answers
2k views

How can I enable colored output for OSX diff?

I need to diff two files (not two versions of the same file, they are however tracked by git, but that is unrelated) and I would like some colored output, how can I achieve that? $ diff file_1 file_2 ...
13
votes
9answers
3k views

Cygwin/Git Bizarre Terminal Issue

Alright, this is weird. First off, this is mintty running on up-to-date cygwin, with git pulled from cygwin's setup.exe. I am running zsh. $ git clone ...
13
votes
3answers
11k views

Pull for another Git branch without switching

we recently switched from SVN to Git and at the same time put our live systems into version control (instead of local checkout and file copy to live). On the project i'm assigned to we all access ...
13
votes
1answer
1k views

How to reuse/extend etckeeper's metadata engine for git control of non-/etc filesystems, or extend git natively with said capability?

Overview + question I want etckeeper-like filesystem metadata control for non-/etc, git-controlled directories. Home and web-app directories, among others, are classically sensitive to metadata ...
12
votes
4answers
4k views

How to amend the last commit to un-add a file?

I have modified two files a, b in the last commit. But file b should not be commited, what's the workflow to amend this?
12
votes
2answers
17k views

How can I push a Git repository to a folder over SSH?

I have a folder called my-project inside which I've done git init, git commit -a, etc. Now I want to push it to an empty folder at /mnt/foo/bar on a remote server. How can I do this? I did try, ...
12
votes
1answer
13k views

Is there way to list all existing repositories using git?

In order to clone a git repository one must have the name of the repository. When working with many repositories it can be hard to remember all the different names, so now I'm wondering if there is ...
11
votes
4answers
7k views

Using git through cygwin on windows 8

I've got a windows 8 dev preview (not sure if it's relevant, but I never had this hassle on w7) machine and I'm trying to clone a git repo from github. The problem is that my ~/.ssh/id_rsa has 440 ...
11
votes
2answers
3k views

How can I Resync a fork from original

I just forked a project in Github. I made modifications and send pull request. Th owner merge my fork with the main project and after that he made some modifications. So for now my fork is not updated ...
11
votes
3answers
39k views

Using GIT on Aptana 3 standalone

The only references I see to GIT in Aptana Studio 3 (the standalone version) are under preferences where the only field is to identify an executable (do I need to do that?) and importing a project, ...
11
votes
3answers
12k views

Update git on mac

I can't remember how I installed git a while back....but now it's living in /usr/bin/git and needs to be updated. I don't care how (pre-compiled or build my own) but what I don't want is another ...
11
votes
2answers
2k views

Rewrite git history to replace all CRLF to LF?

I'm going to transfer a private Git repository from win32 box to Ubuntu. Though I can do a final dos2unix commit, but I'd like to rewrite the whole history, so some Git GUI will display log/diff ...
11
votes
2answers
632 views

How can I achieve separate colors for current, local, and remote ref names when using a custom git log format?

I have a custom git log format that I use. I have color.ui=true set in my .gitconfig. For example this simple format: git log --pretty=format:"%h %d %s" --decorate This would print something like ...
11
votes
2answers
4k views

Homebrew won't link git

When I installed git or upgrade git via brew I couldn't link it with brew link git. If I try sudo brew link git I get: cowardly refusing to sudo brew link It says that I have to check the ...
11
votes
1answer
1k views

How can I selectively disable zsh's version control integration when my CWD is on a remote filesystem?

I'm running zsh on OSX and on occasion I have to work on a mounted sshfs volume. However, git is REALLY slow over sshfs mounts. My prompt makes use of the vc mode stuff that zsh provides built in, but ...
10
votes
3answers
20k views

How do I disable password prompts when doing git push/pull?

Every time I want to push and/or pull from the terminal (in Linux) I have to enter a password. How do I remove this so that it pulls and/or pushes without the password?
10
votes
2answers
13k views

Connecting to github using PuTTY generated SSH key in Windows 7

On an otherwise pristine Windows 7 Enterprise install: Install PuTTY 0.62 Create public/private key pair with puttygen.exe Add public key for pasting into OpenSSH authorized_keys to github account ...
10
votes
1answer
4k views

getting git colors in OSX terminal

I have just installed XCode and GitHub for Mac. I have successfully run "GitHub->Install Command Line Utility". I can connect to repositories with both apps and I can use the git command in the ...
10
votes
1answer
4k views

git: how can i config git to ignore file permissions changes

I have some git projects in a linux server. i use Mac and linux to do my programming. the problem is that the mac filesystem's permissions doesn't really work well like in linux so all the files ...
10
votes
3answers
1k views

How to track $HOME with git

I would like to track my $HOME dir with git. I've got many other git repos in other subdirs (eg $HOME/projects/repo_1 and so on), which shouldn't be tracked, since they already are. I have found ...
9
votes
2answers
4k views

Colors in git output?

I have seen some examples on people getting colors in git output. I tried the following guide http://scie.nti.st/2007/5/2/colors-in-git but unfortunately it didn't succeeded. Is there anything else ...
9
votes
2answers
4k views

How to have Sublime Text 2 show git folders and files in the sidebar?

When adding a folder to a Sublime Text 2 project, it doesn't seem to show .git subfolders. It also seems these files cannot be opened by Ctrl-P. I disabled the Git plugin but that didn't help.