QuestionId stringlengths 3 8 | QuestionTitle stringlengths 15 149 | QuestionScore int64 1 27.2k | QuestionCreatedUtc stringdate 2008-08-01 18:33:08 2025-06-16 04:59:48 | QuestionBodyHtml stringlengths 40 28.2k | QuestionViewCount int64 78 16.5M | QuestionOwnerUserId float64 4 25.2M ⌀ | QuestionLastActivityUtc stringdate 2008-09-08 19:26:01 2026-01-24 22:40:25 | AcceptedAnswerId int64 266 79.7M | AnswerScore int64 2 30.1k | AnswerCreatedUtc stringdate 2008-08-01 23:40:28 2025-06-16 05:23:39 | AnswerOwnerUserId float64 1 29.5M ⌀ | AnswerLastActivityUtc stringdate 2008-08-01 23:40:28 2026-01-23 17:46:09 | QuestionLink stringlengths 31 36 | AnswerLink stringlengths 31 36 | AnswerBodyHtml stringlengths 35 33k | AnswerBodyPreview stringlengths 35 400 | AllTagIdsCsv stringlengths 2 37 | AllTagNamesCsv stringlengths 2 106 | MergedQuestion stringlengths 74 28.4k | quality_filter stringclasses 10
values | unique_id int64 0 29k | tag_major_lang stringclasses 10
values | MergedQuestion_md stringlengths 60 28.1k | AnswerBodyHtml_md stringlengths 14 29.2k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
36794501 | Disable warning about detached HEAD | 100 | 2016-04-22 12:57:08 | <p>In git if you checkout a commit directly you get a big fat warning starting with:</p>
<pre><code>"You are in 'detached HEAD' state. You can look around ..."
</code></pre>
<p>It's fine - I intend to be in detached HEAD state. However I am using this in a script and I don't want this warning in the output logs but I... | 42,720 | 11,722 | 2022-10-19 19:18:09 | 36,794,768 | 93 | 2016-04-22 13:09:15 | 1,755,598 | 2016-04-22 13:20:53 | https://stackoverflow.com/q/36794501 | https://stackoverflow.com/a/36794768 | <p>You have the config for this task:</p>
<p>Set the desired message off by setting the config value to false:</p>
<pre><code># turn the detached message off
git config --global advice.detachedHead false
</code></pre>
<blockquote>
<p><strong><em><code>detachedHead</code></em></strong> </p>
<p>Advice shown wh... | <p>You have the config for this task:</p> <p>Set the desired message off by setting the config value to false:</p> <pre><code># turn the detached message off git config --global advice.detachedHead false </code></pre> <blockquote> <p><strong><em><code>detachedHead</code></em></strong> </p> <p>Advice shown wh... | 119, 1716, 15427 | detach, git, warnings | <h1>Disable warning about detached HEAD</h1>
<p>In git if you checkout a commit directly you get a big fat warning starting with:</p>
<pre><code>"You are in 'detached HEAD' state. You can look around ..."
</code></pre>
<p>It's fine - I intend to be in detached HEAD state. However I am using this in a script and I don... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,087 | git | # Disable warning about detached HEAD
In git if you checkout a commit directly you get a big fat warning starting with:
```
"You are in 'detached HEAD' state. You can look around ..."
```
It's fine - I intend to be in detached HEAD state. However I am using this in a script and I don't want this warning in the outpu... | You have the config for this task:
Set the desired message off by setting the config value to false:
```
# turn the detached message off
git config --global advice.detachedHead false
```
> ***`detachedHead`***
>
> Advice shown when you used git-checkout(1) to move to the detach HEAD state, to instruct how to create ... |
8783093 | .gitignore Syntax: bin vs bin/ vs. bin/* vs. bin/** | 100 | 2012-01-09 01:42:49 | <p>What's the difference between adding <code>bin</code>, <code>bin/</code>, <code>bin/*</code> and <code>bin/**</code> in my .gitignore file? I've been using <code>bin/</code>, but looking at <a href="https://github.com/github/gitignore/blob/master/Android.gitignore" rel="noreferrer">other</a> <a href="https://github.... | 33,818 | 487,894 | 2017-11-16 16:00:05 | 8,783,675 | 93 | 2012-01-09 03:40:48 | 130,535 | 2017-05-26 02:07:25 | https://stackoverflow.com/q/8783093 | https://stackoverflow.com/a/8783675 | <p><code>bin</code> matches any files <em>or</em> directories named 'bin'.</p>
<p><code>bin/</code> matches any <em>directories</em> named 'bin', which in effect means all of its contents since Git doesn't track directories alone.</p>
<p><code>bin/*</code> matches all files and directories directly in any <code>bin/<... | <p><code>bin</code> matches any files <em>or</em> directories named 'bin'.</p> <p><code>bin/</code> matches any <em>directories</em> named 'bin', which in effect means all of its contents since Git doesn't track directories alone.</p> <p><code>bin/*</code> matches all files and directories directly in any <code>bin/<... | 119 | git | <h1>.gitignore Syntax: bin vs bin/ vs. bin/* vs. bin/**</h1>
<p>What's the difference between adding <code>bin</code>, <code>bin/</code>, <code>bin/*</code> and <code>bin/**</code> in my .gitignore file? I've been using <code>bin/</code>, but looking at <a href="https://github.com/github/gitignore/blob/master/Android.g... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,088 | git | # .gitignore Syntax: bin vs bin/ vs. bin/* vs. bin/**
What's the difference between adding `bin`, `bin/`, `bin/*` and `bin/**` in my .gitignore file? I've been using `bin/`, but looking at [other](https://github.com/github/gitignore/blob/master/Android.gitignore) [.gitignore files](https://github.com/github/gitignore)... | `bin` matches any files *or* directories named 'bin'.
`bin/` matches any *directories* named 'bin', which in effect means all of its contents since Git doesn't track directories alone.
`bin/*` matches all files and directories directly in any `bin/`. This prevents Git automatically finding any files in its subdirecto... |
11265463 | Reset git proxy to default configuration | 89 | 2012-06-29 16:21:21 | <p>I installed Socat to use the Git Protocol Through a HTTP CONNECT Proxy, then I create a script called <code>gitproxy</code> in your bin directory.</p>
<pre><code>#!/bin/sh
# Use socat to proxy git through an HTTP CONNECT firewall.
# Useful if you are trying to clone git:// from inside a company.
# Requires that the... | 155,637 | 1,491,645 | 2021-06-08 14:43:12 | 11,265,487 | 93 | 2012-06-29 16:22:45 | 223,092 | 2012-06-29 16:22:45 | https://stackoverflow.com/q/11265463 | https://stackoverflow.com/a/11265487 | <p>You can remove that configuration with:</p>
<pre><code>git config --global --unset core.gitproxy
</code></pre>
| <p>You can remove that configuration with:</p> <pre><code>git config --global --unset core.gitproxy </code></pre> | 119 | git | <h1>Reset git proxy to default configuration</h1>
<p>I installed Socat to use the Git Protocol Through a HTTP CONNECT Proxy, then I create a script called <code>gitproxy</code> in your bin directory.</p>
<pre><code>#!/bin/sh
# Use socat to proxy git through an HTTP CONNECT firewall.
# Useful if you are trying to clone... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,089 | git | # Reset git proxy to default configuration
I installed Socat to use the Git Protocol Through a HTTP CONNECT Proxy, then I create a script called `gitproxy` in your bin directory.
```
#!/bin/sh
# Use socat to proxy git through an HTTP CONNECT firewall.
# Useful if you are trying to clone git:// from inside a company.
... | You can remove that configuration with:
```
git config --global --unset core.gitproxy
``` |
71951105 | How to change current branch in git from master to main | 53 | 2022-04-21 08:20:49 | <p>It is common to change main branches from the old pattern <code>master</code> to <code>main</code>. This can be easily done remotely (GitHub offers a graphical way to do it), but... what should be done with working copies?</p>
| 120,421 | 1,225,007 | 2025-08-03 18:23:05 | 71,951,106 | 93 | 2022-04-21 08:20:49 | 1,225,007 | 2025-01-31 12:57:54 | https://stackoverflow.com/q/71951105 | https://stackoverflow.com/a/71951106 | <ol>
<li><p>rename your local branch:</p>
<pre><code>git branch -m master main
</code></pre>
</li>
<li><p>change the tracked branch</p>
<pre><code>git fetch -p origin
git branch -u origin/master main
</code></pre>
</li>
<li><p>change the main local branch</p>
<pre><code>git remote set-head origin -a
</code></pre>
</li>... | <ol> <li><p>rename your local branch:</p> <pre><code>git branch -m master main </code></pre> </li> <li><p>change the tracked branch</p> <pre><code>git fetch -p origin git branch -u origin/master main </code></pre> </li> <li><p>change the main local branch</p> <pre><code>git remote set-head origin -a </code></pre> </li>... | 119, 53847 | branching-and-merging, git | <h1>How to change current branch in git from master to main</h1>
<p>It is common to change main branches from the old pattern <code>master</code> to <code>main</code>. This can be easily done remotely (GitHub offers a graphical way to do it), but... what should be done with working copies?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,090 | git | # How to change current branch in git from master to main
It is common to change main branches from the old pattern `master` to `main`. This can be easily done remotely (GitHub offers a graphical way to do it), but... what should be done with working copies? | 1. rename your local branch:
```
git branch -m master main
```
2. change the tracked branch
```
git fetch -p origin
git branch -u origin/master main
```
3. change the main local branch
```
git remote set-head origin -a
```
4. optionally, remove the master branch, local and remotely:
... |
23151339 | Set UTF-8 display for Git GUI differences window | 50 | 2014-04-18 09:32:19 | <p>I can't remember how I made Git GUI to display UTF-8 encoded differences correctly. Also I can't find the guide in search engines.</p>
<p>Now I need to do this at new workplace. Could you write down instructions?</p>
<p>OS: Windows 7</p>
| 28,246 | 999,355 | 2021-09-25 19:57:16 | 24,320,398 | 93 | 2014-06-20 05:16:36 | 375,063 | 2014-06-20 05:16:36 | https://stackoverflow.com/q/23151339 | https://stackoverflow.com/a/24320398 | <pre><code># Global setting for all you repositories
> git config --global gui.encoding utf-8
# For one repository only
> git config gui.encoding utf-8
</code></pre>
<p>Or from the GUI window:</p>
<p>Edit -> Options... -> Default File Contents Encoding -> Change</p>
<p>and select "Unicode (UTF-8)"</p>
<p>In ... | <pre><code># Global setting for all you repositories > git config --global gui.encoding utf-8 # For one repository only > git config gui.encoding utf-8 </code></pre> <p>Or from the GUI window:</p> <p>Edit -> Options... -> Default File Contents Encoding -> Change</p> <p>and select "Unicode (UTF-8)"</p> <p>In ... | 119, 606, 8944, 9033, 33729 | diff, git, git-diff, git-gui, utf-8 | <h1>Set UTF-8 display for Git GUI differences window</h1>
<p>I can't remember how I made Git GUI to display UTF-8 encoded differences correctly. Also I can't find the guide in search engines.</p>
<p>Now I need to do this at new workplace. Could you write down instructions?</p>
<p>OS: Windows 7</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,091 | git | # Set UTF-8 display for Git GUI differences window
I can't remember how I made Git GUI to display UTF-8 encoded differences correctly. Also I can't find the guide in search engines.
Now I need to do this at new workplace. Could you write down instructions?
OS: Windows 7 | ```
# Global setting for all you repositories
> git config --global gui.encoding utf-8
# For one repository only
> git config gui.encoding utf-8
```
Or from the GUI window:
Edit -> Options... -> Default File Contents Encoding -> Change
and select "Unicode (UTF-8)"
In the Options, you'll see that there are two pane... |
22339837 | Linux command to delete all files except .git folder? | 49 | 2014-03-12 00:53:35 | <p>I want to <strong>delete all of the current directory's content <em>except</em> for the <code>.git/</code> folder</strong> before I copy the new files into the branch. </p>
<p>What's the linux command for that?</p>
| 18,297 | 682,288 | 2022-09-12 04:57:10 | 22,347,541 | 93 | 2014-03-12 09:47:28 | 19,563 | 2014-03-12 09:47:28 | https://stackoverflow.com/q/22339837 | https://stackoverflow.com/a/22347541 | <p>Resetting the index is cheap, so</p>
<pre><code>git rm -rf .
git clean -fxd
</code></pre>
<p>Then you can reset the index (with <code>git reset</code>) or go straight on to checking out a new branch.</p>
| <p>Resetting the index is cheap, so</p> <pre><code>git rm -rf . git clean -fxd </code></pre> <p>Then you can reset the index (with <code>git reset</code>) or go straight on to checking out a new branch.</p> | 58, 119 | git, linux | <h1>Linux command to delete all files except .git folder?</h1>
<p>I want to <strong>delete all of the current directory's content <em>except</em> for the <code>.git/</code> folder</strong> before I copy the new files into the branch. </p>
<p>What's the linux command for that?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,092 | git | # Linux command to delete all files except .git folder?
I want to **delete all of the current directory's content *except* for the `.git/` folder** before I copy the new files into the branch.
What's the linux command for that? | Resetting the index is cheap, so
```
git rm -rf .
git clean -fxd
```
Then you can reset the index (with `git reset`) or go straight on to checking out a new branch. |
31463025 | Why does git merge a branch into itself? | 45 | 2015-07-16 19:35:53 | <p>I awoke this morning and looked at the commit history of one of my dev team's private repositories on BitBucket. I saw this:</p>
<blockquote>
<p><strong>Anonymous</strong> committed <strong>fcde879 <code>MERGE</code></strong></p>
<p>Merge branch 'develop' of <a href="https://bitbucket.org/abc/xyz">https://bi... | 25,404 | 2,103,394 | 2019-05-31 20:51:54 | 31,463,565 | 93 | 2015-07-16 20:06:35 | 390,819 | 2019-05-31 20:51:54 | https://stackoverflow.com/q/31463025 | https://stackoverflow.com/a/31463565 | <p>This scenario is not unusual.</p>
<p>The key here is that the branches being merged are different: it's the remote repository's <code>develop</code> branch being merged into the developer's local (working) <code>develop</code> branch.</p>
<p>In the developer's local repository there are two distinct branches:</p>
... | <p>This scenario is not unusual.</p> <p>The key here is that the branches being merged are different: it's the remote repository's <code>develop</code> branch being merged into the developer's local (working) <code>develop</code> branch.</p> <p>In the developer's local repository there are two distinct branches:</p> ... | 119, 456, 717, 53847 | branching-and-merging, git, merge, version-control | <h1>Why does git merge a branch into itself?</h1>
<p>I awoke this morning and looked at the commit history of one of my dev team's private repositories on BitBucket. I saw this:</p>
<blockquote>
<p><strong>Anonymous</strong> committed <strong>fcde879 <code>MERGE</code></strong></p>
<p>Merge branch 'develop' of ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,094 | git | # Why does git merge a branch into itself?
I awoke this morning and looked at the commit history of one of my dev team's private repositories on BitBucket. I saw this:
> **Anonymous** committed **fcde879 `MERGE`**
>
> Merge branch 'develop' of <https://bitbucket.org/abc/xyz> into develop
This is, uh, somewhat unusua... | This scenario is not unusual.
The key here is that the branches being merged are different: it's the remote repository's `develop` branch being merged into the developer's local (working) `develop` branch.
In the developer's local repository there are two distinct branches:
- `develop` = The branch he/she is current... |
51757837 | Visual studio 2017 with bitbucket, terminal prompts disabled | 43 | 2018-08-09 02:00:53 | <p>The visual studio stopped sending my commits to the bitbucket and this error appears </p>
<blockquote>
<p>Error encountered while cloning the remote repository: Git failed with a fatal error.
HttpRequestException encountered.
There was an error submitting the request.
can not spawn </p>
<p>C / Prog... | 32,520 | 10,200,626 | 2020-04-17 08:53:29 | 51,759,257 | 93 | 2018-08-09 05:11:25 | 555,977 | 2020-04-17 08:53:29 | https://stackoverflow.com/q/51757837 | https://stackoverflow.com/a/51759257 | <p>I had the same issue, I found an answer that worked for me here:
<a href="https://github.com/github/VisualStudio/issues/949" rel="nofollow noreferrer">https://github.com/github/VisualStudio/issues/949</a></p>
<p>Below are the steps mentioned to fix:
It seems that the bundled Git-Credential-Manager-for-Windows/ in V... | <p>I had the same issue, I found an answer that worked for me here: <a href="https://github.com/github/VisualStudio/issues/949" rel="nofollow noreferrer">https://github.com/github/VisualStudio/issues/949</a></p> <p>Below are the steps mentioned to fix: It seems that the bundled Git-Credential-Manager-for-Windows/ in V... | 119, 34099, 123095, 132586 | git, git-clone, git-credential-manager, visual-studio-2017 | <h1>Visual studio 2017 with bitbucket, terminal prompts disabled</h1>
<p>The visual studio stopped sending my commits to the bitbucket and this error appears </p>
<blockquote>
<p>Error encountered while cloning the remote repository: Git failed with a fatal error.
HttpRequestException encountered.
There was a... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,095 | git | # Visual studio 2017 with bitbucket, terminal prompts disabled
The visual studio stopped sending my commits to the bitbucket and this error appears
> Error encountered while cloning the remote repository: Git failed with a fatal error.
> HttpRequestException encountered.
> There was an error submitting the request.
>... | I had the same issue, I found an answer that worked for me here:
<https://github.com/github/VisualStudio/issues/949>
Below are the steps mentioned to fix:
It seems that the bundled Git-Credential-Manager-for-Windows/ in VIsual Studio 2017 is not the latest release. Downloading the latest release and putting it on top ... |
2712421 | R and version control for the solo data analyst | 164 | 2010-04-26 09:46:43 | <p>Many data analysts that I respect use version control.
For example: </p>
<ul>
<li><a href="http://github.com/hadley/" rel="noreferrer">http://github.com/hadley/</a></li>
<li>See comments on <a href="http://permut.wordpress.com/2010/04/21/revision-control-statistics-bleg/" rel="noreferrer">http://permut.wordpress.co... | 46,233 | 180,892 | 2021-12-04 05:18:56 | 2,715,569 | 92 | 2010-04-26 17:40:50 | 135,870 | 2011-03-16 00:29:17 | https://stackoverflow.com/q/2712421 | https://stackoverflow.com/a/2715569 | <p>I feel the answer to your question is a resounding yes- the benefits of managing your files with a version control system far outweigh the costs of implementing such a system.</p>
<p>I will try to respond in detail to some of the points you raised:</p>
<blockquote>
<ul>
<li><strong>Backup:</strong> I have a ba... | <p>I feel the answer to your question is a resounding yes- the benefits of managing your files with a version control system far outweigh the costs of implementing such a system.</p> <p>I will try to respond in detail to some of the points you raised:</p> <blockquote> <ul> <li><strong>Backup:</strong> I have a ba... | 119, 456, 4452 | git, r, version-control | <h1>R and version control for the solo data analyst</h1>
<p>Many data analysts that I respect use version control.
For example: </p>
<ul>
<li><a href="http://github.com/hadley/" rel="noreferrer">http://github.com/hadley/</a></li>
<li>See comments on <a href="http://permut.wordpress.com/2010/04/21/revision-control-stat... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,097 | git | # R and version control for the solo data analyst
Many data analysts that I respect use version control.
For example:
- <http://github.com/hadley/>
- See comments on <http://permut.wordpress.com/2010/04/21/revision-control-statistics-bleg/>
However, I'm evaluating whether adopting a version control system such as gi... | I feel the answer to your question is a resounding yes- the benefits of managing your files with a version control system far outweigh the costs of implementing such a system.
I will try to respond in detail to some of the points you raised:
> - **Backup:** I have a backup system already in place.
Yes, and so do I. ... |
5361019 | Viewing full version tree in git | 161 | 2011-03-19 08:32:01 | <p>I am using the command line version of Git and gitk. I want to see the full version tree, not just the part that is reachable from the currently checked out version. Is it possible?</p>
| 168,330 | 294,813 | 2025-05-15 10:40:53 | 5,361,023 | 92 | 2011-03-19 08:34:11 | 223,092 | 2011-03-19 08:41:41 | https://stackoverflow.com/q/5361019 | https://stackoverflow.com/a/5361023 | <p>You can try the following:</p>
<pre><code>gitk --all
</code></pre>
<p>You can tell <code>gitk</code> what to display using anything that <a href="http://www.kernel.org/pub/software/scm/git/docs/git-rev-list.html" rel="noreferrer"><code>git rev-list</code> understands</a>, so if you just want a few branches, you ca... | <p>You can try the following:</p> <pre><code>gitk --all </code></pre> <p>You can tell <code>gitk</code> what to display using anything that <a href="http://www.kernel.org/pub/software/scm/git/docs/git-rev-list.html" rel="noreferrer"><code>git rev-list</code> understands</a>, so if you just want a few branches, you ca... | 119, 30785 | git, gitk | <h1>Viewing full version tree in git</h1>
<p>I am using the command line version of Git and gitk. I want to see the full version tree, not just the part that is reachable from the currently checked out version. Is it possible?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,098 | git | # Viewing full version tree in git
I am using the command line version of Git and gitk. I want to see the full version tree, not just the part that is reachable from the currently checked out version. Is it possible? | You can try the following:
```
gitk --all
```
You can tell `gitk` what to display using anything that [`git rev-list` understands](http://www.kernel.org/pub/software/scm/git/docs/git-rev-list.html), so if you just want a few branches, you can do:
```
gitk master origin/master origin/experiment
```
... or more exoti... |
3623755 | Why does my 'git branch' have no master? | 119 | 2010-09-02 04:08:38 | <p>I'm a git newbie and I keep reading about a "master" branch. Is "master" just a conventional name that people used or does it have special meaning like <code>HEAD</code>?</p>
<p>When I do <code>git branch</code> on the clone that I have, I only see 1 single branch - the one I'm on. No "master" at all. If I type <co... | 258,067 | 124,111 | 2023-03-09 07:52:10 | 3,623,762 | 92 | 2010-09-02 04:10:51 | 148,870 | 2010-09-02 04:10:51 | https://stackoverflow.com/q/3623755 | https://stackoverflow.com/a/3623762 | <p>Most Git repositories use <code>master</code> as the main (and default) branch - if you initialize a new Git repo via <code>git init</code>, it will have <code>master</code> checked out by default.</p>
<p>However, if you clone a repository, the default branch you have is whatever the remote's <code>HEAD</code> poin... | <p>Most Git repositories use <code>master</code> as the main (and default) branch - if you initialize a new Git repo via <code>git init</code>, it will have <code>master</code> checked out by default.</p> <p>However, if you clone a repository, the default branch you have is whatever the remote's <code>HEAD</code> poin... | 119 | git | <h1>Why does my 'git branch' have no master?</h1>
<p>I'm a git newbie and I keep reading about a "master" branch. Is "master" just a conventional name that people used or does it have special meaning like <code>HEAD</code>?</p>
<p>When I do <code>git branch</code> on the clone that I have, I only see 1 single branch -... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,099 | git | # Why does my 'git branch' have no master?
I'm a git newbie and I keep reading about a "master" branch. Is "master" just a conventional name that people used or does it have special meaning like `HEAD`?
When I do `git branch` on the clone that I have, I only see 1 single branch - the one I'm on. No "master" at all. I... | Most Git repositories use `master` as the main (and default) branch - if you initialize a new Git repo via `git init`, it will have `master` checked out by default.
However, if you clone a repository, the default branch you have is whatever the remote's `HEAD` points to (`HEAD` is actually a *symbolic ref* that points... |
12956509 | How to set Meld as git mergetool | 117 | 2012-10-18 14:02:47 | <p>I've set:</p>
<pre><code>git config --global merge.tool meld
git config --global mergetool.meld.path c:/Progra~2/meld/bin/
</code></pre>
<p>On "git mergetool" it writes:</p>
<pre><code>Hit return to start merge resolution tool (meld):
The merge tool meld is not available as 'c:/Progra~2/meld/bin/'
</code></pre>
... | 154,524 | 999,355 | 2022-02-21 05:00:43 | 12,957,641 | 92 | 2012-10-18 14:57:45 | 6,309 | 2019-03-08 10:29:19 | https://stackoverflow.com/q/12956509 | https://stackoverflow.com/a/12957641 | <p>You could use complete unix paths like:</p>
<pre><code>PATH=$PATH:/c/python26
git config --global merge.tool meld
git config --global mergetool.meld.path /c/Program files (x86)/meld/bin/meld
</code></pre>
<p>This is what is described in "<a href="http://blog.nerdbank.net/2011/10/how-to-get-meld-working-with-git-on... | <p>You could use complete unix paths like:</p> <pre><code>PATH=$PATH:/c/python26 git config --global merge.tool meld git config --global mergetool.meld.path /c/Program files (x86)/meld/bin/meld </code></pre> <p>This is what is described in "<a href="http://blog.nerdbank.net/2011/10/how-to-get-meld-working-with-git-on... | 13630, 28897 | git-merge, meld | <h1>How to set Meld as git mergetool</h1>
<p>I've set:</p>
<pre><code>git config --global merge.tool meld
git config --global mergetool.meld.path c:/Progra~2/meld/bin/
</code></pre>
<p>On "git mergetool" it writes:</p>
<pre><code>Hit return to start merge resolution tool (meld):
The merge tool meld is not available ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,100 | git | # How to set Meld as git mergetool
I've set:
```
git config --global merge.tool meld
git config --global mergetool.meld.path c:/Progra~2/meld/bin/
```
On "git mergetool" it writes:
```
Hit return to start merge resolution tool (meld):
The merge tool meld is not available as 'c:/Progra~2/meld/bin/'
```
I have tried... | You could use complete unix paths like:
```
PATH=$PATH:/c/python26
git config --global merge.tool meld
git config --global mergetool.meld.path /c/Program files (x86)/meld/bin/meld
```
This is what is described in "[How to get meld working with git on Windows](http://blog.nerdbank.net/2011/10/how-to-get-meld-working-w... |
6248231 | git rebase after previous git merge | 107 | 2011-06-06 05:54:23 | <p>I have the following situation:</p>
<ul>
<li>I created a <code>clone</code>(Y) from a main repository(X), because there were many people working on Y we didn't do any <code>rebase</code> but only <code>merge</code>s. When we want to deliver(<code>push</code>) Y to X we would like to do a <code>rebase</code> in orde... | 83,587 | 13,136 | 2023-11-16 16:46:23 | 6,258,664 | 92 | 2011-06-06 22:16:33 | 389,146 | 2011-06-06 22:16:33 | https://stackoverflow.com/q/6248231 | https://stackoverflow.com/a/6258664 | <p>Rebasing to get a "clean" history is overrated. The best way if you want to preserve history is just to do the merge instead of a rebase. That way if you ever need to go back to a revision, it is <em>exactly</em> the same as the one you tested during development. That also solves your issue about the previously s... | <p>Rebasing to get a "clean" history is overrated. The best way if you want to preserve history is just to do the merge instead of a rebase. That way if you ever need to go back to a revision, it is <em>exactly</em> the same as the one you tested during development. That also solves your issue about the previously s... | 119, 717, 8974, 29934 | git, git-rebase, merge, rebase | <h1>git rebase after previous git merge</h1>
<p>I have the following situation:</p>
<ul>
<li>I created a <code>clone</code>(Y) from a main repository(X), because there were many people working on Y we didn't do any <code>rebase</code> but only <code>merge</code>s. When we want to deliver(<code>push</code>) Y to X we w... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,102 | git | # git rebase after previous git merge
I have the following situation:
- I created a `clone`(Y) from a main repository(X), because there were many people working on Y we didn't do any `rebase` but only `merge`s. When we want to deliver(`push`) Y to X we would like to do a `rebase` in order to have things nice and clea... | Rebasing to get a "clean" history is overrated. The best way if you want to preserve history is just to do the merge instead of a rebase. That way if you ever need to go back to a revision, it is *exactly* the same as the one you tested during development. That also solves your issue about the previously solved merge c... |
801577 | How to recover Git objects damaged by hard disk failure? | 104 | 2009-04-29 09:21:03 | <p>I have had a hard disk failure which resulted in some files of a Git repository getting damaged. When running <code>git fsck --full</code> I get the following output:</p>
<pre><code>error: .git/objects/pack/pack-6863e0a0e4b4ded6090fac5d12eba6ca7346b19c.pack SHA1 checksum mismatch
error: index CRC mismatch for objec... | 112,885 | 54,193 | 2021-08-31 01:41:45 | 802,297 | 92 | 2009-04-29 13:09:54 | 16,135 | 2013-05-30 22:04:39 | https://stackoverflow.com/q/801577 | https://stackoverflow.com/a/802297 | <p>In some previous backups, your bad objects may have been packed in different files or may be loose objects yet. So your objects may be recovered.</p>
<p>It seems there are a few bad objects in your database. So you could do it the manual way.</p>
<p>Because of <code>git hash-object</code>, <code>git mktree</code> ... | <p>In some previous backups, your bad objects may have been packed in different files or may be loose objects yet. So your objects may be recovered.</p> <p>It seems there are a few bad objects in your database. So you could do it the manual way.</p> <p>Because of <code>git hash-object</code>, <code>git mktree</code> ... | 119, 10816, 11782 | corruption, data-recovery, git | <h1>How to recover Git objects damaged by hard disk failure?</h1>
<p>I have had a hard disk failure which resulted in some files of a Git repository getting damaged. When running <code>git fsck --full</code> I get the following output:</p>
<pre><code>error: .git/objects/pack/pack-6863e0a0e4b4ded6090fac5d12eba6ca7346b1... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,103 | git | # How to recover Git objects damaged by hard disk failure?
I have had a hard disk failure which resulted in some files of a Git repository getting damaged. When running `git fsck --full` I get the following output:
```
error: .git/objects/pack/pack-6863e0a0e4b4ded6090fac5d12eba6ca7346b19c.pack SHA1 checksum mismatch
... | In some previous backups, your bad objects may have been packed in different files or may be loose objects yet. So your objects may be recovered.
It seems there are a few bad objects in your database. So you could do it the manual way.
Because of `git hash-object`, `git mktree` and `git commit-tree` do not write the ... |
23725925 | Git repository corrupt (incorrect header check; loose object is corrupt) | 101 | 2014-05-18 19:22:28 | <p>I experienced a power failure yesterday evening while writing a commit message. When I booted the machine back up I couldn't complete the commit. I ran <code>git reset</code>, added back the changed files, and tried again, and got this:</p>
<pre><code>% git commit
error: inflate: data stream error (incorrect header ... | 118,384 | 3,650,362 | 2024-12-20 18:42:06 | 23,749,070 | 92 | 2014-05-20 00:11:05 | 3,650,362 | 2017-09-28 13:41:23 | https://stackoverflow.com/q/23725925 | https://stackoverflow.com/a/23749070 | <p>It appears that git created files in .git/objects for the new commit, but didn't successfully write to them. I solved it by deleting them one at a time and re-running <code>git fsck --full</code> to find the next one. I started with the one originally reported by <code>git fsck</code>:</p>
<pre><code>% rm -f .git/o... | <p>It appears that git created files in .git/objects for the new commit, but didn't successfully write to them. I solved it by deleting them one at a time and re-running <code>git fsck --full</code> to find the next one. I started with the one originally reported by <code>git fsck</code>:</p> <pre><code>% rm -f .git/o... | 119, 4774 | corrupt, git | <h1>Git repository corrupt (incorrect header check; loose object is corrupt)</h1>
<p>I experienced a power failure yesterday evening while writing a commit message. When I booted the machine back up I couldn't complete the commit. I ran <code>git reset</code>, added back the changed files, and tried again, and got this... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,104 | git | # Git repository corrupt (incorrect header check; loose object is corrupt)
I experienced a power failure yesterday evening while writing a commit message. When I booted the machine back up I couldn't complete the commit. I ran `git reset`, added back the changed files, and tried again, and got this:
```
% git commit
... | It appears that git created files in .git/objects for the new commit, but didn't successfully write to them. I solved it by deleting them one at a time and re-running `git fsck --full` to find the next one. I started with the one originally reported by `git fsck`:
```
% rm -f .git/objects/43/46883490a0990e68db0187241a... |
15797183 | Differences between "git pull" commands when pulling from origin? | 97 | 2013-04-03 20:14:43 | <p>What are the differences between these commands?:</p>
<pre class="lang-bash prettyprint-override"><code># 1
git pull
# 2
git pull origin
# 3
git pull origin master
# 4
git pull origin/master
# 5
git pull origin HEAD:master
</code></pre>
| 39,145 | 2,146,348 | 2019-10-18 12:35:51 | 15,799,537 | 92 | 2013-04-03 22:43:06 | 1,870,481 | 2013-04-03 22:43:06 | https://stackoverflow.com/q/15797183 | https://stackoverflow.com/a/15799537 | <p><code>git pull</code> is a convenience command, which is doing different things at the same time. Basically it is just a combination of <code>git fetch</code>, which connects to the remote repository and fetches new commits, and <code>git merge</code> (or <code>git rebase</code>) which incorporates the new commits i... | <p><code>git pull</code> is a convenience command, which is doing different things at the same time. Basically it is just a combination of <code>git fetch</code>, which connects to the remote repository and fetches new commits, and <code>git merge</code> (or <code>git rebase</code>) which incorporates the new commits i... | 119 | git | <h1>Differences between "git pull" commands when pulling from origin?</h1>
<p>What are the differences between these commands?:</p>
<pre class="lang-bash prettyprint-override"><code># 1
git pull
# 2
git pull origin
# 3
git pull origin master
# 4
git pull origin/master
# 5
git pull origin HEAD:master
</code></pre>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,105 | git | # Differences between "git pull" commands when pulling from origin?
What are the differences between these commands?:
```
# 1
git pull
# 2
git pull origin
# 3
git pull origin master
# 4
git pull origin/master
# 5
git pull origin HEAD:master
``` | `git pull` is a convenience command, which is doing different things at the same time. Basically it is just a combination of `git fetch`, which connects to the remote repository and fetches new commits, and `git merge` (or `git rebase`) which incorporates the new commits into your local branch. Because of the two diffe... |
8124411 | Change Git stash message | 96 | 2011-11-14 16:08:33 | <p>I have a stash saved for the future that I want to give a meaningful name. While it's possible to pass a message as argument to <code>git stash save</code>, is there a way to add a message to an existing stash?</p>
| 31,107 | 11,343 | 2014-10-28 08:58:07 | 8,125,440 | 92 | 2011-11-14 17:20:15 | 355,789 | 2011-11-14 17:20:15 | https://stackoverflow.com/q/8124411 | https://stackoverflow.com/a/8125440 | <p>You can directly edit the messages stored in <code>.git/logs/refs/stash</code>.</p>
<p>I know it's probably not ideal, but should work anyway.</p>
| <p>You can directly edit the messages stored in <code>.git/logs/refs/stash</code>.</p> <p>I know it's probably not ideal, but should work anyway.</p> | 119, 13091 | git, git-stash | <h1>Change Git stash message</h1>
<p>I have a stash saved for the future that I want to give a meaningful name. While it's possible to pass a message as argument to <code>git stash save</code>, is there a way to add a message to an existing stash?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,106 | git | # Change Git stash message
I have a stash saved for the future that I want to give a meaningful name. While it's possible to pass a message as argument to `git stash save`, is there a way to add a message to an existing stash? | You can directly edit the messages stored in `.git/logs/refs/stash`.
I know it's probably not ideal, but should work anyway. |
26784396 | Git log graph, display how two branches are diverging | 73 | 2014-11-06 16:25:49 | <p>We would like to view a graph of how two branches are diverging. Running <code>git log --oneline --graph</code> displays only the current branch. How do we include both branches in the graph?</p>
| 29,366 | 1,108,891 | 2024-08-19 03:05:25 | 26,784,584 | 92 | 2014-11-06 16:35:04 | 1,126,841 | 2014-11-06 16:35:04 | https://stackoverflow.com/q/26784396 | https://stackoverflow.com/a/26784584 | <p><code>git log</code> takes zero or more commits as arguments, showing the history leading up to that commit. When no argument is given, <code>HEAD</code> is assumed. For your case, you want to supply the two branch heads you want to compare:</p>
<pre><code>git log --graph --oneline currentbranch otherbranch
</code>... | <p><code>git log</code> takes zero or more commits as arguments, showing the history leading up to that commit. When no argument is given, <code>HEAD</code> is assumed. For your case, you want to supply the two branch heads you want to compare:</p> <pre><code>git log --graph --oneline currentbranch otherbranch </code>... | 119 | git | <h1>Git log graph, display how two branches are diverging</h1>
<p>We would like to view a graph of how two branches are diverging. Running <code>git log --oneline --graph</code> displays only the current branch. How do we include both branches in the graph?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,109 | git | # Git log graph, display how two branches are diverging
We would like to view a graph of how two branches are diverging. Running `git log --oneline --graph` displays only the current branch. How do we include both branches in the graph? | `git log` takes zero or more commits as arguments, showing the history leading up to that commit. When no argument is given, `HEAD` is assumed. For your case, you want to supply the two branch heads you want to compare:
```
git log --graph --oneline currentbranch otherbranch
```
If it doesn't display too much, you ca... |
9078820 | How to create patch between two tags with multiple commits between them? | 72 | 2012-01-31 11:34:16 | <p>I have two tags in my git in same branch. There are at least 5-6 commits between them. How can I create a single patch between the two tags so that it can be applied to a GitHub repo?</p>
| 63,060 | 637,976 | 2023-04-19 03:31:58 | 9,079,053 | 92 | 2012-01-31 11:51:31 | 252,384 | 2012-01-31 12:08:27 | https://stackoverflow.com/q/9078820 | https://stackoverflow.com/a/9079053 | <p>You can create a single diff (patch) between two tags using the following</p>
<pre><code>$ git diff tag1 tag2 -- > the-patch.diff
</code></pre>
<p>Replace <code>tag1</code> and <code>tag2</code> to the tags you want.</p>
| <p>You can create a single diff (patch) between two tags using the following</p> <pre><code>$ git diff tag1 tag2 -- > the-patch.diff </code></pre> <p>Replace <code>tag1</code> and <code>tag2</code> to the tags you want.</p> | 119, 2132 | git, patch | <h1>How to create patch between two tags with multiple commits between them?</h1>
<p>I have two tags in my git in same branch. There are at least 5-6 commits between them. How can I create a single patch between the two tags so that it can be applied to a GitHub repo?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,111 | git | # How to create patch between two tags with multiple commits between them?
I have two tags in my git in same branch. There are at least 5-6 commits between them. How can I create a single patch between the two tags so that it can be applied to a GitHub repo? | You can create a single diff (patch) between two tags using the following
```
$ git diff tag1 tag2 -- > the-patch.diff
```
Replace `tag1` and `tag2` to the tags you want. |
5977234 | How can I push a part of my git repo to Heroku? | 68 | 2011-05-12 11:27:00 | <p>I have a multi-module app that is already on Github. It is comprised of two modules, one of them an Android app and the other a Rails based Web app. So my project's directory structure is in the form of:</p>
<pre><code>ProjectRoot
|
+-- web
|
+-- android
|
+-- .git
</code></pre>
<p>As such I cannot simply <code>cd... | 21,088 | 309,683 | 2024-05-29 11:18:08 | 5,977,494 | 92 | 2011-05-12 11:49:28 | 188,760 | 2019-03-30 09:51:40 | https://stackoverflow.com/q/5977234 | https://stackoverflow.com/a/5977494 | <p>You can use <code>git subtree push</code>. It will generate a new commit tree with your directory as root, and push it.</p>
<pre><code>git subtree push --prefix web heroku master
</code></pre>
<p>Full documentation is <a href="https://github.com/git/git/blob/master/contrib/subtree/git-subtree.txt" rel="noreferrer"... | <p>You can use <code>git subtree push</code>. It will generate a new commit tree with your directory as root, and push it.</p> <pre><code>git subtree push --prefix web heroku master </code></pre> <p>Full documentation is <a href="https://github.com/git/git/blob/master/contrib/subtree/git-subtree.txt" rel="noreferrer"... | 119, 8279 | git, heroku | <h1>How can I push a part of my git repo to Heroku?</h1>
<p>I have a multi-module app that is already on Github. It is comprised of two modules, one of them an Android app and the other a Rails based Web app. So my project's directory structure is in the form of:</p>
<pre><code>ProjectRoot
|
+-- web
|
+-- android
|
+-... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,112 | git | # How can I push a part of my git repo to Heroku?
I have a multi-module app that is already on Github. It is comprised of two modules, one of them an Android app and the other a Rails based Web app. So my project's directory structure is in the form of:
```
ProjectRoot
|
+-- web
|
+-- android
|
+-- .git
```
As such ... | You can use `git subtree push`. It will generate a new commit tree with your directory as root, and push it.
```
git subtree push --prefix web heroku master
```
Full documentation is [here](https://github.com/git/git/blob/master/contrib/subtree/git-subtree.txt). |
30001304 | Clone git repository without history? | 63 | 2015-05-02 10:41:09 | <p>I want to clone a repository from Github. It has lot of history so I'd like to clone without any history.</p>
<p>Is this possible?</p>
| 38,309 | 1,960,604 | 2024-01-02 01:01:26 | 30,001,366 | 92 | 2015-05-02 10:48:24 | 1,342,730 | 2015-05-02 16:42:56 | https://stackoverflow.com/q/30001304 | https://stackoverflow.com/a/30001366 | <p>You can get a shallow clone using the <code>--depth</code> option with value 1</p>
<pre><code>git clone --depth 1 reponame.git
</code></pre>
<p>If you want more commit history, increase the value to meet your needs as required.</p>
| <p>You can get a shallow clone using the <code>--depth</code> option with value 1</p> <pre><code>git clone --depth 1 reponame.git </code></pre> <p>If you want more commit history, increase the value to meet your needs as required.</p> | 119 | git | <h1>Clone git repository without history?</h1>
<p>I want to clone a repository from Github. It has lot of history so I'd like to clone without any history.</p>
<p>Is this possible?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,114 | git | # Clone git repository without history?
I want to clone a repository from Github. It has lot of history so I'd like to clone without any history.
Is this possible? | You can get a shallow clone using the `--depth` option with value 1
```
git clone --depth 1 reponame.git
```
If you want more commit history, increase the value to meet your needs as required. |
31596869 | Difference between stash vs stage files in GIT | 61 | 2015-07-23 19:54:09 | <p>When I need to save my changes from one branch before checking out to another branch, git sometimes says: stage or commit the files before you can checkout to another branch. But I have been recommended to use stash option so:</p>
<ol>
<li><p>Stage the files is not enough to save my files before checking out to ano... | 54,555 | 3,254,515 | 2022-09-03 09:59:05 | 31,614,617 | 92 | 2015-07-24 15:40:20 | 4,848,859 | 2020-04-20 23:13:56 | https://stackoverflow.com/q/31596869 | https://stackoverflow.com/a/31614617 | <p>1.- More than "save" your files, is act as Git expect to according their flow. (Advice, Git knows :) )</p>
<p>2.- <strong>Stash</strong> will move your modified files into a stack. So, later in the same or in another branch, you will be able to bring them back and see those modifications in your project.</p>
<p><s... | <p>1.- More than "save" your files, is act as Git expect to according their flow. (Advice, Git knows :) )</p> <p>2.- <strong>Stash</strong> will move your modified files into a stack. So, later in the same or in another branch, you will be able to bring them back and see those modifications in your project.</p> <p><s... | 13091, 74978 | git-stage, git-stash | <h1>Difference between stash vs stage files in GIT</h1>
<p>When I need to save my changes from one branch before checking out to another branch, git sometimes says: stage or commit the files before you can checkout to another branch. But I have been recommended to use stash option so:</p>
<ol>
<li><p>Stage the files i... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,115 | git | # Difference between stash vs stage files in GIT
When I need to save my changes from one branch before checking out to another branch, git sometimes says: stage or commit the files before you can checkout to another branch. But I have been recommended to use stash option so:
1. Stage the files is not enough to save m... | 1.- More than "save" your files, is act as Git expect to according their flow. (Advice, Git knows :) )
2.- **Stash** will move your modified files into a stack. So, later in the same or in another branch, you will be able to bring them back and see those modifications in your project.
**Stage** is the step before to ... |
46155906 | Git LFS: Get the complete list from the whole repository | 57 | 2017-09-11 12:33:23 | <p>I have only found <code>git lfs ls-files</code> but this command give only the list from a specific ref.</p>
<p>There is a way to have the whole list of LFS object from a Git repository?</p>
| 68,390 | 3,132,486 | 2023-10-23 05:53:03 | 60,707,236 | 92 | 2020-03-16 13:51:16 | 724,485 | 2022-01-20 18:16:01 | https://stackoverflow.com/q/46155906 | https://stackoverflow.com/a/60707236 | <p>You can do this in <em><strong>Git LFS v2.4.0 and later</strong></em> using the <code>--all</code> flag</p>
<pre><code>git lfs ls-files --all
</code></pre>
<p>You can read more about it in <a href="https://github.com/git-lfs/git-lfs/pull/2796" rel="noreferrer">this pull request</a>.</p>
| <p>You can do this in <em><strong>Git LFS v2.4.0 and later</strong></em> using the <code>--all</code> flag</p> <pre><code>git lfs ls-files --all </code></pre> <p>You can read more about it in <a href="https://github.com/git-lfs/git-lfs/pull/2796" rel="noreferrer">this pull request</a>.</p> | 119, 115244 | git, git-lfs | <h1>Git LFS: Get the complete list from the whole repository</h1>
<p>I have only found <code>git lfs ls-files</code> but this command give only the list from a specific ref.</p>
<p>There is a way to have the whole list of LFS object from a Git repository?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,116 | git | # Git LFS: Get the complete list from the whole repository
I have only found `git lfs ls-files` but this command give only the list from a specific ref.
There is a way to have the whole list of LFS object from a Git repository? | You can do this in ***Git LFS v2.4.0 and later*** using the `--all` flag
```
git lfs ls-files --all
```
You can read more about it in [this pull request](https://github.com/git-lfs/git-lfs/pull/2796). |
6006494 | git submodule modified files status | 56 | 2011-05-15 04:30:17 | <p>I've added a submodule in my main git folder tree and haven't changed anything but it's showing up modified. What do I do about this?</p>
<pre><code>$ git status
# On branch master
# Changed but not updated:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>... | 38,362 | 332,913 | 2019-11-26 22:27:30 | 6,006,919 | 92 | 2011-05-15 06:42:36 | 223,092 | 2014-03-20 09:19:59 | https://stackoverflow.com/q/6006494 | https://stackoverflow.com/a/6006919 | <p>The way that the status of git submodules is reported has changed a lot over recent versions of git, so you should really include the output of <code>git --version</code> as well for us to be able to help accurately.</p>
<p>However, in any case, the output of <code>git diff example.com/soundmanager</code> should te... | <p>The way that the status of git submodules is reported has changed a lot over recent versions of git, so you should really include the output of <code>git --version</code> as well for us to be able to help accurately.</p> <p>However, in any case, the output of <code>git diff example.com/soundmanager</code> should te... | 119, 41612 | git, git-submodules | <h1>git submodule modified files status</h1>
<p>I've added a submodule in my main git folder tree and haven't changed anything but it's showing up modified. What do I do about this?</p>
<pre><code>$ git status
# On branch master
# Changed but not updated:
# (use "git add <file>..." to update what will be comm... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,117 | git | # git submodule modified files status
I've added a submodule in my main git folder tree and haven't changed anything but it's showing up modified. What do I do about this?
```
$ git status
# On branch master
# Changed but not updated:
# (use "git add <file>..." to update what will be committed)
# (use "git checko... | The way that the status of git submodules is reported has changed a lot over recent versions of git, so you should really include the output of `git --version` as well for us to be able to help accurately.
However, in any case, the output of `git diff example.com/soundmanager` should tell you more. If you see output w... |
50473587 | Revert a commit on remote branch | 51 | 2018-05-22 17:39:36 | <p>I've worked on a local branch adding many commits.<br>
Then i've pushed it to the <code>remote staging</code> branch. </p>
<p>Now I have to undo the last commit already pushed to <code>remote staging</code> that is the merge of my local branch to <code>remote staging</code></p>
<p>What I've understood looking on ... | 229,527 | 3,722,787 | 2020-06-02 19:14:45 | 50,475,801 | 92 | 2018-05-22 20:15:15 | 1,009,546 | 2018-05-22 20:26:13 | https://stackoverflow.com/q/50473587 | https://stackoverflow.com/a/50475801 | <p>Don't make it complicated.</p>
<p>First you need to do a <code>git log</code> to find out which commit ID you want to revert. For example it is commit <code>abc123</code>. If you know that it's the last one, you can use a special identifier "HEAD".</p>
<p>Then you first revert it locally in your local "staging" br... | <p>Don't make it complicated.</p> <p>First you need to do a <code>git log</code> to find out which commit ID you want to revert. For example it is commit <code>abc123</code>. If you know that it's the last one, you can use a special identifier "HEAD".</p> <p>Then you first revert it locally in your local "staging" br... | 119 | git | <h1>Revert a commit on remote branch</h1>
<p>I've worked on a local branch adding many commits.<br>
Then i've pushed it to the <code>remote staging</code> branch. </p>
<p>Now I have to undo the last commit already pushed to <code>remote staging</code> that is the merge of my local branch to <code>remote staging</code... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,118 | git | # Revert a commit on remote branch
I've worked on a local branch adding many commits.
Then i've pushed it to the `remote staging` branch.
Now I have to undo the last commit already pushed to `remote staging` that is the merge of my local branch to `remote staging`
What I've understood looking on the other answers ... | Don't make it complicated.
First you need to do a `git log` to find out which commit ID you want to revert. For example it is commit `abc123`. If you know that it's the last one, you can use a special identifier "HEAD".
Then you first revert it locally in your local "staging" branch:
```
git checkout staging
git rev... |
15084780 | .gitignore: Ignore one specific directory and that one only | 51 | 2013-02-26 08:47:46 | <p>I have this directory structure</p>
<pre><code>./bin/<java class files>
./sometool/bin/<files for the tool>
</code></pre>
<p>...as well as some other files and directories.</p>
<p>It seens that if I want to avoid tracking the java class files, I should add this to the .gitignore file:</p>
<pre><code>... | 57,108 | 1,460,495 | 2013-02-26 08:51:19 | 15,084,844 | 92 | 2013-02-26 08:50:57 | null | 2013-02-26 08:50:57 | https://stackoverflow.com/q/15084780 | https://stackoverflow.com/a/15084844 | <p>I think paths in <code>.gitignore</code> have their root at the project's root, so you may try <code>/bin</code></p>
<p><strong>EDIT</strong></p>
<p>And by the way, this is normal behaviour from git.</p>
| <p>I think paths in <code>.gitignore</code> have their root at the project's root, so you may try <code>/bin</code></p> <p><strong>EDIT</strong></p> <p>And by the way, this is normal behaviour from git.</p> | 119, 25056 | git, gitignore | <h1>.gitignore: Ignore one specific directory and that one only</h1>
<p>I have this directory structure</p>
<pre><code>./bin/<java class files>
./sometool/bin/<files for the tool>
</code></pre>
<p>...as well as some other files and directories.</p>
<p>It seens that if I want to avoid tracking the java cl... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,119 | git | # .gitignore: Ignore one specific directory and that one only
I have this directory structure
```
./bin/<java class files>
./sometool/bin/<files for the tool>
```
...as well as some other files and directories.
It seens that if I want to avoid tracking the java class files, I should add this to the .gitignore file:... | I think paths in `.gitignore` have their root at the project's root, so you may try `/bin`
**EDIT**
And by the way, this is normal behaviour from git. |
36967600 | How to rebase last x commits on different branch? | 49 | 2016-05-01 14:11:58 | <p>I want to take the latest X commits from a branch and be able to apply them on top of different branch. For example doing <code>git rebase -i HEAD~10</code> would allow me to interactively modify and apply the last 10 commits on the same branch I'm on. </p>
<p>Is it possibly to do the same thing but apply the commi... | 28,020 | 762,886 | 2017-05-17 14:17:13 | 36,967,662 | 92 | 2016-05-01 14:20:07 | 3,306,465 | 2017-05-17 14:17:13 | https://stackoverflow.com/q/36967600 | https://stackoverflow.com/a/36967662 | <p>You can use the <code>--onto</code> flag.</p>
<pre><code>git rebase -i HEAD~10 --onto another_branch
</code></pre>
<p>Note that this will not create a new branch, nor will it move the actual changes to <code>another_branch</code>.</p>
<p>All changes will be applied to the same branch you are on.</p>
<p>So I sugg... | <p>You can use the <code>--onto</code> flag.</p> <pre><code>git rebase -i HEAD~10 --onto another_branch </code></pre> <p>Note that this will not create a new branch, nor will it move the actual changes to <code>another_branch</code>.</p> <p>All changes will be applied to the same branch you are on.</p> <p>So I sugg... | 119 | git | <h1>How to rebase last x commits on different branch?</h1>
<p>I want to take the latest X commits from a branch and be able to apply them on top of different branch. For example doing <code>git rebase -i HEAD~10</code> would allow me to interactively modify and apply the last 10 commits on the same branch I'm on. </p>
... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,120 | git | # How to rebase last x commits on different branch?
I want to take the latest X commits from a branch and be able to apply them on top of different branch. For example doing `git rebase -i HEAD~10` would allow me to interactively modify and apply the last 10 commits on the same branch I'm on.
Is it possibly to do the... | You can use the `--onto` flag.
```
git rebase -i HEAD~10 --onto another_branch
```
Note that this will not create a new branch, nor will it move the actual changes to `another_branch`.
All changes will be applied to the same branch you are on.
So I suggest do it in several stages:
```
git checkout -b staging_branc... |
3719243 | Best practices for adding .gitignore file for Python projects? | 375 | 2010-09-15 15:32:42 | <p>I'm trying to collect some of my default settings, and one thing I realized I don't have a standard for is .gitignore files. There's a great thread showing a <a href="https://stackoverflow.com/questions/2143956/gitignore-for-visual-studio-projects-and-solutions">good .gitignore for Visual Studio projects</a>, but I ... | 695,271 | 147,320 | 2022-12-31 21:52:15 | 3,719,679 | 91 | 2010-09-15 16:21:55 | 327,317 | 2010-09-15 16:21:55 | https://stackoverflow.com/q/3719243 | https://stackoverflow.com/a/3719679 | <p>When using <a href="http://www.buildout.org/" rel="noreferrer">buildout</a> I have following in <code>.gitignore</code> (along with <code>*.pyo</code> and <code>*.pyc</code>):</p>
<pre><code>.installed.cfg
bin
develop-eggs
dist
downloads
eggs
parts
src/*.egg-info
lib
lib64
</code></pre>
<p>Thanks to <a href="http:... | <p>When using <a href="http://www.buildout.org/" rel="noreferrer">buildout</a> I have following in <code>.gitignore</code> (along with <code>*.pyo</code> and <code>*.pyc</code>):</p> <pre><code>.installed.cfg bin develop-eggs dist downloads eggs parts src/*.egg-info lib lib64 </code></pre> <p>Thanks to <a href="http:... | 16, 119, 243, 2530, 25056 | django, git, gitignore, pygtk, python | <h1>Best practices for adding .gitignore file for Python projects?</h1>
<p>I'm trying to collect some of my default settings, and one thing I realized I don't have a standard for is .gitignore files. There's a great thread showing a <a href="https://stackoverflow.com/questions/2143956/gitignore-for-visual-studio-projec... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,122 | git | # Best practices for adding .gitignore file for Python projects?
I'm trying to collect some of my default settings, and one thing I realized I don't have a standard for is .gitignore files. There's a great thread showing a [good .gitignore for Visual Studio projects](https://stackoverflow.com/questions/2143956/gitigno... | When using [buildout](http://www.buildout.org/) I have following in `.gitignore` (along with `*.pyo` and `*.pyc`):
```
.installed.cfg
bin
develop-eggs
dist
downloads
eggs
parts
src/*.egg-info
lib
lib64
```
Thanks to [Jacob Kaplan-Moss](http://jacobian.org/writing/django-apps-with-buildout/)
Also I tend to put `.svn`... |
12055198 | Find out a Git branch creator | 248 | 2012-08-21 12:48:39 | <p>I want to find out who created a branch.</p>
<p>I am sort of able to do so with:</p>
<pre><code>git branch -a | xargs -L 1 bash -c 'echo "$1 `git log --pretty=format:"%H %an" $1^..$1`"' _
</code></pre>
<p>However, this returns the last committer per branch, not necessarily the person who created the branch.</p>
| 249,506 | 1,031,900 | 2024-08-16 15:26:23 | 12,055,538 | 91 | 2012-08-21 13:06:26 | 877,115 | 2014-11-06 15:10:03 | https://stackoverflow.com/q/12055198 | https://stackoverflow.com/a/12055538 | <p>A branch is nothing but a commit pointer. As such, it doesn't track metadata like "who created me." See for yourself. Try <code>cat .git/refs/heads/<branch></code> in your repository.</p>
<p>That written, if you're really into tracking this information in your repository, check out <a href="https://stackoverf... | <p>A branch is nothing but a commit pointer. As such, it doesn't track metadata like "who created me." See for yourself. Try <code>cat .git/refs/heads/<branch></code> in your repository.</p> <p>That written, if you're really into tracking this information in your repository, check out <a href="https://stackoverf... | 119, 76220 | git, git-branch | <h1>Find out a Git branch creator</h1>
<p>I want to find out who created a branch.</p>
<p>I am sort of able to do so with:</p>
<pre><code>git branch -a | xargs -L 1 bash -c 'echo "$1 `git log --pretty=format:"%H %an" $1^..$1`"' _
</code></pre>
<p>However, this returns the last committer per branch, not necessarily t... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,123 | git | # Find out a Git branch creator
I want to find out who created a branch.
I am sort of able to do so with:
```
git branch -a | xargs -L 1 bash -c 'echo "$1 `git log --pretty=format:"%H %an" $1^..$1`"' _
```
However, this returns the last committer per branch, not necessarily the person who created the branch. | A branch is nothing but a commit pointer. As such, it doesn't track metadata like "who created me." See for yourself. Try `cat .git/refs/heads/<branch>` in your repository.
That written, if you're really into tracking this information in your repository, check out [branch descriptions.](https://stackoverflow.com/a/118... |
2472552 | Python way to clone a git repository | 154 | 2010-03-18 18:55:14 | <p>Is there a Python way without using a subprocess to clone a git repository? I'm up for using any sort of modules you recommend. </p>
| 388,067 | 72,987 | 2023-11-11 09:25:12 | 2,472,616 | 91 | 2010-03-18 19:04:57 | 200,266 | 2023-11-11 09:23:11 | https://stackoverflow.com/q/2472552 | https://stackoverflow.com/a/2472616 | <p>There is <a href="https://gitpython.readthedocs.io/en/stable/" rel="nofollow noreferrer">GitPython</a>. Haven’t heard of it before and internally, it relies on having the git executables somewhere; additionally, they might have plenty of bugs. But it could be worth a try.</p>
<p>How to <a href="https://gitpython.rea... | <p>There is <a href="https://gitpython.readthedocs.io/en/stable/" rel="nofollow noreferrer">GitPython</a>. Haven’t heard of it before and internally, it relies on having the git executables somewhere; additionally, they might have plenty of bugs. But it could be worth a try.</p> <p>How to <a href="https://gitpython.rea... | 16, 119, 3849 | git, module, python | <h1>Python way to clone a git repository</h1>
<p>Is there a Python way without using a subprocess to clone a git repository? I'm up for using any sort of modules you recommend. </p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,124 | git | # Python way to clone a git repository
Is there a Python way without using a subprocess to clone a git repository? I'm up for using any sort of modules you recommend. | There is [GitPython](https://gitpython.readthedocs.io/en/stable/). Haven’t heard of it before and internally, it relies on having the git executables somewhere; additionally, they might have plenty of bugs. But it could be worth a try.
How to [clone](https://gitpython.readthedocs.io/en/stable/reference.html#git.repo.b... |
1178389 | Browse and display files in a git repo without cloning | 138 | 2009-07-24 15:23:38 | <p>Is there a way to browse and display files in a git repo without cloning it first? I can do those in svn using the commands:</p>
<pre>
svn ls /path/to/repo
svn cat /path/to/repo/file-in-repo
</pre>
<p>I can supposedly use git show but doing:</p>
<pre>
git show /path/to/repo
git show HEAD:/path/to/repo
</pre>
<p... | 243,310 | 100,217 | 2025-11-29 22:37:58 | 1,178,586 | 91 | 2009-07-24 15:57:52 | 912 | 2016-08-12 18:48:29 | https://stackoverflow.com/q/1178389 | https://stackoverflow.com/a/1178586 | <p>The command you want is <a href="http://www.kernel.org/pub/software/scm/git/docs/git-ls-remote.html" rel="noreferrer"><code>git ls-remote</code></a> which allows you to get some information about remote repositories, but you cant show history or list directories or anything of that level: essentially it only lets yo... | <p>The command you want is <a href="http://www.kernel.org/pub/software/scm/git/docs/git-ls-remote.html" rel="noreferrer"><code>git ls-remote</code></a> which allows you to get some information about remote repositories, but you cant show history or list directories or anything of that level: essentially it only lets yo... | 119 | git | <h1>Browse and display files in a git repo without cloning</h1>
<p>Is there a way to browse and display files in a git repo without cloning it first? I can do those in svn using the commands:</p>
<pre>
svn ls /path/to/repo
svn cat /path/to/repo/file-in-repo
</pre>
<p>I can supposedly use git show but doing:</p>
<pr... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,125 | git | # Browse and display files in a git repo without cloning
Is there a way to browse and display files in a git repo without cloning it first? I can do those in svn using the commands:
```
svn ls /path/to/repo
svn cat /path/to/repo/file-in-repo
```
I can supposedly use git show but doing:
```
git show /path/to/repo
g... | The command you want is [`git ls-remote`](http://www.kernel.org/pub/software/scm/git/docs/git-ls-remote.html) which allows you to get some information about remote repositories, but you cant show history or list directories or anything of that level: essentially it only lets you see the remote objects at a very high-le... |
15296473 | What do git checkouts really mean? | 133 | 2013-03-08 14:38:08 | <p>What are <code>checkout</code>s in git? </p>
<p>I know once you do <code>checkout</code> to a particular branch, the <code>HEAD</code> points to that branch. But what does it really mean? Does it mean I can then work on that branch? If yes, then, without checking out a branch, I am not able to work on it?</p>
<p>A... | 143,724 | 295,530 | 2023-03-21 07:28:23 | 15,297,705 | 91 | 2013-03-08 15:39:34 | 413,399 | 2023-03-21 07:28:23 | https://stackoverflow.com/q/15296473 | https://stackoverflow.com/a/15297705 | <p>As you noted, <code>HEAD</code> is a label noting where you are in the commit tree. It moves with you when you move from one commit to another. <code>git checkout <commit></code> is the basic mechanism for moving around in the commit tree, moving your focus (<code>HEAD</code>) to the specified commit.</p>
<p... | <p>As you noted, <code>HEAD</code> is a label noting where you are in the commit tree. It moves with you when you move from one commit to another. <code>git checkout <commit></code> is the basic mechanism for moving around in the commit tree, moving your focus (<code>HEAD</code>) to the specified commit.</p> <p... | 119, 37230 | git, git-checkout | <h1>What do git checkouts really mean?</h1>
<p>What are <code>checkout</code>s in git? </p>
<p>I know once you do <code>checkout</code> to a particular branch, the <code>HEAD</code> points to that branch. But what does it really mean? Does it mean I can then work on that branch? If yes, then, without checking out a br... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,126 | git | # What do git checkouts really mean?
What are `checkout`s in git?
I know once you do `checkout` to a particular branch, the `HEAD` points to that branch. But what does it really mean? Does it mean I can then work on that branch? If yes, then, without checking out a branch, I am not able to work on it?
Also, what doe... | As you noted, `HEAD` is a label noting where you are in the commit tree. It moves with you when you move from one commit to another. `git checkout <commit>` is the basic mechanism for moving around in the commit tree, moving your focus (`HEAD`) to the specified commit.
The commit can be specified by any of a number of... |
2573905 | Do all git commands have a dry-run option? | 106 | 2010-04-04 08:22:59 | <p>Do all git commands have a <code>--dry-run</code> option, or one which would indicate what the command would do without actually doing them?</p>
| 77,321 | 172,406 | 2024-05-16 08:34:16 | 2,574,064 | 91 | 2010-04-04 09:45:38 | 6,309 | 2012-05-03 06:44:59 | https://stackoverflow.com/q/2573905 | https://stackoverflow.com/a/2574064 | <p>Not every command would naturally support a dry run directly.</p>
<ul>
<li>git merge has <a href="http://www.commandlinefu.com/commands/view/386/git-merge-dry-run" rel="noreferrer">its own option</a> (<code>git merge --no-commit --no-ff</code>)</li>
<li>but <a href="http://kerneltrap.org/mailarchive/git/2008/7/4/23... | <p>Not every command would naturally support a dry run directly.</p> <ul> <li>git merge has <a href="http://www.commandlinefu.com/commands/view/386/git-merge-dry-run" rel="noreferrer">its own option</a> (<code>git merge --no-commit --no-ff</code>)</li> <li>but <a href="http://kerneltrap.org/mailarchive/git/2008/7/4/23... | 119 | git | <h1>Do all git commands have a dry-run option?</h1>
<p>Do all git commands have a <code>--dry-run</code> option, or one which would indicate what the command would do without actually doing them?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,128 | git | # Do all git commands have a dry-run option?
Do all git commands have a `--dry-run` option, or one which would indicate what the command would do without actually doing them? | Not every command would naturally support a dry run directly.
- git merge has [its own option](http://www.commandlinefu.com/commands/view/386/git-merge-dry-run) (`git merge --no-commit --no-ff`)
- but [git pull does not really need it](http://kerneltrap.org/mailarchive/git/2008/7/4/2350514) ('`git fetch origin`', then... |
15437719 | Git push error: "origin does not appear to be a git repository" | 103 | 2013-03-15 16:41:07 | <p>I am following the <a href="http://qugstart.com/blog/ruby-and-rails/create-a-new-git-remote-repository-from-some-local-files-or-local-git-repository/">instructions given here</a> to create a Git repository. All went well until the last line: </p>
<pre><code>$ git push -u origin master
</code></pre>
<blockquote>... | 370,610 | 1,978,617 | 2023-12-12 08:35:28 | 15,445,062 | 91 | 2013-03-16 02:56:48 | 836,835 | 2015-06-17 19:36:34 | https://stackoverflow.com/q/15437719 | https://stackoverflow.com/a/15445062 | <p>As it has already been mentioned in <a href="https://stackoverflow.com/a/15439950/829571">che's answer</a> about adding the remote part, which I believe you are still missing.</p>
<p>Regarding your edit for adding remote on your local USB drive. First of all you must have a 'bare repository' if you want your reposi... | <p>As it has already been mentioned in <a href="https://stackoverflow.com/a/15439950/829571">che's answer</a> about adding the remote part, which I believe you are still missing.</p> <p>Regarding your edit for adding remote on your local USB drive. First of all you must have a 'bare repository' if you want your reposi... | 119, 41346 | git, git-remote | <h1>Git push error: "origin does not appear to be a git repository"</h1>
<p>I am following the <a href="http://qugstart.com/blog/ruby-and-rails/create-a-new-git-remote-repository-from-some-local-files-or-local-git-repository/">instructions given here</a> to create a Git repository. All went well until the last line: <... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,129 | git | # Git push error: "origin does not appear to be a git repository"
I am following the [instructions given here](http://qugstart.com/blog/ruby-and-rails/create-a-new-git-remote-repository-from-some-local-files-or-local-git-repository/) to create a Git repository. All went well until the last line:
```
$ git push -u ori... | As it has already been mentioned in [che's answer](https://stackoverflow.com/a/15439950/829571) about adding the remote part, which I believe you are still missing.
Regarding your edit for adding remote on your local USB drive. First of all you must have a 'bare repository' if you want your repository to be a shared r... |
6770298 | Is it possible to find out who created a tag in Git? | 90 | 2011-07-21 01:10:16 | <p>Commits obviously have an author associated with them; but is it possible to find out which user created a tag on a Git repository?</p>
| 44,101 | 14,902 | 2020-08-13 12:40:07 | 6,770,313 | 91 | 2011-07-21 01:13:23 | 582 | 2011-07-21 01:13:23 | https://stackoverflow.com/q/6770298 | https://stackoverflow.com/a/6770313 | <p>If it's an annotated tag, then yes. You can <code>git show</code> it just like any other object. If it's a lightweight tag, then I don't believe so. Just one of the reasons why you should always annotate the tags you're going to share.</p>
| <p>If it's an annotated tag, then yes. You can <code>git show</code> it just like any other object. If it's a lightweight tag, then I don't believe so. Just one of the reasons why you should always annotate the tags you're going to share.</p> | 119 | git | <h1>Is it possible to find out who created a tag in Git?</h1>
<p>Commits obviously have an author associated with them; but is it possible to find out which user created a tag on a Git repository?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,131 | git | # Is it possible to find out who created a tag in Git?
Commits obviously have an author associated with them; but is it possible to find out which user created a tag on a Git repository? | If it's an annotated tag, then yes. You can `git show` it just like any other object. If it's a lightweight tag, then I don't believe so. Just one of the reasons why you should always annotate the tags you're going to share. |
11225293 | What is the difference between "git reset" vs "git rebase"? | 89 | 2012-06-27 11:37:01 | <p>I have been playing around with git (still very noob) and I wanted to know the difference between "reset" and "rebase". Is the one more powerful than the other?</p>
<p>Say I wanted to delete the 3 commits in bold from the history, which one will be better to use, or should I tag it and then delete it with <code>git... | 111,332 | 1,434,795 | 2024-08-13 20:48:06 | 11,225,432 | 91 | 2012-06-27 11:45:12 | 216,074 | 2018-05-16 16:27:36 | https://stackoverflow.com/q/11225293 | https://stackoverflow.com/a/11225432 | <p>They are completely different. <a href="http://git-scm.com/docs/git-reset" rel="noreferrer"><code>git-reset</code></a> works with refs, on your working directory and the index, without touching any commit objects (or other objects). <a href="http://git-scm.com/docs/git-rebase" rel="noreferrer"><code>git-rebase</code... | <p>They are completely different. <a href="http://git-scm.com/docs/git-reset" rel="noreferrer"><code>git-reset</code></a> works with refs, on your working directory and the index, without touching any commit objects (or other objects). <a href="http://git-scm.com/docs/git-rebase" rel="noreferrer"><code>git-rebase</code... | 119 | git | <h1>What is the difference between "git reset" vs "git rebase"?</h1>
<p>I have been playing around with git (still very noob) and I wanted to know the difference between "reset" and "rebase". Is the one more powerful than the other?</p>
<p>Say I wanted to delete the 3 commits in bold from the history, which one will b... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,132 | git | # What is the difference between "git reset" vs "git rebase"?
I have been playing around with git (still very noob) and I wanted to know the difference between "reset" and "rebase". Is the one more powerful than the other?
Say I wanted to delete the 3 commits in bold from the history, which one will be better to use,... | They are completely different. [`git-reset`](http://git-scm.com/docs/git-reset) works with refs, on your working directory and the index, without touching any commit objects (or other objects). [`git-rebase`](http://git-scm.com/docs/git-rebase) on the other hand is used to rewrite previously made commit objects.
So if... |
250238 | Collapsing a git repository's history | 88 | 2008-10-30 13:53:33 | <p>We have a git project which has quite a big history.</p>
<p>Specifically, early in the project there were quite a lot of binary resource files in the project, these have now been removed as they're effectively external resources.</p>
<p>However, the size of our repository is >200MB (the total checkout is currently... | 32,010 | 31,582 | 2016-03-10 14:33:33 | 251,927 | 91 | 2008-10-30 22:03:31 | 23,356 | 2008-10-31 19:13:16 | https://stackoverflow.com/q/250238 | https://stackoverflow.com/a/251927 | <p>You can remove the binary bloat and keep the rest of your history. Git allows you to reorder and 'squash' prior commits, so you can combine just the commits that add and remove your big binary files. If the adds were all done in one commit and the removals in another, this will be much easier than dealing with each ... | <p>You can remove the binary bloat and keep the rest of your history. Git allows you to reorder and 'squash' prior commits, so you can combine just the commits that add and remove your big binary files. If the adds were all done in one commit and the removals in another, this will be much easier than dealing with each ... | 119, 456 | git, version-control | <h1>Collapsing a git repository's history</h1>
<p>We have a git project which has quite a big history.</p>
<p>Specifically, early in the project there were quite a lot of binary resource files in the project, these have now been removed as they're effectively external resources.</p>
<p>However, the size of our reposi... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,133 | git | # Collapsing a git repository's history
We have a git project which has quite a big history.
Specifically, early in the project there were quite a lot of binary resource files in the project, these have now been removed as they're effectively external resources.
However, the size of our repository is >200MB (the tot... | You can remove the binary bloat and keep the rest of your history. Git allows you to reorder and 'squash' prior commits, so you can combine just the commits that add and remove your big binary files. If the adds were all done in one commit and the removals in another, this will be much easier than dealing with each fil... |
27635955 | How do I create a master branch in a bare Git repository? | 73 | 2014-12-24 11:11:09 | <pre><code>git init --bare test-repo.git
cd test-repo.git
</code></pre>
<p>(Folder is created with git-ish files and folders inside)</p>
<pre><code>git status
</code></pre>
<p><strong>fatal: This operation must be run in a work tree</strong>
(Okay, so I can't use git status with a bare repo; makes sense I guess)</p>
<p... | 212,924 | 164,923 | 2025-04-08 16:28:21 | 27,636,368 | 91 | 2014-12-24 11:41:21 | 2,541,573 | 2015-01-09 22:48:18 | https://stackoverflow.com/q/27635955 | https://stackoverflow.com/a/27636368 | <p>A bare repository is pretty much something you only push to and fetch from. You cannot do much directly "in it": you cannot check stuff out, create references (branches, tags), run <code>git status</code>, etc.</p>
<p>If you want to create a new branch in a bare Git repository, you can push a branch from a clone to... | <p>A bare repository is pretty much something you only push to and fetch from. You cannot do much directly "in it": you cannot check stuff out, create references (branches, tags), run <code>git status</code>, etc.</p> <p>If you want to create a new branch in a bare Git repository, you can push a branch from a clone to... | 119, 64465, 76220 | git, git-bare, git-branch | <h1>How do I create a master branch in a bare Git repository?</h1>
<pre><code>git init --bare test-repo.git
cd test-repo.git
</code></pre>
<p>(Folder is created with git-ish files and folders inside)</p>
<pre><code>git status
</code></pre>
<p><strong>fatal: This operation must be run in a work tree</strong>
(Okay, so I... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,134 | git | # How do I create a master branch in a bare Git repository?
```
git init --bare test-repo.git
cd test-repo.git
```
(Folder is created with git-ish files and folders inside)
```
git status
```
**fatal: This operation must be run in a work tree**
(Okay, so I can't use git status with a bare repo; makes sense I guess)... | A bare repository is pretty much something you only push to and fetch from. You cannot do much directly "in it": you cannot check stuff out, create references (branches, tags), run `git status`, etc.
If you want to create a new branch in a bare Git repository, you can push a branch from a clone to your bare repo:
```... |
60220919 | Which files or folders should be in .gitignore in React project? | 57 | 2020-02-14 06:08:59 | <p>I am making a react project and using Linux mint in Laptop and Windows 10 desktop. I would like to know, which files or folders should I keep in .gitignore so that I don't have to clean cache and install npm whenever I switch computers.</p>
| 123,351 | 8,666,088 | 2024-03-22 12:27:18 | 60,221,045 | 91 | 2020-02-14 06:19:24 | 5,602,214 | 2021-08-09 07:48:46 | https://stackoverflow.com/q/60220919 | https://stackoverflow.com/a/60221045 | <p>Why bother? Just point your browser to <a href="https://www.gitignore.io/" rel="noreferrer">gitignore.io</a> and select all the tools and technologies you are using. You will automatically have a generated <code>.gitignore</code> file.</p>
| <p>Why bother? Just point your browser to <a href="https://www.gitignore.io/" rel="noreferrer">gitignore.io</a> and select all the tools and technologies you are using. You will automatically have a generated <code>.gitignore</code> file.</p> | 119, 25056, 92497 | git, gitignore, reactjs | <h1>Which files or folders should be in .gitignore in React project?</h1>
<p>I am making a react project and using Linux mint in Laptop and Windows 10 desktop. I would like to know, which files or folders should I keep in .gitignore so that I don't have to clean cache and install npm whenever I switch computers.</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,136 | git | # Which files or folders should be in .gitignore in React project?
I am making a react project and using Linux mint in Laptop and Windows 10 desktop. I would like to know, which files or folders should I keep in .gitignore so that I don't have to clean cache and install npm whenever I switch computers. | Why bother? Just point your browser to [gitignore.io](https://www.gitignore.io/) and select all the tools and technologies you are using. You will automatically have a generated `.gitignore` file. |
28222633 | git status not showing contents of newly added folder | 47 | 2015-01-29 19:08:41 | <p>I just created a new git repo at <code>/</code> I created a new file<code>test.txt</code> in the folder <code>test_fold</code> so that the path to the file is <code>test_fold\test.txt</code>. I then run <code>git status</code>. This is the output, it finds the folder but not the file. Why is not showing me that ther... | 56,838 | 2,911,408 | 2022-11-16 03:55:34 | 28,222,696 | 91 | 2015-01-29 19:12:44 | 229,044 | 2021-06-23 13:56:00 | https://stackoverflow.com/q/28222633 | https://stackoverflow.com/a/28222696 | <p>Git will ignore the content of a folder if the folder doesn't already contain tracked paths. You know by the presence of <code>test_fold/</code> that there are files in there (Git will never show you an empty directory as being untracked) and you know that those files are not tracked.</p>
<p>Otherwise, unzipping a f... | <p>Git will ignore the content of a folder if the folder doesn't already contain tracked paths. You know by the presence of <code>test_fold/</code> that there are files in there (Git will never show you an empty directory as being untracked) and you know that those files are not tracked.</p> <p>Otherwise, unzipping a f... | 119 | git | <h1>git status not showing contents of newly added folder</h1>
<p>I just created a new git repo at <code>/</code> I created a new file<code>test.txt</code> in the folder <code>test_fold</code> so that the path to the file is <code>test_fold\test.txt</code>. I then run <code>git status</code>. This is the output, it fin... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,137 | git | # git status not showing contents of newly added folder
I just created a new git repo at `/` I created a new file`test.txt` in the folder `test_fold` so that the path to the file is `test_fold\test.txt`. I then run `git status`. This is the output, it finds the folder but not the file. Why is not showing me that there... | Git will ignore the content of a folder if the folder doesn't already contain tracked paths. You know by the presence of `test_fold/` that there are files in there (Git will never show you an empty directory as being untracked) and you know that those files are not tracked.
Otherwise, unzipping a folder into your repo... |
26215625 | `--name` option doesn't work with `git submodule add` command | 44 | 2014-10-06 11:49:49 | <p>I want to add a git submodule with different name like:</p>
<pre><code>git submodule add --name foo git@bitbucket.org:ironsand/cookbook-foo.git
</code></pre>
<p>I wanted to create a git submodule directory named <code>foo</code>, but the repository are created with the name <code>cookbook-foo</code>.</p>
<p>Most ... | 42,336 | 1,536,527 | 2025-11-25 15:46:57 | 26,219,506 | 91 | 2014-10-06 15:24:35 | 2,541,573 | 2025-11-25 15:46:57 | https://stackoverflow.com/q/26215625 | https://stackoverflow.com/a/26219506 | <p>Don't conflate the <em>path</em> and the <em>name</em> of a submodule. You want to run:</p>
<pre><code>git submodule add git@bitbucket.org:ironsand/cookbook-foo.git foo/
</code></pre>
<p>instead. For more details, see the <a href="https://git-scm.com/docs/git-submodule" rel="nofollow noreferrer"><code>git-submodule<... | <p>Don't conflate the <em>path</em> and the <em>name</em> of a submodule. You want to run:</p> <pre><code>git submodule add git@bitbucket.org:ironsand/cookbook-foo.git foo/ </code></pre> <p>instead. For more details, see the <a href="https://git-scm.com/docs/git-submodule" rel="nofollow noreferrer"><code>git-submodule<... | 119, 41612 | git, git-submodules | <h1>`--name` option doesn't work with `git submodule add` command</h1>
<p>I want to add a git submodule with different name like:</p>
<pre><code>git submodule add --name foo git@bitbucket.org:ironsand/cookbook-foo.git
</code></pre>
<p>I wanted to create a git submodule directory named <code>foo</code>, but the reposi... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,138 | git | # `--name` option doesn't work with `git submodule add` command
I want to add a git submodule with different name like:
```
git submodule add --name foo git@bitbucket.org:ironsand/cookbook-foo.git
```
I wanted to create a git submodule directory named `foo`, but the repository are created with the name `cookbook-foo... | Don't conflate the *path* and the *name* of a submodule. You want to run:
```
git submodule add git@bitbucket.org:ironsand/cookbook-foo.git foo/
```
instead. For more details, see the [`git-submodule`](https://git-scm.com/docs/git-submodule) man page; the relevant `git-submodule` syntax here is:
```
git submodule ad... |
17336895 | git pull: replace local version with the remote version | 40 | 2013-06-27 07:16:11 | <p>There is something I don't understand with the <code>git pull</code> command.
I have a <code>foobar</code> Git repository with two files, named <code>f1</code> and <code>f2</code>.
First, I clone this repo using this command: </p>
<pre><code>git clone git@mycompany:foobar/foobar.git
</code></pre>
<p>I make some w... | 51,838 | 1,632,809 | 2019-05-02 14:37:45 | 17,336,942 | 91 | 2013-06-27 07:19:01 | 337,251 | 2013-06-27 07:30:23 | https://stackoverflow.com/q/17336895 | https://stackoverflow.com/a/17336942 | <pre><code>git fetch origin
git reset --hard origin/master
</code></pre>
<p>Here is the good explanation about git pull <a href="http://www.atlassian.com/git/tutorial/remote-repositories#!pull">git pull</a></p>
<p>The <code>git fetch</code> command imports commits from a remote repository into your local repo. The re... | <pre><code>git fetch origin git reset --hard origin/master </code></pre> <p>Here is the good explanation about git pull <a href="http://www.atlassian.com/git/tutorial/remote-repositories#!pull">git pull</a></p> <p>The <code>git fetch</code> command imports commits from a remote repository into your local repo. The re... | 119 | git | <h1>git pull: replace local version with the remote version</h1>
<p>There is something I don't understand with the <code>git pull</code> command.
I have a <code>foobar</code> Git repository with two files, named <code>f1</code> and <code>f2</code>.
First, I clone this repo using this command: </p>
<pre><code>git clone... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,140 | git | # git pull: replace local version with the remote version
There is something I don't understand with the `git pull` command.
I have a `foobar` Git repository with two files, named `f1` and `f2`.
First, I clone this repo using this command:
```
git clone git@mycompany:foobar/foobar.git
```
I make some wrong modificat... | ```
git fetch origin
git reset --hard origin/master
```
Here is the good explanation about git pull [git pull](http://www.atlassian.com/git/tutorial/remote-repositories#!pull)
The `git fetch` command imports commits from a remote repository into your local repo. The resulting commits are stored as remote branches ins... |
18748942 | Why is git looking inside vendors directory? | 38 | 2013-09-11 18:45:20 | <p>I have the .gitignore file with this code:</p>
<pre><code>/app/cache/*
/app/logs/*
/app/bootstrap*
/vendor/*
/web/bundles/
/app/config/parameters.yml
</code></pre>
<p>but when I do :</p>
<pre><code>$ git status
</code></pre>
<p>in any situation (before and after add and commit), I get a long text output like thi... | 32,485 | 2,571,840 | 2015-08-28 06:22:18 | 18,751,052 | 91 | 2013-09-11 20:52:08 | 1,860,929 | 2015-08-04 07:23:40 | https://stackoverflow.com/q/18748942 | https://stackoverflow.com/a/18751052 | <p>Your vendor directory is checked in to the repo. To remove it, go to your git repo root and run:</p>
<pre><code>git rm -r --cached vendor
</code></pre>
<p>This will recursively (due to <code>-r</code> flag) remove vendor from your git repo. The <code>--cached</code> flag will keep the local copy of vendor director... | <p>Your vendor directory is checked in to the repo. To remove it, go to your git repo root and run:</p> <pre><code>git rm -r --cached vendor </code></pre> <p>This will recursively (due to <code>-r</code> flag) remove vendor from your git repo. The <code>--cached</code> flag will keep the local copy of vendor director... | 12, 119, 25056 | git, gitignore, ruby | <h1>Why is git looking inside vendors directory?</h1>
<p>I have the .gitignore file with this code:</p>
<pre><code>/app/cache/*
/app/logs/*
/app/bootstrap*
/vendor/*
/web/bundles/
/app/config/parameters.yml
</code></pre>
<p>but when I do :</p>
<pre><code>$ git status
</code></pre>
<p>in any situation (before and af... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,141 | git | # Why is git looking inside vendors directory?
I have the .gitignore file with this code:
```
/app/cache/*
/app/logs/*
/app/bootstrap*
/vendor/*
/web/bundles/
/app/config/parameters.yml
```
but when I do :
```
$ git status
```
in any situation (before and after add and commit), I get a long text output like this:
... | Your vendor directory is checked in to the repo. To remove it, go to your git repo root and run:
```
git rm -r --cached vendor
```
This will recursively (due to `-r` flag) remove vendor from your git repo. The `--cached` flag will keep the local copy of vendor directory in tact. Note that if there are other devs work... |
13627598 | How do I get git diff with full context? | 176 | 2012-11-29 14:09:48 | <p>How do I create a patch with full context?</p>
<p>I tried <code>--unified=2000</code>, which gives 2000 lines of context:</p>
<pre><code>git diff --unified=2000 branch master --no-prefix > patch
</code></pre>
<p>How do I include all the lines in the file without having to specify the maximum number of lines?</p>
| 87,421 | 463,758 | 2024-12-12 20:09:25 | 40,683,517 | 90 | 2016-11-18 18:11:03 | 3,900,436 | 2016-11-22 17:36:44 | https://stackoverflow.com/q/13627598 | https://stackoverflow.com/a/40683517 | <p>I know this is old, but I also dislike hard-coded solutions, so I tested this:</p>
<pre><code>git diff -U$(wc -l MYFILE)
</code></pre>
<p>Using -U seems to be the only way to approach the issue, but using a line count promises that it will work for even a small change in a very large file.</p>
| <p>I know this is old, but I also dislike hard-coded solutions, so I tested this:</p> <pre><code>git diff -U$(wc -l MYFILE) </code></pre> <p>Using -U seems to be the only way to approach the issue, but using a line count promises that it will work for even a small change in a very large file.</p> | 119, 606, 9033 | diff, git, git-diff | <h1>How do I get git diff with full context?</h1>
<p>How do I create a patch with full context?</p>
<p>I tried <code>--unified=2000</code>, which gives 2000 lines of context:</p>
<pre><code>git diff --unified=2000 branch master --no-prefix > patch
</code></pre>
<p>How do I include all the lines in the file without h... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,142 | git | # How do I get git diff with full context?
How do I create a patch with full context?
I tried `--unified=2000`, which gives 2000 lines of context:
```
git diff --unified=2000 branch master --no-prefix > patch
```
How do I include all the lines in the file without having to specify the maximum number of lines? | I know this is old, but I also dislike hard-coded solutions, so I tested this:
```
git diff -U$(wc -l MYFILE)
```
Using -U seems to be the only way to approach the issue, but using a line count promises that it will work for even a small change in a very large file. |
5303496 | How to change a git submodule to point to a subfolder? | 158 | 2011-03-14 19:34:20 | <p>Skimming through <a href="https://git.wiki.kernel.org/index.php/GitSubmoduleTutorial">the SubModule tutorial</a>, I created a submodule out of the <a href="https://github.com/boto/boto">boto project</a>. Then, I discovered that I actually need only a subset of this project - specifically, the <a href="https://github... | 114,681 | 11,236 | 2023-06-14 07:20:21 | 5,303,850 | 90 | 2011-03-14 20:05:30 | 223,092 | 2013-09-18 15:29:21 | https://stackoverflow.com/q/5303496 | https://stackoverflow.com/a/5303850 | <p>I'm afraid the URL for submodules always just points to the repository - you can't specify that you only want a subfolder of a repository, in the same way that git doesn't support "narrow clones" in general.</p>
<p>If you can't live with having the whole repository as a submodule, you could always create a new repo... | <p>I'm afraid the URL for submodules always just points to the repository - you can't specify that you only want a subfolder of a repository, in the same way that git doesn't support "narrow clones" in general.</p> <p>If you can't live with having the whole repository as a submodule, you could always create a new repo... | 119, 41612 | git, git-submodules | <h1>How to change a git submodule to point to a subfolder?</h1>
<p>Skimming through <a href="https://git.wiki.kernel.org/index.php/GitSubmoduleTutorial">the SubModule tutorial</a>, I created a submodule out of the <a href="https://github.com/boto/boto">boto project</a>. Then, I discovered that I actually need only a su... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,143 | git | # How to change a git submodule to point to a subfolder?
Skimming through [the SubModule tutorial](https://git.wiki.kernel.org/index.php/GitSubmoduleTutorial), I created a submodule out of the [boto project](https://github.com/boto/boto). Then, I discovered that I actually need only a subset of this project - specific... | I'm afraid the URL for submodules always just points to the repository - you can't specify that you only want a subfolder of a repository, in the same way that git doesn't support "narrow clones" in general.
If you can't live with having the whole repository as a submodule, you could always create a new repository tha... |
5408475 | Moving a git repository up one hierarchy level | 101 | 2011-03-23 16:26:07 | <p>Git beginner question:</p>
<p>I have a small private webproject which is versioned locally with msysgit. There is no exterior repository, as it's only for me, so i can bascially do whatever I want.</p>
<p>I've had this set up in the project directory, ie in "webroot".</p>
<p>Now a second directory had to be creat... | 43,637 | 252,276 | 2018-02-10 16:25:17 | 5,408,577 | 90 | 2011-03-23 16:34:04 | 63,147 | 2011-03-26 13:22:46 | https://stackoverflow.com/q/5408475 | https://stackoverflow.com/a/5408577 | <p>So, you want your git repo to look like this:</p>
<pre><code><projectdir>
/.git
/webroot
/assets
</code></pre>
<p>To do this, you must move the existing files <em>in your repo</em> into a new <code>webroot</code> subdirectory.</p>
<pre><code>cd <git repo root>
mkdir webroot
git mv <all ... | <p>So, you want your git repo to look like this:</p> <pre><code><projectdir> /.git /webroot /assets </code></pre> <p>To do this, you must move the existing files <em>in your repo</em> into a new <code>webroot</code> subdirectory.</p> <pre><code>cd <git repo root> mkdir webroot git mv <all ... | 119, 7330, 9684 | git, hierarchy, repository | <h1>Moving a git repository up one hierarchy level</h1>
<p>Git beginner question:</p>
<p>I have a small private webproject which is versioned locally with msysgit. There is no exterior repository, as it's only for me, so i can bascially do whatever I want.</p>
<p>I've had this set up in the project directory, ie in "... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,144 | git | # Moving a git repository up one hierarchy level
Git beginner question:
I have a small private webproject which is versioned locally with msysgit. There is no exterior repository, as it's only for me, so i can bascially do whatever I want.
I've had this set up in the project directory, ie in "webroot".
Now a second... | So, you want your git repo to look like this:
```
<projectdir>
/.git
/webroot
/assets
```
To do this, you must move the existing files *in your repo* into a new `webroot` subdirectory.
```
cd <git repo root>
mkdir webroot
git mv <all your files> webroot
git commit --all -m "moved all existing files to ne... |
3144647 | git: show all files changed between two commits | 90 | 2010-06-29 20:54:15 | <p>A riff on <a href="https://stackoverflow.com/questions/1552340/git-show-all-changed-files-between-two-commits" title="git: show all changed files between two commits">git: show all changed files between two commits</a>: I want a listing of all files that have been changed between two commits, even if they are now th... | 61,886 | 379,428 | 2023-06-28 12:56:58 | 3,144,810 | 90 | 2010-06-29 21:15:32 | 289,985 | 2010-06-30 20:36:28 | https://stackoverflow.com/q/3144647 | https://stackoverflow.com/a/3144810 | <p>This is the best I could come up with:</p>
<pre><code>git log --name-only --pretty=oneline --full-index HEAD^^..HEAD | grep -vE '^[0-9a-f]{40} ' | sort | uniq
</code></pre>
<p>Replace HEAD^^ and HEAD with the commits you want to compare.</p>
<p>My attempt uses <code>git log</code> with <code>--name-only</code> to... | <p>This is the best I could come up with:</p> <pre><code>git log --name-only --pretty=oneline --full-index HEAD^^..HEAD | grep -vE '^[0-9a-f]{40} ' | sort | uniq </code></pre> <p>Replace HEAD^^ and HEAD with the commits you want to compare.</p> <p>My attempt uses <code>git log</code> with <code>--name-only</code> to... | 119 | git | <h1>git: show all files changed between two commits</h1>
<p>A riff on <a href="https://stackoverflow.com/questions/1552340/git-show-all-changed-files-between-two-commits" title="git: show all changed files between two commits">git: show all changed files between two commits</a>: I want a listing of all files that have ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,145 | git | # git: show all files changed between two commits
A riff on [git: show all changed files between two commits](https://stackoverflow.com/questions/1552340/git-show-all-changed-files-between-two-commits "git: show all changed files between two commits"): I want a listing of all files that have been changed between two c... | This is the best I could come up with:
```
git log --name-only --pretty=oneline --full-index HEAD^^..HEAD | grep -vE '^[0-9a-f]{40} ' | sort | uniq
```
Replace HEAD^^ and HEAD with the commits you want to compare.
My attempt uses `git log` with `--name-only` to list all files of each commit between the specified one... |
5856521 | git rebase --continue and --stepback? | 83 | 2011-05-02 11:22:59 | <p>Is there a way to step back a commit during an interactive rebase?</p>
| 35,762 | 1,277,510 | 2024-06-30 18:42:27 | 32,517,325 | 90 | 2015-09-11 06:53:18 | 393,010 | 2023-10-03 08:55:58 | https://stackoverflow.com/q/5856521 | https://stackoverflow.com/a/32517325 | <p>Yes there is. How to step back during an interactive rebase:</p>
<ol>
<li>Get the commit hash of your current HEAD, for example with <code>git rev-parse HEAD</code></li>
<li>run <code>git rebase --edit-todo</code></li>
<li>insert a pick with that hash to the top of that file <code>pick <hash from step 1></code... | <p>Yes there is. How to step back during an interactive rebase:</p> <ol> <li>Get the commit hash of your current HEAD, for example with <code>git rev-parse HEAD</code></li> <li>run <code>git rebase --edit-todo</code></li> <li>insert a pick with that hash to the top of that file <code>pick <hash from step 1></code... | 119 | git | <h1>git rebase --continue and --stepback?</h1>
<p>Is there a way to step back a commit during an interactive rebase?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,146 | git | # git rebase --continue and --stepback?
Is there a way to step back a commit during an interactive rebase? | Yes there is. How to step back during an interactive rebase:
1. Get the commit hash of your current HEAD, for example with `git rev-parse HEAD`
2. run `git rebase --edit-todo`
3. insert a pick with that hash to the top of that file `pick <hash from step 1>`
4. run `git reset --hard HEAD^` (this is a hard reset so if y... |
21476167 | When I do "git push", what do the statistics mean? (Total, delta, etc.) | 83 | 2014-01-31 09:14:31 | <p>Here is an example:</p>
<pre><code>$ git push -u myserver master
Counting objects: 22, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (14/14), done.
Writing objects: 100% (14/14), 1.89 KiB | 0 bytes/s, done.
Total 14 (delta 10), reused 0 (delta 0)
To myserver.com:git/myrepo.git
ed46414.... | 33,057 | 1,286,417 | 2016-09-16 09:59:23 | 21,484,013 | 90 | 2014-01-31 15:42:14 | 3,253,277 | 2015-01-06 15:56:41 | https://stackoverflow.com/q/21476167 | https://stackoverflow.com/a/21484013 | <h2>Short answer</h2>
<p>This is merely the output of the git command <code>git count-objects -v</code> for the push (the same command is called for output when <code>gc</code>, <code>pull</code> and <code>clone</code>). More info in the man pages : <a href="http://git-scm.com/docs/git-count-objects">git-count-objects... | <h2>Short answer</h2> <p>This is merely the output of the git command <code>git count-objects -v</code> for the push (the same command is called for output when <code>gc</code>, <code>pull</code> and <code>clone</code>). More info in the man pages : <a href="http://git-scm.com/docs/git-count-objects">git-count-objects... | 119, 28898 | git, git-push | <h1>When I do "git push", what do the statistics mean? (Total, delta, etc.)</h1>
<p>Here is an example:</p>
<pre><code>$ git push -u myserver master
Counting objects: 22, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (14/14), done.
Writing objects: 100% (14/14), 1.89 KiB | 0 bytes/s, done.
T... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,147 | git | # When I do "git push", what do the statistics mean? (Total, delta, etc.)
Here is an example:
```
$ git push -u myserver master
Counting objects: 22, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (14/14), done.
Writing objects: 100% (14/14), 1.89 KiB | 0 bytes/s, done.
Total 14 (delta 10), ... | ## Short answer
This is merely the output of the git command `git count-objects -v` for the push (the same command is called for output when `gc`, `pull` and `clone`). More info in the man pages : [git-count-objects(1)](http://git-scm.com/docs/git-count-objects).
```
$ git count-objects -v
...
size: 14 # The "Compres... |
21358872 | Git: Cannot rebase because of uncommitted changes | 58 | 2014-01-26 02:24:06 | <p>Git won't let me rebase from anywhere.</p>
<pre><code>Cannot rebase: Your index contains uncommitted changes.
Please commit or stash them.
</code></pre>
<p>Following the instructions from <a href="https://stackoverflow.com/a/13694625/618450">this answer</a>:</p>
<pre><code>$ git update-index -q --ignore-submodules -... | 108,853 | 618,450 | 2020-12-01 14:35:59 | 21,358,988 | 90 | 2014-01-26 02:42:14 | 1,781,706 | 2020-11-30 20:49:49 | https://stackoverflow.com/q/21358872 | https://stackoverflow.com/a/21358988 | <p><code>git stash</code> stores the different files away from everything else, returning your working directory to the last commit. Once you have done your rebase, run <code>git stash pop</code>. This will return those files to the working directory and allow you to work as before.</p>
<p>EDIT: A good link for learnin... | <p><code>git stash</code> stores the different files away from everything else, returning your working directory to the last commit. Once you have done your rebase, run <code>git stash pop</code>. This will return those files to the working directory and allow you to work as before.</p> <p>EDIT: A good link for learnin... | 119, 29934 | git, git-rebase | <h1>Git: Cannot rebase because of uncommitted changes</h1>
<p>Git won't let me rebase from anywhere.</p>
<pre><code>Cannot rebase: Your index contains uncommitted changes.
Please commit or stash them.
</code></pre>
<p>Following the instructions from <a href="https://stackoverflow.com/a/13694625/618450">this answer</a>:... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,149 | git | # Git: Cannot rebase because of uncommitted changes
Git won't let me rebase from anywhere.
```
Cannot rebase: Your index contains uncommitted changes.
Please commit or stash them.
```
Following the instructions from [this answer](https://stackoverflow.com/a/13694625/618450):
```
$ git update-index -q --ignore-submo... | `git stash` stores the different files away from everything else, returning your working directory to the last commit. Once you have done your rebase, run `git stash pop`. This will return those files to the working directory and allow you to work as before.
EDIT: A good link for learning all about the `git stash` com... |
14369378 | How to make git ignore a directory while merging | 55 | 2013-01-16 22:52:19 | <p>As interesting and useful as the answer to <a href="https://stackoverflow.com/questions/3111515/how-to-setup-a-git-driver-to-ignore-a-folder-on-merge">How to setup a git driver to ignore a folder on merge</a> was, it did not answer the original question which still has me stumped.</p>
<p>Unlike the question linked ... | 35,914 | 1,985,322 | 2020-12-02 08:34:46 | 14,369,793 | 90 | 2013-01-16 23:29:24 | 606,723 | 2015-09-16 21:42:14 | https://stackoverflow.com/q/14369378 | https://stackoverflow.com/a/14369793 | <p>I don't actually use Git, but I think this would work for your case:</p>
<p>Use something like what's specified here: <a href="https://gist.github.com/564416" rel="noreferrer">https://gist.github.com/564416</a></p>
<pre><code>git checkout master
git merge --no-commit --no-ff development
git reset -- /path/to/f... | <p>I don't actually use Git, but I think this would work for your case:</p> <p>Use something like what's specified here: <a href="https://gist.github.com/564416" rel="noreferrer">https://gist.github.com/564416</a></p> <pre><code>git checkout master git merge --no-commit --no-ff development git reset -- /path/to/f... | 119, 717 | git, merge | <h1>How to make git ignore a directory while merging</h1>
<p>As interesting and useful as the answer to <a href="https://stackoverflow.com/questions/3111515/how-to-setup-a-git-driver-to-ignore-a-folder-on-merge">How to setup a git driver to ignore a folder on merge</a> was, it did not answer the original question which... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,150 | git | # How to make git ignore a directory while merging
As interesting and useful as the answer to [How to setup a git driver to ignore a folder on merge](https://stackoverflow.com/questions/3111515/how-to-setup-a-git-driver-to-ignore-a-folder-on-merge) was, it did not answer the original question which still has me stumpe... | I don't actually use Git, but I think this would work for your case:
Use something like what's specified here: <https://gist.github.com/564416>
```
git checkout master
git merge --no-commit --no-ff development
git reset -- /path/to/folder # revert updates from path
git commit
```
Again, I don't use git, I am jus... |
34850831 | Change git email for previous commits | 48 | 2016-01-18 09:05:36 | <p>So I read a lot about how to change previous commit's email address but for some reason mine is not updating.</p>
<p>I did like 40 commits to my private repo with my local email (nameofMyComputer@kevin.local) which is bad since this email is not associated(and it can't be) with Github.</p>
<p>I then remembered that ... | 32,861 | 4,481,287 | 2023-01-25 19:27:29 | 34,863,275 | 90 | 2016-01-18 20:13:31 | 2,082,964 | 2016-01-18 20:13:31 | https://stackoverflow.com/q/34850831 | https://stackoverflow.com/a/34863275 | <p>You can indeed do his for many commits at once like this:</p>
<pre><code>git rebase -i HEAD~40 -x "git commit --amend --author 'Author Name <author.name@mail.com>' --no-edit"
</code></pre>
<p>I worked this out better in <a href="https://stackoverflow.com/a/31669789/2082964">this answer</a>.</p>
| <p>You can indeed do his for many commits at once like this:</p> <pre><code>git rebase -i HEAD~40 -x "git commit --amend --author 'Author Name <author.name@mail.com>' --no-edit" </code></pre> <p>I worked this out better in <a href="https://stackoverflow.com/a/31669789/2082964">this answer</a>.</p> | 119, 53850, 91259 | git, git-commit, git-rewrite-history | <h1>Change git email for previous commits</h1>
<p>So I read a lot about how to change previous commit's email address but for some reason mine is not updating.</p>
<p>I did like 40 commits to my private repo with my local email (nameofMyComputer@kevin.local) which is bad since this email is not associated(and it can't ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,152 | git | # Change git email for previous commits
So I read a lot about how to change previous commit's email address but for some reason mine is not updating.
I did like 40 commits to my private repo with my local email (nameofMyComputer@kevin.local) which is bad since this email is not associated(and it can't be) with Github... | You can indeed do his for many commits at once like this:
```
git rebase -i HEAD~40 -x "git commit --amend --author 'Author Name <author.name@mail.com>' --no-edit"
```
I worked this out better in [this answer](https://stackoverflow.com/a/31669789/2082964). |
14753603 | Shortcuts for git commands | 47 | 2013-02-07 14:34:42 | <p>I would like to use shortcuts or aliases for git commands. </p>
<pre><code>git diff
git status
git push
git pull
git stash
git branch -a
</code></pre>
<p>How do I create shortcuts or aliases, is there a predefined list?</p>
| 59,948 | 253,714 | 2025-12-31 00:02:21 | 14,753,646 | 90 | 2013-02-07 14:36:44 | 1,117,668 | 2013-02-07 14:36:44 | https://stackoverflow.com/q/14753603 | https://stackoverflow.com/a/14753646 | <p>Put this into your <code>.gitconfig</code></p>
<pre><code>[alias]
st = status
ci = commit
br = branch
co = checkout
</code></pre>
<p>You can add as much as you want</p>
| <p>Put this into your <code>.gitconfig</code></p> <pre><code>[alias] st = status ci = commit br = branch co = checkout </code></pre> <p>You can add as much as you want</p> | 119 | git | <h1>Shortcuts for git commands</h1>
<p>I would like to use shortcuts or aliases for git commands. </p>
<pre><code>git diff
git status
git push
git pull
git stash
git branch -a
</code></pre>
<p>How do I create shortcuts or aliases, is there a predefined list?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,153 | git | # Shortcuts for git commands
I would like to use shortcuts or aliases for git commands.
```
git diff
git status
git push
git pull
git stash
git branch -a
```
How do I create shortcuts or aliases, is there a predefined list? | Put this into your `.gitconfig`
```
[alias]
st = status
ci = commit
br = branch
co = checkout
```
You can add as much as you want |
28485686 | Android Studio git check in author name | 46 | 2015-02-12 19:03:55 | <p>I use Android Studio with Bitbucket(over Git) for my repositories. I generally get the author name on the revision history as my name (not my Bitbucket username). When I installed Android Studio in a new computer and pushed for the first time, it showed a dialog asking for Git Username and email.
Now all my check in... | 55,284 | 177,890 | 2019-08-07 14:08:26 | 28,488,184 | 90 | 2015-02-12 21:32:43 | 147,024 | 2015-02-12 21:32:43 | https://stackoverflow.com/q/28485686 | https://stackoverflow.com/a/28488184 | <p>I don't think there is any UI for changing this in Android Studio, but you can change this from the command line:</p>
<pre><code>git config user.name <your user name>
git config user.email <your email>
</code></pre>
<p>Add --global if you want this to apply to all Git repositories on your machine.</p>
| <p>I don't think there is any UI for changing this in Android Studio, but you can change this from the command line:</p> <pre><code>git config user.name <your user name> git config user.email <your email> </code></pre> <p>Add --global if you want this to apply to all Git repositories on your machine.</p> | 119, 456, 8945, 91905 | android-studio, git, intellij-idea, version-control | <h1>Android Studio git check in author name</h1>
<p>I use Android Studio with Bitbucket(over Git) for my repositories. I generally get the author name on the revision history as my name (not my Bitbucket username). When I installed Android Studio in a new computer and pushed for the first time, it showed a dialog askin... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,154 | git | # Android Studio git check in author name
I use Android Studio with Bitbucket(over Git) for my repositories. I generally get the author name on the revision history as my name (not my Bitbucket username). When I installed Android Studio in a new computer and pushed for the first time, it showed a dialog asking for Git... | I don't think there is any UI for changing this in Android Studio, but you can change this from the command line:
```
git config user.name <your user name>
git config user.email <your email>
```
Add --global if you want this to apply to all Git repositories on your machine. |
11879287 | Export git with version history | 46 | 2012-08-09 08:16:18 | <p>I need to export a git repository content and import it in a target repository. I know of two alternatives to do it, but they do not solve my problem</p>
<p>a) Add the source repository as a remote and do a merge to the target. I cannot use this as both repositories are not on the same network</p>
<p>b) Use git ar... | 36,172 | 426,329 | 2022-11-11 03:44:36 | 11,896,597 | 90 | 2012-08-10 06:35:30 | 1,036,728 | 2012-08-10 06:35:30 | https://stackoverflow.com/q/11879287 | https://stackoverflow.com/a/11896597 | <p><code>git bundle</code> is provided for this exact purpose.</p>
<p><strong>Example:</strong></p>
<ol>
<li><p>Bundle your source repository in its entirety</p>
<p><code>git bundle create my_repo.bundle --all</code></p></li>
<li><p>Take ``my_repo.bundle'' to where your target is</p></li>
<li><p>From your target, lo... | <p><code>git bundle</code> is provided for this exact purpose.</p> <p><strong>Example:</strong></p> <ol> <li><p>Bundle your source repository in its entirety</p> <p><code>git bundle create my_repo.bundle --all</code></p></li> <li><p>Take ``my_repo.bundle'' to where your target is</p></li> <li><p>From your target, lo... | 119 | git | <h1>Export git with version history</h1>
<p>I need to export a git repository content and import it in a target repository. I know of two alternatives to do it, but they do not solve my problem</p>
<p>a) Add the source repository as a remote and do a merge to the target. I cannot use this as both repositories are not ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,155 | git | # Export git with version history
I need to export a git repository content and import it in a target repository. I know of two alternatives to do it, but they do not solve my problem
a) Add the source repository as a remote and do a merge to the target. I cannot use this as both repositories are not on the same netw... | `git bundle` is provided for this exact purpose.
**Example:**
1. Bundle your source repository in its entirety
`git bundle create my_repo.bundle --all`
2. Take ``my_repo.bundle'' to where your target is
3. From your target, load up your source commit objects
`git bundle unbundle my_repo.bundle`
...from wh... |
14517440 | How to add .gitignore file into Xcode project | 44 | 2013-01-25 07:41:11 | <p>When making sure that iPhone project could be installed as an exact copy into a brand new computer via version control (git), I just realized that <strong>.gitignore</strong> file was missing. Added under version control, but now would like to add that file also <strong>into Xcode project</strong> for easy viewing a... | 47,502 | 113,079 | 2023-09-25 04:40:17 | 14,517,564 | 90 | 2013-01-25 07:51:22 | 1,218,876 | 2018-01-28 13:08:58 | https://stackoverflow.com/q/14517440 | https://stackoverflow.com/a/14517564 | <ol>
<li>When the open panel is showing, press <code>Command-Shift-.</code> and the hidden files will appear, including <code>.gitignore</code>. </li>
<li>Select the <code>.gitignore</code> file and press the Add button.</li>
</ol>
<p>This works in any app, not just Xcode. <a href="https://cocoadev.github.io/ShowingHi... | <ol> <li>When the open panel is showing, press <code>Command-Shift-.</code> and the hidden files will appear, including <code>.gitignore</code>. </li> <li>Select the <code>.gitignore</code> file and press the Add button.</li> </ol> <p>This works in any app, not just Xcode. <a href="https://cocoadev.github.io/ShowingHi... | 908, 25056, 57052 | gitignore, hidden-files, xcode | <h1>How to add .gitignore file into Xcode project</h1>
<p>When making sure that iPhone project could be installed as an exact copy into a brand new computer via version control (git), I just realized that <strong>.gitignore</strong> file was missing. Added under version control, but now would like to add that file also... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,156 | git | # How to add .gitignore file into Xcode project
When making sure that iPhone project could be installed as an exact copy into a brand new computer via version control (git), I just realized that **.gitignore** file was missing. Added under version control, but now would like to add that file also **into Xcode project*... | 1. When the open panel is showing, press `Command-Shift-.` and the hidden files will appear, including `.gitignore`.
2. Select the `.gitignore` file and press the Add button.
This works in any app, not just Xcode. [It's an obscure feature of `NSOpenPanel`](https://cocoadev.github.io/ShowingHiddenFilesInAnNSOpenPanel/)... |
6090732 | Delete files from git index when they are already deleted from fs | 44 | 2011-05-22 20:57:24 | <p>I have a bunch of files deleted from the fs and listed as deleted in <code>git status</code>.</p>
<p>How can I stage this changes faster then running <code>git rm</code> for each file?</p>
| 20,245 | 91,610 | 2024-10-22 15:11:25 | 6,090,778 | 90 | 2011-05-22 21:05:37 | 223,092 | 2011-05-22 21:24:41 | https://stackoverflow.com/q/6090732 | https://stackoverflow.com/a/6090778 | <p>You can do this with:</p>
<pre><code>git ls-files --deleted -z | xargs -0 git rm
</code></pre>
<p>Whenever this question is asked, people suggest <code>git add -u</code>, but the problem with that answer is that it also stages other modifications in your working copy, not just deletions. That might be OK in many ... | <p>You can do this with:</p> <pre><code>git ls-files --deleted -z | xargs -0 git rm </code></pre> <p>Whenever this question is asked, people suggest <code>git add -u</code>, but the problem with that answer is that it also stages other modifications in your working copy, not just deletions. That might be OK in many ... | 99, 119 | filesystems, git | <h1>Delete files from git index when they are already deleted from fs</h1>
<p>I have a bunch of files deleted from the fs and listed as deleted in <code>git status</code>.</p>
<p>How can I stage this changes faster then running <code>git rm</code> for each file?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,157 | git | # Delete files from git index when they are already deleted from fs
I have a bunch of files deleted from the fs and listed as deleted in `git status`.
How can I stage this changes faster then running `git rm` for each file? | You can do this with:
```
git ls-files --deleted -z | xargs -0 git rm
```
Whenever this question is asked, people suggest `git add -u`, but the problem with that answer is that it also stages other modifications in your working copy, not just deletions. That might be OK in many situations, but if you want to just sta... |
32630379 | git: Your branch and 'origin/somebranch' have diverged - how to throw away local commits | 29 | 2015-09-17 12:32:12 | <p>I have a question that most closely matches my problem was made, but could not add a comment.</p>
<p><a href="https://stackoverflow.com/questions/19864934/git-your-branch-and-origin-master-have-diverged-how-to-throw-away-local-com">git: Your branch and 'origin/master' have diverged - how to throw away local... | 76,663 | 5,269,166 | 2024-01-05 15:25:17 | 32,630,762 | 90 | 2015-09-17 12:51:45 | 216,074 | 2015-09-17 12:51:45 | https://stackoverflow.com/q/32630379 | https://stackoverflow.com/a/32630762 | <blockquote>
<p>Your branch and 'origin / processos_criminais_151029' have diverged</p>
</blockquote>
<p>So of course, resetting to <code>origin/master</code> will not work. You will have to reset to that remote branch in order to reset your local branch to it.</p>
<p>So the commands you need to run are this:</p>
... | <blockquote> <p>Your branch and 'origin / processos_criminais_151029' have diverged</p> </blockquote> <p>So of course, resetting to <code>origin/master</code> will not work. You will have to reset to that remote branch in order to reset your local branch to it.</p> <p>So the commands you need to run are this:</p> ... | 119, 51381, 53850 | git, git-commit, git-reset | <h1>git: Your branch and 'origin/somebranch' have diverged - how to throw away local commits</h1>
<p>I have a question that most closely matches my problem was made, but could not add a comment.</p>
<p><a href="https://stackoverflow.com/questions/19864934/git-your-branch-and-origin-master-have-diverged-how-to-throw-aw... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,158 | git | # git: Your branch and 'origin/somebranch' have diverged - how to throw away local commits
I have a question that most closely matches my problem was made, but could not add a comment.
[git: Your branch and 'origin/master' have diverged - how to throw away local commits?](https://stackoverflow.com/questions/19864934/... | > Your branch and 'origin / processos_criminais_151029' have diverged
So of course, resetting to `origin/master` will not work. You will have to reset to that remote branch in order to reset your local branch to it.
So the commands you need to run are this:
```
git fetch origin
git reset --hard origin/processos_crim... |
17333531 | How can I display the current branch and folder path in terminal? | 168 | 2013-06-27 02:20:55 | <p>I've been watching some of the Team Treehouse videos and they have a very nice looking terminal when working with Git.</p>
<p>For example they have (something similar):</p>
<pre><code>mike@treehouseMac: [/Work/test - feature-branch-name] $ git add .
mike@treehouseMac: [/Work/test - feature-branch-name] $ git commi... | 299,748 | 1,575,153 | 2026-01-22 19:03:39 | 17,334,317 | 89 | 2013-06-27 04:02:57 | 641,955 | 2013-07-06 15:30:48 | https://stackoverflow.com/q/17333531 | https://stackoverflow.com/a/17334317 | <p>It's not about a plugin. It's about prompt tricks in the shell. </p>
<p>For a cool setup in bash, check out the <code>dotfiles</code> project of this guy:</p>
<p><a href="https://github.com/mathiasbynens/dotfiles">https://github.com/mathiasbynens/dotfiles</a></p>
<p>To get a fancy prompt, include the <code>.bash_... | <p>It's not about a plugin. It's about prompt tricks in the shell. </p> <p>For a cool setup in bash, check out the <code>dotfiles</code> project of this guy:</p> <p><a href="https://github.com/mathiasbynens/dotfiles">https://github.com/mathiasbynens/dotfiles</a></p> <p>To get a fancy prompt, include the <code>.bash_... | 119, 369, 391, 76220 | git, git-branch, macos, terminal | <h1>How can I display the current branch and folder path in terminal?</h1>
<p>I've been watching some of the Team Treehouse videos and they have a very nice looking terminal when working with Git.</p>
<p>For example they have (something similar):</p>
<pre><code>mike@treehouseMac: [/Work/test - feature-branch-name] $ ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,159 | git | # How can I display the current branch and folder path in terminal?
I've been watching some of the Team Treehouse videos and they have a very nice looking terminal when working with Git.
For example they have (something similar):
```
mike@treehouseMac: [/Work/test - feature-branch-name] $ git add .
mike@treehouseMac... | It's not about a plugin. It's about prompt tricks in the shell.
For a cool setup in bash, check out the `dotfiles` project of this guy:
<https://github.com/mathiasbynens/dotfiles>
To get a fancy prompt, include the `.bash_prompt` in your `~/.bash_profile` or `~/.bashrc`.
To get the exact same prompt as in your ques... |
2475831 | Merging: Hg/Git vs. SVN | 144 | 2010-03-19 08:18:57 | <p>I often read that Hg (and Git and...) are better at merging than SVN but I have never seen practical examples of where Hg/Git can merge something where SVN fails (or where SVN needs manual intervention). Could you post a few step-by-step lists of branch/modify/commit/...-operations that show where SVN would fail whi... | 24,355 | 276,010 | 2018-08-13 11:54:17 | 2,477,089 | 89 | 2010-03-19 12:14:33 | 46,058 | 2018-08-13 11:54:17 | https://stackoverflow.com/q/2475831 | https://stackoverflow.com/a/2477089 | <p>I do not use Subversion myself, but from the <a href="http://subversion.apache.org/docs/release-notes/1.5.html#merge-tracking" rel="nofollow noreferrer">release notes for Subversion 1.5: Merge tracking (foundational)</a> it looks like there are the following differences from how merge tracking work in full-<a href="... | <p>I do not use Subversion myself, but from the <a href="http://subversion.apache.org/docs/release-notes/1.5.html#merge-tracking" rel="nofollow noreferrer">release notes for Subversion 1.5: Merge tracking (foundational)</a> it looks like there are the following differences from how merge tracking work in full-<a href="... | 63, 119, 717, 802, 3346 | dvcs, git, mercurial, merge, svn | <h1>Merging: Hg/Git vs. SVN</h1>
<p>I often read that Hg (and Git and...) are better at merging than SVN but I have never seen practical examples of where Hg/Git can merge something where SVN fails (or where SVN needs manual intervention). Could you post a few step-by-step lists of branch/modify/commit/...-operations t... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,161 | git | # Merging: Hg/Git vs. SVN
I often read that Hg (and Git and...) are better at merging than SVN but I have never seen practical examples of where Hg/Git can merge something where SVN fails (or where SVN needs manual intervention). Could you post a few step-by-step lists of branch/modify/commit/...-operations that show ... | I do not use Subversion myself, but from the [release notes for Subversion 1.5: Merge tracking (foundational)](http://subversion.apache.org/docs/release-notes/1.5.html#merge-tracking) it looks like there are the following differences from how merge tracking work in full-[DAG](https://en.wikipedia.org/wiki/Directed_acyc... |
771897 | Selectively revert or checkout changes to a file in Git? | 99 | 2009-04-21 09:59:11 | <p>Is there a command that allows you to partially undo the changes to a file (or files) in the working directory?</p>
<p>Suppose you have edited a file a lot but you realize that you want to undo some of the changes back to the committed state, but not the other changes.</p>
<p>I'm envisioning an option for <code>gi... | 38,818 | 3,146 | 2024-01-19 22:48:43 | 772,045 | 89 | 2009-04-21 10:56:53 | 19,563 | 2024-01-19 22:48:43 | https://stackoverflow.com/q/771897 | https://stackoverflow.com/a/772045 | <p>You could use</p>
<pre><code>git add -p <path>
</code></pre>
<p>to stage the chunks that you want to keep in a particular file, then</p>
<pre><code>git checkout -- <path>
</code></pre>
<p>to discard the working tree changes that you didn't want to keep, by checking out the staged version of the file.</p>... | <p>You could use</p> <pre><code>git add -p <path> </code></pre> <p>to stage the chunks that you want to keep in a particular file, then</p> <pre><code>git checkout -- <path> </code></pre> <p>to discard the working tree changes that you didn't want to keep, by checking out the staged version of the file.</p>... | 119 | git | <h1>Selectively revert or checkout changes to a file in Git?</h1>
<p>Is there a command that allows you to partially undo the changes to a file (or files) in the working directory?</p>
<p>Suppose you have edited a file a lot but you realize that you want to undo some of the changes back to the committed state, but not... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,162 | git | # Selectively revert or checkout changes to a file in Git?
Is there a command that allows you to partially undo the changes to a file (or files) in the working directory?
Suppose you have edited a file a lot but you realize that you want to undo some of the changes back to the committed state, but not the other chang... | You could use
```
git add -p <path>
```
to stage the chunks that you want to keep in a particular file, then
```
git checkout -- <path>
```
to discard the working tree changes that you didn't want to keep, by checking out the staged version of the file.
Finally, you can use
```
git reset -- <path>
```
to revert ... |
1128496 | To get a prompt which indicates Git-branch in Zsh | 96 | 2009-07-14 22:47:17 | <p>I run the following codes separately as my prompt unsuccessfully in .zshrc. This suggests me that apparently I do not have a program called __git_ps1. It is not in MacPorts.</p>
<h2>#1</h2>
<pre><code>PROMPT="$(__git_ps1 " \[\033[1;32m\] (%s)\[\033[0m\]")\$"$
</code></pre>
<h2>#2</h2>
<pre><code>PROMPT="$(__git_... | 102,375 | 54,964 | 2024-07-31 21:58:01 | 1,128,583 | 89 | 2009-07-14 23:10:33 | 131,097 | 2021-11-19 13:07:15 | https://stackoverflow.com/q/1128496 | https://stackoverflow.com/a/1128583 | <p><code>__git_ps1</code> is from git-completion.bash. In zsh you probably have to provide your own function to determine the current directories git branch. There are quite a few <a href="http://www.jukie.net/%7Ebart/blog/zsh-git-prompt" rel="noreferrer">blog posts</a> about a <a href="http://nullcreations.net/entries... | <p><code>__git_ps1</code> is from git-completion.bash. In zsh you probably have to provide your own function to determine the current directories git branch. There are quite a few <a href="http://www.jukie.net/%7Ebart/blog/zsh-git-prompt" rel="noreferrer">blog posts</a> about a <a href="http://nullcreations.net/entries... | 119, 3791, 5003 | git, prompt, zsh | <h1>To get a prompt which indicates Git-branch in Zsh</h1>
<p>I run the following codes separately as my prompt unsuccessfully in .zshrc. This suggests me that apparently I do not have a program called __git_ps1. It is not in MacPorts.</p>
<h2>#1</h2>
<pre><code>PROMPT="$(__git_ps1 " \[\033[1;32m\] (%s)\[\033[0m\]")\... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,163 | git | # To get a prompt which indicates Git-branch in Zsh
I run the following codes separately as my prompt unsuccessfully in .zshrc. This suggests me that apparently I do not have a program called __git_ps1. It is not in MacPorts.
## #1
```
PROMPT="$(__git_ps1 " \[\033[1;32m\] (%s)\[\033[0m\]")\$"$
```
## #2
```
PROMPT... | `__git_ps1` is from git-completion.bash. In zsh you probably have to provide your own function to determine the current directories git branch. There are quite a few [blog posts](http://www.jukie.net/%7Ebart/blog/zsh-git-prompt) about a [git prompt](http://nullcreations.net/entries/general/zsh-prompt-to-show-git-branch... |
3107789 | Using git, how do you reset the working tree (local file system state) to the state of the index ("staged" files)? | 86 | 2010-06-24 06:54:13 | <p>Situation:</p>
<ol>
<li>Edit files</li>
<li>Add files to the index with <code>git add</code> (these files are now "staged")</li>
<li>Edit more files</li>
</ol>
<p>Now we have three different states: the state of <code>HEAD</code> (which points to the last commit), the state of the index (which includes all... | 52,318 | 374,953 | 2025-07-31 20:24:43 | 3,107,870 | 89 | 2010-06-24 07:10:18 | 19,563 | 2010-06-24 07:10:18 | https://stackoverflow.com/q/3107789 | https://stackoverflow.com/a/3107870 | <p>I tend to use <code>git checkout .</code> which discards all changes from the working directory down. This makes a difference if you're not at the root of the repository.</p>
<p>This command doesn't remove newly created files which is usually a good thing. If you need to do this then you can use <code>git clean</co... | <p>I tend to use <code>git checkout .</code> which discards all changes from the working directory down. This makes a difference if you're not at the root of the repository.</p> <p>This command doesn't remove newly created files which is usually a good thing. If you need to do this then you can use <code>git clean</co... | 119 | git | <h1>Using git, how do you reset the working tree (local file system state) to the state of the index ("staged" files)?</h1>
<p>Situation:</p>
<ol>
<li>Edit files</li>
<li>Add files to the index with <code>git add</code> (these files are now "staged")</li>
<li>Edit more files</li>
</ol>
<p>Now we have three di... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,164 | git | # Using git, how do you reset the working tree (local file system state) to the state of the index ("staged" files)?
Situation:
1. Edit files
2. Add files to the index with `git add` (these files are now "staged")
3. Edit more files
Now we have three different states: the state of `HEAD` (which points to the last co... | I tend to use `git checkout .` which discards all changes from the working directory down. This makes a difference if you're not at the root of the repository.
This command doesn't remove newly created files which is usually a good thing. If you need to do this then you can use `git clean` as well. |
5581857 | Git and the Umlaut problem on Mac OS X | 74 | 2011-04-07 13:27:59 | <p>Today I discovered a bug for Git on Mac OS X. </p>
<p>For example, I will commit a file with the name überschrift.txt with the German special character Ü at the beginning. From the command <code>git status</code> I get following output.</p>
<pre><code>Users-iMac: user$ git status
On branch master
# Untr... | 19,655 | 411,951 | 2022-07-12 10:00:17 | 15,553,796 | 89 | 2013-03-21 17:06:38 | 2,196,172 | 2022-07-12 10:00:17 | https://stackoverflow.com/q/5581857 | https://stackoverflow.com/a/15553796 | <p>Enable core.precomposeunicode on the mac</p>
<pre><code>git config --global core.precomposeunicode true
</code></pre>
<p>For this to work, you need to have at least Git 1.8.2.</p>
<p>Mountain Lion ships with 1.7.5. To get a newer git either use <a href="https://code.google.com/archive/p/git-osx-installer" rel="nofol... | <p>Enable core.precomposeunicode on the mac</p> <pre><code>git config --global core.precomposeunicode true </code></pre> <p>For this to work, you need to have at least Git 1.8.2.</p> <p>Mountain Lion ships with 1.7.5. To get a newer git either use <a href="https://code.google.com/archive/p/git-osx-installer" rel="nofol... | 81, 119, 369 | git, macos, versioning | <h1>Git and the Umlaut problem on Mac OS X</h1>
<p>Today I discovered a bug for Git on Mac OS X. </p>
<p>For example, I will commit a file with the name überschrift.txt with the German special character Ü at the beginning. From the command <code>git status</code> I get following output.</p>
<pre><code>Users... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,166 | git | # Git and the Umlaut problem on Mac OS X
Today I discovered a bug for Git on Mac OS X.
For example, I will commit a file with the name überschrift.txt with the German special character Ü at the beginning. From the command `git status` I get following output.
```
Users-iMac: user$ git status
On branch master
# Untra... | Enable core.precomposeunicode on the mac
```
git config --global core.precomposeunicode true
```
For this to work, you need to have at least Git 1.8.2.
Mountain Lion ships with 1.7.5. To get a newer git either use [git-osx-installer](https://code.google.com/archive/p/git-osx-installer "dd") or [homebrew](https://bre... |
6626136 | Best Practice for Adding .gitignore to Repo | 74 | 2011-07-08 14:44:59 | <p>What is the best practice regarding the <em>.gitignore</em> file with Git; should it be excluded from the repository or included? If it's conditional, what are the conditions for each circumstance?</p>
| 28,440 | 561,624 | 2013-03-15 12:57:32 | 6,626,178 | 89 | 2011-07-08 14:47:41 | 229,044 | 2013-03-15 12:57:32 | https://stackoverflow.com/q/6626136 | https://stackoverflow.com/a/6626178 | <p>They should almost always be included, as their purpose is to ignore "output" files (compiled binaries, log files) which are going to be generated by anybody working with a clone of your project. They're meant to be version-controlled and included with the repository.</p>
<p>You should not use <code>.gitignore</cod... | <p>They should almost always be included, as their purpose is to ignore "output" files (compiled binaries, log files) which are going to be generated by anybody working with a clone of your project. They're meant to be version-controlled and included with the repository.</p> <p>You should not use <code>.gitignore</cod... | 119, 25056 | git, gitignore | <h1>Best Practice for Adding .gitignore to Repo</h1>
<p>What is the best practice regarding the <em>.gitignore</em> file with Git; should it be excluded from the repository or included? If it's conditional, what are the conditions for each circumstance?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,167 | git | # Best Practice for Adding .gitignore to Repo
What is the best practice regarding the *.gitignore* file with Git; should it be excluded from the repository or included? If it's conditional, what are the conditions for each circumstance? | They should almost always be included, as their purpose is to ignore "output" files (compiled binaries, log files) which are going to be generated by anybody working with a clone of your project. They're meant to be version-controlled and included with the repository.
You should not use `.gitignore` files within the r... |
25095061 | How can I get a list of Git branches that I've recently checked out? | 58 | 2014-08-02 12:30:54 | <p>When moving between Git branches I sometimes forget the name of a branch I was recently on. How can I display a list of recently checked out branches/tags/commits <strong>in order of checkout</strong>?</p>
| 17,748 | 58,876 | 2022-06-23 08:36:27 | 25,095,062 | 89 | 2014-08-02 12:30:54 | 58,876 | 2019-12-20 21:35:56 | https://stackoverflow.com/q/25095061 | https://stackoverflow.com/a/25095062 | <h3>Summary:</h3>
<p>You can use Git's <code>reflog</code> to show recent movements <strong>in order of checkout</strong>: <code>git reflog</code></p>
<h3>Script:</h3>
<p>Here's a script you can download and use via <code>git recent</code> from inside any Git repository: <a href="https://gist.github.com/jordan-broug... | <h3>Summary:</h3> <p>You can use Git's <code>reflog</code> to show recent movements <strong>in order of checkout</strong>: <code>git reflog</code></p> <h3>Script:</h3> <p>Here's a script you can download and use via <code>git recent</code> from inside any Git repository: <a href="https://gist.github.com/jordan-broug... | 119, 37230, 76220 | git, git-branch, git-checkout | <h1>How can I get a list of Git branches that I've recently checked out?</h1>
<p>When moving between Git branches I sometimes forget the name of a branch I was recently on. How can I display a list of recently checked out branches/tags/commits <strong>in order of checkout</strong>?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,170 | git | # How can I get a list of Git branches that I've recently checked out?
When moving between Git branches I sometimes forget the name of a branch I was recently on. How can I display a list of recently checked out branches/tags/commits **in order of checkout**? | ### Summary:
You can use Git's `reflog` to show recent movements **in order of checkout**: `git reflog`
### Script:
Here's a script you can download and use via `git recent` from inside any Git repository: <https://gist.github.com/jordan-brough/48e2803c0ffa6dc2e0bd>
### Usage:
```
$ (master) git recent -n 5
1) ma... |
25906192 | git ls-files in bare repository | 54 | 2014-09-18 06:58:25 | <p>I want to access a bare git repository, and I want to list all files in the repository.</p>
<p>On a normal git repository I can easily do that by running <code>git ls-files</code>. </p>
<p>Example output:</p>
<pre><code>$ git ls-files
README.md
file1.js
file2.js
file3.js
folder1/file4.js
folder2/file5.js
</code><... | 18,858 | 109,305 | 2025-02-15 23:44:56 | 25,906,261 | 89 | 2014-09-18 07:02:51 | 6,309 | 2014-09-18 07:02:51 | https://stackoverflow.com/q/25906192 | https://stackoverflow.com/a/25906261 | <p>You can try the other command which list files:</p>
<pre><code>git ls-tree --full-tree -r HEAD
</code></pre>
<p>According <a href="https://stackoverflow.com/questions/8533202/list-files-in-local-git-repo#comment39711737_14406253">to this comment</a>, the command <a href="http://git-scm.com/docs/git-ls-tree" rel="n... | <p>You can try the other command which list files:</p> <pre><code>git ls-tree --full-tree -r HEAD </code></pre> <p>According <a href="https://stackoverflow.com/questions/8533202/list-files-in-local-git-repo#comment39711737_14406253">to this comment</a>, the command <a href="http://git-scm.com/docs/git-ls-tree" rel="n... | 119, 64465, 107030 | git, git-bare, git-ls-files | <h1>git ls-files in bare repository</h1>
<p>I want to access a bare git repository, and I want to list all files in the repository.</p>
<p>On a normal git repository I can easily do that by running <code>git ls-files</code>. </p>
<p>Example output:</p>
<pre><code>$ git ls-files
README.md
file1.js
file2.js
file3.js
f... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,172 | git | # git ls-files in bare repository
I want to access a bare git repository, and I want to list all files in the repository.
On a normal git repository I can easily do that by running `git ls-files`.
Example output:
```
$ git ls-files
README.md
file1.js
file2.js
file3.js
folder1/file4.js
folder2/file5.js
```
In a bar... | You can try the other command which list files:
```
git ls-tree --full-tree -r HEAD
```
According [to this comment](https://stackoverflow.com/questions/8533202/list-files-in-local-git-repo#comment39711737_14406253), the command [git ls-tree](http://git-scm.com/docs/git-ls-tree) works in **[bare repo](https://stackove... |
14125385 | Git "revert" current directory | 53 | 2013-01-02 16:17:58 | <p>In Subversion (SVN), it's possible to do <code>svn revert ./*</code> in which the current directory and <em>only</em> the current directory gets reverted.</p>
<p>What is the Git equivalent to <code>svn revert</code> in which only the current directory gets reverted?</p>
<p>I know that there's <code>git reset --hard<... | 70,872 | 841,626 | 2022-06-05 13:29:58 | 14,125,472 | 89 | 2013-01-02 16:23:09 | 1,093,528 | 2022-05-14 20:56:05 | https://stackoverflow.com/q/14125385 | https://stackoverflow.com/a/14125472 | <p>Like <a href="https://stackoverflow.com/questions/14125385/git-revert-current-directory#comment19553456_14125385">vcsjones says</a>, the solution here is <code>git checkout</code>:</p>
<pre><code>git checkout <refspec> -- path/to/directory # or path/to/file
</code></pre>
<p>where <code><refspec></code> ... | <p>Like <a href="https://stackoverflow.com/questions/14125385/git-revert-current-directory#comment19553456_14125385">vcsjones says</a>, the solution here is <code>git checkout</code>:</p> <pre><code>git checkout <refspec> -- path/to/directory # or path/to/file </code></pre> <p>where <code><refspec></code> ... | 119, 456, 12309, 12626, 37230 | git, git-checkout, reset, revert, version-control | <h1>Git "revert" current directory</h1>
<p>In Subversion (SVN), it's possible to do <code>svn revert ./*</code> in which the current directory and <em>only</em> the current directory gets reverted.</p>
<p>What is the Git equivalent to <code>svn revert</code> in which only the current directory gets reverted?</p>
<p>I k... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,173 | git | # Git "revert" current directory
In Subversion (SVN), it's possible to do `svn revert ./*` in which the current directory and *only* the current directory gets reverted.
What is the Git equivalent to `svn revert` in which only the current directory gets reverted?
I know that there's `git reset --hard`, but it revert... | Like [vcsjones says](https://stackoverflow.com/questions/14125385/git-revert-current-directory#comment19553456_14125385), the solution here is `git checkout`:
```
git checkout <refspec> -- path/to/directory # or path/to/file
```
where `<refspec>` can, for instance, be `HEAD`, that is, the current working commit. Not... |
5354682 | How can I fix a reverted git commit? | 50 | 2011-03-18 16:04:53 | <p>I've committed a bunch of changes to a repository, and they were reverted by someone else (they compile on windows but not on linux). I think that the changes are still in the history, but how can I get those changes back, fix them, and then resubmit?</p>
| 39,899 | 21,981 | 2022-10-05 14:08:48 | 5,354,692 | 89 | 2011-03-18 16:06:06 | 636,626 | 2016-04-08 07:51:35 | https://stackoverflow.com/q/5354682 | https://stackoverflow.com/a/5354692 | <p>Have you tried reverting the revert?</p>
<p>They reverted your commit using</p>
<pre><code>git revert <your commit id>
</code></pre>
<p>The revert itself is a commit and has its own commit id. So now you need to do</p>
<pre><code>git revert <the commit id of his revert-commit>
</code></pre>
| <p>Have you tried reverting the revert?</p> <p>They reverted your commit using</p> <pre><code>git revert <your commit id> </code></pre> <p>The revert itself is a commit and has its own commit id. So now you need to do</p> <pre><code>git revert <the commit id of his revert-commit> </code></pre> | 119, 5597 | commit, git | <h1>How can I fix a reverted git commit?</h1>
<p>I've committed a bunch of changes to a repository, and they were reverted by someone else (they compile on windows but not on linux). I think that the changes are still in the history, but how can I get those changes back, fix them, and then resubmit?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,176 | git | # How can I fix a reverted git commit?
I've committed a bunch of changes to a repository, and they were reverted by someone else (they compile on windows but not on linux). I think that the changes are still in the history, but how can I get those changes back, fix them, and then resubmit? | Have you tried reverting the revert?
They reverted your commit using
```
git revert <your commit id>
```
The revert itself is a commit and has its own commit id. So now you need to do
```
git revert <the commit id of his revert-commit>
``` |
20229222 | How to resolve ALL conflicts using HEAD, with any mergetool | 45 | 2013-11-26 22:21:35 | <p>So for some reason I'm getting a lot of conflicts with a new merged hotfix. The file that was actually [manually] changed has no conflict.
All the conflicts are in files that were untouched during the fix and apparently its an issue with whitespaces. I'll try to figure that problem later but now I need to merge the ... | 72,512 | 845,169 | 2018-09-13 12:36:41 | 20,229,324 | 89 | 2013-11-26 22:28:10 | 751,061 | 2013-11-26 22:51:53 | https://stackoverflow.com/q/20229222 | https://stackoverflow.com/a/20229324 | <pre><code>git merge -Xours origin/master
</code></pre>
<p>will do a merge with <code>origin/master</code> (the same thing that <code>git pull origin master</code> does) and will resolve any conflicts by taking the versions from your local branch.</p>
<p>If you're already part-way through the bad merge, you can reset... | <pre><code>git merge -Xours origin/master </code></pre> <p>will do a merge with <code>origin/master</code> (the same thing that <code>git pull origin master</code> does) and will resolve any conflicts by taking the versions from your local branch.</p> <p>If you're already part-way through the bad merge, you can reset... | 119, 28897, 66176 | git, git-merge, opendiff | <h1>How to resolve ALL conflicts using HEAD, with any mergetool</h1>
<p>So for some reason I'm getting a lot of conflicts with a new merged hotfix. The file that was actually [manually] changed has no conflict.
All the conflicts are in files that were untouched during the fix and apparently its an issue with whitespace... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,178 | git | # How to resolve ALL conflicts using HEAD, with any mergetool
So for some reason I'm getting a lot of conflicts with a new merged hotfix. The file that was actually [manually] changed has no conflict.
All the conflicts are in files that were untouched during the fix and apparently its an issue with whitespaces. I'll t... | ```
git merge -Xours origin/master
```
will do a merge with `origin/master` (the same thing that `git pull origin master` does) and will resolve any conflicts by taking the versions from your local branch.
If you're already part-way through the bad merge, you can reset everything to the head first with `git reset --h... |
15027873 | Untrack and stop tracking files in git | 44 | 2013-02-22 15:44:22 | <p>I have a deep subfolder called <code>objects</code> with files called <code>*.object</code> which I don't want tracked by git (Windows).</p>
<p>In .gitignore I have tried various combinations (e.g. <code>**/objects/*</code> or <code>**/objects/*</code> etc.) to no avail: each time, when I do <code>git status</code>... | 60,763 | 279,255 | 2013-02-22 16:10:55 | 15,028,424 | 89 | 2013-02-22 16:10:55 | 279,255 | 2013-02-22 16:10:55 | https://stackoverflow.com/q/15027873 | https://stackoverflow.com/a/15028424 | <p>OK, though wildcards don't work (in Windows apparently) it seems one can remove a whole folder with:</p>
<pre><code>git rm -r --cached "path/to/foo/"
</code></pre>
<p>I understand that --cached only unstages - you have to <code>git commit</code> to remove them from the repo.</p>
| <p>OK, though wildcards don't work (in Windows apparently) it seems one can remove a whole folder with:</p> <pre><code>git rm -r --cached "path/to/foo/" </code></pre> <p>I understand that --cached only unstages - you have to <code>git commit</code> to remove them from the repo.</p> | 119 | git | <h1>Untrack and stop tracking files in git</h1>
<p>I have a deep subfolder called <code>objects</code> with files called <code>*.object</code> which I don't want tracked by git (Windows).</p>
<p>In .gitignore I have tried various combinations (e.g. <code>**/objects/*</code> or <code>**/objects/*</code> etc.) to no ava... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,179 | git | # Untrack and stop tracking files in git
I have a deep subfolder called `objects` with files called `*.object` which I don't want tracked by git (Windows).
In .gitignore I have tried various combinations (e.g. `**/objects/*` or `**/objects/*` etc.) to no avail: each time, when I do `git status` I see:
```
# Untracke... | OK, though wildcards don't work (in Windows apparently) it seems one can remove a whole folder with:
```
git rm -r --cached "path/to/foo/"
```
I understand that --cached only unstages - you have to `git commit` to remove them from the repo. |
8813249 | Git submodules: specify a specific SHA? | 35 | 2012-01-11 02:02:56 | <p>I'm referencing a git submodule in my project, and now need to reference a specific SHA in the target git repo.</p>
<pre><code># .gitmodules
[submodule "vendor/plugins/ssl_requirement"]
path = vendor/plugins/ssl_requirement
url = git://github.com/retr0h/ssl_requirement.git
</code></pre>
<p>The SHA I want is <c... | 36,884 | 365,950 | 2012-01-11 02:04:52 | 8,813,266 | 89 | 2012-01-11 02:04:52 | 582 | 2012-01-11 02:04:52 | https://stackoverflow.com/q/8813249 | https://stackoverflow.com/a/8813266 | <p>Submodules, by definition, always reference particular SHA1 in the subproject. That SHA1 isn't expressed in the <code>.gitmodules</code> file, but is instead expressed as the entry in the tree object that contains the submodule. The way you set this in git is by <code>cd</code>ing into the submodule, checking out th... | <p>Submodules, by definition, always reference particular SHA1 in the subproject. That SHA1 isn't expressed in the <code>.gitmodules</code> file, but is instead expressed as the entry in the tree object that contains the submodule. The way you set this in git is by <code>cd</code>ing into the submodule, checking out th... | 119, 41612 | git, git-submodules | <h1>Git submodules: specify a specific SHA?</h1>
<p>I'm referencing a git submodule in my project, and now need to reference a specific SHA in the target git repo.</p>
<pre><code># .gitmodules
[submodule "vendor/plugins/ssl_requirement"]
path = vendor/plugins/ssl_requirement
url = git://github.com/retr0h/ssl_requi... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,180 | git | # Git submodules: specify a specific SHA?
I'm referencing a git submodule in my project, and now need to reference a specific SHA in the target git repo.
```
# .gitmodules
[submodule "vendor/plugins/ssl_requirement"]
path = vendor/plugins/ssl_requirement
url = git://github.com/retr0h/ssl_requirement.git
```
The ... | Submodules, by definition, always reference particular SHA1 in the subproject. That SHA1 isn't expressed in the `.gitmodules` file, but is instead expressed as the entry in the tree object that contains the submodule. The way you set this in git is by `cd`ing into the submodule, checking out the SHA1 you want, then `cd... |
51436934 | Git Extensions stored wrong credentials | 33 | 2018-07-20 07:06:22 | <p>My username and password were stored somewhere in internals of Git Extensions. After some time it was necessary to give username and password again and I gave wrong pass many times.</p>
<p>Now if I want to pull something etc. I receive <code>fatal: Authentication failed</code>. I cannot give new password, it seems ... | 66,449 | 502,950 | 2024-01-10 08:36:55 | 51,437,252 | 89 | 2018-07-20 07:26:53 | 717,372 | 2024-01-10 08:36:55 | https://stackoverflow.com/q/51436934 | https://stackoverflow.com/a/51437252 | <p>GitExtensions doesn't store any passwords.</p>
<p>They are stored by git or, more exactly, by "git credential manager" that stores them inside windows.</p>
<p>Search for <a href="https://support.microsoft.com/windows/accessing-credential-manager-1b5c916a-6a16-889f-8581-fc16e8165ac0" rel="noreferrer">Creden... | <p>GitExtensions doesn't store any passwords.</p> <p>They are stored by git or, more exactly, by "git credential manager" that stores them inside windows.</p> <p>Search for <a href="https://support.microsoft.com/windows/accessing-credential-manager-1b5c916a-6a16-889f-8581-fc16e8165ac0" rel="noreferrer">Creden... | 119, 39597 | git, git-extensions | <h1>Git Extensions stored wrong credentials</h1>
<p>My username and password were stored somewhere in internals of Git Extensions. After some time it was necessary to give username and password again and I gave wrong pass many times.</p>
<p>Now if I want to pull something etc. I receive <code>fatal: Authentication fai... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,181 | git | # Git Extensions stored wrong credentials
My username and password were stored somewhere in internals of Git Extensions. After some time it was necessary to give username and password again and I gave wrong pass many times.
Now if I want to pull something etc. I receive `fatal: Authentication failed`. I cannot give n... | GitExtensions doesn't store any passwords.
They are stored by git or, more exactly, by "git credential manager" that stores them inside windows.
Search for [Credential manager](https://support.microsoft.com/windows/accessing-credential-manager-1b5c916a-6a16-889f-8581-fc16e8165ac0)* in the start menu and you should fi... |
7650797 | How to stash only unstaged changes in Git? | 444 | 2011-10-04 16:05:04 | <p>I would like to use this workflow:</p>
<ol>
<li>Stage some changes.</li>
<li>Save the unstaged changes to the stash.</li>
<li>Do some stuff with the things in stage (build, test, etc.).</li>
<li>Commit.</li>
<li>Restore the unstaged changes.</li>
</ol>
<p>Is there a way to do step 2?</p>
<p>Example:</p>
<pre><code>g... | 134,227 | 461,597 | 2024-06-06 03:21:56 | 71,222,518 | 88 | 2022-02-22 13:53:01 | 1,599,633 | 2023-10-15 12:52:59 | https://stackoverflow.com/q/7650797 | https://stackoverflow.com/a/71222518 | <p>From Git 2.35+ (Q1 2022) you can now use the <code>--staged</code> flag (<a href="https://git-scm.com/docs/git-stash" rel="noreferrer">man</a>) on <code>git stash push</code> to only stash the changes <strong>in your index</strong>.</p>
<p>Since your question asks the exact opposite, we have 2 choices:</p>
<ol>
<li>... | <p>From Git 2.35+ (Q1 2022) you can now use the <code>--staged</code> flag (<a href="https://git-scm.com/docs/git-stash" rel="noreferrer">man</a>) on <code>git stash push</code> to only stash the changes <strong>in your index</strong>.</p> <p>Since your question asks the exact opposite, we have 2 choices:</p> <ol> <li>... | 119, 13091 | git, git-stash | <h1>How to stash only unstaged changes in Git?</h1>
<p>I would like to use this workflow:</p>
<ol>
<li>Stage some changes.</li>
<li>Save the unstaged changes to the stash.</li>
<li>Do some stuff with the things in stage (build, test, etc.).</li>
<li>Commit.</li>
<li>Restore the unstaged changes.</li>
</ol>
<p>Is there ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,182 | git | # How to stash only unstaged changes in Git?
I would like to use this workflow:
1. Stage some changes.
2. Save the unstaged changes to the stash.
3. Do some stuff with the things in stage (build, test, etc.).
4. Commit.
5. Restore the unstaged changes.
Is there a way to do step 2?
Example:
```
git init
echo one >f... | From Git 2.35+ (Q1 2022) you can now use the `--staged` flag ([man](https://git-scm.com/docs/git-stash)) on `git stash push` to only stash the changes **in your index**.
Since your question asks the exact opposite, we have 2 choices:
1. Reverse the operation like so:
```
git stash push --staged # Stash st... |
29517440 | Is there some kind of 'git rebase --dry-run', which would notify me of conflicts in advance? | 121 | 2015-04-08 14:23:44 | <p>I'm trying to script rebasing and my script will take different paths depending on if the rebase results in any conflicts.</p>
<p>Is there a way to determine if a rebase would result in conflicts before executing the rebase?</p>
| 40,835 | 2,295,034 | 2023-09-15 09:12:38 | 33,054,740 | 88 | 2015-10-10 13:55:34 | 2,541,573 | 2023-08-30 15:05:16 | https://stackoverflow.com/q/29517440 | https://stackoverflow.com/a/33054740 | <p>At the time of writing this (Git <del>v2.6.1</del> <strong>v2.10.0</strong>), the <code>git rebase</code> command offers no <code>--dry-run</code> option. There is no way of knowing, before actually attempting a rebase, whether or not you're going to run into conflicts.</p>
<p>However, if you run <code>git rebase</c... | <p>At the time of writing this (Git <del>v2.6.1</del> <strong>v2.10.0</strong>), the <code>git rebase</code> command offers no <code>--dry-run</code> option. There is no way of knowing, before actually attempting a rebase, whether or not you're going to run into conflicts.</p> <p>However, if you run <code>git rebase</c... | 119, 29934, 106113 | git, git-merge-conflict, git-rebase | <h1>Is there some kind of 'git rebase --dry-run', which would notify me of conflicts in advance?</h1>
<p>I'm trying to script rebasing and my script will take different paths depending on if the rebase results in any conflicts.</p>
<p>Is there a way to determine if a rebase would result in conflicts before executing t... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,184 | git | # Is there some kind of 'git rebase --dry-run', which would notify me of conflicts in advance?
I'm trying to script rebasing and my script will take different paths depending on if the rebase results in any conflicts.
Is there a way to determine if a rebase would result in conflicts before executing the rebase? | At the time of writing this (Git ~~v2.6.1~~ **v2.10.0**), the `git rebase` command offers no `--dry-run` option. There is no way of knowing, before actually attempting a rebase, whether or not you're going to run into conflicts.
However, if you run `git rebase` and hit a conflict, the process will stop and exit with a... |
47113509 | git branch is not showing all the branches | 64 | 2017-11-04 17:30:50 | <pre><code>/opt/lampp/htdocs/drupal-8.4.0$ git branch
</code></pre>
<p>I have installed drupal in my system ,I want to switch to other branch but when used git branch is not showing other branches !</p>
| 216,850 | 8,886,331 | 2023-08-23 14:47:14 | 47,206,980 | 88 | 2017-11-09 16:30:29 | 3,886,995 | 2019-06-29 22:20:47 | https://stackoverflow.com/q/47113509 | https://stackoverflow.com/a/47206980 | <p>Execute <code>git branch -av</code> to show all remote and local branches.</p>
| <p>Execute <code>git branch -av</code> to show all remote and local branches.</p> | 119 | git | <h1>git branch is not showing all the branches</h1>
<pre><code>/opt/lampp/htdocs/drupal-8.4.0$ git branch
</code></pre>
<p>I have installed drupal in my system ,I want to switch to other branch but when used git branch is not showing other branches !</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,188 | git | # git branch is not showing all the branches
```
/opt/lampp/htdocs/drupal-8.4.0$ git branch
```
I have installed drupal in my system ,I want to switch to other branch but when used git branch is not showing other branches ! | Execute `git branch -av` to show all remote and local branches. |
1839606 | Delete a svn-Branch via git? | 64 | 2009-12-03 12:30:31 | <p>I'am using git as scm of choice but have to use a svn-repo. I can create a svn-remote-branch like this:</p>
<pre><code>git svn branch the_branch
</code></pre>
<p>But how can i delete the remote branch?</p>
| 15,111 | 78,598 | 2018-01-30 06:36:13 | 1,839,809 | 88 | 2009-12-03 13:18:06 | 24,478 | 2014-02-19 14:52:06 | https://stackoverflow.com/q/1839606 | https://stackoverflow.com/a/1839809 | <p>Currently, it is not possible to delete an SVN branch using git-svn. But it is easy to delete the branch using SVN, without even having to check it out. So simply type </p>
<pre><code>svn rm $URL/branches/the_branch
</code></pre>
<p>Please note that deleting a Subversion branch does not cause it to be deleted fr... | <p>Currently, it is not possible to delete an SVN branch using git-svn. But it is easy to delete the branch using SVN, without even having to check it out. So simply type </p> <pre><code>svn rm $URL/branches/the_branch </code></pre> <p>Please note that deleting a Subversion branch does not cause it to be deleted fr... | 119, 6452 | git, git-svn | <h1>Delete a svn-Branch via git?</h1>
<p>I'am using git as scm of choice but have to use a svn-repo. I can create a svn-remote-branch like this:</p>
<pre><code>git svn branch the_branch
</code></pre>
<p>But how can i delete the remote branch?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,189 | git | # Delete a svn-Branch via git?
I'am using git as scm of choice but have to use a svn-repo. I can create a svn-remote-branch like this:
```
git svn branch the_branch
```
But how can i delete the remote branch? | Currently, it is not possible to delete an SVN branch using git-svn. But it is easy to delete the branch using SVN, without even having to check it out. So simply type
```
svn rm $URL/branches/the_branch
```
Please note that deleting a Subversion branch does not cause it to be deleted from the git-svn repository. (Th... |
2974106 | How to lookup the latest git commit hash from an ant build script | 58 | 2010-06-04 12:33:15 | <p>How can I lookup the latest git commit hash from an ant build script?</p>
<p>I am currently working on a new open source project which I store on github. I would like to extend my existing ANT build file to allow me to create numbered builds. I am imagining that I would launch the build with something like "ant bui... | 25,610 | 325,129 | 2025-01-08 15:32:04 | 4,059,546 | 88 | 2010-10-30 16:21:03 | 491,884 | 2013-02-21 22:47:07 | https://stackoverflow.com/q/2974106 | https://stackoverflow.com/a/4059546 | <p>I wrote the following ant target for a project on github. Usage:</p>
<ul>
<li>stores version in property "repository.version"</li>
<li>works if no git is installed or no .git directory is present (fallback)</li>
<li>other targets must depend on this target if they need the git version</li>
<li>only one git command ... | <p>I wrote the following ant target for a project on github. Usage:</p> <ul> <li>stores version in property "repository.version"</li> <li>works if no git is installed or no .git directory is present (fallback)</li> <li>other targets must depend on this target if they need the git version</li> <li>only one git command ... | 119, 142 | ant, git | <h1>How to lookup the latest git commit hash from an ant build script</h1>
<p>How can I lookup the latest git commit hash from an ant build script?</p>
<p>I am currently working on a new open source project which I store on github. I would like to extend my existing ANT build file to allow me to create numbered builds... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,190 | git | # How to lookup the latest git commit hash from an ant build script
How can I lookup the latest git commit hash from an ant build script?
I am currently working on a new open source project which I store on github. I would like to extend my existing ANT build file to allow me to create numbered builds. I am imagining... | I wrote the following ant target for a project on github. Usage:
- stores version in property "repository.version"
- works if no git is installed or no .git directory is present (fallback)
- other targets must depend on this target if they need the git version
- only one git command gets executed (--always)
---
```
... |
14778460 | Git stash apply and drop | 56 | 2013-02-08 17:51:20 | <p>Is there a git command that both applies the stash and removes it?</p>
<p>This as one command: </p>
<pre><code>git stash apply
git stash drop
</code></pre>
| 17,376 | 537,998 | 2013-02-08 17:54:30 | 14,778,512 | 88 | 2013-02-08 17:54:30 | 1,200 | 2013-02-08 17:54:30 | https://stackoverflow.com/q/14778460 | https://stackoverflow.com/a/14778512 | <p>You want <a href="https://www.kernel.org/pub/software/scm/git/docs/git-stash.html" rel="noreferrer"><code>git stash pop</code></a>!</p>
<pre><code>pop [--index] [-q|--quiet] [<stash>]
Remove a single stashed state from the stash list and apply it on
top of the current working tree state, i.e., d... | <p>You want <a href="https://www.kernel.org/pub/software/scm/git/docs/git-stash.html" rel="noreferrer"><code>git stash pop</code></a>!</p> <pre><code>pop [--index] [-q|--quiet] [<stash>] Remove a single stashed state from the stash list and apply it on top of the current working tree state, i.e., d... | 119 | git | <h1>Git stash apply and drop</h1>
<p>Is there a git command that both applies the stash and removes it?</p>
<p>This as one command: </p>
<pre><code>git stash apply
git stash drop
</code></pre>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,191 | git | # Git stash apply and drop
Is there a git command that both applies the stash and removes it?
This as one command:
```
git stash apply
git stash drop
``` | You want [`git stash pop`](https://www.kernel.org/pub/software/scm/git/docs/git-stash.html)!
```
pop [--index] [-q|--quiet] [<stash>]
Remove a single stashed state from the stash list and apply it on
top of the current working tree state, i.e., do the inverse
operation of git stash save. The worki... |
6378850 | Git revert local commit | 56 | 2011-06-16 21:28:09 | <p>I have a git repo hooked up in phpstorm on windows. I committed a few change sets then pushed them to our "central repo". After this I have then made a few more commits. I no longer want these commits that have not been pushed to the central repo. How do I clean my working copy to be the same as the central repo (or... | 88,266 | 502,340 | 2015-03-06 15:58:06 | 6,378,867 | 88 | 2011-06-16 21:29:42 | 259,466 | 2011-06-16 21:29:42 | https://stackoverflow.com/q/6378850 | https://stackoverflow.com/a/6378867 | <pre><code>git reset --hard remotes/origin/HEAD
</code></pre>
| <pre><code>git reset --hard remotes/origin/HEAD </code></pre> | 64, 119, 21628 | git, msysgit, windows | <h1>Git revert local commit</h1>
<p>I have a git repo hooked up in phpstorm on windows. I committed a few change sets then pushed them to our "central repo". After this I have then made a few more commits. I no longer want these commits that have not been pushed to the central repo. How do I clean my working copy to be... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,192 | git | # Git revert local commit
I have a git repo hooked up in phpstorm on windows. I committed a few change sets then pushed them to our "central repo". After this I have then made a few more commits. I no longer want these commits that have not been pushed to the central repo. How do I clean my working copy to be the same... | ```
git reset --hard remotes/origin/HEAD
``` |
5587183 | git un-remove before commit? | 55 | 2011-04-07 20:26:56 | <p>I accidentally did a </p>
<p><code>git rm filename.txt -f</code></p>
<p>now if I do a <code>git commit -m ''</code>, it will commit this delete. How do I un-remove it before I do a git commit?</p>
| 25,380 | 27,305 | 2011-04-07 20:45:08 | 5,587,196 | 88 | 2011-04-07 20:27:46 | 119,963 | 2011-04-07 20:45:08 | https://stackoverflow.com/q/5587183 | https://stackoverflow.com/a/5587196 | <p>To get the version from the current commit (<code>HEAD</code>) into both the index (staging area, what you're about to commit) and the work tree:</p>
<pre><code>git checkout HEAD filename.txt
</code></pre>
<p>Note that this isn't just for "unremoval" - it's for getting you back to the version from the commit, whet... | <p>To get the version from the current commit (<code>HEAD</code>) into both the index (staging area, what you're about to commit) and the work tree:</p> <pre><code>git checkout HEAD filename.txt </code></pre> <p>Note that this isn't just for "unremoval" - it's for getting you back to the version from the commit, whet... | 119 | git | <h1>git un-remove before commit?</h1>
<p>I accidentally did a </p>
<p><code>git rm filename.txt -f</code></p>
<p>now if I do a <code>git commit -m ''</code>, it will commit this delete. How do I un-remove it before I do a git commit?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,193 | git | # git un-remove before commit?
I accidentally did a
`git rm filename.txt -f`
now if I do a `git commit -m ''`, it will commit this delete. How do I un-remove it before I do a git commit? | To get the version from the current commit (`HEAD`) into both the index (staging area, what you're about to commit) and the work tree:
```
git checkout HEAD filename.txt
```
Note that this isn't just for "unremoval" - it's for getting you back to the version from the commit, whether you've modified it by changing one... |
23296370 | Add previously ignored directory to Git repository | 53 | 2014-04-25 14:49:00 | <p>My <code>.gitignore</code> file looks like:</p>
<pre><code>html/
cache/
resources/
# Temp files often created by editors
*.~
</code></pre>
<p>I know wish to start tracking a specific directory in html, so I add `!html/support/</p>
<pre><code>html/
cache/
resources/
# Temp files often created by editors
*.~
# Trac... | 29,595 | 1,032,531 | 2021-06-23 17:38:16 | 23,296,404 | 88 | 2014-04-25 14:50:29 | 440,564 | 2017-01-04 13:01:59 | https://stackoverflow.com/q/23296370 | https://stackoverflow.com/a/23296404 | <p><strong>Not ignoring doesn't mean tracking.</strong></p>
<p>Just use </p>
<pre><code>git add html/support/
</code></pre>
<p>at the root of your git repository.</p>
<p>If the file is still ignored, though, you can use <code>git add -f</code> to force adding it (this will not modify the <code>.gitignore</code> fil... | <p><strong>Not ignoring doesn't mean tracking.</strong></p> <p>Just use </p> <pre><code>git add html/support/ </code></pre> <p>at the root of your git repository.</p> <p>If the file is still ignored, though, you can use <code>git add -f</code> to force adding it (this will not modify the <code>.gitignore</code> fil... | 58, 119 | git, linux | <h1>Add previously ignored directory to Git repository</h1>
<p>My <code>.gitignore</code> file looks like:</p>
<pre><code>html/
cache/
resources/
# Temp files often created by editors
*.~
</code></pre>
<p>I know wish to start tracking a specific directory in html, so I add `!html/support/</p>
<pre><code>html/
cache/... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,194 | git | # Add previously ignored directory to Git repository
My `.gitignore` file looks like:
```
html/
cache/
resources/
# Temp files often created by editors
*.~
```
I know wish to start tracking a specific directory in html, so I add `!html/support/
```
html/
cache/
resources/
# Temp files often created by editors
*.~
#... | **Not ignoring doesn't mean tracking.**
Just use
```
git add html/support/
```
at the root of your git repository.
If the file is still ignored, though, you can use `git add -f` to force adding it (this will not modify the `.gitignore` file, just allow one little exception) :
```
git add -f html/support/
``` |
11094968 | In Git, how can I recover a staged file that was reverted prior to committing? | 50 | 2012-06-19 05:36:46 | <p>I was attempting to pull a change into my repository using Git Tower. When I did so, there was a conflict and I mistakenly hit stage all (as I wanted to commit after resolving the conflict). When I did so, the conflict marked itself as resolved.</p>
<p>I wanted to manually resolve the change so I hit "Abort Merge"... | 28,294 | 864,663 | 2024-05-23 21:16:15 | 11,096,537 | 88 | 2012-06-19 07:44:11 | 6,236 | 2023-01-20 20:08:25 | https://stackoverflow.com/q/11094968 | https://stackoverflow.com/a/11096537 | <p>If you had anything staged to git, you probably should be able to get that back. (If you just changed working copy, you wouldn't be able to restore it.)</p>
<p>First of all: <strong>Backup</strong> your repository and working copy before going ahead. (Make sure to backup the <code>.git</code> directory.) Also avoid ... | <p>If you had anything staged to git, you probably should be able to get that back. (If you just changed working copy, you wouldn't be able to restore it.)</p> <p>First of all: <strong>Backup</strong> your repository and working copy before going ahead. (Make sure to backup the <code>.git</code> directory.) Also avoid ... | 119, 78499 | git, git-tower | <h1>In Git, how can I recover a staged file that was reverted prior to committing?</h1>
<p>I was attempting to pull a change into my repository using Git Tower. When I did so, there was a conflict and I mistakenly hit stage all (as I wanted to commit after resolving the conflict). When I did so, the conflict marked it... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,195 | git | # In Git, how can I recover a staged file that was reverted prior to committing?
I was attempting to pull a change into my repository using Git Tower. When I did so, there was a conflict and I mistakenly hit stage all (as I wanted to commit after resolving the conflict). When I did so, the conflict marked itself as re... | If you had anything staged to git, you probably should be able to get that back. (If you just changed working copy, you wouldn't be able to restore it.)
First of all: **Backup** your repository and working copy before going ahead. (Make sure to backup the `.git` directory.) Also avoid closing the terminal where this h... |
13457203 | How to add the Signed-off-by field in the git patch | 46 | 2012-11-19 15:43:42 | <p>I'm generating a git patch. And then I want to send it to the project maintainer.</p>
<p>I want to mark my Name and my email address as <code>signed-off-by</code> in the git patch</p>
<p>How to do it? in order that the project maintainer get the <code>signed-off-by</code> field with my name and email address.</p>
| 35,507 | 1,003,575 | 2023-05-30 08:31:07 | 13,457,395 | 88 | 2012-11-19 15:53:52 | 69,755 | 2016-12-09 22:22:30 | https://stackoverflow.com/q/13457203 | https://stackoverflow.com/a/13457395 | <p>When you commit, just use:</p>
<pre><code>git commit -s
</code></pre>
<p>or</p>
<pre><code>git commit --signoff
</code></pre>
<p>Or you can just write at the end of the commit message, on a line by itself separated by a blank line from the body of the commit:</p>
<pre><code>Signed-off-by: Your Name <your.ema... | <p>When you commit, just use:</p> <pre><code>git commit -s </code></pre> <p>or</p> <pre><code>git commit --signoff </code></pre> <p>Or you can just write at the end of the commit message, on a line by itself separated by a blank line from the body of the commit:</p> <pre><code>Signed-off-by: Your Name <your.ema... | 119 | git | <h1>How to add the Signed-off-by field in the git patch</h1>
<p>I'm generating a git patch. And then I want to send it to the project maintainer.</p>
<p>I want to mark my Name and my email address as <code>signed-off-by</code> in the git patch</p>
<p>How to do it? in order that the project maintainer get the <code>sign... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,196 | git | # How to add the Signed-off-by field in the git patch
I'm generating a git patch. And then I want to send it to the project maintainer.
I want to mark my Name and my email address as `signed-off-by` in the git patch
How to do it? in order that the project maintainer get the `signed-off-by` field with my name and ema... | When you commit, just use:
```
git commit -s
```
or
```
git commit --signoff
```
Or you can just write at the end of the commit message, on a line by itself separated by a blank line from the body of the commit:
```
Signed-off-by: Your Name <your.email@example.com>
```
If you already have the commit, use `git com... |
1409002 | In Git and Subversion, how do I find out the current user at the terminal? | 46 | 2009-09-11 04:41:10 | <p>In Perforce, I can check who I am by running <code>p4 info</code>, here's the <a href="http://www.perforce.com/perforce/doc.091/manuals/cmdref/info.html#1040665" rel="noreferrer">p4 doc</a>. What's the equivalent for Git and Subversion at the terminal?</p>
| 36,997 | 117,642 | 2017-06-21 13:51:38 | 1,409,067 | 88 | 2009-09-11 05:03:47 | 35,989 | 2009-09-11 05:03:47 | https://stackoverflow.com/q/1409002 | https://stackoverflow.com/a/1409067 | <p>Presumably you are after the git user name that will be attached to any commits:</p>
<pre><code>$ git config user.name
Wilbert Wilbert
$ git config --list
user.name=Wilbert Wilbert
user.email=wilbertwilbert@gmale.com
color.status=auto
color.branch=auto
...
</code></pre>
<p>Keys might appear more than once because... | <p>Presumably you are after the git user name that will be attached to any commits:</p> <pre><code>$ git config user.name Wilbert Wilbert $ git config --list user.name=Wilbert Wilbert user.email=wilbertwilbert@gmale.com color.status=auto color.branch=auto ... </code></pre> <p>Keys might appear more than once because... | 63, 119 | git, svn | <h1>In Git and Subversion, how do I find out the current user at the terminal?</h1>
<p>In Perforce, I can check who I am by running <code>p4 info</code>, here's the <a href="http://www.perforce.com/perforce/doc.091/manuals/cmdref/info.html#1040665" rel="noreferrer">p4 doc</a>. What's the equivalent for Git and Subvers... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,197 | git | # In Git and Subversion, how do I find out the current user at the terminal?
In Perforce, I can check who I am by running `p4 info`, here's the [p4 doc](http://www.perforce.com/perforce/doc.091/manuals/cmdref/info.html#1040665). What's the equivalent for Git and Subversion at the terminal? | Presumably you are after the git user name that will be attached to any commits:
```
$ git config user.name
Wilbert Wilbert
$ git config --list
user.name=Wilbert Wilbert
user.email=wilbertwilbert@gmale.com
color.status=auto
color.branch=auto
...
```
Keys might appear more than once because Git reads from several fil... |
29796127 | GIT - How to make a branch be the same as master | 45 | 2015-04-22 11:28:34 | <p>I have a website using git</p>
<p>The setup has the master branch as the live site and a develop branch as the dev domain which is used for testing features before they go live</p>
<p>No work is ever done directly on master or develop, it's always done on feature branches and then merged in to develop for testing,... | 50,041 | 1,240,237 | 2022-08-31 10:28:01 | 29,796,226 | 88 | 2015-04-22 11:32:43 | 105,672 | 2022-08-31 10:28:01 | https://stackoverflow.com/q/29796127 | https://stackoverflow.com/a/29796226 | <p>If you don't care about preserving develop just checkout <code>develop</code> and reset it to <code>master</code> or <code>main</code> or whatever you/ your team named your default branch.</p>
<pre><code># make sure the default branch is up to date before you do this
git checkout develop
git reset --hard master # re... | <p>If you don't care about preserving develop just checkout <code>develop</code> and reset it to <code>master</code> or <code>main</code> or whatever you/ your team named your default branch.</p> <pre><code># make sure the default branch is up to date before you do this git checkout develop git reset --hard master # re... | 119, 456 | git, version-control | <h1>GIT - How to make a branch be the same as master</h1>
<p>I have a website using git</p>
<p>The setup has the master branch as the live site and a develop branch as the dev domain which is used for testing features before they go live</p>
<p>No work is ever done directly on master or develop, it's always done on f... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,198 | git | # GIT - How to make a branch be the same as master
I have a website using git
The setup has the master branch as the live site and a develop branch as the dev domain which is used for testing features before they go live
No work is ever done directly on master or develop, it's always done on feature branches and the... | If you don't care about preserving develop just checkout `develop` and reset it to `master` or `main` or whatever you/ your team named your default branch.
```
# make sure the default branch is up to date before you do this
git checkout develop
git reset --hard master # replace with your name if it differs
git push -f... |
3765234 | Listing and deleting Git commits that are under no branch (dangling?) | 220 | 2010-09-21 23:29:30 | <p>I've got a Git repository with plenty of commits that are under no particular branch, I can <code>git show</code> them, but when I try to list branches that contain them, it reports back nothing.</p>
<p>I thought this is the dangling commits/tree issue (as a result of -D branch), so I pruned the repo, but I still s... | 127,556 | 171,428 | 2024-05-07 01:37:31 | 3,765,586 | 87 | 2010-09-22 00:57:32 | 9,410 | 2010-09-22 01:13:48 | https://stackoverflow.com/q/3765234 | https://stackoverflow.com/a/3765586 | <blockquote>
<p>No output, nothing dangling (right?)</p>
</blockquote>
<p>Note that commits referred to from your reflog are considered reachable.</p>
<blockquote>
<p>What exactly is the state of that commit? How can I list all commits with similar state</p>
</blockquote>
<p>Pass <code>--no-reflogs</code> to con... | <blockquote> <p>No output, nothing dangling (right?)</p> </blockquote> <p>Note that commits referred to from your reflog are considered reachable.</p> <blockquote> <p>What exactly is the state of that commit? How can I list all commits with similar state</p> </blockquote> <p>Pass <code>--no-reflogs</code> to con... | 119, 1879, 116920 | branch, git, git-dangling | <h1>Listing and deleting Git commits that are under no branch (dangling?)</h1>
<p>I've got a Git repository with plenty of commits that are under no particular branch, I can <code>git show</code> them, but when I try to list branches that contain them, it reports back nothing.</p>
<p>I thought this is the dangling com... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,200 | git | # Listing and deleting Git commits that are under no branch (dangling?)
I've got a Git repository with plenty of commits that are under no particular branch, I can `git show` them, but when I try to list branches that contain them, it reports back nothing.
I thought this is the dangling commits/tree issue (as a resul... | > No output, nothing dangling (right?)
Note that commits referred to from your reflog are considered reachable.
> What exactly is the state of that commit? How can I list all commits with similar state
Pass `--no-reflogs` to convince `git fsck` to show them to you.
> How can I delete commits like those?
Once your ... |
1456269 | Python Git Module experiences? | 185 | 2009-09-21 19:10:10 | <p>What are people's experiences with any of the Git modules for Python? (I know of GitPython, PyGit, and Dulwich - feel free to mention others if you know of them.)</p>
<p>I am writing a program which will have to interact (add, delete, commit) with a Git repository, but have no experience with Git, so one of the th... | 136,195 | 42,971 | 2016-12-24 20:28:12 | 1,479,669 | 87 | 2009-09-25 21:26:53 | 42,971 | 2016-12-24 20:28:12 | https://stackoverflow.com/q/1456269 | https://stackoverflow.com/a/1479669 | <p>I thought I would answer my own question, since I'm taking a different path than suggested in the answers. Nonetheless, thanks to those who answered.</p>
<p>First, a brief synopsis of my experiences with GitPython, PyGit, and Dulwich:</p>
<ul>
<li><a href="https://github.com/gitpython-developers/GitPython" rel="n... | <p>I thought I would answer my own question, since I'm taking a different path than suggested in the answers. Nonetheless, thanks to those who answered.</p> <p>First, a brief synopsis of my experiences with GitPython, PyGit, and Dulwich:</p> <ul> <li><a href="https://github.com/gitpython-developers/GitPython" rel="n... | 16, 119 | git, python | <h1>Python Git Module experiences?</h1>
<p>What are people's experiences with any of the Git modules for Python? (I know of GitPython, PyGit, and Dulwich - feel free to mention others if you know of them.)</p>
<p>I am writing a program which will have to interact (add, delete, commit) with a Git repository, but have ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,201 | git | # Python Git Module experiences?
What are people's experiences with any of the Git modules for Python? (I know of GitPython, PyGit, and Dulwich - feel free to mention others if you know of them.)
I am writing a program which will have to interact (add, delete, commit) with a Git repository, but have no experience wit... | I thought I would answer my own question, since I'm taking a different path than suggested in the answers. Nonetheless, thanks to those who answered.
First, a brief synopsis of my experiences with GitPython, PyGit, and Dulwich:
- [GitPython](https://github.com/gitpython-developers/GitPython): After downloading, I got... |
28572293 | Can I delete all the local branches except the current one? | 181 | 2015-02-17 22:24:01 | <p>I want to delete all branches that get listed in the output of ...</p>
<pre><code>$ git branch
</code></pre>
<p>... but keeping current branch, <em>in one step</em>. Is that possible? If so, how?</p>
| 117,079 | 1,420,625 | 2024-06-05 14:01:28 | 41,465,769 | 87 | 2017-01-04 14:06:29 | 2,391,795 | 2019-06-17 13:08:56 | https://stackoverflow.com/q/28572293 | https://stackoverflow.com/a/41465769 | <p>Based on @pankijs answer, I made two git aliases:</p>
<pre><code>[alias]
# Delete all local branches but master and the current one, only if they are fully merged with master.
br-delete-useless = "!f(){\
git branch | grep -v "master" | grep -v ^* | xargs git branch -d;\
}; f"
# Delete all lo... | <p>Based on @pankijs answer, I made two git aliases:</p> <pre><code>[alias] # Delete all local branches but master and the current one, only if they are fully merged with master. br-delete-useless = "!f(){\ git branch | grep -v "master" | grep -v ^* | xargs git branch -d;\ }; f" # Delete all lo... | 119, 76220 | git, git-branch | <h1>Can I delete all the local branches except the current one?</h1>
<p>I want to delete all branches that get listed in the output of ...</p>
<pre><code>$ git branch
</code></pre>
<p>... but keeping current branch, <em>in one step</em>. Is that possible? If so, how?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,202 | git | # Can I delete all the local branches except the current one?
I want to delete all branches that get listed in the output of ...
```
$ git branch
```
... but keeping current branch, *in one step*. Is that possible? If so, how? | Based on @pankijs answer, I made two git aliases:
```
[alias]
# Delete all local branches but master and the current one, only if they are fully merged with master.
br-delete-useless = "!f(){\
git branch | grep -v "master" | grep -v ^* | xargs git branch -d;\
}; f"
# Delete all local branches b... |
4050905 | Changing .gitconfig location on Windows | 144 | 2010-10-29 10:15:08 | <p>By default on Windows Git places global .gitconfig in <code>c:\documents and settings\user\</code></p>
<p>How can I change that position so .gitconfig is stored in <code>c:\my_configuration_files\</code>?</p>
<p>Can it be done at all?</p>
| 228,097 | 62,699 | 2024-05-03 10:27:30 | 4,051,282 | 87 | 2010-10-29 11:18:26 | 33,006 | 2018-04-08 23:12:49 | https://stackoverflow.com/q/4050905 | https://stackoverflow.com/a/4051282 | <p>If you set <code>HOME</code> to <code>c:\my_configuration_files\</code>, then git will locate .gitconfig there. Editing environment variables is described <a href="https://stackoverflow.com/a/32233667/220986">here</a>. You need to set the HOME variable, then re-open any cmd.exe window. Use the "set" command to verif... | <p>If you set <code>HOME</code> to <code>c:\my_configuration_files\</code>, then git will locate .gitconfig there. Editing environment variables is described <a href="https://stackoverflow.com/a/32233667/220986">here</a>. You need to set the HOME variable, then re-open any cmd.exe window. Use the "set" command to verif... | 64, 119 | git, windows | <h1>Changing .gitconfig location on Windows</h1>
<p>By default on Windows Git places global .gitconfig in <code>c:\documents and settings\user\</code></p>
<p>How can I change that position so .gitconfig is stored in <code>c:\my_configuration_files\</code>?</p>
<p>Can it be done at all?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,204 | git | # Changing .gitconfig location on Windows
By default on Windows Git places global .gitconfig in `c:\documents and settings\user\`
How can I change that position so .gitconfig is stored in `c:\my_configuration_files\`?
Can it be done at all? | If you set `HOME` to `c:\my_configuration_files\`, then git will locate .gitconfig there. Editing environment variables is described [here](https://stackoverflow.com/a/32233667/220986). You need to set the HOME variable, then re-open any cmd.exe window. Use the "set" command to verify that HOME indeed points to the rig... |
5104649 | How to abort an interactive rebase if --abort doesn't work? | 131 | 2011-02-24 12:28:42 | <p>I've got myself into a muddle via an interactive rebase, and I now wish to abort it. (i.e. go back to the point before I was dropped into interactive rebase mode, in my case via <code>git pull --rebase</code>.) The way to do this seems to be via <code>git rebase --abort</code>, but this doesn't work:</p>
<pre><co... | 166,992 | 11,543 | 2025-12-31 18:39:10 | 5,104,775 | 87 | 2011-02-24 12:38:31 | 158,676 | 2014-02-06 10:03:35 | https://stackoverflow.com/q/5104649 | https://stackoverflow.com/a/5104775 | <p>Try to follow the advice you see on the screen, and first reset your master's HEAD to the commit it expects.</p>
<pre><code>git update-ref refs/heads/master b918ac16a33881ce00799bea63d9c23bf7022d67
</code></pre>
<p>Then, abort the rebase again.</p>
| <p>Try to follow the advice you see on the screen, and first reset your master's HEAD to the commit it expects.</p> <pre><code>git update-ref refs/heads/master b918ac16a33881ce00799bea63d9c23bf7022d67 </code></pre> <p>Then, abort the rebase again.</p> | 119, 8974, 10871, 16746, 23931 | abort, exit, git, quit, rebase | <h1>How to abort an interactive rebase if --abort doesn't work?</h1>
<p>I've got myself into a muddle via an interactive rebase, and I now wish to abort it. (i.e. go back to the point before I was dropped into interactive rebase mode, in my case via <code>git pull --rebase</code>.) The way to do this seems to be via ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,205 | git | # How to abort an interactive rebase if --abort doesn't work?
I've got myself into a muddle via an interactive rebase, and I now wish to abort it. (i.e. go back to the point before I was dropped into interactive rebase mode, in my case via `git pull --rebase`.) The way to do this seems to be via `git rebase --abort`, ... | Try to follow the advice you see on the screen, and first reset your master's HEAD to the commit it expects.
```
git update-ref refs/heads/master b918ac16a33881ce00799bea63d9c23bf7022d67
```
Then, abort the rebase again. |
16562339 | Git-flow and master with multiple parallel release-branches | 102 | 2013-05-15 10:12:53 | <p>We are trying to adopt the <a href="http://nvie.com/posts/a-successful-git-branching-model/" rel="noreferrer">successful Git branching model</a> implemented by git-flow. Now, we are working on at least two release-branches, one for the latest stable release and one for the next ("preview") release. What I don't unde... | 86,317 | 209,706 | 2018-11-15 05:32:41 | 16,866,118 | 87 | 2013-05-31 21:15:28 | 241,453 | 2014-06-23 09:23:14 | https://stackoverflow.com/q/16562339 | https://stackoverflow.com/a/16866118 | <p>In the git-flow model, your "latest released" version actually maps to the <code>master</code>, while your "preview release" maps to a git-flow <code>release</code> branch. It is forked from <code>develop</code> and finally merged into <code>master</code> when the actual release happens. Then this will become your "... | <p>In the git-flow model, your "latest released" version actually maps to the <code>master</code>, while your "preview release" maps to a git-flow <code>release</code> branch. It is forked from <code>develop</code> and finally merged into <code>master</code> when the actual release happens. Then this will become your "... | 119, 64339 | git, git-flow | <h1>Git-flow and master with multiple parallel release-branches</h1>
<p>We are trying to adopt the <a href="http://nvie.com/posts/a-successful-git-branching-model/" rel="noreferrer">successful Git branching model</a> implemented by git-flow. Now, we are working on at least two release-branches, one for the latest stabl... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,206 | git | # Git-flow and master with multiple parallel release-branches
We are trying to adopt the [successful Git branching model](http://nvie.com/posts/a-successful-git-branching-model/) implemented by git-flow. Now, we are working on at least two release-branches, one for the latest stable release and one for the next ("prev... | In the git-flow model, your "latest released" version actually maps to the `master`, while your "preview release" maps to a git-flow `release` branch. It is forked from `develop` and finally merged into `master` when the actual release happens. Then this will become your "latest release" and you will usually fix only b... |
11983749 | What are the differences between `--squash` and `--no-ff --no-commit`? | 84 | 2012-08-16 08:57:46 | <p>Which one should one use to hide microcommits?</p>
<p>Is the only difference between <code>git merge --squash</code> and <code>git merge --no-ff --no-commit</code> the denial of the other parents? </p>
| 41,339 | 321,973 | 2019-07-08 17:35:31 | 11,984,240 | 87 | 2012-08-16 09:25:56 | 640,650 | 2019-07-08 17:35:31 | https://stackoverflow.com/q/11983749 | https://stackoverflow.com/a/11984240 | <h1>The differences</h1>
<p>These options exists for separate purposes. Your repository ends up differently.</p>
<p>Let's suppose that your repository is like this after you are done developing on the topic branch:</p>
<p><img src="https://i.sstatic.net/cbPxa.png" alt="enter image description here"></p>
<hr>
<h2><... | <h1>The differences</h1> <p>These options exists for separate purposes. Your repository ends up differently.</p> <p>Let's suppose that your repository is like this after you are done developing on the topic branch:</p> <p><img src="https://i.sstatic.net/cbPxa.png" alt="enter image description here"></p> <hr> <h2><... | 119, 717, 28897, 42532, 52842 | fast-forward, git, git-merge, merge, squash | <h1>What are the differences between `--squash` and `--no-ff --no-commit`?</h1>
<p>Which one should one use to hide microcommits?</p>
<p>Is the only difference between <code>git merge --squash</code> and <code>git merge --no-ff --no-commit</code> the denial of the other parents? </p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,208 | git | # What are the differences between `--squash` and `--no-ff --no-commit`?
Which one should one use to hide microcommits?
Is the only difference between `git merge --squash` and `git merge --no-ff --no-commit` the denial of the other parents? | # The differences
These options exists for separate purposes. Your repository ends up differently.
Let's suppose that your repository is like this after you are done developing on the topic branch:

---
## `--squash`
If you checkout master and then `... |
3069979 | what's the Git equivalent of TFS commands shelve/unshelve? cherry-pick? | 84 | 2010-06-18 13:27:47 | <p>I found that the shelve/unshelve commands in TFS are very handy and very simple to use. What's the equivalent in Git ?</p>
<p>here's the scenario in TFS :</p>
<ul>
<li>I made changes in the trunk</li>
<li>I shelve : the change set is saved on the server (with a label) and I get the source back before the changes</... | 45,068 | 3,109 | 2018-08-29 14:33:48 | 3,070,044 | 87 | 2010-06-18 13:35:00 | 119,963 | 2010-06-18 13:35:00 | https://stackoverflow.com/q/3069979 | https://stackoverflow.com/a/3070044 | <p>What you describe is similar to <a href="http://kernel.org/pub/software/scm/git/docs/git-stash.html" rel="noreferrer"><code>git stash</code></a>, except since with git you have your own repository (not just a single one on a server), only you can get that change set back.</p>
<p>The general idea is:</p>
<pre><code... | <p>What you describe is similar to <a href="http://kernel.org/pub/software/scm/git/docs/git-stash.html" rel="noreferrer"><code>git stash</code></a>, except since with git you have your own repository (not just a single one on a server), only you can get that change set back.</p> <p>The general idea is:</p> <pre><code... | 119, 733 | git, tfs | <h1>what's the Git equivalent of TFS commands shelve/unshelve? cherry-pick?</h1>
<p>I found that the shelve/unshelve commands in TFS are very handy and very simple to use. What's the equivalent in Git ?</p>
<p>here's the scenario in TFS :</p>
<ul>
<li>I made changes in the trunk</li>
<li>I shelve : the change set is ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,209 | git | # what's the Git equivalent of TFS commands shelve/unshelve? cherry-pick?
I found that the shelve/unshelve commands in TFS are very handy and very simple to use. What's the equivalent in Git ?
here's the scenario in TFS :
- I made changes in the trunk
- I shelve : the change set is saved on the server (with a label)... | What you describe is similar to [`git stash`](http://kernel.org/pub/software/scm/git/docs/git-stash.html), except since with git you have your own repository (not just a single one on a server), only you can get that change set back.
The general idea is:
```
# do some stuff
vim foo/bar.c
# stash away your changes
git... |
31401754 | Why does the same conflict reappear when I use git rebase? | 82 | 2015-07-14 08:38:15 | <p>I have read relevant questions about git merge and git rebase on SO, but I still cannot fully understand what is happening under the hood.</p>
<p>Here is our branching situation:</p>
<pre><code>MASTER------------------------
\ \
\ \----Feature B---
\ \
... | 39,439 | 954,376 | 2021-11-27 03:48:18 | 31,402,549 | 87 | 2015-07-14 09:18:03 | 26,396 | 2018-06-04 20:54:21 | https://stackoverflow.com/q/31401754 | https://stackoverflow.com/a/31402549 | <h3>Is rebase suitable for your situation?</h3>
<p>Based on the fact that <code>Feature A</code> and <code>Feature B</code> seem to be <em>shared</em> branches, I'd say <strong>no</strong>.</p>
<p>Rebasing is a way to merge branches <em>without having merge commits</em> (i.e. commits that have two or more parents) ma... | <h3>Is rebase suitable for your situation?</h3> <p>Based on the fact that <code>Feature A</code> and <code>Feature B</code> seem to be <em>shared</em> branches, I'd say <strong>no</strong>.</p> <p>Rebasing is a way to merge branches <em>without having merge commits</em> (i.e. commits that have two or more parents) ma... | 119, 717, 28897, 29934 | git, git-merge, git-rebase, merge | <h1>Why does the same conflict reappear when I use git rebase?</h1>
<p>I have read relevant questions about git merge and git rebase on SO, but I still cannot fully understand what is happening under the hood.</p>
<p>Here is our branching situation:</p>
<pre><code>MASTER------------------------
\ \
... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,210 | git | # Why does the same conflict reappear when I use git rebase?
I have read relevant questions about git merge and git rebase on SO, but I still cannot fully understand what is happening under the hood.
Here is our branching situation:
```
MASTER------------------------
\ \
\ \----Feature... | ### Is rebase suitable for your situation?
Based on the fact that `Feature A` and `Feature B` seem to be *shared* branches, I'd say **no**.
Rebasing is a way to merge branches *without having merge commits* (i.e. commits that have two or more parents) making it appear as a linear history. It's best used to merge *loc... |
19713861 | git rebase --editor=/something/other/than/vim? (for easier squashing) | 76 | 2013-10-31 18:18:24 | <p>I happily use vim as my default editor for commits, and do not wish to change it. However, when it comes to rebasing, I find myself squashing dozens and dozens of commits which I find much easier with an interactive editor like Textwrangler (substituting "pick" with "squash" in all but the top commit).</p>
<p><stro... | 43,716 | 714,112 | 2023-08-18 03:16:52 | 19,713,991 | 87 | 2013-10-31 18:26:03 | 845,716 | 2013-10-31 18:26:03 | https://stackoverflow.com/q/19713861 | https://stackoverflow.com/a/19713991 | <p>Try adding the <code>GIT_EDITOR</code> environment variable before your command, like so:</p>
<pre><code>GIT_EDITOR=<editor of choice> git rebase <...>
</code></pre>
<p>For example, to use <code>nano</code> I would type:</p>
<pre><code>GIT_EDITOR=nano git rebase -i abcdef1234
</code></pre>
| <p>Try adding the <code>GIT_EDITOR</code> environment variable before your command, like so:</p> <pre><code>GIT_EDITOR=<editor of choice> git rebase <...> </code></pre> <p>For example, to use <code>nano</code> I would type:</p> <pre><code>GIT_EDITOR=nano git rebase -i abcdef1234 </code></pre> | 119, 370, 5025, 29934 | editor, git, git-rebase, vim | <h1>git rebase --editor=/something/other/than/vim? (for easier squashing)</h1>
<p>I happily use vim as my default editor for commits, and do not wish to change it. However, when it comes to rebasing, I find myself squashing dozens and dozens of commits which I find much easier with an interactive editor like Textwrangl... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,211 | git | # git rebase --editor=/something/other/than/vim? (for easier squashing)
I happily use vim as my default editor for commits, and do not wish to change it. However, when it comes to rebasing, I find myself squashing dozens and dozens of commits which I find much easier with an interactive editor like Textwrangler (subst... | Try adding the `GIT_EDITOR` environment variable before your command, like so:
```
GIT_EDITOR=<editor of choice> git rebase <...>
```
For example, to use `nano` I would type:
```
GIT_EDITOR=nano git rebase -i abcdef1234
``` |
9599411 | Differences between Git merge --squash and --no-commit | 72 | 2012-03-07 10:08:07 | <p>As the title says, I am not really clear about the differences between a <code>git merge --squash</code> and a <code>git merge --no-commit</code>.</p>
<p>As far as I understand the help page for <code>git merge</code>, both commands would leave me in an updated working-tree, where it is still possible to edit and t... | 57,262 | 1,129,916 | 2023-07-13 11:13:49 | 9,599,775 | 87 | 2012-03-07 10:33:04 | 106,205 | 2022-02-07 18:42:25 | https://stackoverflow.com/q/9599411 | https://stackoverflow.com/a/9599775 | <pre><code>git merge --no-commit
</code></pre>
<p>This is just like a normal merge but doesn't create a merge-commit. This commit will be a <a href="https://stackoverflow.com/q/18584376/438273">merge commit</a>: when you look at the history, your commit will appear as a normal merge.</p>
<pre><code>git merge --squash
<... | <pre><code>git merge --no-commit </code></pre> <p>This is just like a normal merge but doesn't create a merge-commit. This commit will be a <a href="https://stackoverflow.com/q/18584376/438273">merge commit</a>: when you look at the history, your commit will appear as a normal merge.</p> <pre><code>git merge --squash <... | 119, 717, 42532 | git, merge, squash | <h1>Differences between Git merge --squash and --no-commit</h1>
<p>As the title says, I am not really clear about the differences between a <code>git merge --squash</code> and a <code>git merge --no-commit</code>.</p>
<p>As far as I understand the help page for <code>git merge</code>, both commands would leave me in a... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,212 | git | # Differences between Git merge --squash and --no-commit
As the title says, I am not really clear about the differences between a `git merge --squash` and a `git merge --no-commit`.
As far as I understand the help page for `git merge`, both commands would leave me in an updated working-tree, where it is still possibl... | ```
git merge --no-commit
```
This is just like a normal merge but doesn't create a merge-commit. This commit will be a [merge commit](https://stackoverflow.com/q/18584376/438273): when you look at the history, your commit will appear as a normal merge.
```
git merge --squash
```
This will merge the changes into you... |
19474577 | What does the argument @{u} mean in Git? | 70 | 2013-10-20 06:31:31 | <p>In the book "Git: Version Control for Everyone. Beginner's Guide" on page 69 there is a suggestion: "As an alternative to <code>git pull</code>, we can also use <code>git fetch</code> followed by <code>git merge @{u}</code>".</p>
<p>What does <code>@{u}</code> mean here?</p>
<p>A search in Google... | 10,972 | 793,824 | 2023-06-06 13:02:45 | 19,474,730 | 87 | 2013-10-20 06:54:47 | 565,145 | 2023-06-06 13:02:45 | https://stackoverflow.com/q/19474577 | https://stackoverflow.com/a/19474730 | <p>It is a shortcut to refer to the upstream branch which the current branch is tracking. So for instance if you're on branch <code>topic/fix_blub</code> which is tracking <code>origin/topic/fix_blub</code> then <code>git merge @{u}</code> does the same thing as <code>git merge origin/topic/fix_blub</code>.</p>
<p><cod... | <p>It is a shortcut to refer to the upstream branch which the current branch is tracking. So for instance if you're on branch <code>topic/fix_blub</code> which is tracking <code>origin/topic/fix_blub</code> then <code>git merge @{u}</code> does the same thing as <code>git merge origin/topic/fix_blub</code>.</p> <p><cod... | 119 | git | <h1>What does the argument @{u} mean in Git?</h1>
<p>In the book "Git: Version Control for Everyone. Beginner's Guide" on page 69 there is a suggestion: "As an alternative to <code>git pull</code>, we can also use <code>git fetch</code> followed by <code>git merge @{u}</code>".</p>
<p>What does <cod... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,214 | git | # What does the argument @{u} mean in Git?
In the book "Git: Version Control for Everyone. Beginner's Guide" on page 69 there is a suggestion: "As an alternative to `git pull`, we can also use `git fetch` followed by `git merge @{u}`".
What does `@{u}` mean here?
A search in Google for `git merge @{u}` provides a li... | It is a shortcut to refer to the upstream branch which the current branch is tracking. So for instance if you're on branch `topic/fix_blub` which is tracking `origin/topic/fix_blub` then `git merge @{u}` does the same thing as `git merge origin/topic/fix_blub`.
`@{u}` is part of Git's mini-language for locating revisi... |
17605208 | git diff showing only commits that revision/branch A is ahead of revision/branch B | 64 | 2013-07-11 23:27:09 | <p>Sometimes I have the following problem:</p>
<ol>
<li><p>Add some commits in a feature branch.</p></li>
<li><p>Update master from upstream.</p></li>
<li><p>Want to see the diff between the feature branch and master, but <code>git diff master</code> shows all of the things that have been added/removed in master, when... | 56,330 | 373,514 | 2025-01-28 21:08:23 | 17,618,008 | 87 | 2013-07-12 15:02:16 | 240,553 | 2013-07-12 15:02:16 | https://stackoverflow.com/q/17605208 | https://stackoverflow.com/a/17618008 | <p>I think the right answer is triple dot</p>
<pre><code>git diff master...feature
</code></pre>
<p>That shows only new changes on feature with respect to master. See also: <a href="https://stackoverflow.com/questions/14670265/git-diff-show-only-whats-new-on-the-remote/17617690">git diff - show only what's new on... | <p>I think the right answer is triple dot</p> <pre><code>git diff master...feature </code></pre> <p>That shows only new changes on feature with respect to master. See also: <a href="https://stackoverflow.com/questions/14670265/git-diff-show-only-whats-new-on-the-remote/17617690">git diff - show only what's new on... | 119 | git | <h1>git diff showing only commits that revision/branch A is ahead of revision/branch B</h1>
<p>Sometimes I have the following problem:</p>
<ol>
<li><p>Add some commits in a feature branch.</p></li>
<li><p>Update master from upstream.</p></li>
<li><p>Want to see the diff between the feature branch and master, but <code... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,218 | git | # git diff showing only commits that revision/branch A is ahead of revision/branch B
Sometimes I have the following problem:
1. Add some commits in a feature branch.
2. Update master from upstream.
3. Want to see the diff between the feature branch and master, but `git diff master` shows all of the things that have b... | I think the right answer is triple dot
```
git diff master...feature
```
That shows only new changes on feature with respect to master. See also: [git diff - show only what's new on the remote](https://stackoverflow.com/questions/14670265/git-diff-show-only-whats-new-on-the-remote/17617690) |
5290444 | Why does git hash-object return a different hash than openssl sha1? | 63 | 2011-03-13 15:50:07 | <p>Context: I downloaded <a href="http://code.google.com/p/audirvana/downloads/detail?name=Audirvana%200.7.1.zip&can=2&q=" rel="noreferrer">a file (Audirvana 0.7.1.zip)</a> from code.google to my Macbook Pro (Mac OS X 10.6.6).</p>
<p>I wanted to verify the checksum, which for that particular file is posted as ... | 13,074 | 657,606 | 2021-08-31 14:32:59 | 5,290,484 | 87 | 2011-03-13 15:56:06 | 223,092 | 2011-03-13 16:07:47 | https://stackoverflow.com/q/5290444 | https://stackoverflow.com/a/5290484 | <p>You see a difference because <code>git hash-object</code> doesn't just take a hash of the bytes in the file - it prepends the string "blob " followed by the file size and a NUL to the file's contents before hashing. There are more details in this other answer on Stack Overflow:</p>
<ul>
<li><a href="https://stacko... | <p>You see a difference because <code>git hash-object</code> doesn't just take a hash of the bytes in the file - it prepends the string "blob " followed by the file size and a NUL to the file's contents before hashing. There are more details in this other answer on Stack Overflow:</p> <ul> <li><a href="https://stacko... | 119, 1999, 3190 | git, openssl, sha1 | <h1>Why does git hash-object return a different hash than openssl sha1?</h1>
<p>Context: I downloaded <a href="http://code.google.com/p/audirvana/downloads/detail?name=Audirvana%200.7.1.zip&can=2&q=" rel="noreferrer">a file (Audirvana 0.7.1.zip)</a> from code.google to my Macbook Pro (Mac OS X 10.6.6).</p>
<p>... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,219 | git | # Why does git hash-object return a different hash than openssl sha1?
Context: I downloaded [a file (Audirvana 0.7.1.zip)](http://code.google.com/p/audirvana/downloads/detail?name=Audirvana%200.7.1.zip&can=2&q=) from code.google to my Macbook Pro (Mac OS X 10.6.6).
I wanted to verify the checksum, which for that part... | You see a difference because `git hash-object` doesn't just take a hash of the bytes in the file - it prepends the string "blob " followed by the file size and a NUL to the file's contents before hashing. There are more details in this other answer on Stack Overflow:
- [How to assign a Git SHA1's to a file without Git... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.