Questions tagged [git]

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.

Git is an open source distributed version control system originally designed and written by Linus Torvalds. It has been designed with some of the following goals:

  • Speed. Multiple patches can be applied quickly even to large repositories.

  • Distributed development. Git can support developers who synchronize with a central shared repository, developers who share changes with each other directly, and everything in between.

  • Non-linear development. Git provides powerful branching and merging help, even across distributed repositories. Multiple merge strategies are employed to make merges as painless as possible.

Git is usually compared with Mercurial and the two share many features. They are the two most popular DVCS packages.

Related Super User questions

Related Stack Overflow questions

2679 questions
1106
votes
25 answers

How to tell git which private key to use?

ssh has the -i option to tell which private key file to use when authenticating: -i identity_fileSelects a file from which the identity (private key) for RSA or DSA authentication is read.  The default is ~/.ssh/identity for protocol…
jrdioko
  • 12,445
  • 5
  • 27
  • 26
307
votes
4 answers

How do I reset 'master' to 'origin/master'?

Can I do the following in a simpler way? git checkout origin/master git branch -D master git branch master git checkout master
Lenik
  • 17,942
  • 25
  • 87
  • 119
252
votes
11 answers

Can you GPG sign old commits?

Git now has the ability to sign commits with git commit -S, which is great, but sometimes I forget the flag to commit, and sometimes I mail myself patches which I apply with am, and that command doesn't have a flag for signing. Is there a way to…
Magnus
  • 4,146
  • 3
  • 22
  • 28
234
votes
5 answers

Pull 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 the same repository and to get changes into live we…
user27709
228
votes
7 answers

Change git init default branch name

I'm trying to figure out how to make git init use a different default branch name other than master for the first commit, but I can't find a git config for it or anything that'd allow me to do this (e.g. aliases only work for commands, not branch…
SoniEx2
  • 2,587
  • 3
  • 12
  • 14
211
votes
5 answers

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).
Anonymous
  • 2,541
  • 4
  • 23
  • 31
180
votes
13 answers

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 Git, namely set up the Git variables github.user and…
picardo
  • 2,527
  • 7
  • 26
  • 25
154
votes
10 answers

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 one? $ git log commit…
n179911
  • 3,613
  • 14
  • 39
  • 38
150
votes
3 answers

Git on Mac: How to set Nano as the default text editor?

When I'm using Git on Mac and need to do a rebase, the Vim editor kicks in by default. I would prefer Nano – could someone please explain how to reconfigure Git to make it use Nano for rebase?
Dimitri Vorontzov
147
votes
9 answers

how to avoid being asked "Enter passphrase for key " when I'm doing ssh operation on a remote host?

I'm ssh into a remote host (linux, fedora) and I want to do ssh operation(git with bitbucket) there. There is ssh-agent running on that machine, $ ps -e|grep sh-agent 2203 ? 00:00:00 ssh-agent but when I want to git, it requires me to enter…
lily
  • 1,735
  • 3
  • 14
  • 14
143
votes
6 answers

Is there a way to edit a commit message on GitHub?

Is there a way to edit a commit message after committing and pushing to GitHub? I see that there is a 'add a note' as well as inline commenting, but no actual editing of a commit message. There is also 'amend commit' in git extensions but that…
Matthew Peters
  • 1,808
  • 3
  • 13
  • 14
129
votes
5 answers

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?
Lenik
  • 17,942
  • 25
  • 87
  • 119
128
votes
8 answers

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 at work that I can only SSH into from machine…
PKKid
124
votes
6 answers

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.
Charles Roper
  • 10,599
  • 16
  • 56
  • 75
111
votes
1 answer

GIT merge master into a branch

I have been developing a new feature on a new branch, and on the side have committed quite a few changes on my master branch. Is it possible to merge the master branch into my new branch to keep it up-to-date so that I won't have too many merge…
mnml
  • 2,001
  • 4
  • 23
  • 28
1
2 3
99 100