Git is an open-source distributed version control system (DVCS). Use this tag for questions related to Git usage and workflows. DO NOT USE the [github] tag for Git-related issues simply because a repository happens to be hosted on GitHub. Also, do not use this tag for general programming questions that happen to involve a Git repository.
There is a file that was being tracked by Git, but now the file is on the .gitignore list.
However, that file keeps showing up in git status after it's edited. How do you force Git to completely ...
asked Aug 13 '09 at 19:23
Ivan
82.7k1515 gold badges4848 silver badges5757 bronze badges
How do I revert from my current state to a snapshot made on a certain commit?
If I do git log, then I get the following output:
$ git log
commit a867b4af366350be2e7c21b8de9cc6504678a61b`
Author: Me &...
asked Nov 6 '10 at 16:58
Crazy Serb
76.5k88 gold badges3333 silver badges4646 bronze badges
I accidentally dropped a DVD-rip into a website project, then carelessly git commit -a -m ..., and, zap, the repo was bloated by 2.2 gigs. Next time I made some edits, deleted the video file, and ...
asked Jan 20 '10 at 11:18
culebrón
29.5k1919 gold badges6767 silver badges100100 bronze badges
I accidentally committed the wrong files to Git, but didn't push the commit to the server yet.
How can I undo those commits from the local repository?
The only way seems to be to copy the edits in ...
I have a project that used to contain a submodule, at path mysubmodule. I installed the latest Git from source (1.8.3-rc2) and ran git submodule deinit mysubmodule. I then deleted the .gitmodules ...
asked May 15 '13 at 20:42
Chris B.
75.5k2323 gold badges9292 silver badges130130 bronze badges
In Git, I was trying to do a squash commit by merging in another branch and then resetting HEAD to the previous place via:
git reset origin/master
But I need to step out of this. How can I move HEAD ...
asked Dec 29 '15 at 21:53
timpone
17.6k3232 gold badges105105 silver badges202202 bronze badges
I want to resolve merge conflicts in my Git repository.
How can I do that?
asked Oct 2 '08 at 11:31
Spoike
115k4242 gold badges134134 silver badges157157 bronze badges
I have an already initialized Git repository that I added a .gitignore file to. How can I refresh the file index so the files I want ignored get ignored?
asked Jul 16 '09 at 19:26
trobrock
44.7k1111 gold badges3636 silver badges4444 bronze badges
I want to delete a branch both locally and remotely.
Failed Attempts to Delete a Remote Branch
$ git branch -d remotes/origin/bugfix
error: branch 'remotes/origin/bugfix' not found.
$ git branch -d ...
asked Jan 5 '10 at 1:12
Matthew Rankin
416k3838 gold badges117117 silver badges159159 bronze badges
I have a Git repository which contains a number of subdirectories. Now I have found that one of the subdirectories is unrelated to the other and should be detached to a separate repository.
How can I ...
asked Dec 11 '08 at 13:57
matli
26.6k66 gold badges3535 silver badges3737 bronze badges
I have my Git repository which, at the root, has two sub directories:
/finisht
/static
When this was in SVN, /finisht was checked out in one place, while /static was checked out elsewhere, like so:
...
asked Mar 1 '09 at 16:46
Nick Sergeant
30.7k1212 gold badges3535 silver badges4444 bronze badges
I was writing a simple script on the school computer, and committing the changes to Git (in a repo that was in my pen drive, cloned from my computer at home). After several commits, I realized I was ...
asked Apr 15 '09 at 3:09
Flávio Amieiro
37.1k88 gold badges3030 silver badges2424 bronze badges
I would like to put a Git project on GitHub but it contains certain files with sensitive data (usernames and passwords, like /config/deploy.rb for capistrano).
I know I can add these filenames to ....
asked May 16 '09 at 14:49
Stefan
8,34966 gold badges3535 silver badges4646 bronze badges
I ended up with a detached head today, the same problem as described in: git push says everything up-to-date even though I have local changes
As far as I know I didn't do anything out of the ordinary,...
asked Oct 19 '10 at 5:54
Adam Bergmark
6,83233 gold badges1919 silver badges2222 bronze badges
How can I add a blank directory (that contains no files) to a Git repository?
asked Sep 22 '08 at 16:41
Laurie Young
131k1313 gold badges4646 silver badges5454 bronze badges
Ok, after seeing this post by PJ Hyett, I have decided to skip to the end and go with Git.
So what I need is a beginner's practical guide to Git. "Beginner" being defined as someone who knows how to ...
How can I squash my last X commits together into one commit using Git?
asked Mar 4 '11 at 4:11
markdorison
121k2727 gold badges5252 silver badges6969 bronze badges
Long story short...
As far as I can tell, the term "branch" (in Git parlance) may refer to related but different things:
a non-symbolic reference/pointer to a commit,
the name of such a reference (e....
asked Jul 31 '14 at 20:41
jub0bs
50.4k2424 gold badges153153 silver badges162162 bronze badges
I recently switched to synchronizing my repositories to https:// on GitHub (due to firewall issues), and it asks for a password every time.
Is there a way to cache the credentials, instead of ...
asked Mar 17 '11 at 17:47
Zepplock
27.5k44 gold badges3333 silver badges4949 bronze badges
Most of the time when I try to checkout another existing branch, Git doesn't allow me if I have some uncommitted changes on the current branch. So I'll have to commit or stash those changes first.
...
asked Feb 26 '14 at 21:29
Xufeng
5,61266 gold badges2222 silver badges2828 bronze badges
I've started playing with Git and have come across the terms "upstream" and "downstream". I've seen these before but never understood them fully. What do these terms mean in the context of SCMs (...
asked Apr 29 '10 at 17:18
brendan
11.2k33 gold badges2424 silver badges2525 bronze badges
What are the differences between git pull and git fetch?
asked Nov 15 '08 at 9:51
pupeno
264k117117 gold badges335335 silver badges558558 bronze badges
Consider the following scenario:
I have developed a small experimental project A in its own Git repo. It has now matured, and I'd like A to be part of larger project B, which has its own big ...
asked Sep 15 '09 at 8:31
static_rtti
48.3k4545 gold badges128128 silver badges184184 bronze badges
I use tabs for indentation in my python programs, but I would like to collaborate (using git) with people who use spaces instead.
Is there a way for git to automatically convert between spaces and ...
I'm not clear on what the following means (from the Git submodule update documentation):
...will make the submodules HEAD be detached, unless --rebase or --merge is specified...
How does --rebase/-...
asked Dec 30 '09 at 9:02
deepblue
7,9661212 gold badges4545 silver badges5959 bronze badges
How does git submodule add -b work?
After adding a submodule with a specific branch, a new cloned repository (after git submodule update --init) will be at a specific commit, not the branch itself (...
asked Nov 22 '09 at 4:55
Ivan
82.7k1515 gold badges4848 silver badges5757 bronze badges
Looks like I have a missing tree error. Just to be fair, I did totally just mess up my local files on git and got fed up and did a complete hard disk delete on my repo and recloned from remote master. ...
I have the folder application/ which I add to the .gitignore. Inside the application/ folder is the folder application/language/gr. How can I include this folder?
I've tried this
application/
!...
asked Apr 3 '11 at 22:48
chchrist
16.5k1111 gold badges4141 silver badges7979 bronze badges
I have cloned a project that includes some .csproj files. I don't need/like my local csproj files being tracked by Git (or being brought up when creating a patch), but clearly they are needed in the ...
asked Jun 1 '09 at 19:08
Joshua Ball
21.9k66 gold badges2424 silver badges2626 bronze badges
I'm working with several repositories, but lately I was just working in our internal one and all was great.
Today I had to commit and push code into other one, but I'm having some troubles.
$ git ...
asked Mar 13 '13 at 9:20
balexandre
70.2k4444 gold badges222222 silver badges323323 bronze badges
I have local changes to a file that I don't want to commit to my repository. It is a configuration file for building the application on a server, but I want to build locally with different settings. ...
asked Nov 29 '12 at 17:00
ckb
5,93333 gold badges1414 silver badges1111 bronze badges
I'm not sure if this is something supported by Git, but in theory it seems like it should work to me.
My workflow often involves my editing of files in multiple branches simultaneously. In other ...
asked Jun 7 '11 at 18:53
jtolds
3,05133 gold badges1515 silver badges1414 bronze badges
I would like to know how to delete a commit.
By delete, I mean it is as if I didn't make that commit, and when I do a push in the future, my changes will not push to the remote branch.
I read git ...
asked Aug 27 '09 at 3:39
hap497
136k4343 gold badges7878 silver badges9191 bronze badges
I wrote the wrong thing in a commit message.
How can I change the message? The commit has not been pushed yet.
asked Oct 7 '08 at 15:44
Laurie Young
131k1313 gold badges4646 silver badges5454 bronze badges
How do I force an overwrite of local files on a git pull?
The scenario is the following:
A team member is modifying the templates for a website we are working on
They are adding some images to the ...
asked Jul 14 '09 at 14:58
Jakub Troszok
88.1k1010 gold badges3737 silver badges5050 bronze badges
The short: is there a way to have a git repo push to and pull from a list of remote repos (rather than a single "origin")?
The long: I often have a situation when I'm developing an app in multiple ...
asked May 11 '09 at 18:07
Zorzella
8,04133 gold badges1717 silver badges1010 bronze badges
How do I remove a Git submodule?
By the way, is there a reason I can't simply do
git submodule rm whatever ?
asked Aug 11 '09 at 14:31
I have the following repository layout:
master branch (production)
integration
working
What I want to achieve is to cherry-pick a range of commits from the working branch and merge it into the ...
asked Jan 3 '10 at 9:50
crazybyte
8,78355 gold badges2424 silver badges2121 bronze badges
I know how to make a new branch that tracks remote branches, but how do I make an existing branch track a remote branch?
I know I can just edit the .git/config file, but it seems there should be an ...
asked Feb 6 '09 at 15:14
Pat Notz
192k2929 gold badges8787 silver badges9292 bronze badges
I forked a project, applied several fixes and created a pull request which was accepted. A few days later, another change was made by another contributor. So my fork doesn't contain that change.
How ...
asked Aug 30 '11 at 13:53
Lea Hayes
58.3k1616 gold badges5555 silver badges106106 bronze badges
I am new to git and trying to wrap my head around the way branches work. According to the documentation git checkout
Updates files in the working tree to match the version in the index or the ...
asked Jun 24 '14 at 11:03
user3282276
3,18566 gold badges2525 silver badges4545 bronze badges
I have made some changes to a file which has been committed a few times as part of a group of files, but now want to reset/revert the changes on it back to a previous version.
I have done a git log ...
asked Oct 18 '08 at 23:34
Hates_
60.9k66 gold badges3030 silver badges3737 bronze badges
I accidentally committed an unwanted file (filename.orig while resolving a merge) to my repository several commits ago, without me noticing it until now. I want to completely delete the file from the ...
asked Nov 21 '08 at 4:11
Grant Limberg
19.8k1010 gold badges6060 silver badges8484 bronze badges
When is it recommended to use Git rebase vs. Git merge?
Do I still need to merge after a successful rebase?
asked Apr 29 '09 at 20:26
Coocoo4Cocoa
43.5k5050 gold badges148148 silver badges175175 bronze badges
The command git add [--all|-A] appears to be identical to git add .. Is this correct? If not, how do they differ?
asked Feb 21 '09 at 6:51
cmcginty
105k3939 gold badges153153 silver badges156156 bronze badges
I've seen some books and articles have some really pretty looking graphs of Git branches and commits. How can I make high-quality printable images of Git history?
asked Jun 29 '09 at 10:12
krosenvold
72k2929 gold badges143143 silver badges205205 bronze badges
I've been wondering whether there is a good "git export" solution that creates a copy of a tree without the .git repository directory. There are at least three methods I know of:
git clone ...
asked Oct 2 '08 at 2:21
Greg Hewgill
859k173173 gold badges11131113 silver badges12511251 bronze badges
Git has a well-known, or at least sort-of-well-known, empty tree whose SHA1 is:
4b825dc642cb6eb9a060e54bf8d69288fbee4904
(you can see this in any repo, even a newly created one, with git cat-file -t ...
asked Mar 19 '12 at 5:32
torek
360k4545 gold badges478478 silver badges610610 bronze badges
Within my master branch, I did a git merge some-other-branch locally, but never pushed the changes to origin master. I didn't mean to merge, so I'd like to undo it. When doing a git status after my ...
asked Mar 5 '10 at 19:24
Matt Huggins
76k3333 gold badges142142 silver badges216216 bronze badges
I have a repo (origin) on a USB key that I cloned on my hard drive (local). I moved "origin" to a NAS and successfully tested cloning it from here.
I would like to know if I can change the URI of "...
asked Mar 12 '10 at 12:48
e-satis
534k105105 gold badges287287 silver badges322322 bronze badges