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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
14578680 | Changing case of Folder via Git bash on Windows | 49 | 2013-01-29 08:40:04 | <p>I need to change the case of folders <strike>and files</strike>. First thing I tried was renaming the folders, but Git didn't pick up the changes. So I tried using <a href="https://stackoverflow.com/questions/1793735/git-change-case-of-a-file-on-windows?lq=1"><code>git mv -f controller Controller</code></a> but it s... | 24,288 | 475,624 | 2019-08-01 13:47:13 | 14,580,217 | 87 | 2013-01-29 10:03:19 | 159,834 | 2013-08-20 06:34:20 | https://stackoverflow.com/q/14578680 | https://stackoverflow.com/a/14580217 | <p>In summary of the comments, you'll have to rename the directory via a intermediate temporary name. E.g.</p>
<pre><code>git mv controller Controller-tmp
git mv Controller-tmp Controller
</code></pre>
<p>I think this has to do with the fact that the MinGW implementation of <code>rename(2)</code> does not support thi... | <p>In summary of the comments, you'll have to rename the directory via a intermediate temporary name. E.g.</p> <pre><code>git mv controller Controller-tmp git mv Controller-tmp Controller </code></pre> <p>I think this has to do with the fact that the MinGW implementation of <code>rename(2)</code> does not support thi... | 64, 119 | git, windows | <h1>Changing case of Folder via Git bash on Windows</h1>
<p>I need to change the case of folders <strike>and files</strike>. First thing I tried was renaming the folders, but Git didn't pick up the changes. So I tried using <a href="https://stackoverflow.com/questions/1793735/git-change-case-of-a-file-on-windows?lq=1">... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,221 | git | # Changing case of Folder via Git bash on Windows
I need to change the case of folders and files. First thing I tried was renaming the folders, but Git didn't pick up the changes. So I tried using [`git mv -f controller Controller`](https://stackoverflow.com/questions/1793735/git-change-case-of-a-file-on-windows?lq=1)... | In summary of the comments, you'll have to rename the directory via a intermediate temporary name. E.g.
```
git mv controller Controller-tmp
git mv Controller-tmp Controller
```
I think this has to do with the fact that the MinGW implementation of `rename(2)` does not support this operation. See this [thread](http://... |
3782893 | Git : fatal: Ambiguous object name: 'origin/release_2.6' | 49 | 2010-09-23 22:12:23 | <p>I am getting this error when trying to create a remote tracking branch</p>
<pre><code>git co -b release_2.6 origin/release_2.6
warning: refname 'origin/release_2.6' is ambiguous.
warning: refname 'origin/release_2.6' is ambiguous.
fatal: Ambiguous object name: 'origin/release_2.6'.
</code></pre>
<p>I only have the... | 58,413 | 72,537 | 2022-08-26 00:29:33 | 3,783,005 | 87 | 2010-09-23 22:37:09 | 356,716 | 2012-11-20 05:11:29 | https://stackoverflow.com/q/3782893 | https://stackoverflow.com/a/3783005 | <p>If something can be found in both <code>refs/heads/</code> and <code>refs/remotes/</code> then this is ambiguous.
You have local branch <code>origin/release_2.6</code> and remote tracking branch <code>release_2.6</code> for remote <code>origin</code>. Don't think you are supposed to have a <code>refs/heads/origin/r... | <p>If something can be found in both <code>refs/heads/</code> and <code>refs/remotes/</code> then this is ambiguous. You have local branch <code>origin/release_2.6</code> and remote tracking branch <code>release_2.6</code> for remote <code>origin</code>. Don't think you are supposed to have a <code>refs/heads/origin/r... | 119, 5036 | git, reference | <h1>Git : fatal: Ambiguous object name: 'origin/release_2.6'</h1>
<p>I am getting this error when trying to create a remote tracking branch</p>
<pre><code>git co -b release_2.6 origin/release_2.6
warning: refname 'origin/release_2.6' is ambiguous.
warning: refname 'origin/release_2.6' is ambiguous.
fatal: Ambiguous ob... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,222 | git | # Git : fatal: Ambiguous object name: 'origin/release_2.6'
I am getting this error when trying to create a remote tracking branch
```
git co -b release_2.6 origin/release_2.6
warning: refname 'origin/release_2.6' is ambiguous.
warning: refname 'origin/release_2.6' is ambiguous.
fatal: Ambiguous object name: 'origin/r... | If something can be found in both `refs/heads/` and `refs/remotes/` then this is ambiguous.
You have local branch `origin/release_2.6` and remote tracking branch `release_2.6` for remote `origin`. Don't think you are supposed to have a `refs/heads/origin/release_2.6` branch though. Anyway, you can specify full referenc... |
10914496 | Easy way to clean up un-staged deleted files in Git | 48 | 2012-06-06 12:45:51 | <p>Often I move files in a git repository using my IDE or via the command line (not via git mv).</p>
<p>As a result I and end up with several unstaged files to be deleted on my next commit as below:</p>
<pre><code># On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# ... | 41,762 | 320,619 | 2012-06-06 12:56:34 | 10,914,622 | 87 | 2012-06-06 12:53:22 | 147,356 | 2012-06-06 12:53:22 | https://stackoverflow.com/q/10914496 | https://stackoverflow.com/a/10914622 | <p>If I understand your question correctly, you want to commit your deletes...that is, you want to perform the equivalent of <code>git rm</code> for <em>all</em> of the files that show up as deleted. <code>git clean</code> won't do this.</p>
<p>You can run <code>git add -u</code>:</p>
<blockquote>
<p>Only match a... | <p>If I understand your question correctly, you want to commit your deletes...that is, you want to perform the equivalent of <code>git rm</code> for <em>all</em> of the files that show up as deleted. <code>git clean</code> won't do this.</p> <p>You can run <code>git add -u</code>:</p> <blockquote> <p>Only match a... | 119 | git | <h1>Easy way to clean up un-staged deleted files in Git</h1>
<p>Often I move files in a git repository using my IDE or via the command line (not via git mv).</p>
<p>As a result I and end up with several unstaged files to be deleted on my next commit as below:</p>
<pre><code># On branch master
# Changes to be committe... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,223 | git | # Easy way to clean up un-staged deleted files in Git
Often I move files in a git repository using my IDE or via the command line (not via git mv).
As a result I and end up with several unstaged files to be deleted on my next commit as below:
```
# On branch master
# Changes to be committed:
# (use "git reset HEAD... | If I understand your question correctly, you want to commit your deletes...that is, you want to perform the equivalent of `git rm` for *all* of the files that show up as deleted. `git clean` won't do this.
You can run `git add -u`:
> Only match against already tracked files in the index
> rather than the working tree... |
27201656 | git: pushing a new, empty branch for an empty project? | 47 | 2014-11-29 11:20:35 | <p>I have an empty project on remote, which I cloned. Now I want to start working on a branch, <code>testdev</code> and start working on it without putting any code to master.</p>
<pre><code>$ git checkout -b testdev
$ git status
On branch testdev
Initial commit
nothing to commit (create/copy files and use "git add"... | 49,660 | 696,668 | 2022-06-16 18:10:32 | 27,201,674 | 87 | 2014-11-29 11:23:21 | 6,309 | 2022-06-16 18:10:32 | https://stackoverflow.com/q/27201656 | https://stackoverflow.com/a/27201674 | <p>If you repo is still empty, you might try and create an empty commit, to have <em>something</em> to push:</p>
<pre><code>git commit --allow-empty -m "initial commit"
git push -u origin testdev
</code></pre>
<p>See also "<a href="https://stackoverflow.com/a/17096880/6309">Why do I need to explicitly pu... | <p>If you repo is still empty, you might try and create an empty commit, to have <em>something</em> to push:</p> <pre><code>git commit --allow-empty -m "initial commit" git push -u origin testdev </code></pre> <p>See also "<a href="https://stackoverflow.com/a/17096880/6309">Why do I need to explicitly pu... | 119, 8337 | bitbucket, git | <h1>git: pushing a new, empty branch for an empty project?</h1>
<p>I have an empty project on remote, which I cloned. Now I want to start working on a branch, <code>testdev</code> and start working on it without putting any code to master.</p>
<pre><code>$ git checkout -b testdev
$ git status
On branch testdev
Initia... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,224 | git | # git: pushing a new, empty branch for an empty project?
I have an empty project on remote, which I cloned. Now I want to start working on a branch, `testdev` and start working on it without putting any code to master.
```
$ git checkout -b testdev
$ git status
On branch testdev
Initial commit
nothing to commit (cr... | If you repo is still empty, you might try and create an empty commit, to have *something* to push:
```
git commit --allow-empty -m "initial commit"
git push -u origin testdev
```
See also "[Why do I need to explicitly push a new branch?](https://stackoverflow.com/a/17096880/6309)".
---
Git 2.35 (Q1 2022) allows inf... |
40036648 | GIT Fatal : refusing to merge unrelated histories | 40 | 2016-10-14 06:47:22 | <pre><code>$ git pull origin master
From https://bitbucket.org/tecgenome/chl-v2.0-html
* branch master -> FETCH_HEAD
fatal: refusing to merge unrelated histories
</code></pre>
<p>How can I avoid or get past that error message?</p>
| 49,241 | 6,294,937 | 2023-01-30 08:43:56 | 40,037,123 | 87 | 2016-10-14 07:13:49 | 6,309 | 2023-01-30 08:43:56 | https://stackoverflow.com/q/40036648 | https://stackoverflow.com/a/40037123 | <p><a href="https://stackoverflow.com/a/36528527/6309">Since Git 2.9 (April 2016)</a>, you can try:</p>
<pre><code>git pull --allow-unrelated-histories origin master
</code></pre>
<p>But check why those branches are no longer common though.<br />
Maybe there was a force push rewriting <em>all</em> the history of <code>... | <p><a href="https://stackoverflow.com/a/36528527/6309">Since Git 2.9 (April 2016)</a>, you can try:</p> <pre><code>git pull --allow-unrelated-histories origin master </code></pre> <p>But check why those branches are no longer common though.<br /> Maybe there was a force push rewriting <em>all</em> the history of <code>... | 119, 8337 | bitbucket, git | <h1>GIT Fatal : refusing to merge unrelated histories</h1>
<pre><code>$ git pull origin master
From https://bitbucket.org/tecgenome/chl-v2.0-html
* branch master -> FETCH_HEAD
fatal: refusing to merge unrelated histories
</code></pre>
<p>How can I avoid or get past that error message?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,227 | git | # GIT Fatal : refusing to merge unrelated histories
```
$ git pull origin master
From https://bitbucket.org/tecgenome/chl-v2.0-html
* branch master -> FETCH_HEAD
fatal: refusing to merge unrelated histories
```
How can I avoid or get past that error message? | [Since Git 2.9 (April 2016)](https://stackoverflow.com/a/36528527/6309), you can try:
```
git pull --allow-unrelated-histories origin master
```
But check why those branches are no longer common though.
Maybe there was a force push rewriting *all* the history of `origin/master`.
In which case, if you don't have lo... |
2618989 | How can I remove my last commit in my local git repository | 40 | 2010-04-11 22:44:23 | <p>When I do a 'git pull', I have conflict with the head commit. So I did a 'git rebase --abort'</p>
<p>Can I 'save' my commit to a "patch" and then do a git pull?</p>
<p>What I want to emulate is:</p>
<ul>
<li>I did not commit, but I did a 'git stash' instead</li>
<li>Do a git pull to avoid any merge error</li>
</u... | 57,746 | 286,802 | 2016-01-12 19:40:17 | 2,619,068 | 87 | 2010-04-11 23:09:25 | 149,264 | 2010-04-11 23:09:25 | https://stackoverflow.com/q/2618989 | https://stackoverflow.com/a/2619068 | <p>Your <code>7826b2</code> patch will still cause a conflict when it's applied after pulling, but you can do the following:</p>
<pre><code>git reset --soft HEAD^
git stash
git pull
git stash pop # Will cause a conflict
git commit # Re-commit 7826b2
</code></pre>
<p>Another workflow is also possible:</p>
<pre><co... | <p>Your <code>7826b2</code> patch will still cause a conflict when it's applied after pulling, but you can do the following:</p> <pre><code>git reset --soft HEAD^ git stash git pull git stash pop # Will cause a conflict git commit # Re-commit 7826b2 </code></pre> <p>Another workflow is also possible:</p> <pre><co... | 119 | git | <h1>How can I remove my last commit in my local git repository</h1>
<p>When I do a 'git pull', I have conflict with the head commit. So I did a 'git rebase --abort'</p>
<p>Can I 'save' my commit to a "patch" and then do a git pull?</p>
<p>What I want to emulate is:</p>
<ul>
<li>I did not commit, but I did a 'git sta... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,228 | git | # How can I remove my last commit in my local git repository
When I do a 'git pull', I have conflict with the head commit. So I did a 'git rebase --abort'
Can I 'save' my commit to a "patch" and then do a git pull?
What I want to emulate is:
- I did not commit, but I did a 'git stash' instead
- Do a git pull to avo... | Your `7826b2` patch will still cause a conflict when it's applied after pulling, but you can do the following:
```
git reset --soft HEAD^
git stash
git pull
git stash pop # Will cause a conflict
git commit # Re-commit 7826b2
```
Another workflow is also possible:
```
git reset --hard HEAD^
git pull
git cherry-pic... |
13036947 | 10 GIT lines erased 8Gb form my pc - How to get them back? | 8 | 2012-10-23 18:34:48 | <p>I'm a beginner in GIT and didn't know how powerful this program is... I erased 8 Gb from several commands.<br>
As I remember I typed the following lines:</p>
<pre><code>$git config --global user.name "my name"
$git config --global user.email "my email"
$git add *.c
$git commit -m
$git status
</code></pre>
<p>then ... | 6,378 | 1,769,195 | 2018-03-26 00:33:42 | 13,037,141 | 87 | 2012-10-23 18:47:51 | 82,294 | 2012-10-23 18:55:11 | https://stackoverflow.com/q/13036947 | https://stackoverflow.com/a/13037141 | <p>Oh boy. I see what you did, and it's not pretty. Let's read the documentation for "git clean":</p>
<blockquote>
<p>git-clean - Remove untracked files from the working tree</p>
</blockquote>
<p>This means that <code>git-clean</code> <strong>deletes</strong> files that it <strong>cannot restore.</strong> Git ha... | <p>Oh boy. I see what you did, and it's not pretty. Let's read the documentation for "git clean":</p> <blockquote> <p>git-clean - Remove untracked files from the working tree</p> </blockquote> <p>This means that <code>git-clean</code> <strong>deletes</strong> files that it <strong>cannot restore.</strong> Git ha... | 119, 2200 | git, recovery | <h1>10 GIT lines erased 8Gb form my pc - How to get them back?</h1>
<p>I'm a beginner in GIT and didn't know how powerful this program is... I erased 8 Gb from several commands.<br>
As I remember I typed the following lines:</p>
<pre><code>$git config --global user.name "my name"
$git config --global user.email "my em... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,229 | git | # 10 GIT lines erased 8Gb form my pc - How to get them back?
I'm a beginner in GIT and didn't know how powerful this program is... I erased 8 Gb from several commands.
As I remember I typed the following lines:
```
$git config --global user.name "my name"
$git config --global user.email "my email"
$git add *.c
$git... | Oh boy. I see what you did, and it's not pretty. Let's read the documentation for "git clean":
> git-clean - Remove untracked files from the working tree
This means that `git-clean` **deletes** files that it **cannot restore.** Git has some safety measures in place so that you don't accidentally run `git clean` -- it... |
10697463 | Resolve Git merge conflicts in favor of their changes during a pull | 2,133 | 2012-05-22 07:18:07 | <p>How do I resolve a git merge conflict in favor of pulled changes?</p>
<p>I want to remove all conflicting changes from a working tree without having to go through all of the conflicts with <code>git mergetool</code>, while keeping all conflict-free changes. Preferably, I want to do this while pulling, not afterwards... | 1,793,015 | 93,540 | 2025-02-15 07:47:21 | 62,097,243 | 86 | 2020-05-30 02:54:03 | 418,439 | 2020-05-30 02:54:03 | https://stackoverflow.com/q/10697463 | https://stackoverflow.com/a/62097243 | <p>If you're already in conflicted state, and do not want to checkout path one by one. You may try</p>
<pre><code>git merge --abort
git pull -X theirs
</code></pre>
| <p>If you're already in conflicted state, and do not want to checkout path one by one. You may try</p> <pre><code>git merge --abort git pull -X theirs </code></pre> | 119, 28897, 106113 | git, git-merge, git-merge-conflict | <h1>Resolve Git merge conflicts in favor of their changes during a pull</h1>
<p>How do I resolve a git merge conflict in favor of pulled changes?</p>
<p>I want to remove all conflicting changes from a working tree without having to go through all of the conflicts with <code>git mergetool</code>, while keeping all confl... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,230 | git | # Resolve Git merge conflicts in favor of their changes during a pull
How do I resolve a git merge conflict in favor of pulled changes?
I want to remove all conflicting changes from a working tree without having to go through all of the conflicts with `git mergetool`, while keeping all conflict-free changes. Preferab... | If you're already in conflicted state, and do not want to checkout path one by one. You may try
```
git merge --abort
git pull -X theirs
``` |
2938301 | Remove specific commit | 507 | 2010-05-30 10:57:28 | <p>I was working with a friend on a project, and he edited a bunch of files that shouldn't have been edited. Somehow I merged his work into mine, either when I pulled it, or when I tried to just pick the specific files out that I wanted. I've been looking and playing for a long time, trying to figure out how to remove ... | 884,364 | 184,212 | 2024-09-05 16:20:37 | 3,207,170 | 86 | 2010-07-08 19:26:04 | 387,082 | 2021-08-09 18:24:57 | https://stackoverflow.com/q/2938301 | https://stackoverflow.com/a/3207170 | <p>The algorithm that Git uses when calculating diffs to be reverted requires that</p>
<ol>
<li>The lines being reverted are not modified by any later commits.</li>
<li>There not be any other "adjacent" commits later in history.</li>
</ol>
<p>The definition of "adjacent" is based on the default numb... | <p>The algorithm that Git uses when calculating diffs to be reverted requires that</p> <ol> <li>The lines being reverted are not modified by any later commits.</li> <li>There not be any other "adjacent" commits later in history.</li> </ol> <p>The definition of "adjacent" is based on the default numb... | 119, 5597, 12309, 36489 | cherry-pick, commit, git, revert | <h1>Remove specific commit</h1>
<p>I was working with a friend on a project, and he edited a bunch of files that shouldn't have been edited. Somehow I merged his work into mine, either when I pulled it, or when I tried to just pick the specific files out that I wanted. I've been looking and playing for a long time, try... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,231 | git | # Remove specific commit
I was working with a friend on a project, and he edited a bunch of files that shouldn't have been edited. Somehow I merged his work into mine, either when I pulled it, or when I tried to just pick the specific files out that I wanted. I've been looking and playing for a long time, trying to fi... | The algorithm that Git uses when calculating diffs to be reverted requires that
1. The lines being reverted are not modified by any later commits.
2. There not be any other "adjacent" commits later in history.
The definition of "adjacent" is based on the default number of lines from a context diff, which is 3. So if ... |
1836742 | Using git, how do I ignore a file in one branch but have it committed in another branch? | 191 | 2009-12-02 23:55:23 | <p>I've got a project that I'm deploying to <a href="http://heroku.com" rel="noreferrer">Heroku</a>. The source code tree includes a bunch of mp3 files (the website will be for a recording project I was heavily involved with). </p>
<p>I'd like to put the source code for it up on <a href="http://github.com" rel="noref... | 109,339 | 29,262 | 2022-12-25 00:03:10 | 4,044,387 | 86 | 2010-10-28 15:26:11 | 468,646 | 2022-12-25 00:03:10 | https://stackoverflow.com/q/1836742 | https://stackoverflow.com/a/4044387 | <blockquote>
<p>This solution appears to work only for certain, patched versions of git. See <a href="https://stackoverflow.com/a/39280410/5794048">a new answer pointing to workarounds</a> and <a href="https://stackoverflow.com/a/39285099/5794048">another answer and subsequent comments</a> for a hint which versions may... | <blockquote> <p>This solution appears to work only for certain, patched versions of git. See <a href="https://stackoverflow.com/a/39280410/5794048">a new answer pointing to workarounds</a> and <a href="https://stackoverflow.com/a/39285099/5794048">another answer and subsequent comments</a> for a hint which versions may... | 119, 25056 | git, gitignore | <h1>Using git, how do I ignore a file in one branch but have it committed in another branch?</h1>
<p>I've got a project that I'm deploying to <a href="http://heroku.com" rel="noreferrer">Heroku</a>. The source code tree includes a bunch of mp3 files (the website will be for a recording project I was heavily involved w... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,232 | git | # Using git, how do I ignore a file in one branch but have it committed in another branch?
I've got a project that I'm deploying to [Heroku](http://heroku.com). The source code tree includes a bunch of mp3 files (the website will be for a recording project I was heavily involved with).
I'd like to put the source code... | > This solution appears to work only for certain, patched versions of git. See [a new answer pointing to workarounds](https://stackoverflow.com/a/39280410/5794048) and [another answer and subsequent comments](https://stackoverflow.com/a/39285099/5794048) for a hint which versions may work.
I wrote a blog post on how t... |
43489971 | How to suppress the editor for `git rebase --continue`? | 86 | 2017-04-19 08:06:43 | <p>I'm often rebasing interactive to make tiny changes in the history (for example removing a blank line, or editing one line). In most cases those changes are based on some peer review.</p>
<p>At first I do my change like that:</p>
<pre class="lang-bash prettyprint-override"><code>git rebase --interactive 83bbeb27fcb... | 21,384 | 476,791 | 2024-05-17 13:00:27 | 45,783,848 | 86 | 2017-08-20 15:33:21 | 6,309 | 2022-09-08 05:25:21 | https://stackoverflow.com/q/43489971 | https://stackoverflow.com/a/45783848 | <p>First approach, through Git configuration:</p>
<pre><code>git -c core.editor=true rebase --continue
</code></pre>
<p>Or, with environment variables:</p>
<pre><code>GIT_EDITOR=true git rebase --continue
</code></pre>
<p>This will override the editor that <code>git</code> uses for message confirmation. <code>true</cod... | <p>First approach, through Git configuration:</p> <pre><code>git -c core.editor=true rebase --continue </code></pre> <p>Or, with environment variables:</p> <pre><code>GIT_EDITOR=true git rebase --continue </code></pre> <p>This will override the editor that <code>git</code> uses for message confirmation. <code>true</cod... | 119, 369, 1231, 91259 | command-line, git, git-rewrite-history, macos | <h1>How to suppress the editor for `git rebase --continue`?</h1>
<p>I'm often rebasing interactive to make tiny changes in the history (for example removing a blank line, or editing one line). In most cases those changes are based on some peer review.</p>
<p>At first I do my change like that:</p>
<pre class="lang-bash... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,233 | git | # How to suppress the editor for `git rebase --continue`?
I'm often rebasing interactive to make tiny changes in the history (for example removing a blank line, or editing one line). In most cases those changes are based on some peer review.
At first I do my change like that:
```
git rebase --interactive 83bbeb27fcb... | First approach, through Git configuration:
```
git -c core.editor=true rebase --continue
```
Or, with environment variables:
```
GIT_EDITOR=true git rebase --continue
```
This will override the editor that `git` uses for message confirmation. `true` command simply ends with zero exit code. It makes `git` continue `... |
38599554 | How do you get a specific version from Git in Visual Studio 2015? | 67 | 2016-07-26 20:45:40 | <p>Is there a way to get a specific version (from a specific commit) of a file in Visual Studio 2015 - Team Explorer/Team Services Git?</p>
<p>I simply wish to run the solution with a previous version of a file just to see how things used to run and then come back to the latest version to continue development.</p>
<p... | 75,433 | 483,638 | 2020-09-18 03:44:43 | 38,599,925 | 86 | 2016-07-26 21:10:03 | 383,710 | 2018-07-25 20:50:18 | https://stackoverflow.com/q/38599554 | https://stackoverflow.com/a/38599925 | <p>In Visual Studio 2015, if you do <em>View History</em> (from the <em>Actions</em> menu on the <em>Changes</em> panel in Team Explorer):</p>
<p><a href="https://i.sstatic.net/fXYBJ.png" rel="noreferrer"><img src="https://i.sstatic.net/fXYBJ.png" alt="View History"></a></p>
<p>Then right click on the commit you're i... | <p>In Visual Studio 2015, if you do <em>View History</em> (from the <em>Actions</em> menu on the <em>Changes</em> panel in Team Explorer):</p> <p><a href="https://i.sstatic.net/fXYBJ.png" rel="noreferrer"><img src="https://i.sstatic.net/fXYBJ.png" alt="View History"></a></p> <p>Then right click on the commit you're i... | 119, 108143, 116537 | azure-devops, git, visual-studio-2015 | <h1>How do you get a specific version from Git in Visual Studio 2015?</h1>
<p>Is there a way to get a specific version (from a specific commit) of a file in Visual Studio 2015 - Team Explorer/Team Services Git?</p>
<p>I simply wish to run the solution with a previous version of a file just to see how things used to ru... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,236 | git | # How do you get a specific version from Git in Visual Studio 2015?
Is there a way to get a specific version (from a specific commit) of a file in Visual Studio 2015 - Team Explorer/Team Services Git?
I simply wish to run the solution with a previous version of a file just to see how things used to run and then come ... | In Visual Studio 2015, if you do *View History* (from the *Actions* menu on the *Changes* panel in Team Explorer):
[](https://i.sstatic.net/fXYBJ.png)
Then right click on the commit you're interested in:
[](https://i.sstat... |
10242924 | How to close a branch WITHOUT removing it from history in git? | 66 | 2012-04-20 08:42:21 | <p>I'd like to make a commit and close its branch, <strong>without removing it from history</strong>.</p>
<p>With mercurial I'd <code>commit --close-branch</code>, then <code>update</code> to a previous one, and go on working. With git... I'm confused.</p>
| 24,627 | 207,655 | 2022-04-02 19:49:02 | 10,243,236 | 86 | 2012-04-20 09:05:41 | 11,343 | 2015-03-20 14:03:06 | https://stackoverflow.com/q/10242924 | https://stackoverflow.com/a/10243236 | <p>There's no exact equivalent to closing a branch in Git, because Git branches are more lightweight than in Mercurial. Their Mercurial equivalent is more bookmarks than branches. </p>
<p>If I understand correctly, closing a branch in Mercurial roughly makes it disappear from the branch list, so you can achieve the sa... | <p>There's no exact equivalent to closing a branch in Git, because Git branches are more lightweight than in Mercurial. Their Mercurial equivalent is more bookmarks than branches. </p> <p>If I understand correctly, closing a branch in Mercurial roughly makes it disappear from the branch list, so you can achieve the sa... | 119, 1879 | branch, git | <h1>How to close a branch WITHOUT removing it from history in git?</h1>
<p>I'd like to make a commit and close its branch, <strong>without removing it from history</strong>.</p>
<p>With mercurial I'd <code>commit --close-branch</code>, then <code>update</code> to a previous one, and go on working. With git... I'm conf... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,237 | git | # How to close a branch WITHOUT removing it from history in git?
I'd like to make a commit and close its branch, **without removing it from history**.
With mercurial I'd `commit --close-branch`, then `update` to a previous one, and go on working. With git... I'm confused. | There's no exact equivalent to closing a branch in Git, because Git branches are more lightweight than in Mercurial. Their Mercurial equivalent is more bookmarks than branches.
If I understand correctly, closing a branch in Mercurial roughly makes it disappear from the branch list, so you can achieve the same thing by... |
6214711 | git log and show on a bare repo | 61 | 2011-06-02 12:49:49 | <p>I created a bare repository on a file-server in my local network at home.
After this i pushed a branch of an existing repository from my desktop-pc to this new remote repository.</p>
<p>Pushing worked perfectly and it seems, that all data arrived (a "git branch -va" gives me the correct data).
But i cannot use git... | 52,211 | 376,172 | 2017-01-27 16:43:24 | 6,311,945 | 86 | 2011-06-10 20:51:56 | 712,605 | 2011-06-11 20:36:37 | https://stackoverflow.com/q/6214711 | https://stackoverflow.com/a/6311945 | <p>Yes, this is normal for new bare (and non-bare) repositories.</p>
<h3>Explanation</h3>
<p><code>HEAD</code> is what Git calls a <em>symbolic reference</em>—a reference to another reference.</p>
<p>In non-bare repositories, <code>HEAD</code> normally indicates which branch is currently checked out. A new co... | <p>Yes, this is normal for new bare (and non-bare) repositories.</p> <h3>Explanation</h3> <p><code>HEAD</code> is what Git calls a <em>symbolic reference</em>—a reference to another reference.</p> <p>In non-bare repositories, <code>HEAD</code> normally indicates which branch is currently checked out. A new co... | 119 | git | <h1>git log and show on a bare repo</h1>
<p>I created a bare repository on a file-server in my local network at home.
After this i pushed a branch of an existing repository from my desktop-pc to this new remote repository.</p>
<p>Pushing worked perfectly and it seems, that all data arrived (a "git branch -va" gives me... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,239 | git | # git log and show on a bare repo
I created a bare repository on a file-server in my local network at home.
After this i pushed a branch of an existing repository from my desktop-pc to this new remote repository.
Pushing worked perfectly and it seems, that all data arrived (a "git branch -va" gives me the correct dat... | Yes, this is normal for new bare (and non-bare) repositories.
### Explanation
`HEAD` is what Git calls a *symbolic reference*—a reference to another reference.
In non-bare repositories, `HEAD` normally indicates which branch is currently checked out. A new commit will cause the branch named by `HEAD` to be advanced ... |
9616362 | Rails which files to ignore for GIT | 57 | 2012-03-08 10:43:09 | <p>I created a GIT repo, locally. I now see a bunch of files i rather ignore for GIT check-in. This brings me to the question: is there any default .gitignore for Rails? Any best practices?</p>
<p>I think of <em>tmp</em> and <em>log</em> for sure. But are there any other files or folders i should consider?</p>
| 32,660 | 549,010 | 2024-06-16 09:52:15 | 9,616,445 | 86 | 2012-03-08 10:49:09 | 257,925 | 2023-06-13 22:29:03 | https://stackoverflow.com/q/9616362 | https://stackoverflow.com/a/9616445 | <p>Github has sample <code>.gitignore</code> files for almost any kind of project known to humanity in <a href="https://github.com/github/gitignore" rel="nofollow noreferrer">their github/gitignore</a> repository.</p>
<p>There is one specifically for Rails:
<a href="https://github.com/github/gitignore/blob/main/Rails.g... | <p>Github has sample <code>.gitignore</code> files for almost any kind of project known to humanity in <a href="https://github.com/github/gitignore" rel="nofollow noreferrer">their github/gitignore</a> repository.</p> <p>There is one specifically for Rails: <a href="https://github.com/github/gitignore/blob/main/Rails.g... | 119, 4984 | git, ruby-on-rails | <h1>Rails which files to ignore for GIT</h1>
<p>I created a GIT repo, locally. I now see a bunch of files i rather ignore for GIT check-in. This brings me to the question: is there any default .gitignore for Rails? Any best practices?</p>
<p>I think of <em>tmp</em> and <em>log</em> for sure. But are there any other ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,240 | git | # Rails which files to ignore for GIT
I created a GIT repo, locally. I now see a bunch of files i rather ignore for GIT check-in. This brings me to the question: is there any default .gitignore for Rails? Any best practices?
I think of *tmp* and *log* for sure. But are there any other files or folders i should consid... | Github has sample `.gitignore` files for almost any kind of project known to humanity in [their github/gitignore](https://github.com/github/gitignore) repository.
There is one specifically for Rails:
[Rails.gitignore](https://github.com/github/gitignore/blob/main/Rails.gitignore) |
37956397 | How to make git stash include new files that have not been staged? | 49 | 2016-06-21 23:52:25 | <p>I'm no great expert at git but I've been using it for a couple of years. Lately I've noticed some strange behaviour relating to stashing. It seems to be only partially working for me. </p>
<p>For example today I tried to stash 4 uncommitted changes. 1 file was added to the stash, the remaining 3 stayed as uncom... | 32,757 | 216,440 | 2016-06-24 13:32:29 | 37,968,072 | 86 | 2016-06-22 12:30:32 | 2,295,034 | 2016-06-22 12:30:32 | https://stackoverflow.com/q/37956397 | https://stackoverflow.com/a/37968072 | <p>The problem seems to be that by default the <a href="https://git-scm.com/docs/git-stash"><code>stash</code></a> command will not include untracked files.</p>
<p>To include untracked files, use the <code>-u</code> (<code>--include-untracked</code>) flag:</p>
<pre><code>git stash -u
</code></pre>
<blockquote>
<p>... | <p>The problem seems to be that by default the <a href="https://git-scm.com/docs/git-stash"><code>stash</code></a> command will not include untracked files.</p> <p>To include untracked files, use the <code>-u</code> (<code>--include-untracked</code>) flag:</p> <pre><code>git stash -u </code></pre> <blockquote> <p>... | 119, 39597 | git, git-extensions | <h1>How to make git stash include new files that have not been staged?</h1>
<p>I'm no great expert at git but I've been using it for a couple of years. Lately I've noticed some strange behaviour relating to stashing. It seems to be only partially working for me. </p>
<p>For example today I tried to stash 4 uncommit... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,241 | git | # How to make git stash include new files that have not been staged?
I'm no great expert at git but I've been using it for a couple of years. Lately I've noticed some strange behaviour relating to stashing. It seems to be only partially working for me.
For example today I tried to stash 4 uncommitted changes. 1 file ... | The problem seems to be that by default the [`stash`](https://git-scm.com/docs/git-stash) command will not include untracked files.
To include untracked files, use the `-u` (`--include-untracked`) flag:
```
git stash -u
```
> If the **--include-untracked** option is used, all untracked files are
> also stashed and t... |
14673257 | Git GUI and gitk is not present after installing Git | 46 | 2013-02-03 13:59:39 | <p>I am using <a href="https://en.wikipedia.org/wiki/Ubuntu_version_history#Ubuntu_11.10_.28Oneiric_Ocelot.29" rel="nofollow noreferrer">Ubuntu 11.10 (Oneiric Ocelot)</a> and have just installed Git using</p>
<pre><code>sudo apt-get install
</code></pre>
<p>The basic Git commands seem to work. (I have created a reposi... | 42,090 | 1,114,136 | 2022-06-24 18:02:42 | 14,673,290 | 86 | 2013-02-03 14:03:50 | 166,749 | 2013-02-03 14:54:24 | https://stackoverflow.com/q/14673257 | https://stackoverflow.com/a/14673290 | <pre><code>sudo apt-get install git-gui gitk
</code></pre>
| <pre><code>sudo apt-get install git-gui gitk </code></pre> | 119, 74581 | git, ubuntu-11.10 | <h1>Git GUI and gitk is not present after installing Git</h1>
<p>I am using <a href="https://en.wikipedia.org/wiki/Ubuntu_version_history#Ubuntu_11.10_.28Oneiric_Ocelot.29" rel="nofollow noreferrer">Ubuntu 11.10 (Oneiric Ocelot)</a> and have just installed Git using</p>
<pre><code>sudo apt-get install
</code></pre>
<p>... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,242 | git | # Git GUI and gitk is not present after installing Git
I am using [Ubuntu 11.10 (Oneiric Ocelot)](https://en.wikipedia.org/wiki/Ubuntu_version_history#Ubuntu_11.10_.28Oneiric_Ocelot.29) and have just installed Git using
```
sudo apt-get install
```
The basic Git commands seem to work. (I have created a repository an... | ```
sudo apt-get install git-gui gitk
``` |
4589333 | Git ignore locally deleted folder | 35 | 2011-01-03 23:23:13 | <p>I have a Ruby on Rails application which crashes when <code>vendor/rails</code> is present but works fine if it is not. I need to keep this folder deleted in my local copy so that I can work, but I don't want this deletion to ever be committed. Someone put it there for a reason.</p>
<p>So how do I delete this folde... | 15,825 | 76,900 | 2018-03-21 12:13:17 | 4,590,664 | 86 | 2011-01-04 04:33:07 | 9,410 | 2018-03-21 12:13:17 | https://stackoverflow.com/q/4589333 | https://stackoverflow.com/a/4590664 | <pre><code> git ls-files <strong>--deleted</strong> -z | <a href="http://www.kernel.org/pub/software/scm/git/docs/git-update-index.html" rel="noreferrer">git update-index</a> <strong>--assume-unchanged</strong> -z --stdin</code></pre>
<p>Note that because this is an index-based operation, you cannot set directories to... | <pre><code> git ls-files <strong>--deleted</strong> -z | <a href="http://www.kernel.org/pub/software/scm/git/docs/git-update-index.html" rel="noreferrer">git update-index</a> <strong>--assume-unchanged</strong> -z --stdin</code></pre> <p>Note that because this is an index-based operation, you cannot set directories to... | 119, 4333 | git, ignore | <h1>Git ignore locally deleted folder</h1>
<p>I have a Ruby on Rails application which crashes when <code>vendor/rails</code> is present but works fine if it is not. I need to keep this folder deleted in my local copy so that I can work, but I don't want this deletion to ever be committed. Someone put it there for a re... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,244 | git | # Git ignore locally deleted folder
I have a Ruby on Rails application which crashes when `vendor/rails` is present but works fine if it is not. I need to keep this folder deleted in my local copy so that I can work, but I don't want this deletion to ever be committed. Someone put it there for a reason.
So how do I d... | ```
git ls-files --deleted -z | git update-index --assume-unchanged -z --stdin
```
Note that because this is an index-based operation, you cannot set directories to be ignored – only individual files. If upstream ever adds a file inside those directories, you will have to repeat the fix-up. |
1841341 | Remove local git tags that are no longer on the remote repository | 759 | 2009-12-03 17:01:42 | <p>We use tags in git as part of our deployment process. From time to time, we want to clean up these tags by removing them from our remote repository.</p>
<p>This is pretty straightforward. One user deletes the local tag and the remote tag in one set of commands. We have a little shell script that combines both st... | 324,377 | 144,071 | 2025-01-10 10:03:23 | 1,847,797 | 85 | 2009-12-04 15:43:17 | 99,220 | 2009-12-04 15:43:17 | https://stackoverflow.com/q/1841341 | https://stackoverflow.com/a/1847797 | <p>Good question. :) I don't have a complete answer...</p>
<p>That said, you can get a list of remote tags via <code>git ls-remote</code>. To list the tags in the repository referenced by <code>origin</code>, you'd run:</p>
<pre><code>git ls-remote --tags origin
</code></pre>
<p>That returns a list of hashes and ... | <p>Good question. :) I don't have a complete answer...</p> <p>That said, you can get a list of remote tags via <code>git ls-remote</code>. To list the tags in the repository referenced by <code>origin</code>, you'd run:</p> <pre><code>git ls-remote --tags origin </code></pre> <p>That returns a list of hashes and ... | 119, 60718 | git, git-tag | <h1>Remove local git tags that are no longer on the remote repository</h1>
<p>We use tags in git as part of our deployment process. From time to time, we want to clean up these tags by removing them from our remote repository.</p>
<p>This is pretty straightforward. One user deletes the local tag and the remote tag i... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,246 | git | # Remove local git tags that are no longer on the remote repository
We use tags in git as part of our deployment process. From time to time, we want to clean up these tags by removing them from our remote repository.
This is pretty straightforward. One user deletes the local tag and the remote tag in one set of comma... | Good question. :) I don't have a complete answer...
That said, you can get a list of remote tags via `git ls-remote`. To list the tags in the repository referenced by `origin`, you'd run:
```
git ls-remote --tags origin
```
That returns a list of hashes and friendly tag names, like:
```
94bf6de8315d9a7b22385e86e1f5... |
15467507 | Trying to commit Git files but getting :: fatal: LF would be replaced by CRLF in <some file in repo> | 77 | 2013-03-17 23:21:17 | <p>When I try to commit some changed files, I get the following error message with TortoiseGit</p>
<p><code>fatal: LF would be replaced by CRLF in <some file in the repo></code></p>
<p>Now, before I get the usual <code>LF vs CRLF</code> answers, I know and understand what the debate is about. Secondly, I've als... | 104,817 | 30,674 | 2025-02-25 05:09:29 | 15,471,083 | 85 | 2013-03-18 06:45:16 | 6,309 | 2018-06-29 20:41:59 | https://stackoverflow.com/q/15467507 | https://stackoverflow.com/a/15471083 | <p>You might want to set <code>core.safecrlf</code> to "warn", if you want only warning and not a fatal error.</p>
<p>From <a href="http://git-scm.com/docs/git-config" rel="noreferrer">"<code>git config</code>" mange page</a>:</p>
<p>core.safecrlf</p>
<blockquote>
<p>If true, makes git check if converting CRLF is ... | <p>You might want to set <code>core.safecrlf</code> to "warn", if you want only warning and not a fatal error.</p> <p>From <a href="http://git-scm.com/docs/git-config" rel="noreferrer">"<code>git config</code>" mange page</a>:</p> <p>core.safecrlf</p> <blockquote> <p>If true, makes git check if converting CRLF is ... | 64, 119, 33953 | git, visual-studio, windows | <h1>Trying to commit Git files but getting :: fatal: LF would be replaced by CRLF in <some file in repo></h1>
<p>When I try to commit some changed files, I get the following error message with TortoiseGit</p>
<p><code>fatal: LF would be replaced by CRLF in <some file in the repo></code></p>
<p>Now, before I get... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,250 | git | # Trying to commit Git files but getting :: fatal: LF would be replaced by CRLF in
When I try to commit some changed files, I get the following error message with TortoiseGit
`fatal: LF would be replaced by CRLF in <some file in the repo>`
Now, before I get the usual `LF vs CRLF` answers, I know and understand what ... | You might want to set `core.safecrlf` to "warn", if you want only warning and not a fatal error.
From ["`git config`" mange page](http://git-scm.com/docs/git-config):
core.safecrlf
> If true, makes git check if converting CRLF is reversible when end-of-line conversion is active. Git will verify if a command modifies... |
3590400 | Git commit to common submodule (master branch) | 76 | 2010-08-28 10:32:31 | <p>I've two or more projects (let's call them <em>ProjectFoo</em> and <em>ProjectBar</em>) having some <strong>common code</strong> that I put in a <strong>submodule</strong>.</p>
<p>My understanding is that if I commit changes to a submodule from within <em>ProjectFoo</em> it'll be in a detached head that only all <e... | 34,822 | 167,897 | 2023-01-18 08:10:22 | 3,592,542 | 85 | 2010-08-28 21:27:38 | 299,409 | 2018-07-03 09:48:02 | https://stackoverflow.com/q/3590400 | https://stackoverflow.com/a/3592542 | <p>Short answer: </p>
<pre><code>cd ProjectFooBarCommoneSubmodule
git checkout master
<Do your editing>
git commit --all -m "Lots of fixes"
git push submodule_origin master
cd ..
git add ProjectFooBarCommoneSubmodule
git commit -m "Bumped up the revision of ProjectFooBarCommoneSubmodule"
git push origin master
... | <p>Short answer: </p> <pre><code>cd ProjectFooBarCommoneSubmodule git checkout master <Do your editing> git commit --all -m "Lots of fixes" git push submodule_origin master cd .. git add ProjectFooBarCommoneSubmodule git commit -m "Bumped up the revision of ProjectFooBarCommoneSubmodule" git push origin master ... | 119, 5597, 41612 | commit, git, git-submodules | <h1>Git commit to common submodule (master branch)</h1>
<p>I've two or more projects (let's call them <em>ProjectFoo</em> and <em>ProjectBar</em>) having some <strong>common code</strong> that I put in a <strong>submodule</strong>.</p>
<p>My understanding is that if I commit changes to a submodule from within <em>Proj... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,251 | git | # Git commit to common submodule (master branch)
I've two or more projects (let's call them *ProjectFoo* and *ProjectBar*) having some **common code** that I put in a **submodule**.
My understanding is that if I commit changes to a submodule from within *ProjectFoo* it'll be in a detached head that only all *ProjectF... | Short answer:
```
cd ProjectFooBarCommoneSubmodule
git checkout master
<Do your editing>
git commit --all -m "Lots of fixes"
git push submodule_origin master
cd ..
git add ProjectFooBarCommoneSubmodule
git commit -m "Bumped up the revision of ProjectFooBarCommoneSubmodule"
git push origin master
```
The longer one:
... |
40987847 | Unable to find current origin/master revision in submodule path | 74 | 2016-12-06 04:28:29 | <p>In my project (which uses <code>git</code>), I need to use <a href="https://github.com/mb21/JSONedit" rel="noreferrer">a library</a>, which is still in progress. I decided to create a submodule for that library, because I want to update from time to time its latest version (I don't plan to make my own change there).... | 118,308 | 702,977 | 2023-06-07 22:55:43 | 40,987,947 | 85 | 2016-12-06 04:39:52 | 4,255,272 | 2020-11-10 03:40:15 | https://stackoverflow.com/q/40987847 | https://stackoverflow.com/a/40987947 | <p>Running this in the main repository should do the trick:</p>
<pre><code>git pull --recurse-submodules
</code></pre>
<p>According to the other discussion, especially as <a href="https://stackoverflow.com/users/229753/tobu">@Tobu</a> <a href="https://stackoverflow.com/a/8573310/537554#comment-15144961">pointed out in ... | <p>Running this in the main repository should do the trick:</p> <pre><code>git pull --recurse-submodules </code></pre> <p>According to the other discussion, especially as <a href="https://stackoverflow.com/users/229753/tobu">@Tobu</a> <a href="https://stackoverflow.com/a/8573310/537554#comment-15144961">pointed out in ... | 119, 41612 | git, git-submodules | <h1>Unable to find current origin/master revision in submodule path</h1>
<p>In my project (which uses <code>git</code>), I need to use <a href="https://github.com/mb21/JSONedit" rel="noreferrer">a library</a>, which is still in progress. I decided to create a submodule for that library, because I want to update from ti... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,252 | git | # Unable to find current origin/master revision in submodule path
In my project (which uses `git`), I need to use [a library](https://github.com/mb21/JSONedit), which is still in progress. I decided to create a submodule for that library, because I want to update from time to time its latest version (I don't plan to m... | Running this in the main repository should do the trick:
```
git pull --recurse-submodules
```
According to the other discussion, especially as [@Tobu](https://stackoverflow.com/users/229753/tobu) [pointed out in his comment over there](https://stackoverflow.com/a/8573310/537554#comment-15144961), if the error persis... |
35738790 | how to close a branch in git | 68 | 2016-03-02 04:53:12 | <p>When I know I won't use a branch any more is it possible to close or lock it? Actually I would like to close a branch but I don't think it is possible to close a branch with GIT. what about the delete. What happens to my history when I delete a branch? </p>
| 128,438 | 5,916,543 | 2021-06-10 15:38:44 | 35,738,879 | 85 | 2016-03-02 05:02:24 | 2,450,855 | 2016-03-02 08:13:10 | https://stackoverflow.com/q/35738790 | https://stackoverflow.com/a/35738879 | <p><strong>Updated Answer</strong></p>
<p>As <a href="https://stackoverflow.com/users/3159253/user3159253">@user3159253</a> stated in comments of this answer :</p>
<blockquote>
<p>git garbage-collects commits which aren't referenced, directly or indirectly, by a named reference (branch, tag, etc). That is why it is... | <p><strong>Updated Answer</strong></p> <p>As <a href="https://stackoverflow.com/users/3159253/user3159253">@user3159253</a> stated in comments of this answer :</p> <blockquote> <p>git garbage-collects commits which aren't referenced, directly or indirectly, by a named reference (branch, tag, etc). That is why it is... | 119, 60718, 76220, 81662 | git, git-archive, git-branch, git-tag | <h1>how to close a branch in git</h1>
<p>When I know I won't use a branch any more is it possible to close or lock it? Actually I would like to close a branch but I don't think it is possible to close a branch with GIT. what about the delete. What happens to my history when I delete a branch? </p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,253 | git | # how to close a branch in git
When I know I won't use a branch any more is it possible to close or lock it? Actually I would like to close a branch but I don't think it is possible to close a branch with GIT. what about the delete. What happens to my history when I delete a branch? | **Updated Answer**
As [@user3159253](https://stackoverflow.com/users/3159253/user3159253) stated in comments of this answer :
> git garbage-collects commits which aren't referenced, directly or indirectly, by a named reference (branch, tag, etc). That is why it is important to leave a reference to a freezed branch.
... |
39644366 | git clone with different username/account | 64 | 2016-09-22 16:31:42 | <p>How can I <code>clone</code> a repository on <code>git</code> with an account that's different from what I was previously using?</p>
<p>For example, I might have been using one account for cloning one repo, and now I need to access another repo that only a different account has access to.</p>
<p>Thanks for the help<... | 136,168 | 1,541,397 | 2025-12-22 16:53:41 | 39,644,516 | 85 | 2016-09-22 16:39:51 | 6,859,255 | 2016-09-22 16:45:30 | https://stackoverflow.com/q/39644366 | https://stackoverflow.com/a/39644516 | <p>If you clone via https you can do something like</p>
<pre><code>git clone https://username@github.com/username/repository.git
</code></pre>
<p>This will prompt you for a password.</p>
<p>You can also directly provide a password by calling</p>
<pre><code>git clone https://username:password@github.com/username/rep... | <p>If you clone via https you can do something like</p> <pre><code>git clone https://username@github.com/username/repository.git </code></pre> <p>This will prompt you for a password.</p> <p>You can also directly provide a password by calling</p> <pre><code>git clone https://username:password@github.com/username/rep... | 119, 3050 | clone, git | <h1>git clone with different username/account</h1>
<p>How can I <code>clone</code> a repository on <code>git</code> with an account that's different from what I was previously using?</p>
<p>For example, I might have been using one account for cloning one repo, and now I need to access another repo that only a different... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,254 | git | # git clone with different username/account
How can I `clone` a repository on `git` with an account that's different from what I was previously using?
For example, I might have been using one account for cloning one repo, and now I need to access another repo that only a different account has access to.
Thanks for t... | If you clone via https you can do something like
```
git clone https://username@github.com/username/repository.git
```
This will prompt you for a password.
You can also directly provide a password by calling
```
git clone https://username:password@github.com/username/repository.git
```
But be aware that the passwo... |
6235379 | How to send pull request on Git | 61 | 2011-06-04 07:17:34 | <p>We have recently migrated to Git from SVN. We have setup a bare repository on one machine in our LAN network and cloned on other machines. Now when anyone do the changes and commits we want that he sends the pull request to the bare repo (by telling or emailing or any other way) after that one will go through the ch... | 45,770 | 236,639 | 2017-01-16 11:24:03 | 6,235,394 | 85 | 2011-06-04 07:19:37 | 893 | 2012-10-28 21:15:44 | https://stackoverflow.com/q/6235379 | https://stackoverflow.com/a/6235394 | <p>Both Git (the software) and GitHub (the web service) have a concept called "pull request", and unfortunately they are not exactly the same thing.</p>
<h2>Native Git</h2>
<p>The native Git <code>request-pull</code> command has a very short <a href="https://www.kernel.org/pub/software/scm/git/docs/git-request-pull.h... | <p>Both Git (the software) and GitHub (the web service) have a concept called "pull request", and unfortunately they are not exactly the same thing.</p> <h2>Native Git</h2> <p>The native Git <code>request-pull</code> command has a very short <a href="https://www.kernel.org/pub/software/scm/git/docs/git-request-pull.h... | 119, 6452, 64512 | git, git-svn, pull-request | <h1>How to send pull request on Git</h1>
<p>We have recently migrated to Git from SVN. We have setup a bare repository on one machine in our LAN network and cloned on other machines. Now when anyone do the changes and commits we want that he sends the pull request to the bare repo (by telling or emailing or any other w... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,255 | git | # How to send pull request on Git
We have recently migrated to Git from SVN. We have setup a bare repository on one machine in our LAN network and cloned on other machines. Now when anyone do the changes and commits we want that he sends the pull request to the bare repo (by telling or emailing or any other way) after... | Both Git (the software) and GitHub (the web service) have a concept called "pull request", and unfortunately they are not exactly the same thing.
## Native Git
The native Git `request-pull` command has a very short [manual page](https://www.kernel.org/pub/software/scm/git/docs/git-request-pull.html) with the followin... |
71332146 | incoming and current in a rebase | 58 | 2022-03-03 04:27:59 | <p>There is a similar question to this one but its scope is too general and the response overly complicated.
My question is <em>very punctual</em></p>
<p>When from my branch <code>MyBranch</code> and doing a rebase like <code>git rebase master</code>
and having a conflict</p>
<p>which is <em>incoming change</em>? and ... | 27,479 | 4,451,521 | 2022-03-03 05:12:14 | 71,332,348 | 85 | 2022-03-03 05:06:33 | 184,546 | 2022-03-03 05:12:14 | https://stackoverflow.com/q/71332146 | https://stackoverflow.com/a/71332348 | <blockquote>
<p>When from my branch <code>MyBranch</code> and doing a rebase like <code>git rebase master</code> and having a conflict which is incoming change? and which is current change?</p>
</blockquote>
<p>When rebasing <code>MyBranch</code> onto <code>master</code>, "incoming" is the branch you have che... | <blockquote> <p>When from my branch <code>MyBranch</code> and doing a rebase like <code>git rebase master</code> and having a conflict which is incoming change? and which is current change?</p> </blockquote> <p>When rebasing <code>MyBranch</code> onto <code>master</code>, "incoming" is the branch you have che... | 119, 8974 | git, rebase | <h1>incoming and current in a rebase</h1>
<p>There is a similar question to this one but its scope is too general and the response overly complicated.
My question is <em>very punctual</em></p>
<p>When from my branch <code>MyBranch</code> and doing a rebase like <code>git rebase master</code>
and having a conflict</p>
... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,257 | git | # incoming and current in a rebase
There is a similar question to this one but its scope is too general and the response overly complicated.
My question is *very punctual*
When from my branch `MyBranch` and doing a rebase like `git rebase master`
and having a conflict
which is *incoming change*? and which is *curren... | > When from my branch `MyBranch` and doing a rebase like `git rebase master` and having a conflict which is incoming change? and which is current change?
When rebasing `MyBranch` onto `master`, "incoming" is the branch you have checked out, which is `MyBranch`, and "current" is `master`.
The reason is because of what... |
36800155 | Git: rename directory (case-only) on Windows | 57 | 2016-04-22 17:40:25 | <p>I want to rename a directory versioned by Git on a Windows system (change the case of the directory name):</p>
<pre><code>$ git mv docs DOCS
Rename from 'docs' to 'DOCS/docs' failed. Should I try again? (y/n) n
fatal: renaming 'docs' failed: Permission denied
</code></pre>
<p>I've also tried with the force-option ... | 13,478 | 2,460,378 | 2024-04-26 22:40:58 | 36,800,417 | 85 | 2016-04-22 17:55:47 | 6,236,921 | 2016-04-22 17:55:47 | https://stackoverflow.com/q/36800155 | https://stackoverflow.com/a/36800417 | <p>You can try to do it in 2 step.</p>
<pre><code>$ git mv docs DOCS2
$ git mv DOCS2 DOCS
</code></pre>
<p>it will work</p>
| <p>You can try to do it in 2 step.</p> <pre><code>$ git mv docs DOCS2 $ git mv DOCS2 DOCS </code></pre> <p>it will work</p> | 64, 119, 4510 | git, rename, windows | <h1>Git: rename directory (case-only) on Windows</h1>
<p>I want to rename a directory versioned by Git on a Windows system (change the case of the directory name):</p>
<pre><code>$ git mv docs DOCS
Rename from 'docs' to 'DOCS/docs' failed. Should I try again? (y/n) n
fatal: renaming 'docs' failed: Permission denied
</... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,258 | git | # Git: rename directory (case-only) on Windows
I want to rename a directory versioned by Git on a Windows system (change the case of the directory name):
```
$ git mv docs DOCS
Rename from 'docs' to 'DOCS/docs' failed. Should I try again? (y/n) n
fatal: renaming 'docs' failed: Permission denied
```
I've also tried w... | You can try to do it in 2 step.
```
$ git mv docs DOCS2
$ git mv DOCS2 DOCS
```
it will work |
26126876 | why `git diff` reports no file change after `git add` | 52 | 2014-09-30 17:43:07 | <h2> Why is that <code>git diff</code> thinks there are no changes</h2>
<p>..even if <code>git status</code> reports them as <em>modified</em>?</p>
<pre><code>$ git status
On branch master
Your branch is ahead of 'origin/master' by 2 commits.
(use "git push" to publish your local commits)
Changes to be committed:
... | 28,658 | 171,592 | 2020-07-07 08:53:34 | 26,127,000 | 85 | 2014-09-30 17:50:54 | 630,866 | 2020-07-07 08:53:34 | https://stackoverflow.com/q/26126876 | https://stackoverflow.com/a/26127000 | <p>Please try <code>git diff --staged</code> command.</p>
<p>Alternative options available are listed below.</p>
<blockquote>
<p><code>git diff</code></p>
</blockquote>
<p>shows changes between index/staging and working files. Since, in your case, <code>git add</code> moved your <code>files-with-changes</code> to stagi... | <p>Please try <code>git diff --staged</code> command.</p> <p>Alternative options available are listed below.</p> <blockquote> <p><code>git diff</code></p> </blockquote> <p>shows changes between index/staging and working files. Since, in your case, <code>git add</code> moved your <code>files-with-changes</code> to stagi... | 119, 9033, 34792 | git, git-add, git-diff | <h1>why `git diff` reports no file change after `git add`</h1>
<h2> Why is that <code>git diff</code> thinks there are no changes</h2>
<p>..even if <code>git status</code> reports them as <em>modified</em>?</p>
<pre><code>$ git status
On branch master
Your branch is ahead of 'origin/master' by 2 commits.
(use "git ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,260 | git | # why `git diff` reports no file change after `git add`
## Why is that `git diff` thinks there are no changes
..even if `git status` reports them as *modified*?
```
$ git status
On branch master
Your branch is ahead of 'origin/master' by 2 commits.
(use "git push" to publish your local commits)
Changes to be comm... | Please try `git diff --staged` command.
Alternative options available are listed below.
> `git diff`
shows changes between index/staging and working files. Since, in your case, `git add` moved your `files-with-changes` to staging area, there were no modifications shown/seen.
> `git diff --staged`
shows changes bet... |
17354353 | Git rebase squash all commits in branch, off of another branch, without conflicts | 52 | 2013-06-27 22:33:19 | <p>A common development workflow for us is to checkout branch <code>b</code>, commit a bunch to it, then squash all those commits into one (still on <code>b</code>).</p>
<p>However, during the <code>rebase -i</code> process to squash all the commits, there are frequently conflicts at multiple steps.</p>
<p><strong>I ... | 25,177 | 743,464 | 2024-08-10 19:58:13 | 17,354,830 | 85 | 2013-06-27 23:20:45 | 1,847,483 | 2015-06-23 12:21:14 | https://stackoverflow.com/q/17354353 | https://stackoverflow.com/a/17354830 | <p>If you don't need the commit information, then you could just do a soft reset. Then files remain as they were and when you commit, this commit will be on top of the commit you did reset to.</p>
<p>To find the commit to reset to:</p>
<pre><code>git merge-base HEAD BRANCH_YOU_BRANCHED_FROM
</code></pre>
<p>Then</p>... | <p>If you don't need the commit information, then you could just do a soft reset. Then files remain as they were and when you commit, this commit will be on top of the commit you did reset to.</p> <p>To find the commit to reset to:</p> <pre><code>git merge-base HEAD BRANCH_YOU_BRANCHED_FROM </code></pre> <p>Then</p>... | 119, 8974, 42532 | git, rebase, squash | <h1>Git rebase squash all commits in branch, off of another branch, without conflicts</h1>
<p>A common development workflow for us is to checkout branch <code>b</code>, commit a bunch to it, then squash all those commits into one (still on <code>b</code>).</p>
<p>However, during the <code>rebase -i</code> process to s... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,261 | git | # Git rebase squash all commits in branch, off of another branch, without conflicts
A common development workflow for us is to checkout branch `b`, commit a bunch to it, then squash all those commits into one (still on `b`).
However, during the `rebase -i` process to squash all the commits, there are frequently confl... | If you don't need the commit information, then you could just do a soft reset. Then files remain as they were and when you commit, this commit will be on top of the commit you did reset to.
To find the commit to reset to:
```
git merge-base HEAD BRANCH_YOU_BRANCHED_FROM
```
Then
```
git reset --soft COMMIT_HASH
```... |
4592866 | Git: How to estimate a contribution of a person to my project in terms of added/changed lines of code? | 49 | 2011-01-04 11:02:03 | <p>I have a GIT repository and I want to calculate how many lines of code were added/changed by one person or a group of persons during some period of time. Is it possible to calculate with git?</p>
| 37,508 | 504,325 | 2020-02-20 21:43:45 | 4,593,065 | 85 | 2011-01-04 11:25:11 | 573 | 2016-02-08 22:56:15 | https://stackoverflow.com/q/4592866 | https://stackoverflow.com/a/4593065 | <p>You can use <code>git log</code> and some shell-fu:</p>
<pre><code>git log --shortstat --author "Aviv Ben-Yosef" --since "2 weeks ago" --until "1 week ago" \
| grep "files\? changed" \
| awk '{files+=$1; inserted+=$4; deleted+=$6} END \
{print "files changed", files, "lines inserted:", inserted, ... | <p>You can use <code>git log</code> and some shell-fu:</p> <pre><code>git log --shortstat --author "Aviv Ben-Yosef" --since "2 weeks ago" --until "1 week ago" \ | grep "files\? changed" \ | awk '{files+=$1; inserted+=$4; deleted+=$6} END \ {print "files changed", files, "lines inserted:", inserted, ... | 119 | git | <h1>Git: How to estimate a contribution of a person to my project in terms of added/changed lines of code?</h1>
<p>I have a GIT repository and I want to calculate how many lines of code were added/changed by one person or a group of persons during some period of time. Is it possible to calculate with git?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,262 | git | # Git: How to estimate a contribution of a person to my project in terms of added/changed lines of code?
I have a GIT repository and I want to calculate how many lines of code were added/changed by one person or a group of persons during some period of time. Is it possible to calculate with git? | You can use `git log` and some shell-fu:
```
git log --shortstat --author "Aviv Ben-Yosef" --since "2 weeks ago" --until "1 week ago" \
| grep "files\? changed" \
| awk '{files+=$1; inserted+=$4; deleted+=$6} END \
{print "files changed", files, "lines inserted:", inserted, "lines deleted:", deleted... |
5770016 | Why does Git not default to "origin master"? | 38 | 2011-04-24 10:26:14 | <p>I tried many times doing a</p>
<pre><code>git pull
</code></pre>
<p>and it says the branch is not specified. So the answer in <a href="https://stackoverflow.com/questions/658885/how-do-you-get-git-to-always-pull-from-a-specific-branch">How do you get git to always pull from a specific branch?</a> seems to work.</p... | 24,416 | 325,418 | 2021-05-17 17:55:41 | 5,770,096 | 85 | 2011-04-24 10:43:48 | 223,092 | 2013-03-10 21:14:43 | https://stackoverflow.com/q/5770016 | https://stackoverflow.com/a/5770096 | <p>git tries to use sensible defaults for <code>git pull</code> based on the branch that you're currently on. If you get the error you refer to from <code>git pull</code> while you're on <code>master</code>, that means you haven't configured an upstream branch for <code>master</code>. In many situations this will be ... | <p>git tries to use sensible defaults for <code>git pull</code> based on the branch that you're currently on. If you get the error you refer to from <code>git pull</code> while you're on <code>master</code>, that means you haven't configured an upstream branch for <code>master</code>. In many situations this will be ... | 119 | git | <h1>Why does Git not default to "origin master"?</h1>
<p>I tried many times doing a</p>
<pre><code>git pull
</code></pre>
<p>and it says the branch is not specified. So the answer in <a href="https://stackoverflow.com/questions/658885/how-do-you-get-git-to-always-pull-from-a-specific-branch">How do you get git to alwa... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,263 | git | # Why does Git not default to "origin master"?
I tried many times doing a
```
git pull
```
and it says the branch is not specified. So the answer in [How do you get git to always pull from a specific branch?](https://stackoverflow.com/questions/658885/how-do-you-get-git-to-always-pull-from-a-specific-branch) seems t... | git tries to use sensible defaults for `git pull` based on the branch that you're currently on. If you get the error you refer to from `git pull` while you're on `master`, that means you haven't configured an upstream branch for `master`. In many situations this will be configured already - for example, when you clone ... |
6901446 | Deploying to heroku with git keeps getting rejected due to fast-forwards | 28 | 2011-08-01 16:25:50 | <p>I keep getting the following fail with heroku + git...</p>
<pre><code>$ heroku jammit:deploy --app XXXXXXXXXXX
===== Compiling assets...[OK]
===== Commiting assets...[OK]
===== Done...
===== Deploying assets for xxxxx-staging to heroku...
To git@heroku.com:XXXXXXXX.git
! [rejected] master -> master (non-... | 13,055 | 149,080 | 2016-09-09 13:10:16 | 6,907,492 | 85 | 2011-08-02 05:07:08 | 308,315 | 2011-08-02 05:07:08 | https://stackoverflow.com/q/6901446 | https://stackoverflow.com/a/6907492 | <p>Just force the commit every time you push and it will push it even if there are fast-forward commits. We do this in our development Heroku server all the time since we're all pushing different commits (some further behind than others).</p>
<pre><code>git push -f git@heroku.com:picasso-staging.git
</code></pre>
<p... | <p>Just force the commit every time you push and it will push it even if there are fast-forward commits. We do this in our development Heroku server all the time since we're all pushing different commits (some further behind than others).</p> <pre><code>git push -f git@heroku.com:picasso-staging.git </code></pre> <p... | 119, 4984, 8279, 64108 | git, heroku, ruby-on-rails, ruby-on-rails-3 | <h1>Deploying to heroku with git keeps getting rejected due to fast-forwards</h1>
<p>I keep getting the following fail with heroku + git...</p>
<pre><code>$ heroku jammit:deploy --app XXXXXXXXXXX
===== Compiling assets...[OK]
===== Commiting assets...[OK]
===== Done...
===== Deploying assets for xxxxx-staging to herok... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,265 | git | # Deploying to heroku with git keeps getting rejected due to fast-forwards
I keep getting the following fail with heroku + git...
```
$ heroku jammit:deploy --app XXXXXXXXXXX
===== Compiling assets...[OK]
===== Commiting assets...[OK]
===== Done...
===== Deploying assets for xxxxx-staging to heroku...
To git@heroku.c... | Just force the commit every time you push and it will push it even if there are fast-forward commits. We do this in our development Heroku server all the time since we're all pushing different commits (some further behind than others).
```
git push -f git@heroku.com:picasso-staging.git
```
I don't use jammit for depl... |
2715085 | Rebasing and what does one mean by rebasing pushed commits | 117 | 2010-04-26 16:28:15 | <p>It is often said that, you should not rebase commits that you have already pushed. What could be meaning of that? </p>
| 73,354 | 33,997 | 2015-01-31 22:28:51 | 2,715,147 | 84 | 2010-04-26 16:37:05 | 63,147 | 2014-09-29 15:51:02 | https://stackoverflow.com/q/2715085 | https://stackoverflow.com/a/2715147 | <p>The <a href="http://git-scm.com/book" rel="noreferrer">ProGit book</a> has a <a href="http://git-scm.com/book/en/Git-Branching-Rebasing" rel="noreferrer">good explanation</a>.</p>
<p>The specific answer to your question can be found in the section titled "<em>The Perils of Rebasing</em>". A quote from that section... | <p>The <a href="http://git-scm.com/book" rel="noreferrer">ProGit book</a> has a <a href="http://git-scm.com/book/en/Git-Branching-Rebasing" rel="noreferrer">good explanation</a>.</p> <p>The specific answer to your question can be found in the section titled "<em>The Perils of Rebasing</em>". A quote from that section... | 119, 8974 | git, rebase | <h1>Rebasing and what does one mean by rebasing pushed commits</h1>
<p>It is often said that, you should not rebase commits that you have already pushed. What could be meaning of that? </p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,266 | git | # Rebasing and what does one mean by rebasing pushed commits
It is often said that, you should not rebase commits that you have already pushed. What could be meaning of that? | The [ProGit book](http://git-scm.com/book) has a [good explanation](http://git-scm.com/book/en/Git-Branching-Rebasing).
The specific answer to your question can be found in the section titled "*The Perils of Rebasing*". A quote from that section:
> When you rebase stuff, you’re
> abandoning existing commits and
> cre... |
37664226 | git fetch origin --prune doesn't delete local branches? | 108 | 2016-06-06 18:17:15 | <p>At one point I thought that <code>git fetch origin --prune</code> deleted local branches that were no longer present on the server. Somehow this is not my experience at the moment.</p>
<p>I ran this command, and the local branch was not deleted. It is <em>not</em> currently checked out. I ran <code>git branch -vv</... | 83,158 | 571,778 | 2025-08-11 02:29:48 | 37,664,434 | 84 | 2016-06-06 18:28:44 | 1,256,452 | 2016-06-06 19:19:36 | https://stackoverflow.com/q/37664226 | https://stackoverflow.com/a/37664434 | <p>The various prune options (<code>git remote update --prune</code>, <code>git remote prune</code>, <code>git fetch --prune</code>) <em>only</em> delete remote-tracking branches.<sup>1</sup></p>
<p>You'll need to manually delete local branches you no longer want, or change or remove their upstream setting if the remo... | <p>The various prune options (<code>git remote update --prune</code>, <code>git remote prune</code>, <code>git fetch --prune</code>) <em>only</em> delete remote-tracking branches.<sup>1</sup></p> <p>You'll need to manually delete local branches you no longer want, or change or remove their upstream setting if the remo... | 119, 33720 | git, git-fetch | <h1>git fetch origin --prune doesn't delete local branches?</h1>
<p>At one point I thought that <code>git fetch origin --prune</code> deleted local branches that were no longer present on the server. Somehow this is not my experience at the moment.</p>
<p>I ran this command, and the local branch was not deleted. It is... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,267 | git | # git fetch origin --prune doesn't delete local branches?
At one point I thought that `git fetch origin --prune` deleted local branches that were no longer present on the server. Somehow this is not my experience at the moment.
I ran this command, and the local branch was not deleted. It is *not* currently checked ou... | The various prune options (`git remote update --prune`, `git remote prune`, `git fetch --prune`) *only* delete remote-tracking branches.1
You'll need to manually delete local branches you no longer want, or change or remove their upstream setting if the remote-tracking branch no longer exists. Note that each local bra... |
20076233 | Replace remote tag with Git | 100 | 2013-11-19 15:59:56 | <p>I have some tags on my "origin" repository. Then I realized I needed to add some changes on one of the tags, and push them back on my repository.
Is there a way I can push an existing tag to the repository in one time, or should I delete the tag before ?</p>
| 91,503 | 2,180,332 | 2024-10-15 02:00:04 | 55,250,897 | 84 | 2019-03-19 22:28:31 | 2,033,312 | 2024-10-15 02:00:04 | https://stackoverflow.com/q/20076233 | https://stackoverflow.com/a/55250897 | <p>So if you need to move a tag (eg: <strong>"v0.5"</strong>) on a git branch (eg: <strong>"master"</strong>) to a different commit, probably a newer one, then you can use the <code>-f</code> option to <a href="http://schacon.github.com/git/git-tag.html" rel="noreferrer"><code>git tag</code></a>:</p... | <p>So if you need to move a tag (eg: <strong>"v0.5"</strong>) on a git branch (eg: <strong>"master"</strong>) to a different commit, probably a newer one, then you can use the <code>-f</code> option to <a href="http://schacon.github.com/git/git-tag.html" rel="noreferrer"><code>git tag</code></a>:</p... | 115, 119, 1879 | branch, git, tags | <h1>Replace remote tag with Git</h1>
<p>I have some tags on my "origin" repository. Then I realized I needed to add some changes on one of the tags, and push them back on my repository.
Is there a way I can push an existing tag to the repository in one time, or should I delete the tag before ?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,268 | git | # Replace remote tag with Git
I have some tags on my "origin" repository. Then I realized I needed to add some changes on one of the tags, and push them back on my repository.
Is there a way I can push an existing tag to the repository in one time, or should I delete the tag before ? | So if you need to move a tag (eg: **"v0.5"**) on a git branch (eg: **"master"**) to a different commit, probably a newer one, then you can use the `-f` option to [`git tag`](http://schacon.github.com/git/git-tag.html):
```
-f
--force
Replace an existing tag with the given name (instead of failing)
```
You probably w... |
1161869 | How to get SHA of the latest commit from remote git repository? | 99 | 2009-07-21 21:30:04 | <p>Does anyone know how to get the latest SHA of a given branch <strong>from outside</strong> a git repository?</p>
<p>If you are inside a git repository, you can do:</p>
<pre><code>git log origin/branch_X | head -1
</code></pre>
<p>However, I am not inside a git repository, and I would like to avoid having to <code... | 128,616 | 105,748 | 2023-02-20 19:05:15 | 1,162,373 | 84 | 2009-07-21 23:58:25 | 46,058 | 2016-03-06 21:50:49 | https://stackoverflow.com/q/1161869 | https://stackoverflow.com/a/1162373 | <p>If you want to check SHA-1 of given branch in remote repository, then <a href="https://stackoverflow.com/questions/1161869/in-git-how-to-get-sha-of-the-latest-commit-from-outside-the-repository/1161926#1161926">your answer</a> is correct:</p>
<pre><code>$ git ls-remote <URL>
</code></pre>
<p>However if you a... | <p>If you want to check SHA-1 of given branch in remote repository, then <a href="https://stackoverflow.com/questions/1161869/in-git-how-to-get-sha-of-the-latest-commit-from-outside-the-repository/1161926#1161926">your answer</a> is correct:</p> <pre><code>$ git ls-remote <URL> </code></pre> <p>However if you a... | 119 | git | <h1>How to get SHA of the latest commit from remote git repository?</h1>
<p>Does anyone know how to get the latest SHA of a given branch <strong>from outside</strong> a git repository?</p>
<p>If you are inside a git repository, you can do:</p>
<pre><code>git log origin/branch_X | head -1
</code></pre>
<p>However, I ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,269 | git | # How to get SHA of the latest commit from remote git repository?
Does anyone know how to get the latest SHA of a given branch **from outside** a git repository?
If you are inside a git repository, you can do:
```
git log origin/branch_X | head -1
```
However, I am not inside a git repository, and I would like to a... | If you want to check SHA-1 of given branch in remote repository, then [your answer](https://stackoverflow.com/questions/1161869/in-git-how-to-get-sha-of-the-latest-commit-from-outside-the-repository/1161926#1161926) is correct:
```
$ git ls-remote <URL>
```
However if you are on the same filesystem simpler solution (... |
5851966 | Moving a git repo to a second computer? | 92 | 2011-05-01 22:45:16 | <p>I have a project with a simple local git repo, and I want to <em>move</em> this project (folders etc.) to another computer and work from there from now on. I don't want to have anything left on the old machine (except of course my other git projects). I want it to be as if I have been working from the new machine al... | 73,845 | 154,066 | 2022-08-07 17:07:14 | 5,852,283 | 84 | 2011-05-01 23:52:25 | 526,535 | 2016-08-09 17:08:22 | https://stackoverflow.com/q/5851966 | https://stackoverflow.com/a/5852283 | <p>For your case, the best way to do it is to copy over the folder (copy, scp, cp, robocopy - whichever) to the new computer and delete the old folder.</p>
<p>I completely disagree with @Pablo Santa Cruz that cloning is the paradigm for what you are doing. No it is not. You are moving a repo to a new computer.</p>
<p... | <p>For your case, the best way to do it is to copy over the folder (copy, scp, cp, robocopy - whichever) to the new computer and delete the old folder.</p> <p>I completely disagree with @Pablo Santa Cruz that cloning is the paradigm for what you are doing. No it is not. You are moving a repo to a new computer.</p> <p... | 119 | git | <h1>Moving a git repo to a second computer?</h1>
<p>I have a project with a simple local git repo, and I want to <em>move</em> this project (folders etc.) to another computer and work from there from now on. I don't want to have anything left on the old machine (except of course my other git projects). I want it to be ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,270 | git | # Moving a git repo to a second computer?
I have a project with a simple local git repo, and I want to *move* this project (folders etc.) to another computer and work from there from now on. I don't want to have anything left on the old machine (except of course my other git projects). I want it to be as if I have bee... | For your case, the best way to do it is to copy over the folder (copy, scp, cp, robocopy - whichever) to the new computer and delete the old folder.
I completely disagree with @Pablo Santa Cruz that cloning is the paradigm for what you are doing. No it is not. You are moving a repo to a new computer.
Why I don't like... |
45678862 | git submodule update vs git submodule sync | 87 | 2017-08-14 16:23:06 | <p>The <code>git</code> documentation doesn't make it at all clear what the difference is between a <code>git submodule update</code> and a <code>git submodule sync</code> is. I'm also not finding any help out on the web. Can someone help me out with what the difference is here?</p>
<pre><code> update
Update ... | 93,364 | 1,327,774 | 2017-08-28 20:50:12 | 45,679,261 | 84 | 2017-08-14 16:47:26 | 1,405,588 | 2017-08-28 20:50:12 | https://stackoverflow.com/q/45678862 | https://stackoverflow.com/a/45679261 | <p><code>update</code> is basically doing <code>git pull</code> in each submodule (except without a branch, since the main repo specifies a commit directly).</p>
<p>The tricky one is <code>sync</code>. Imagine you clone a project with submodules, then later the upstream project <em>changes</em> one of the submodules t... | <p><code>update</code> is basically doing <code>git pull</code> in each submodule (except without a branch, since the main repo specifies a commit directly).</p> <p>The tricky one is <code>sync</code>. Imagine you clone a project with submodules, then later the upstream project <em>changes</em> one of the submodules t... | 119, 41612 | git, git-submodules | <h1>git submodule update vs git submodule sync</h1>
<p>The <code>git</code> documentation doesn't make it at all clear what the difference is between a <code>git submodule update</code> and a <code>git submodule sync</code> is. I'm also not finding any help out on the web. Can someone help me out with what the differen... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,271 | git | # git submodule update vs git submodule sync
The `git` documentation doesn't make it at all clear what the difference is between a `git submodule update` and a `git submodule sync` is. I'm also not finding any help out on the web. Can someone help me out with what the difference is here?
```
update
Update t... | `update` is basically doing `git pull` in each submodule (except without a branch, since the main repo specifies a commit directly).
The tricky one is `sync`. Imagine you clone a project with submodules, then later the upstream project *changes* one of the submodules to point to a different URL.
Your local copy of th... |
18979120 | is it possible to add a comment to a diff file (unified)? | 64 | 2013-09-24 10:29:25 | <p>I wonder if it's possible to add a certain amount of unparsed content to a diff file (unified) that is ignored as a comment.</p>
<p>One good use of this would be having git diffs augmented with important information such as from which branch is that diff from (especially when using the --full-index option, which m... | 24,271 | 700,023 | 2021-04-02 13:37:57 | 20,911,434 | 84 | 2014-01-03 19:38:43 | 2,217,862 | 2014-01-03 19:38:43 | https://stackoverflow.com/q/18979120 | https://stackoverflow.com/a/20911434 | <p>The unified diff starts with two line header:</p>
<pre><code> --- from-file from-file-modification-time
+++ to-file to-file-modification-time
</code></pre>
<p>Anything before this header is ignored, so you can add any comment here, for example:</p>
<pre><code> This may be some useful description of this patch th... | <p>The unified diff starts with two line header:</p> <pre><code> --- from-file from-file-modification-time +++ to-file to-file-modification-time </code></pre> <p>Anything before this header is ignored, so you can add any comment here, for example:</p> <pre><code> This may be some useful description of this patch th... | 119, 606, 9033 | diff, git, git-diff | <h1>is it possible to add a comment to a diff file (unified)?</h1>
<p>I wonder if it's possible to add a certain amount of unparsed content to a diff file (unified) that is ignored as a comment.</p>
<p>One good use of this would be having git diffs augmented with important information such as from which branch is tha... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,274 | git | # is it possible to add a comment to a diff file (unified)?
I wonder if it's possible to add a certain amount of unparsed content to a diff file (unified) that is ignored as a comment.
One good use of this would be having git diffs augmented with important information such as from which branch is that diff from (espe... | The unified diff starts with two line header:
```
--- from-file from-file-modification-time
+++ to-file to-file-modification-time
```
Anything before this header is ignored, so you can add any comment here, for example:
```
This may be some useful description of this patch that
will be ignored by the diff/patch ... |
4734844 | git: Why doesn't git diff show any differences? | 59 | 2011-01-19 11:46:35 | <p>If I run 'git status' on my repo it gives:</p>
<pre><code># On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# modified: myfile
</code></pre>
<p>However, if I do a 'git diff myfile' it shows no differences. Is this because I have made a change and removed it so ... | 47,614 | 581,359 | 2017-02-25 21:17:49 | 4,734,909 | 84 | 2011-01-19 11:54:21 | 217,931 | 2016-11-02 07:36:18 | https://stackoverflow.com/q/4734844 | https://stackoverflow.com/a/4734909 | <p>Your file is already staged to be committed. You can show it's diff using the <code>--cached</code> option of git.</p>
<pre><code>git diff --cached myfile
</code></pre>
<p>To unstage it, just do what git status suggests in it's output ;)</p>
<p>You can check <a href="https://git-scm.com/book/en/v2/Git-Basics-Reco... | <p>Your file is already staged to be committed. You can show it's diff using the <code>--cached</code> option of git.</p> <pre><code>git diff --cached myfile </code></pre> <p>To unstage it, just do what git status suggests in it's output ;)</p> <p>You can check <a href="https://git-scm.com/book/en/v2/Git-Basics-Reco... | 119, 9033, 54839 | git, git-diff, git-status | <h1>git: Why doesn't git diff show any differences?</h1>
<p>If I run 'git status' on my repo it gives:</p>
<pre><code># On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# modified: myfile
</code></pre>
<p>However, if I do a 'git diff myfile' it shows no differences... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,276 | git | # git: Why doesn't git diff show any differences?
If I run 'git status' on my repo it gives:
```
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# modified: myfile
```
However, if I do a 'git diff myfile' it shows no differences. Is this because I have made a change ... | Your file is already staged to be committed. You can show it's diff using the `--cached` option of git.
```
git diff --cached myfile
```
To unstage it, just do what git status suggests in it's output ;)
You can check [The Git Index](https://git-scm.com/book/en/v2/Git-Basics-Recording-Changes-to-the-Repository) For m... |
12013788 | How to remove subversion remote in git? | 58 | 2012-08-17 22:05:28 | <p>I have a git repository that was originally created using git-svn. Now I have a git server that I push to and the svn repository has been lost. Can I remove the svn remote? How?</p>
| 19,751 | 633,318 | 2024-05-21 09:23:16 | 12,013,821 | 84 | 2012-08-17 22:08:14 | 1,604,346 | 2018-02-22 11:11:57 | https://stackoverflow.com/q/12013788 | https://stackoverflow.com/a/12013821 | <p>You can edit the <code>.git/config</code> file and remove the section associated with the remote you want to remove.</p>
<p>The lines you want to remove probably look roughly like this:</p>
<pre><code>[svn-remote "svn"]
url = url-of-svn-repository/trunk
fetch = :refs/remotes/git-svn
</code></pre>
<p>This ... | <p>You can edit the <code>.git/config</code> file and remove the section associated with the remote you want to remove.</p> <p>The lines you want to remove probably look roughly like this:</p> <pre><code>[svn-remote "svn"] url = url-of-svn-repository/trunk fetch = :refs/remotes/git-svn </code></pre> <p>This ... | 119, 6452 | git, git-svn | <h1>How to remove subversion remote in git?</h1>
<p>I have a git repository that was originally created using git-svn. Now I have a git server that I push to and the svn repository has been lost. Can I remove the svn remote? How?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,277 | git | # How to remove subversion remote in git?
I have a git repository that was originally created using git-svn. Now I have a git server that I push to and the svn repository has been lost. Can I remove the svn remote? How? | You can edit the `.git/config` file and remove the section associated with the remote you want to remove.
The lines you want to remove probably look roughly like this:
```
[svn-remote "svn"]
url = url-of-svn-repository/trunk
fetch = :refs/remotes/git-svn
```
This will remove the remote from Git, but you will... |
6583917 | How to find the number of files changed from one commit to another in git | 58 | 2011-07-05 14:02:20 | <p>I am working on a git repository which contains huge number of files changed b/w one commit to another, how to extract the number of files changes b/w commits.</p>
| 63,101 | 579,689 | 2020-09-28 15:59:27 | 6,584,048 | 84 | 2011-07-05 14:10:44 | 596,781 | 2020-09-28 15:59:27 | https://stackoverflow.com/q/6583917 | https://stackoverflow.com/a/6584048 | <p>EDIT: "this will always count the files plus one, cause the <code>--format=oneline</code> includes the commit-hash/header" as mentioned by c00kiemon5ter</p>
<hr />
<p>The <code>git whatchanged</code> tool shows you a summary of files that were modified. By itself it lists all commits, but you can also limi... | <p>EDIT: "this will always count the files plus one, cause the <code>--format=oneline</code> includes the commit-hash/header" as mentioned by c00kiemon5ter</p> <hr /> <p>The <code>git whatchanged</code> tool shows you a summary of files that were modified. By itself it lists all commits, but you can also limi... | 119 | git | <h1>How to find the number of files changed from one commit to another in git</h1>
<p>I am working on a git repository which contains huge number of files changed b/w one commit to another, how to extract the number of files changes b/w commits.</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,278 | git | # How to find the number of files changed from one commit to another in git
I am working on a git repository which contains huge number of files changed b/w one commit to another, how to extract the number of files changes b/w commits. | EDIT: "this will always count the files plus one, cause the `--format=oneline` includes the commit-hash/header" as mentioned by c00kiemon5ter
---
The `git whatchanged` tool shows you a summary of files that were modified. By itself it lists all commits, but you can also limit it to just the recent *n* commits:
```
g... |
29616173 | How to reset to my last commit in Android Studio | 49 | 2015-04-13 22:31:52 | <p>I commit changes to git from Android Studio, after that I have made some changes in my project that gives me errors, and now I want to get back that commited version that has no errors.
How can I do that?</p>
| 58,710 | 4,711,270 | 2020-09-09 17:47:09 | 29,616,255 | 84 | 2015-04-13 22:39:07 | 1,843,331 | 2015-09-03 09:49:12 | https://stackoverflow.com/q/29616173 | https://stackoverflow.com/a/29616255 | <p>To undo your latest changes and reset to the most recent commit:</p>
<p>Go to <em>VCS -> Git -> Reset HEAD..</em></p>
<p>Change <em>Reset type</em> to <code>hard</code> to remove those changes.</p>
<p>It will look like this. You can validate the reset before you do it if you want.</p>
<p><img src="https://i.ssta... | <p>To undo your latest changes and reset to the most recent commit:</p> <p>Go to <em>VCS -> Git -> Reset HEAD..</em></p> <p>Change <em>Reset type</em> to <code>hard</code> to remove those changes.</p> <p>It will look like this. You can validate the reset before you do it if you want.</p> <p><img src="https://i.ssta... | 119, 1386, 91905 | android, android-studio, git | <h1>How to reset to my last commit in Android Studio</h1>
<p>I commit changes to git from Android Studio, after that I have made some changes in my project that gives me errors, and now I want to get back that commited version that has no errors.
How can I do that?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,279 | git | # How to reset to my last commit in Android Studio
I commit changes to git from Android Studio, after that I have made some changes in my project that gives me errors, and now I want to get back that commited version that has no errors.
How can I do that? | To undo your latest changes and reset to the most recent commit:
Go to *VCS -> Git -> Reset HEAD..*
Change *Reset type* to `hard` to remove those changes.
It will look like this. You can validate the reset before you do it if you want.

---
**What ha... |
6007855 | Revert to local commit? | 47 | 2011-05-15 10:35:03 | <p>I've pulled code down from my repo which has messed things up. I'd like to revert my entire project to my last local commit. How would I do this?</p>
| 71,955 | 358,438 | 2013-02-22 18:18:12 | 6,007,875 | 84 | 2011-05-15 10:39:55 | 532,744 | 2011-05-15 10:39:55 | https://stackoverflow.com/q/6007855 | https://stackoverflow.com/a/6007875 | <p>This will reset everything to your <em>current</em> commit (getting rid of all changes, staged or otherwise:</p>
<pre><code>git reset HEAD --hard
</code></pre>
<p>This will reset everything to the <em>previous</em> commit (also getting rid of all changes, staged or otherwise)</p>
<pre><code>git reset HEAD^ --hard... | <p>This will reset everything to your <em>current</em> commit (getting rid of all changes, staged or otherwise:</p> <pre><code>git reset HEAD --hard </code></pre> <p>This will reset everything to the <em>previous</em> commit (also getting rid of all changes, staged or otherwise)</p> <pre><code>git reset HEAD^ --hard... | 119 | git | <h1>Revert to local commit?</h1>
<p>I've pulled code down from my repo which has messed things up. I'd like to revert my entire project to my last local commit. How would I do this?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,281 | git | # Revert to local commit?
I've pulled code down from my repo which has messed things up. I'd like to revert my entire project to my last local commit. How would I do this? | This will reset everything to your *current* commit (getting rid of all changes, staged or otherwise:
```
git reset HEAD --hard
```
This will reset everything to the *previous* commit (also getting rid of all changes, staged or otherwise)
```
git reset HEAD^ --hard
```
the ^ next to HEAD means **one** commit before... |
6777629 | Merge branches without checking out branch | 46 | 2011-07-21 14:24:34 | <p>I have 3 branches. </p>
<pre><code> master [ Live Server]
\
stage [ Stage Server Where we test changes; merge commits ]
\
Dev [ Local Machine ]
</code></pre>
<p>I would like to downstream the changes to. Each of these branches are set to tracking each other.</p>
<p>Normally, to ... | 16,565 | 171,217 | 2024-08-20 19:41:20 | 23,941,734 | 84 | 2014-05-29 19:48:28 | null | 2024-08-20 19:41:20 | https://stackoverflow.com/q/6777629 | https://stackoverflow.com/a/23941734 | <p>You can indeed "merge" a branch B into branch A without having to check out branch A, <strong>but only if it's a fast-forward merge</strong>.</p>
<p>You can use a refspec with <code>fetch</code> to do the "merge". If merging branch B into branch A using <code>git merge</code> would result in a fa... | <p>You can indeed "merge" a branch B into branch A without having to check out branch A, <strong>but only if it's a fast-forward merge</strong>.</p> <p>You can use a refspec with <code>fetch</code> to do the "merge". If merging branch B into branch A using <code>git merge</code> would result in a fa... | 119, 717 | git, merge | <h1>Merge branches without checking out branch</h1>
<p>I have 3 branches. </p>
<pre><code> master [ Live Server]
\
stage [ Stage Server Where we test changes; merge commits ]
\
Dev [ Local Machine ]
</code></pre>
<p>I would like to downstream the changes to. Each of these branches a... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,282 | git | # Merge branches without checking out branch
I have 3 branches.
```
master [ Live Server]
\
stage [ Stage Server Where we test changes; merge commits ]
\
Dev [ Local Machine ]
```
I would like to downstream the changes to. Each of these branches are set to tracking each other.
No... | You can indeed "merge" a branch B into branch A without having to check out branch A, **but only if it's a fast-forward merge**.
You can use a refspec with `fetch` to do the "merge". If merging branch B into branch A using `git merge` would result in a fast-forward merge, then you can do the following without having t... |
25755061 | How do I create tag with certain commits and push it to origin? | 35 | 2014-09-09 23:26:50 | <p>Say the current log in my gerrit looks like the following:</p>
<ul>
<li>commit10 (master)</li>
<li>commit9</li>
<li>commit8</li>
<li>commit7</li>
<li>commit6 v1.72.0</li>
<li>commit5</li>
<li>commit4 v1.71.0</li>
<li>commit3</li>
<li>commit2</li>
<li>commit1</li>
</ul>
<p>My goal is to create a new tag (v1.73.0) t... | 81,732 | 3,521,546 | 2023-04-10 10:54:32 | 25,755,777 | 84 | 2014-09-10 00:59:54 | 1,256,452 | 2019-02-28 16:39:45 | https://stackoverflow.com/q/25755061 | https://stackoverflow.com/a/25755777 | <h2>How tags work</h2>
<p>In git, each tag is said to "point to" a (one, single) commit. In fact, the same is true of a branch: a branch name <em>also</em> just points to one commit.</p>
<p>What makes this work is two things:</p>
<ul>
<li>each commit also points to another commit (or perhaps several), and</li>
<li>... | <h2>How tags work</h2> <p>In git, each tag is said to "point to" a (one, single) commit. In fact, the same is true of a branch: a branch name <em>also</em> just points to one commit.</p> <p>What makes this work is two things:</p> <ul> <li>each commit also points to another commit (or perhaps several), and</li> <li>... | 115, 119, 5597 | commit, git, tags | <h1>How do I create tag with certain commits and push it to origin?</h1>
<p>Say the current log in my gerrit looks like the following:</p>
<ul>
<li>commit10 (master)</li>
<li>commit9</li>
<li>commit8</li>
<li>commit7</li>
<li>commit6 v1.72.0</li>
<li>commit5</li>
<li>commit4 v1.71.0</li>
<li>commit3</li>
<li>commit2</... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,283 | git | # How do I create tag with certain commits and push it to origin?
Say the current log in my gerrit looks like the following:
- commit10 (master)
- commit9
- commit8
- commit7
- commit6 v1.72.0
- commit5
- commit4 v1.71.0
- commit3
- commit2
- commit1
My goal is to create a new tag (v1.73.0) that should contain commi... | ## How tags work
In git, each tag is said to "point to" a (one, single) commit. In fact, the same is true of a branch: a branch name *also* just points to one commit.
What makes this work is two things:
- each commit also points to another commit (or perhaps several), and
- for branches (and *only* for branches), th... |
24357108 | Error "Updates were rejected because the remote contains work that you do not have locally" | 285 | 2014-06-23 00:44:20 | <p>I'm working on a team with a few developers using Git on <a href="https://en.wikipedia.org/wiki/Bitbucket" rel="noreferrer">Bitbucket</a>. We are all working on a <em>dev</em> branch, not pushing to <em>master</em> until a release.</p>
<p>One of the developers committed incorrect code that overwrote my own by accide... | 716,238 | 2,056,426 | 2024-11-21 20:41:28 | 24,357,784 | 83 | 2014-06-23 02:45:01 | 414,547 | 2014-06-23 02:45:01 | https://stackoverflow.com/q/24357108 | https://stackoverflow.com/a/24357784 | <p><code>git pull <remote> master:dev</code> will fetch the <code>remote/master</code> branch and merge it into your <code>local/dev</code> branch.</p>
<p><code>git pull <remote> dev</code> will fetch the <code>remote/dev</code> branch, and merge it into your current branch.</p>
<p>I think you said the co... | <p><code>git pull <remote> master:dev</code> will fetch the <code>remote/master</code> branch and merge it into your <code>local/dev</code> branch.</p> <p><code>git pull <remote> dev</code> will fetch the <code>remote/dev</code> branch, and merge it into your current branch.</p> <p>I think you said the co... | 119, 456, 717, 5597, 8337 | bitbucket, commit, git, merge, version-control | <h1>Error "Updates were rejected because the remote contains work that you do not have locally"</h1>
<p>I'm working on a team with a few developers using Git on <a href="https://en.wikipedia.org/wiki/Bitbucket" rel="noreferrer">Bitbucket</a>. We are all working on a <em>dev</em> branch, not pushing to <em>master</em> u... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,285 | git | # Error "Updates were rejected because the remote contains work that you do not have locally"
I'm working on a team with a few developers using Git on [Bitbucket](https://en.wikipedia.org/wiki/Bitbucket). We are all working on a *dev* branch, not pushing to *master* until a release.
One of the developers committed in... | `git pull <remote> master:dev` will fetch the `remote/master` branch and merge it into your `local/dev` branch.
`git pull <remote> dev` will fetch the `remote/dev` branch, and merge it into your current branch.
I think you said the conflicting commit is on `remote/dev`, so that is the branch you probably intended to ... |
6759791 | How do I move forward and backward between commits in git? | 164 | 2011-07-20 09:32:22 | <p>I am doing a <code>git bisect</code> and after arriving to the problematic commit, I am now trying to get a step forward/backward to make sure I am in the right one.</p>
<p>I know of <code>HEAD^</code> to go backwards in history but is there another shortcut to get me forward (towards a specific commit in the futur... | 185,807 | 146,272 | 2025-03-09 15:27:37 | 14,200,660 | 83 | 2013-01-07 17:08:56 | 245,966 | 2019-06-18 13:46:05 | https://stackoverflow.com/q/6759791 | https://stackoverflow.com/a/14200660 | <p>I've experimented a bit and this seems to do the trick to navigate forwards (<strong>edit</strong>: it works well only when you have a linear history without merge commits):</p>
<pre><code>git checkout $(git rev-list --topo-order HEAD..towards | tail -1)
</code></pre>
<p>where <code>towards</code> is a SHA1 of the... | <p>I've experimented a bit and this seems to do the trick to navigate forwards (<strong>edit</strong>: it works well only when you have a linear history without merge commits):</p> <pre><code>git checkout $(git rev-list --topo-order HEAD..towards | tail -1) </code></pre> <p>where <code>towards</code> is a SHA1 of the... | 119 | git | <h1>How do I move forward and backward between commits in git?</h1>
<p>I am doing a <code>git bisect</code> and after arriving to the problematic commit, I am now trying to get a step forward/backward to make sure I am in the right one.</p>
<p>I know of <code>HEAD^</code> to go backwards in history but is there anothe... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,286 | git | # How do I move forward and backward between commits in git?
I am doing a `git bisect` and after arriving to the problematic commit, I am now trying to get a step forward/backward to make sure I am in the right one.
I know of `HEAD^` to go backwards in history but is there another shortcut to get me forward (towards ... | I've experimented a bit and this seems to do the trick to navigate forwards (**edit**: it works well only when you have a linear history without merge commits):
```
git checkout $(git rev-list --topo-order HEAD..towards | tail -1)
```
where `towards` is a SHA1 of the commit or a tag.
Explanation:
- the command insi... |
9725156 | Remove old git commits | 141 | 2012-03-15 17:39:07 | <p>I'm very new to git, and was wondering if something like this is possible?</p>
<pre><code>>git log --pretty=oneline --abbrev-commit
2f05aba Added new feature
3371cec Fixed screw up <-- I want to remove this
daed25c Screw up <-- and remove this.
e2b2a84 First. So it's like they ne... | 176,835 | 468,130 | 2024-02-22 14:04:45 | 9,725,198 | 83 | 2012-03-15 17:41:43 | 585,869 | 2013-04-07 01:20:41 | https://stackoverflow.com/q/9725156 | https://stackoverflow.com/a/9725198 | <p>This is possible with <code>git rebase</code>. Try the following</p>
<pre><code>git rebase -i HEAD~4
</code></pre>
<p>and then, follow the interactive instructions in your editor. In the first step you "squash" the commits. It should look something like this:</p>
<pre><code>pick 2f05aba ... will be preserved
squa... | <p>This is possible with <code>git rebase</code>. Try the following</p> <pre><code>git rebase -i HEAD~4 </code></pre> <p>and then, follow the interactive instructions in your editor. In the first step you "squash" the commits. It should look something like this:</p> <pre><code>pick 2f05aba ... will be preserved squa... | 119 | git | <h1>Remove old git commits</h1>
<p>I'm very new to git, and was wondering if something like this is possible?</p>
<pre><code>>git log --pretty=oneline --abbrev-commit
2f05aba Added new feature
3371cec Fixed screw up <-- I want to remove this
daed25c Screw up <-- and remove this.
e2b2a84 First. ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,287 | git | # Remove old git commits
I'm very new to git, and was wondering if something like this is possible?
```
>git log --pretty=oneline --abbrev-commit
2f05aba Added new feature
3371cec Fixed screw up <-- I want to remove this
daed25c Screw up <-- and remove this.
e2b2a84 First. So it's like they... | This is possible with `git rebase`. Try the following
```
git rebase -i HEAD~4
```
and then, follow the interactive instructions in your editor. In the first step you "squash" the commits. It should look something like this:
```
pick 2f05aba ... will be preserved
squash 3371cec ... will be squashed with daed25c
squa... |
33513174 | Git:nothing added to commit but untracked files present | 106 | 2015-11-04 03:27:33 | <p>I'm new to Git and is using for the very first time. I would appreciate if someone could help me out. I tried finding the answer at forums,but there are tons of commands that are coming out and not sure which one to use.</p>
<p>On the prod server, if I do the <code>git pull</code>, it is giving me the following err... | 310,713 | 4,943,236 | 2025-01-24 15:08:26 | 33,513,201 | 83 | 2015-11-04 03:32:03 | 1,863,229 | 2015-11-04 03:32:03 | https://stackoverflow.com/q/33513174 | https://stackoverflow.com/a/33513201 | <p>You have two options here. You can either <em>add</em> the untracked files to your Git repository (as the warning message suggested), or you can <em>add</em> the files to your <code>.gitignore</code> file, if you want Git to ignore them.</p>
<p>To add the files use <code>git add</code>:</p>
<pre><code>git add Opt... | <p>You have two options here. You can either <em>add</em> the untracked files to your Git repository (as the warning message suggested), or you can <em>add</em> the files to your <code>.gitignore</code> file, if you want Git to ignore them.</p> <p>To add the files use <code>git add</code>:</p> <pre><code>git add Opt... | 119 | git | <h1>Git:nothing added to commit but untracked files present</h1>
<p>I'm new to Git and is using for the very first time. I would appreciate if someone could help me out. I tried finding the answer at forums,but there are tons of commands that are coming out and not sure which one to use.</p>
<p>On the prod server, if ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,288 | git | # Git:nothing added to commit but untracked files present
I'm new to Git and is using for the very first time. I would appreciate if someone could help me out. I tried finding the answer at forums,but there are tons of commands that are coming out and not sure which one to use.
On the prod server, if I do the `git pu... | You have two options here. You can either *add* the untracked files to your Git repository (as the warning message suggested), or you can *add* the files to your `.gitignore` file, if you want Git to ignore them.
To add the files use `git add`:
```
git add Optimization/language/languageUpdate.php
git add email_test.p... |
17222440 | Is there a "git pull --dry-run" option in Git? | 93 | 2013-06-20 19:42:59 | <p>Is there such a thing as <code>git pull --dry-run</code> to see how stuff will be merged before it messes up my working tree?</p>
<p>Right now I am doing:</p>
<pre><code>git fetch origin && git merge --no-commit --no-ff
</code></pre>
<p>I did not see anything in the man page for 'git-pull' related to it.<... | 79,026 | 1,816,471 | 2022-02-04 21:33:54 | 17,222,591 | 83 | 2013-06-20 19:53:00 | 203,583 | 2017-12-31 19:39:57 | https://stackoverflow.com/q/17222440 | https://stackoverflow.com/a/17222591 | <p>I have always relied on the inherent abilities of Git to get me back if a merge fails.</p>
<p>To estimate how the merge might occur, you can start like you did with:</p>
<pre><code>$ git fetch origin branch # Fetch changes, but don't merge
$ git diff HEAD..origin/branch # Diff your current head to the fetched com... | <p>I have always relied on the inherent abilities of Git to get me back if a merge fails.</p> <p>To estimate how the merge might occur, you can start like you did with:</p> <pre><code>$ git fetch origin branch # Fetch changes, but don't merge $ git diff HEAD..origin/branch # Diff your current head to the fetched com... | 119, 28896 | git, git-pull | <h1>Is there a "git pull --dry-run" option in Git?</h1>
<p>Is there such a thing as <code>git pull --dry-run</code> to see how stuff will be merged before it messes up my working tree?</p>
<p>Right now I am doing:</p>
<pre><code>git fetch origin && git merge --no-commit --no-ff
</code></pre>
<p>I did not see... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,291 | git | # Is there a "git pull --dry-run" option in Git?
Is there such a thing as `git pull --dry-run` to see how stuff will be merged before it messes up my working tree?
Right now I am doing:
```
git fetch origin && git merge --no-commit --no-ff
```
I did not see anything in the man page for 'git-pull' related to it.
To... | I have always relied on the inherent abilities of Git to get me back if a merge fails.
To estimate how the merge might occur, you can start like you did with:
```
$ git fetch origin branch # Fetch changes, but don't merge
$ git diff HEAD..origin/branch # Diff your current head to the fetched commit
... personal jud... |
53683896 | What does depth for git clone mean? | 92 | 2018-12-08 15:18:21 | <p>We tried to speed up the CI build of one of our software projects at work. Somebody committed some huge (by git's standards) binaries early in the project's life. Rewriting git's history just to get rid of them seems like too much trouble, so we figured doing a shallow clone that avoided those big early commits woul... | 121,741 | 287,933 | 2022-11-18 12:54:17 | 53,684,344 | 83 | 2018-12-08 16:06:43 | 1,256,452 | 2018-12-08 16:06:43 | https://stackoverflow.com/q/53683896 | https://stackoverflow.com/a/53684344 | <p>As <a href="https://stackoverflow.com/questions/53683896/what-does-depth-for-git-clone-mean#comment94224569_53683896">Jonathon Reinhart commented</a>, you're seeing the effect of merges.</p>
<p>The <code>--depth</code> parameter refers to how deep Git goes on a "walk" from each starting point. As the documentation... | <p>As <a href="https://stackoverflow.com/questions/53683896/what-does-depth-for-git-clone-mean#comment94224569_53683896">Jonathon Reinhart commented</a>, you're seeing the effect of merges.</p> <p>The <code>--depth</code> parameter refers to how deep Git goes on a "walk" from each starting point. As the documentation... | 119, 34099 | git, git-clone | <h1>What does depth for git clone mean?</h1>
<p>We tried to speed up the CI build of one of our software projects at work. Somebody committed some huge (by git's standards) binaries early in the project's life. Rewriting git's history just to get rid of them seems like too much trouble, so we figured doing a shallow cl... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,292 | git | # What does depth for git clone mean?
We tried to speed up the CI build of one of our software projects at work. Somebody committed some huge (by git's standards) binaries early in the project's life. Rewriting git's history just to get rid of them seems like too much trouble, so we figured doing a shallow clone that ... | As [Jonathon Reinhart commented](https://stackoverflow.com/questions/53683896/what-does-depth-for-git-clone-mean#comment94224569_53683896), you're seeing the effect of merges.
The `--depth` parameter refers to how deep Git goes on a "walk" from each starting point. As the documentation you quoted mentions, it also imp... |
5875275 | `git commit -v` by default | 81 | 2011-05-03 20:25:06 | <p>How can I configure <code>git commit</code> to act as <code>git commit -v</code> (showing the full diff being committed) by default?</p>
<p>Using an alias is not quite satisfactory, as it does not affect commit message editing during operations which may indirectly commit, such as <code>git rebase</code>. </p>
| 19,456 | 99,692 | 2016-12-05 11:54:53 | 37,848,889 | 83 | 2016-06-16 02:26:26 | 5,751,278 | 2016-06-16 02:26:26 | https://stackoverflow.com/q/5875275 | https://stackoverflow.com/a/37848889 | <p>If you are using git 2.9, this can be done with a config.</p>
<pre><code>git config --global commit.verbose true
</code></pre>
<p>Git 2.9.0 Release Notes:
<a href="https://github.com/git/git/blob/v2.9.0/Documentation/RelNotes/2.9.0.txt">https://github.com/git/git/blob/v2.9.0/Documentation/RelNotes/2.9.0.txt</a></... | <p>If you are using git 2.9, this can be done with a config.</p> <pre><code>git config --global commit.verbose true </code></pre> <p>Git 2.9.0 Release Notes: <a href="https://github.com/git/git/blob/v2.9.0/Documentation/RelNotes/2.9.0.txt">https://github.com/git/git/blob/v2.9.0/Documentation/RelNotes/2.9.0.txt</a></... | 119 | git | <h1>`git commit -v` by default</h1>
<p>How can I configure <code>git commit</code> to act as <code>git commit -v</code> (showing the full diff being committed) by default?</p>
<p>Using an alias is not quite satisfactory, as it does not affect commit message editing during operations which may indirectly commit, such a... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,293 | git | # `git commit -v` by default
How can I configure `git commit` to act as `git commit -v` (showing the full diff being committed) by default?
Using an alias is not quite satisfactory, as it does not affect commit message editing during operations which may indirectly commit, such as `git rebase`. | If you are using git 2.9, this can be done with a config.
```
git config --global commit.verbose true
```
Git 2.9.0 Release Notes:
<https://github.com/git/git/blob/v2.9.0/Documentation/RelNotes/2.9.0.txt>
> "git commit" learned to pay attention to the "commit.verbose"
> configuration variable and act as if the "--ve... |
25986534 | How to do Git Log see only merges to master branch? | 81 | 2014-09-23 03:47:04 | <p>In my work process I need to provide a list of files to my server admin.
The list comes from the merge of my working branch (Branch A) into Master branch.</p>
<p>So I merge branch A into branch Master and then deploy Master.</p>
<p>Right now the best I could do with <code>git log</code> is the following but this l... | 92,605 | 716,435 | 2022-09-16 11:58:17 | 25,986,615 | 83 | 2014-09-23 03:55:56 | 4,021,077 | 2014-09-23 03:55:56 | https://stackoverflow.com/q/25986534 | https://stackoverflow.com/a/25986615 | <p>Narrow it down using <code>git log --merges --author</code> to figure out the commit you want and then try </p>
<pre><code>git diff --name-only ${MERGE_SHA}^1..${MERGE_SHA}
</code></pre>
| <p>Narrow it down using <code>git log --merges --author</code> to figure out the commit you want and then try </p> <pre><code>git diff --name-only ${MERGE_SHA}^1..${MERGE_SHA} </code></pre> | 119 | git | <h1>How to do Git Log see only merges to master branch?</h1>
<p>In my work process I need to provide a list of files to my server admin.
The list comes from the merge of my working branch (Branch A) into Master branch.</p>
<p>So I merge branch A into branch Master and then deploy Master.</p>
<p>Right now the best I c... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,294 | git | # How to do Git Log see only merges to master branch?
In my work process I need to provide a list of files to my server admin.
The list comes from the merge of my working branch (Branch A) into Master branch.
So I merge branch A into branch Master and then deploy Master.
Right now the best I could do with `git log` ... | Narrow it down using `git log --merges --author` to figure out the commit you want and then try
```
git diff --name-only ${MERGE_SHA}^1..${MERGE_SHA}
``` |
2658 | Getting started with Version Control System | 75 | 2008-08-05 18:29:14 | <p>I need to implement version control, even for just the developing I do at home. I have read about how great subversion is for the past couple of years and was about to dedicate myself to learning this on the side until I heard about Git being the up and coming version control system.</p>
<p>Given the situation, sho... | 9,892 | 406 | 2022-02-23 12:27:23 | 2,668 | 83 | 2008-08-05 18:34:44 | 309,844 | 2009-08-11 20:37:16 | https://stackoverflow.com/q/2658 | https://stackoverflow.com/a/2668 | <p>The most important thing about version control is:</p>
<p><em><strong>JUST START USING IT</strong></em></p>
<p>Not using version control is a horrible idea. If you are not using version control, stop reading right now and start using it.</p>
<p>It is very easy to convert from</p>
<pre><code>cvs<->svn<->g... | <p>The most important thing about version control is:</p> <p><em><strong>JUST START USING IT</strong></em></p> <p>Not using version control is a horrible idea. If you are not using version control, stop reading right now and start using it.</p> <p>It is very easy to convert from</p> <pre><code>cvs<->svn<->g... | 33, 63, 119, 456, 3346 | dvcs, git, language-agnostic, svn, version-control | <h1>Getting started with Version Control System</h1>
<p>I need to implement version control, even for just the developing I do at home. I have read about how great subversion is for the past couple of years and was about to dedicate myself to learning this on the side until I heard about Git being the up and coming ve... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,295 | git | # Getting started with Version Control System
I need to implement version control, even for just the developing I do at home. I have read about how great subversion is for the past couple of years and was about to dedicate myself to learning this on the side until I heard about Git being the up and coming version cont... | The most important thing about version control is:
***JUST START USING IT***
Not using version control is a horrible idea. If you are not using version control, stop reading right now and start using it.
It is very easy to convert from
```
cvs<->svn<->git<->hg
```
It doesn't matter which one you choose. Just pick ... |
7773939 | Show git ahead and behind info for all branches, including remotes | 73 | 2011-10-14 21:48:51 | <p>On a github project you can go to a /branches page and se pretty graphs like this one that for each branch show how far behind and how far ahead each branch is with respect to master.</p>
<p><img src="https://i.sstatic.net/aFmCc.png" alt="git branch ahead behind"></p>
<p>Is there a command line tool that does some... | 38,659 | 382,912 | 2024-08-04 05:06:25 | 7,774,433 | 83 | 2011-10-14 22:58:29 | 51,022 | 2021-05-25 19:19:14 | https://stackoverflow.com/q/7773939 | https://stackoverflow.com/a/7774433 | <p>I've been curious about this as well, so i just whipped up a <a href="https://gist.github.com/1288596" rel="noreferrer"><code>git branch-status</code></a> script that gives this information using <code>git for-each-ref</code></p>
<pre class="lang-bash prettyprint-override"><code>#!/bin/bash
# by http://github.com/je... | <p>I've been curious about this as well, so i just whipped up a <a href="https://gist.github.com/1288596" rel="noreferrer"><code>git branch-status</code></a> script that gives this information using <code>git for-each-ref</code></p> <pre class="lang-bash prettyprint-override"><code>#!/bin/bash # by http://github.com/je... | 119 | git | <h1>Show git ahead and behind info for all branches, including remotes</h1>
<p>On a github project you can go to a /branches page and se pretty graphs like this one that for each branch show how far behind and how far ahead each branch is with respect to master.</p>
<p><img src="https://i.sstatic.net/aFmCc.png" alt="g... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,297 | git | # Show git ahead and behind info for all branches, including remotes
On a github project you can go to a /branches page and se pretty graphs like this one that for each branch show how far behind and how far ahead each branch is with respect to master.

Is t... | I've been curious about this as well, so i just whipped up a [`git branch-status`](https://gist.github.com/1288596) script that gives this information using `git for-each-ref`
```
#!/bin/bash
# by http://github.com/jehiah
# this prints out some branch status (similar to the '... ahead' info you get from git status)
... |
7430717 | git, filter-branch on all branches | 59 | 2011-09-15 12:21:21 | <p>I'm using the following sources to expunge some large files and directories from my repository:</p>
<p><a href="http://dound.com/2009/04/git-forever-remove-files-or-folders-from-history/" rel="noreferrer">http://dound.com/2009/04/git-forever-remove-files-or-folders-from-history/</a></p>
<p><a href="https://stackov... | 30,901 | 6,691 | 2017-07-12 12:44:56 | 7,430,801 | 83 | 2011-09-15 12:27:25 | 480,943 | 2016-05-21 12:02:23 | https://stackoverflow.com/q/7430717 | https://stackoverflow.com/a/7430801 | <p>The solution is simple:</p>
<p><code>git filter-branch [options] -- --all</code></p>
<p><em>Note the four dashes (two sets of double dashes with a space in between) in <code>-- --all</code>.</em></p>
<p>If you look at the docs for <code>git-filter-branch</code>, it says this:</p>
<pre><code>git filter-branch [--... | <p>The solution is simple:</p> <p><code>git filter-branch [options] -- --all</code></p> <p><em>Note the four dashes (two sets of double dashes with a space in between) in <code>-- --all</code>.</em></p> <p>If you look at the docs for <code>git-filter-branch</code>, it says this:</p> <pre><code>git filter-branch [--... | 119, 46509, 91259 | git, git-filter-branch, git-rewrite-history | <h1>git, filter-branch on all branches</h1>
<p>I'm using the following sources to expunge some large files and directories from my repository:</p>
<p><a href="http://dound.com/2009/04/git-forever-remove-files-or-folders-from-history/" rel="noreferrer">http://dound.com/2009/04/git-forever-remove-files-or-folders-from-h... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,298 | git | # git, filter-branch on all branches
I'm using the following sources to expunge some large files and directories from my repository:
<http://dound.com/2009/04/git-forever-remove-files-or-folders-from-history/>
[Why is my git repository so big?](https://stackoverflow.com/questions/1029969/why-is-my-git-repository-so-... | The solution is simple:
`git filter-branch [options] -- --all`
*Note the four dashes (two sets of double dashes with a space in between) in `-- --all`.*
If you look at the docs for `git-filter-branch`, it says this:
```
git filter-branch [--env-filter <command>] [--tree-filter <command>]
[--index-filter <comman... |
39023360 | Git squash commits in the middle of a branch | 58 | 2016-08-18 16:35:19 | <p>I want to squash several commits together in the middle of a branch without modifying the commits before and after.</p>
<p>I have :</p>
<pre><code>A -- B -- C -- D -- E -- F -- G
| |
master dev
origin/master
</code></pre>
<p>I want to squash that into</p>
<pre><... | 22,116 | 4,062,250 | 2016-08-18 17:31:37 | 39,023,568 | 83 | 2016-08-18 16:47:54 | 1,863,229 | 2016-08-18 17:31:37 | https://stackoverflow.com/q/39023360 | https://stackoverflow.com/a/39023568 | <p>You can do an interactive rebase and hand select the commits which you want to squash. This will rewrite the history of your <code>dev</code> branch, but since you have not pushed these commits, there should not be any negative aftermath from this besides what might happen on your own computer.</p>
<p>Start with t... | <p>You can do an interactive rebase and hand select the commits which you want to squash. This will rewrite the history of your <code>dev</code> branch, but since you have not pushed these commits, there should not be any negative aftermath from this besides what might happen on your own computer.</p> <p>Start with t... | 119, 98455 | git, git-squash | <h1>Git squash commits in the middle of a branch</h1>
<p>I want to squash several commits together in the middle of a branch without modifying the commits before and after.</p>
<p>I have :</p>
<pre><code>A -- B -- C -- D -- E -- F -- G
| |
master dev
origin/master
</... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,299 | git | # Git squash commits in the middle of a branch
I want to squash several commits together in the middle of a branch without modifying the commits before and after.
I have :
```
A -- B -- C -- D -- E -- F -- G
| |
master dev
origin/master
```
I want to squash that in... | You can do an interactive rebase and hand select the commits which you want to squash. This will rewrite the history of your `dev` branch, but since you have not pushed these commits, there should not be any negative aftermath from this besides what might happen on your own computer.
Start with the following:
```
git... |
356323 | can't add all files to git due to permissions | 56 | 2008-12-10 14:49:07 | <p>I want to add all the files in the current directory to git:</p>
<pre><code>git add .
error: open(".mysql_history"): Permission denied
fatal: unable to index file .mysql_history
</code></pre>
<p>That's fine. That file happens to be in this directory and owned by root. I want to add all <em>other</em> files. Is th... | 109,018 | 8,611 | 2025-11-26 16:40:04 | 359,696 | 83 | 2008-12-11 15:23:06 | 23,896 | 2008-12-11 15:23:06 | https://stackoverflow.com/q/356323 | https://stackoverflow.com/a/359696 | <p>Use <code>git add --ignore-errors .</code></p>
<p>This will still give an error for the unreadable file(s), but not a fatal one. The other files will be added.</p>
| <p>Use <code>git add --ignore-errors .</code></p> <p>This will still give an error for the unreadable file(s), but not a fatal one. The other files will be added.</p> | 119 | git | <h1>can't add all files to git due to permissions</h1>
<p>I want to add all the files in the current directory to git:</p>
<pre><code>git add .
error: open(".mysql_history"): Permission denied
fatal: unable to index file .mysql_history
</code></pre>
<p>That's fine. That file happens to be in this directory and owned ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,301 | git | # can't add all files to git due to permissions
I want to add all the files in the current directory to git:
```
git add .
error: open(".mysql_history"): Permission denied
fatal: unable to index file .mysql_history
```
That's fine. That file happens to be in this directory and owned by root. I want to add all *other... | Use `git add --ignore-errors .`
This will still give an error for the unreadable file(s), but not a fatal one. The other files will be added. |
5432396 | Create a patch by comparing a specific branch on the remote with a specific local branch | 52 | 2011-03-25 12:27:15 | <p>I've been working with git for a few weeks, but now I'd like to contribute back to this open source project. I've merged my work with the latest, remote by pulling editing out conflicts and it all looks the way it should in gitk. Now I need to create a patch that is against the latest version of origin (remote) mast... | 31,496 | 536,187 | 2017-06-28 04:22:51 | 5,433,913 | 83 | 2011-03-25 14:37:57 | 311,635 | 2017-06-28 04:22:51 | https://stackoverflow.com/q/5432396 | https://stackoverflow.com/a/5433913 | <p>Use <code>git format-patch origin/master</code>. This creates a patch file for each commit on your checked out branch, which is not in origin/master.</p>
<p>To have one file instead of multiple files you can use</p>
<pre><code>git format-patch master --stdout > mypatch.patch
</code></pre>
| <p>Use <code>git format-patch origin/master</code>. This creates a patch file for each commit on your checked out branch, which is not in origin/master.</p> <p>To have one file instead of multiple files you can use</p> <pre><code>git format-patch master --stdout > mypatch.patch </code></pre> | 119 | git | <h1>Create a patch by comparing a specific branch on the remote with a specific local branch</h1>
<p>I've been working with git for a few weeks, but now I'd like to contribute back to this open source project. I've merged my work with the latest, remote by pulling editing out conflicts and it all looks the way it shoul... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,302 | git | # Create a patch by comparing a specific branch on the remote with a specific local branch
I've been working with git for a few weeks, but now I'd like to contribute back to this open source project. I've merged my work with the latest, remote by pulling editing out conflicts and it all looks the way it should in gitk... | Use `git format-patch origin/master`. This creates a patch file for each commit on your checked out branch, which is not in origin/master.
To have one file instead of multiple files you can use
```
git format-patch master --stdout > mypatch.patch
``` |
3168370 | git: how to move some commits to new branch | 51 | 2010-07-02 18:52:46 | <p>I have been working in straight line:</p>
<pre><code>A---B---C---D---E---F (master:HEAD)
</code></pre>
<p>Now I want to move backward:</p>
<pre><code>git checkout C
</code></pre>
<p>and move few last commits to a new branch:</p>
<p>Option 1:</p>
<pre><code> D---E---F (new:HEAD)
/
A---B---C (m... | 11,396 | 234,780 | 2017-05-31 15:56:09 | 3,168,412 | 83 | 2010-07-02 18:58:01 | 90,002 | 2010-07-02 18:58:01 | https://stackoverflow.com/q/3168370 | https://stackoverflow.com/a/3168412 | <p>To get from your first diagram (master = HEAD = F) to option 1:</p>
<pre><code>git branch new # Make a 'new' branch pointing at HEAD, which is F
git reset --hard C # Move master back to point at C
git checkout new # Make HEAD follow new, and get F in the working tree
</code></pre>
<p>And from option... | <p>To get from your first diagram (master = HEAD = F) to option 1:</p> <pre><code>git branch new # Make a 'new' branch pointing at HEAD, which is F git reset --hard C # Move master back to point at C git checkout new # Make HEAD follow new, and get F in the working tree </code></pre> <p>And from option... | 119, 456 | git, version-control | <h1>git: how to move some commits to new branch</h1>
<p>I have been working in straight line:</p>
<pre><code>A---B---C---D---E---F (master:HEAD)
</code></pre>
<p>Now I want to move backward:</p>
<pre><code>git checkout C
</code></pre>
<p>and move few last commits to a new branch:</p>
<p>Option 1:</p>
<pre><code> ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,303 | git | # git: how to move some commits to new branch
I have been working in straight line:
```
A---B---C---D---E---F (master:HEAD)
```
Now I want to move backward:
```
git checkout C
```
and move few last commits to a new branch:
Option 1:
```
D---E---F (new:HEAD)
/
A---B---C (master)
```
Option 2:
... | To get from your first diagram (master = HEAD = F) to option 1:
```
git branch new # Make a 'new' branch pointing at HEAD, which is F
git reset --hard C # Move master back to point at C
git checkout new # Make HEAD follow new, and get F in the working tree
```
And from option 1 to option 2 (picking up ... |
15736564 | Why after merge does GIT say "Already up-to-date", but differences between branches still exist? | 47 | 2013-04-01 01:43:16 | <p>I was originally working in 'newfeature' branch and I was called to fix a bug on the live branch urgently. I created a branch for that called 'generalmaintenance', did the job and then switched to develop and merged it in. I now want to return to 'newfeature' branch and to merge in the changes that I merged into it ... | 34,286 | 1,288,274 | 2020-10-15 15:01:28 | 15,737,656 | 83 | 2013-04-01 04:33:04 | 845,488 | 2020-05-20 08:46:54 | https://stackoverflow.com/q/15736564 | https://stackoverflow.com/a/15737656 | <p><strong>Reverting Merges vs. Resetting Merges</strong></p>
<p>My guess is that you actually <em>are</em> <code>Already-up-to-date</code>. </p>
<p>The problem is that <a href="https://www.kernel.org/pub/software/scm/git/docs/git-revert.html" rel="noreferrer">git revert</a> doesn't undo the merge, it only undoes the... | <p><strong>Reverting Merges vs. Resetting Merges</strong></p> <p>My guess is that you actually <em>are</em> <code>Already-up-to-date</code>. </p> <p>The problem is that <a href="https://www.kernel.org/pub/software/scm/git/docs/git-revert.html" rel="noreferrer">git revert</a> doesn't undo the merge, it only undoes the... | 119, 717, 3146 | conflict, git, merge | <h1>Why after merge does GIT say "Already up-to-date", but differences between branches still exist?</h1>
<p>I was originally working in 'newfeature' branch and I was called to fix a bug on the live branch urgently. I created a branch for that called 'generalmaintenance', did the job and then switched to develop and me... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,305 | git | # Why after merge does GIT say "Already up-to-date", but differences between branches still exist?
I was originally working in 'newfeature' branch and I was called to fix a bug on the live branch urgently. I created a branch for that called 'generalmaintenance', did the job and then switched to develop and merged it i... | **Reverting Merges vs. Resetting Merges**
My guess is that you actually *are* `Already-up-to-date`.
The problem is that [git revert](https://www.kernel.org/pub/software/scm/git/docs/git-revert.html) doesn't undo the merge, it only undoes the changes that the merge brought with it. When you create a merge commit, you'... |
46733179 | Git Extensions: Squash commits? | 46 | 2017-10-13 15:22:46 | <p>To squash multiple commits, I have always used:</p>
<pre><code>git reset --soft HEAD~<number of commits to squash> && git commit
</code></pre>
<p>But I wonder if there is a good way to do this in a good git client like git extensions? It would be cool if you could just select consecutive commits and ... | 41,342 | 8,377,123 | 2020-07-06 12:08:34 | 47,464,064 | 83 | 2017-11-23 22:34:25 | 2,338,036 | 2020-07-06 12:08:34 | https://stackoverflow.com/q/46733179 | https://stackoverflow.com/a/47464064 | <p>There are multiple ways of doing a squash.</p>
<p>Here's how you can easily squash the current and <em>all its immediate parent commits</em> into a single commit in <a href="https://github.com/gitextensions/gitextensions" rel="noreferrer">Git Extensions</a>:</p>
<ol>
<li>Right click on a commit you wish to squash to... | <p>There are multiple ways of doing a squash.</p> <p>Here's how you can easily squash the current and <em>all its immediate parent commits</em> into a single commit in <a href="https://github.com/gitextensions/gitextensions" rel="noreferrer">Git Extensions</a>:</p> <ol> <li>Right click on a commit you wish to squash to... | 119, 39597 | git, git-extensions | <h1>Git Extensions: Squash commits?</h1>
<p>To squash multiple commits, I have always used:</p>
<pre><code>git reset --soft HEAD~<number of commits to squash> && git commit
</code></pre>
<p>But I wonder if there is a good way to do this in a good git client like git extensions? It would be cool if you c... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,306 | git | # Git Extensions: Squash commits?
To squash multiple commits, I have always used:
```
git reset --soft HEAD~<number of commits to squash> && git commit
```
But I wonder if there is a good way to do this in a good git client like git extensions? It would be cool if you could just select consecutive commits and squash... | There are multiple ways of doing a squash.
Here's how you can easily squash the current and *all its immediate parent commits* into a single commit in [Git Extensions](https://github.com/gitextensions/gitextensions):
1. Right click on a commit you wish to squash to and select "Reset the current branch to here"
2. Sel... |
13450039 | How to undo git flow feature finish? | 44 | 2012-11-19 08:28:47 | <p>I am learning git-flow and I just did <code>git flow feature finish <feature-name></code>, which merged my feature branch to develop and removed it.</p>
<p>Instead of this, I want to push the feature branch to github, so I can merge it after a peer review.</p>
<p>So the question is, how do I 'undo' this comm... | 21,395 | 517,529 | 2022-03-08 15:49:42 | 13,505,455 | 83 | 2012-11-22 03:23:18 | 337,297 | 2013-01-03 16:48:45 | https://stackoverflow.com/q/13450039 | https://stackoverflow.com/a/13505455 | <p>These steps should do the trick:</p>
<p>Get the sha's needed:</p>
<pre><code>git log
</code></pre>
<p><code><sha1></code> is the commit right before the merge<br>
<code><sha2></code> is the last commit on develop before you started working on the feature</p>
<pre><code>git checkout develop
git checko... | <p>These steps should do the trick:</p> <p>Get the sha's needed:</p> <pre><code>git log </code></pre> <p><code><sha1></code> is the commit right before the merge<br> <code><sha2></code> is the last commit on develop before you started working on the feature</p> <pre><code>git checkout develop git checko... | 119, 53847, 64339, 76220 | branching-and-merging, git, git-branch, git-flow | <h1>How to undo git flow feature finish?</h1>
<p>I am learning git-flow and I just did <code>git flow feature finish <feature-name></code>, which merged my feature branch to develop and removed it.</p>
<p>Instead of this, I want to push the feature branch to github, so I can merge it after a peer review.</p>
<p... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,307 | git | # How to undo git flow feature finish?
I am learning git-flow and I just did `git flow feature finish <feature-name>`, which merged my feature branch to develop and removed it.
Instead of this, I want to push the feature branch to github, so I can merge it after a peer review.
So the question is, how do I 'undo' thi... | These steps should do the trick:
Get the sha's needed:
```
git log
```
`<sha1>` is the commit right before the merge
`<sha2>` is the last commit on develop before you started working on the feature
```
git checkout develop
git checkout -b feature/<feature-name>
git reset <sha1> --hard
git checkout develop
git res... |
18596867 | What is the git command to list ignored files? | 35 | 2013-09-03 16:10:00 | <p>My netbeans IDE shows ignored files on a different color.
I presume, the IDE is knowing this by using some git command.</p>
<p>I wish to know what files on a project folder and subfolders are being ignored.</p>
<p>What command should we use?</p>
| 32,165 | 378,170 | 2013-09-03 16:18:15 | 18,596,993 | 83 | 2013-09-03 16:18:15 | 503,402 | 2013-09-03 16:18:15 | https://stackoverflow.com/q/18596867 | https://stackoverflow.com/a/18596993 | <p><code>git status --ignored</code> will show all untracked files. It also includes the normal status output. There does not appear to be a status option to only show the ignored files.</p>
| <p><code>git status --ignored</code> will show all untracked files. It also includes the normal status output. There does not appear to be a status option to only show the ignored files.</p> | 119 | git | <h1>What is the git command to list ignored files?</h1>
<p>My netbeans IDE shows ignored files on a different color.
I presume, the IDE is knowing this by using some git command.</p>
<p>I wish to know what files on a project folder and subfolders are being ignored.</p>
<p>What command should we use?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,308 | git | # What is the git command to list ignored files?
My netbeans IDE shows ignored files on a different color.
I presume, the IDE is knowing this by using some git command.
I wish to know what files on a project folder and subfolders are being ignored.
What command should we use? | `git status --ignored` will show all untracked files. It also includes the normal status output. There does not appear to be a status option to only show the ignored files. |
17355477 | remote tag not shown in local | 33 | 2013-06-28 00:37:23 | <p>I am new to using git and tags. My team member ran the following commands:</p>
<pre><code>git tag v1.27.1
git push origin v1.27.1
</code></pre>
<p>Now when I <code>git pull</code> and then run <code>git tag</code> in my environment, I expect to see a list of all the tags. I can see other tags that were pushed to ... | 29,740 | 1,352,101 | 2018-02-15 16:20:01 | 17,356,120 | 83 | 2013-06-28 02:03:03 | 683,080 | 2013-06-28 02:12:58 | https://stackoverflow.com/q/17355477 | https://stackoverflow.com/a/17356120 | <p>Unfortunately, <code>git pull</code> doesn't fetch tags by default. You need to run <code>git fetch --tags</code>, and then you'll have them.</p>
<p>The default behavior of <code>git pull</code> and <code>git fetch</code> is to only retrieve tags that are directly accessible by the current references. If any tags... | <p>Unfortunately, <code>git pull</code> doesn't fetch tags by default. You need to run <code>git fetch --tags</code>, and then you'll have them.</p> <p>The default behavior of <code>git pull</code> and <code>git fetch</code> is to only retrieve tags that are directly accessible by the current references. If any tags... | 119, 60718 | git, git-tag | <h1>remote tag not shown in local</h1>
<p>I am new to using git and tags. My team member ran the following commands:</p>
<pre><code>git tag v1.27.1
git push origin v1.27.1
</code></pre>
<p>Now when I <code>git pull</code> and then run <code>git tag</code> in my environment, I expect to see a list of all the tags. I ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,310 | git | # remote tag not shown in local
I am new to using git and tags. My team member ran the following commands:
```
git tag v1.27.1
git push origin v1.27.1
```
Now when I `git pull` and then run `git tag` in my environment, I expect to see a list of all the tags. I can see other tags that were pushed to repo in the simil... | Unfortunately, `git pull` doesn't fetch tags by default. You need to run `git fetch --tags`, and then you'll have them.
The default behavior of `git pull` and `git fetch` is to only retrieve tags that are directly accessible by the current references. If any tags are not, then those are not fetched. Passing `--tags` t... |
35736116 | Making a Git push from a detached head | 145 | 2016-03-02 00:10:32 | <p>I am on a detached head and made some changes. I want to push up these changed to this detached head with Git. I do not want my changes to go onto the develop branch and certainly not on the master branch. I am working on a file with another individual.</p>
<p>Example branches</p>
<pre><code> develop
master
... | 205,867 | 4,184,670 | 2024-04-30 20:04:22 | 35,736,137 | 82 | 2016-03-02 00:12:11 | 459,750 | 2016-03-02 00:12:11 | https://stackoverflow.com/q/35736116 | https://stackoverflow.com/a/35736137 | <p>Create a new branch using <code>git checkout -b BRANCH_NAME</code></p>
<p>Then push the new branch to remote: <code>git push origin BRANCH_NAME</code></p>
| <p>Create a new branch using <code>git checkout -b BRANCH_NAME</code></p> <p>Then push the new branch to remote: <code>git push origin BRANCH_NAME</code></p> | 119, 28898 | git, git-push | <h1>Making a Git push from a detached head</h1>
<p>I am on a detached head and made some changes. I want to push up these changed to this detached head with Git. I do not want my changes to go onto the develop branch and certainly not on the master branch. I am working on a file with another individual.</p>
<p>Example... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,311 | git | # Making a Git push from a detached head
I am on a detached head and made some changes. I want to push up these changed to this detached head with Git. I do not want my changes to go onto the develop branch and certainly not on the master branch. I am working on a file with another individual.
Example branches
```
... | Create a new branch using `git checkout -b BRANCH_NAME`
Then push the new branch to remote: `git push origin BRANCH_NAME` |
5270760 | What's the meaning of 'origin' in 'git push origin master' | 112 | 2011-03-11 08:46:42 | <p>When I run:</p>
<pre><code>git push origin master
</code></pre>
<p>...what is the meaning of <code>origin</code> in this context?</p>
| 64,116 | 462,462 | 2023-03-31 21:47:34 | 5,270,788 | 82 | 2011-03-11 08:49:51 | 350,923 | 2011-03-11 16:39:18 | https://stackoverflow.com/q/5270760 | https://stackoverflow.com/a/5270788 | <p><code>origin</code> is the default name of the remote git repository you cloned from. Have a look at <code>.git/refs/remotes/origin/*</code> and <code>.git/config</code> within your sources to see how git knows about it.</p>
| <p><code>origin</code> is the default name of the remote git repository you cloned from. Have a look at <code>.git/refs/remotes/origin/*</code> and <code>.git/config</code> within your sources to see how git knows about it.</p> | 119 | git | <h1>What's the meaning of 'origin' in 'git push origin master'</h1>
<p>When I run:</p>
<pre><code>git push origin master
</code></pre>
<p>...what is the meaning of <code>origin</code> in this context?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,312 | git | # What's the meaning of 'origin' in 'git push origin master'
When I run:
```
git push origin master
```
...what is the meaning of `origin` in this context? | `origin` is the default name of the remote git repository you cloned from. Have a look at `.git/refs/remotes/origin/*` and `.git/config` within your sources to see how git knows about it. |
41464752 | Git rebase interactive the last n commits | 85 | 2017-01-04 13:16:33 | <p>I have made a bunch of unpushed commits in my feature branch and now want to reorder and partly squash belonging commits visually. I reckon the solution somehow lies in the Git interactive, but how to invoke it?</p>
<pre><code>$ git rebase --interactive --onto <the-ID-of-the-first-commit-to-rewrite>
</code></... | 78,264 | 2,460,378 | 2024-04-25 14:40:05 | 41,464,876 | 82 | 2017-01-04 13:23:03 | 2,082,964 | 2022-09-26 15:51:15 | https://stackoverflow.com/q/41464752 | https://stackoverflow.com/a/41464876 | <p>you should use</p>
<pre><code>git rebase --interactive <sha1>
</code></pre>
<p>where <code><sha1></code> should <strong>not</strong> be the sha of the first commit you want to rewrite, but the sha of the commit just before.</p>
<p>if your history looks like this:</p>
<pre><code>pick 43576ef last commit
.... | <p>you should use</p> <pre><code>git rebase --interactive <sha1> </code></pre> <p>where <code><sha1></code> should <strong>not</strong> be the sha of the first commit you want to rewrite, but the sha of the commit just before.</p> <p>if your history looks like this:</p> <pre><code>pick 43576ef last commit .... | 119, 29934 | git, git-rebase | <h1>Git rebase interactive the last n commits</h1>
<p>I have made a bunch of unpushed commits in my feature branch and now want to reorder and partly squash belonging commits visually. I reckon the solution somehow lies in the Git interactive, but how to invoke it?</p>
<pre><code>$ git rebase --interactive --onto <... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,314 | git | # Git rebase interactive the last n commits
I have made a bunch of unpushed commits in my feature branch and now want to reorder and partly squash belonging commits visually. I reckon the solution somehow lies in the Git interactive, but how to invoke it?
```
$ git rebase --interactive --onto <the-ID-of-the-first-com... | you should use
```
git rebase --interactive <sha1>
```
where `<sha1>` should **not** be the sha of the first commit you want to rewrite, but the sha of the commit just before.
if your history looks like this:
```
pick 43576ef last commit
...
pick 5116d42 first commit to rewrite
pick cb85072 last good commit
```
Th... |
4166019 | How can I change which commit master points to in git? | 85 | 2010-11-12 15:14:43 | <p>In git, I've been making commits onto the master branch, when really I should have been working on a feature branch. I want to change this so that master is back to where it started, and what was on master is now on a new branch. Basically, my commit history looks like this:</p>
<pre><code>A -- B -- C -- D -- E
... | 53,091 | 219 | 2022-03-27 19:35:03 | 4,166,044 | 82 | 2010-11-12 15:16:40 | 112,968 | 2022-03-27 19:35:03 | https://stackoverflow.com/q/4166019 | https://stackoverflow.com/a/4166044 | <ol>
<li>Stash your uncommitted changes: <code>git stash</code></li>
<li>Create a new branch: <code>git branch new_branch</code></li>
<li>Reset master to origin/master: <code>git reset --hard origin/master</code></li>
<li>Check out the new branch again: <code>git checkout new_branch</code></li>
<li>Unstash your changes... | <ol> <li>Stash your uncommitted changes: <code>git stash</code></li> <li>Create a new branch: <code>git branch new_branch</code></li> <li>Reset master to origin/master: <code>git reset --hard origin/master</code></li> <li>Check out the new branch again: <code>git checkout new_branch</code></li> <li>Unstash your changes... | 119 | git | <h1>How can I change which commit master points to in git?</h1>
<p>In git, I've been making commits onto the master branch, when really I should have been working on a feature branch. I want to change this so that master is back to where it started, and what was on master is now on a new branch. Basically, my commit hi... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,315 | git | # How can I change which commit master points to in git?
In git, I've been making commits onto the master branch, when really I should have been working on a feature branch. I want to change this so that master is back to where it started, and what was on master is now on a new branch. Basically, my commit history loo... | 1. Stash your uncommitted changes: `git stash`
2. Create a new branch: `git branch new_branch`
3. Reset master to origin/master: `git reset --hard origin/master`
4. Check out the new branch again: `git checkout new_branch`
5. Unstash your changes: `git stash pop`
Stash/unstash is not necessary if your working tree is ... |
12305093 | Stash changes to specific files | 83 | 2012-09-06 17:10:53 | <p>I have a large git project that I, stupidly, imported to eclipse and ran an autoformat on. Now, every file in the project is showing as modified. Rather than commit my formatted files, I would rather revert all the files that I have only been formatted and not had other changes. For instance:</p>
<pre><code>$ gi... | 87,576 | 702,948 | 2025-01-14 17:49:49 | 12,305,243 | 82 | 2012-09-06 17:21:44 | 506,338 | 2018-04-21 04:32:19 | https://stackoverflow.com/q/12305093 | https://stackoverflow.com/a/12305243 | <p>You can <code>add</code> the files with changes you want to keep, then <code>stash</code> the rest of the files and clear the stash:</p>
<pre><code>git add file2.cpp file2.h file3.cpp
git stash --keep-index
</code></pre>
<p>At this point, you've stashed your unwanted changes. If you'd like to permanently get rid o... | <p>You can <code>add</code> the files with changes you want to keep, then <code>stash</code> the rest of the files and clear the stash:</p> <pre><code>git add file2.cpp file2.h file3.cpp git stash --keep-index </code></pre> <p>At this point, you've stashed your unwanted changes. If you'd like to permanently get rid o... | 119, 13091 | git, git-stash | <h1>Stash changes to specific files</h1>
<p>I have a large git project that I, stupidly, imported to eclipse and ran an autoformat on. Now, every file in the project is showing as modified. Rather than commit my formatted files, I would rather revert all the files that I have only been formatted and not had other cha... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,316 | git | # Stash changes to specific files
I have a large git project that I, stupidly, imported to eclipse and ran an autoformat on. Now, every file in the project is showing as modified. Rather than commit my formatted files, I would rather revert all the files that I have only been formatted and not had other changes. For i... | You can `add` the files with changes you want to keep, then `stash` the rest of the files and clear the stash:
```
git add file2.cpp file2.h file3.cpp
git stash --keep-index
```
At this point, you've stashed your unwanted changes. If you'd like to permanently get rid of them, run:
```
git stash drop
```
Now you hav... |
19619747 | git submodule update --remote vs git pull | 77 | 2013-10-27 15:26:42 | <p>What is the difference between running </p>
<pre><code>git submodule update --remote
</code></pre>
<p>vs </p>
<pre><code>cd <submodule directoy>
git pull
</code></pre>
<p>Assuming that the submodule was previously set to track some branch:</p>
<pre><code>git submodule add -b master [URL to Git repo]
</cod... | 73,803 | 2,924,714 | 2024-06-29 19:02:15 | 19,621,245 | 82 | 2013-10-27 17:44:28 | 6,309 | 2024-06-29 19:02:15 | https://stackoverflow.com/q/19619747 | https://stackoverflow.com/a/19621245 | <p>The difference is:</p>
<ul>
<li><code>git pull</code> will only update your submodule branch, but it can be any branch that you could have checked out yourself in that submodule repo.</li>
<li><code>git submodule update --remote</code> will only update the branch registered in the <code>.gitmodule</code>, and by def... | <p>The difference is:</p> <ul> <li><code>git pull</code> will only update your submodule branch, but it can be any branch that you could have checked out yourself in that submodule repo.</li> <li><code>git submodule update --remote</code> will only update the branch registered in the <code>.gitmodule</code>, and by def... | 119, 41612 | git, git-submodules | <h1>git submodule update --remote vs git pull</h1>
<p>What is the difference between running </p>
<pre><code>git submodule update --remote
</code></pre>
<p>vs </p>
<pre><code>cd <submodule directoy>
git pull
</code></pre>
<p>Assuming that the submodule was previously set to track some branch:</p>
<pre><code>... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,317 | git | # git submodule update --remote vs git pull
What is the difference between running
```
git submodule update --remote
```
vs
```
cd <submodule directoy>
git pull
```
Assuming that the submodule was previously set to track some branch:
```
git submodule add -b master [URL to Git repo]
``` | The difference is:
- `git pull` will only update your submodule branch, but it can be any branch that you could have checked out yourself in that submodule repo.
- `git submodule update --remote` will only update the branch registered in the `.gitmodule`, and by default, you will end up with a detached HEAD, unless `-... |
23937436 | Add subdirectory of remote repo with git-subtree | 72 | 2014-05-29 15:49:19 | <p>Is there a way to add a subdirectory of a remote repository into a subdirectory of my repository with git-subtree?</p>
<p>Suppose I have this <strong>main</strong> repository:</p>
<pre><code>/
dir1
dir2
</code></pre>
<p>And this <strong>library</strong> repository:</p>
<pre><code>/
libdir
som... | 24,744 | 880,367 | 2019-11-25 11:13:44 | 30,386,041 | 82 | 2015-05-21 23:30:05 | 691,281 | 2019-11-25 11:13:44 | https://stackoverflow.com/q/23937436 | https://stackoverflow.com/a/30386041 | <p>I've been experimenting with this, and found some partial solutions, though none are quite perfect.</p>
<p>For these examples, I'll consider merging the four files from <code>contrib/completion/</code> of <a href="https://github.com/git/git.git" rel="noreferrer">https://github.com/git/git.git</a> into <code>third_p... | <p>I've been experimenting with this, and found some partial solutions, though none are quite perfect.</p> <p>For these examples, I'll consider merging the four files from <code>contrib/completion/</code> of <a href="https://github.com/git/git.git" rel="noreferrer">https://github.com/git/git.git</a> into <code>third_p... | 119, 68200 | git, git-subtree | <h1>Add subdirectory of remote repo with git-subtree</h1>
<p>Is there a way to add a subdirectory of a remote repository into a subdirectory of my repository with git-subtree?</p>
<p>Suppose I have this <strong>main</strong> repository:</p>
<pre><code>/
dir1
dir2
</code></pre>
<p>And this <strong>library</st... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,319 | git | # Add subdirectory of remote repo with git-subtree
Is there a way to add a subdirectory of a remote repository into a subdirectory of my repository with git-subtree?
Suppose I have this **main** repository:
```
/
dir1
dir2
```
And this **library** repository:
```
/
libdir
some-file
some-fil... | I've been experimenting with this, and found some partial solutions, though none are quite perfect.
For these examples, I'll consider merging the four files from `contrib/completion/` of <https://github.com/git/git.git> into `third_party/git_completion/` of the local repository.
# 1. git diff | git apply
This is pro... |
24297331 | What's recommended .gitignore for Scala/sbt project in IntelliJ IDEA? | 70 | 2014-06-19 01:14:35 | <p>I created a new Scala/sbt project in IntelliJ IDEA 13. Since other team members will be working on this project (presumably with other IDEs), what should I put in the <code>.gitignore</code>? It seems some of the project dependencies are defined in the <code>.idea</code> folder, so I wasn't sure if I can put the w... | 25,996 | 1,003,412 | 2018-01-23 17:30:13 | 24,297,595 | 82 | 2014-06-19 01:53:58 | 3,669,252 | 2018-01-23 17:30:13 | https://stackoverflow.com/q/24297331 | https://stackoverflow.com/a/24297595 | <p><strong>EDIT After discovering Joe</strong>:</p>
<p>Just ask <a href="https://github.com/karan/joe" rel="noreferrer">Joe</a> to take care of your <code>.gitignore</code></p>
<p><strong>Original Answer:</strong></p>
<p>Since you're using Scala you should add: </p>
<pre><code>target
*.class
</code></pre>
<p>Thes... | <p><strong>EDIT After discovering Joe</strong>:</p> <p>Just ask <a href="https://github.com/karan/joe" rel="noreferrer">Joe</a> to take care of your <code>.gitignore</code></p> <p><strong>Original Answer:</strong></p> <p>Since you're using Scala you should add: </p> <pre><code>target *.class </code></pre> <p>Thes... | 119, 3143, 8945, 41325 | git, intellij-idea, sbt, scala | <h1>What's recommended .gitignore for Scala/sbt project in IntelliJ IDEA?</h1>
<p>I created a new Scala/sbt project in IntelliJ IDEA 13. Since other team members will be working on this project (presumably with other IDEs), what should I put in the <code>.gitignore</code>? It seems some of the project dependencies ar... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,320 | git | # What's recommended .gitignore for Scala/sbt project in IntelliJ IDEA?
I created a new Scala/sbt project in IntelliJ IDEA 13. Since other team members will be working on this project (presumably with other IDEs), what should I put in the `.gitignore`? It seems some of the project dependencies are defined in the `.ide... | **EDIT After discovering Joe**:
Just ask [Joe](https://github.com/karan/joe) to take care of your `.gitignore`
**Original Answer:**
Since you're using Scala you should add:
```
target
*.class
```
These can be generated back easily and could be machine dependent.
If you're going to use IntelliJ then the following:... |
7336966 | Git interactive unstage part of a file or by hunks | 64 | 2011-09-07 16:02:53 | <p>There's <code>git add -p</code> to stage changes and <code>git checkout -p</code> to discard changes interactively. How can I unstage changes from index by hunks? </p>
<p>(I thought that <code>git unstage -p</code> or <code>git reset HEAD -p</code> might work.)</p>
| 10,331 | 219,931 | 2024-09-13 16:39:49 | 7,337,544 | 82 | 2011-09-07 16:46:26 | 526,535 | 2011-09-07 16:46:26 | https://stackoverflow.com/q/7336966 | https://stackoverflow.com/a/7337544 | <p>If I am not mistaken, what you want is to unstage hunks interactively? I thought <code>git reset -p</code> does exactly that. Its prompt message is even exactly like <code>Unstage this hunk?</code></p>
<p>Also from the manual:</p>
<blockquote>
<p>This means that git reset -p is the opposite of git add -p, i.e. y... | <p>If I am not mistaken, what you want is to unstage hunks interactively? I thought <code>git reset -p</code> does exactly that. Its prompt message is even exactly like <code>Unstage this hunk?</code></p> <p>Also from the manual:</p> <blockquote> <p>This means that git reset -p is the opposite of git add -p, i.e. y... | 119 | git | <h1>Git interactive unstage part of a file or by hunks</h1>
<p>There's <code>git add -p</code> to stage changes and <code>git checkout -p</code> to discard changes interactively. How can I unstage changes from index by hunks? </p>
<p>(I thought that <code>git unstage -p</code> or <code>git reset HEAD -p</code> might w... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,321 | git | # Git interactive unstage part of a file or by hunks
There's `git add -p` to stage changes and `git checkout -p` to discard changes interactively. How can I unstage changes from index by hunks?
(I thought that `git unstage -p` or `git reset HEAD -p` might work.) | If I am not mistaken, what you want is to unstage hunks interactively? I thought `git reset -p` does exactly that. Its prompt message is even exactly like `Unstage this hunk?`
Also from the manual:
> This means that git reset -p is the opposite of git add -p, i.e. you
> can use it to selectively reset hunks. See the ... |
9314365 | git clean is not removing a submodule added to a branch when switching branches | 58 | 2012-02-16 15:48:33 | <p>How do I get rid of submodules when switching branches. I do not understand why git clean says it removed the submodule but does not. Is this a bug? Below are cut&paste steps to reproduce.</p>
<pre><code>git --version
git version 1.7.8.4
git init submod
cd submod
echo "This is a submodule" > README.txt
git ... | 29,495 | 990,524 | 2022-07-29 23:16:04 | 10,761,699 | 82 | 2012-05-25 21:40:46 | 1,084,945 | 2012-05-25 21:40:46 | https://stackoverflow.com/q/9314365 | https://stackoverflow.com/a/10761699 | <p>This isn't a bug, it's documented behaviour. From <code>man git-clean</code>:</p>
<blockquote>
<p>If an untracked directory is managed by a different git repository, it is not removed by default.</p>
</blockquote>
<p>The <code>submod</code> directory is a different <code>git</code> repository; if you want to remove ... | <p>This isn't a bug, it's documented behaviour. From <code>man git-clean</code>:</p> <blockquote> <p>If an untracked directory is managed by a different git repository, it is not removed by default.</p> </blockquote> <p>The <code>submod</code> directory is a different <code>git</code> repository; if you want to remove ... | 119 | git | <h1>git clean is not removing a submodule added to a branch when switching branches</h1>
<p>How do I get rid of submodules when switching branches. I do not understand why git clean says it removed the submodule but does not. Is this a bug? Below are cut&paste steps to reproduce.</p>
<pre><code>git --version
git v... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,323 | git | # git clean is not removing a submodule added to a branch when switching branches
How do I get rid of submodules when switching branches. I do not understand why git clean says it removed the submodule but does not. Is this a bug? Below are cut&paste steps to reproduce.
```
git --version
git version 1.7.8.4
git init... | This isn't a bug, it's documented behaviour. From `man git-clean`:
> If an untracked directory is managed by a different git repository, it is not removed by default.
The `submod` directory is a different `git` repository; if you want to remove it, `Use -f option twice if you really want to remove such a directory`.
... |
46175753 | How do I see the permission of a file in Git? | 57 | 2017-09-12 11:56:33 | <p>I'd like to see the file permission as it exists in the repository index.</p>
<p>How can this be done? </p>
| 44,888 | 1,663,462 | 2017-09-12 12:06:24 | 46,175,878 | 82 | 2017-09-12 12:03:14 | 354,577 | 2017-09-12 12:03:14 | https://stackoverflow.com/q/46175753 | https://stackoverflow.com/a/46175878 | <p>Use <a href="https://git-scm.com/docs/git-ls-files#git-ls-files--s" rel="noreferrer"><code>git ls-files -s <file></code></a>:</p>
<blockquote>
<p>Show staged contents' mode bits, object name and stage number in the output.</p>
</blockquote>
<p>Note that Git <a href="https://stackoverflow.com/a/29800979/354... | <p>Use <a href="https://git-scm.com/docs/git-ls-files#git-ls-files--s" rel="noreferrer"><code>git ls-files -s <file></code></a>:</p> <blockquote> <p>Show staged contents' mode bits, object name and stage number in the output.</p> </blockquote> <p>Note that Git <a href="https://stackoverflow.com/a/29800979/354... | 119 | git | <h1>How do I see the permission of a file in Git?</h1>
<p>I'd like to see the file permission as it exists in the repository index.</p>
<p>How can this be done? </p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,324 | git | # How do I see the permission of a file in Git?
I'd like to see the file permission as it exists in the repository index.
How can this be done? | Use [`git ls-files -s <file>`](https://git-scm.com/docs/git-ls-files#git-ls-files--s):
> Show staged contents' mode bits, object name and stage number in the output.
Note that Git [only tracks files' executable bit](https://stackoverflow.com/a/29800979/354577). You'll only ever see 644 or 755. |
21459540 | Add new commit to the existing Git tag | 52 | 2014-01-30 14:44:49 | <p>I have created a Git tag as <code>v1.1</code> using </p>
<pre><code>git tag -a v1.1 -m 'my version 1.1'
</code></pre>
<p>and I pushed that tag. Later, I made some changes related to <code>v1.1</code>. Now when I push new changes and check the git tag using
<code>git describe</code> it is showing me <code>v1.1-g2d... | 100,479 | 3,156,324 | 2025-02-07 17:45:30 | 21,466,838 | 82 | 2014-01-30 20:31:34 | 354,577 | 2014-01-30 20:31:34 | https://stackoverflow.com/q/21459540 | https://stackoverflow.com/a/21466838 | <p>You can't put a new commit into an existing tag without breaking an important Git guideline: <strong>Never(*) modify commits that you have published.</strong></p>
<p>Tags in Git aren't meant to be mutable. Once you push a tag out there, leave it alone.</p>
<p>You can, however, add some changes on top of <code>v1.1... | <p>You can't put a new commit into an existing tag without breaking an important Git guideline: <strong>Never(*) modify commits that you have published.</strong></p> <p>Tags in Git aren't meant to be mutable. Once you push a tag out there, leave it alone.</p> <p>You can, however, add some changes on top of <code>v1.1... | 119, 60718 | git, git-tag | <h1>Add new commit to the existing Git tag</h1>
<p>I have created a Git tag as <code>v1.1</code> using </p>
<pre><code>git tag -a v1.1 -m 'my version 1.1'
</code></pre>
<p>and I pushed that tag. Later, I made some changes related to <code>v1.1</code>. Now when I push new changes and check the git tag using
<code>git... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,325 | git | # Add new commit to the existing Git tag
I have created a Git tag as `v1.1` using
```
git tag -a v1.1 -m 'my version 1.1'
```
and I pushed that tag. Later, I made some changes related to `v1.1`. Now when I push new changes and check the git tag using
`git describe` it is showing me `v1.1-g2dcc97`.
How can I add my ... | You can't put a new commit into an existing tag without breaking an important Git guideline: **Never(*) modify commits that you have published.**
Tags in Git aren't meant to be mutable. Once you push a tag out there, leave it alone.
You can, however, add some changes on top of `v1.1` and release something like `v1.1.... |
13235875 | Resolve merge conflicts on pull using my changes | 50 | 2012-11-05 16:07:03 | <p>I want to pull a project and resolve merge conflicts using my changes. How can I do this?</p>
| 32,689 | 991,523 | 2020-08-19 07:19:06 | 13,235,977 | 82 | 2012-11-05 16:13:11 | 1,205,715 | 2012-11-05 16:26:09 | https://stackoverflow.com/q/13235875 | https://stackoverflow.com/a/13235977 | <p>Use the <em>recursive</em> merge strategy with the <em>ours</em> option:</p>
<pre><code>git merge -s recursive -X ours branch_to_merge
</code></pre>
<p>or </p>
<pre><code>git pull -s recursive -X ours
</code></pre>
<p>For any conflicts, it will use the hunk that comes from your branch. See the <a href="http://ww... | <p>Use the <em>recursive</em> merge strategy with the <em>ours</em> option:</p> <pre><code>git merge -s recursive -X ours branch_to_merge </code></pre> <p>or </p> <pre><code>git pull -s recursive -X ours </code></pre> <p>For any conflicts, it will use the hunk that comes from your branch. See the <a href="http://ww... | 119 | git | <h1>Resolve merge conflicts on pull using my changes</h1>
<p>I want to pull a project and resolve merge conflicts using my changes. How can I do this?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,326 | git | # Resolve merge conflicts on pull using my changes
I want to pull a project and resolve merge conflicts using my changes. How can I do this? | Use the *recursive* merge strategy with the *ours* option:
```
git merge -s recursive -X ours branch_to_merge
```
or
```
git pull -s recursive -X ours
```
For any conflicts, it will use the hunk that comes from your branch. See the [git merge](http://www.kernel.org/pub/software/scm/git/docs/git-merge.html) man page... |
7846699 | how to discard git local branch changes? | 50 | 2011-10-21 08:12:21 | <p>how to discard git local branch changes?
eg, local branch with version: A->B->C
Now I am on version A, and it has some changes conflict with latest version C.
I want to discard local changes and pull the latest version C.</p>
<pre><code>$ git pull
</code></pre>
<p>I will meet some error. and there are many files,... | 57,958 | 792,359 | 2012-10-17 10:01:16 | 7,846,774 | 82 | 2011-10-21 08:19:33 | 969,818 | 2011-10-21 08:19:33 | https://stackoverflow.com/q/7846699 | https://stackoverflow.com/a/7846774 | <p>If you have uncommitted changes that you want to discard, use this:</p>
<pre><code>$ git reset --hard
</code></pre>
<p>which is equivalent to</p>
<pre><code>$ git reset --hard HEAD
</code></pre>
<p>This removes all the local uncommitted changes. If you want to remove some offending commits from your local branch... | <p>If you have uncommitted changes that you want to discard, use this:</p> <pre><code>$ git reset --hard </code></pre> <p>which is equivalent to</p> <pre><code>$ git reset --hard HEAD </code></pre> <p>This removes all the local uncommitted changes. If you want to remove some offending commits from your local branch... | 119 | git | <h1>how to discard git local branch changes?</h1>
<p>how to discard git local branch changes?
eg, local branch with version: A->B->C
Now I am on version A, and it has some changes conflict with latest version C.
I want to discard local changes and pull the latest version C.</p>
<pre><code>$ git pull
</code></pre>
<p... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,327 | git | # how to discard git local branch changes?
how to discard git local branch changes?
eg, local branch with version: A->B->C
Now I am on version A, and it has some changes conflict with latest version C.
I want to discard local changes and pull the latest version C.
```
$ git pull
```
I will meet some error. and there... | If you have uncommitted changes that you want to discard, use this:
```
$ git reset --hard
```
which is equivalent to
```
$ git reset --hard HEAD
```
This removes all the local uncommitted changes. If you want to remove some offending commits from your local branch, try rewinding it:
```
$ git reset --hard HEAD^ #... |
33488085 | How to get a new branch in my fork from the original repository? | 49 | 2015-11-02 22:19:48 | <p>I forked a repo and the original repo has gotten a new branch after I forked it.</p>
<pre><code>OriginalRepo
|
+-BranchA
|
+-newBranch
MyFork
|
+-BranchA
</code></pre>
<p>I want to get the branch newBranch into my fork, how can I do this?</p>
| 30,018 | 1,689,322 | 2024-04-16 20:47:08 | 33,488,139 | 82 | 2015-11-02 22:23:54 | 1,539,655 | 2022-03-04 04:48:29 | https://stackoverflow.com/q/33488085 | https://stackoverflow.com/a/33488139 | <pre><code>git remote add OriginalRepo repository-URL
git fetch OriginalRepo
git checkout newBranch
git push origin newBranch
</code></pre>
| <pre><code>git remote add OriginalRepo repository-URL git fetch OriginalRepo git checkout newBranch git push origin newBranch </code></pre> | 119 | git | <h1>How to get a new branch in my fork from the original repository?</h1>
<p>I forked a repo and the original repo has gotten a new branch after I forked it.</p>
<pre><code>OriginalRepo
|
+-BranchA
|
+-newBranch
MyFork
|
+-BranchA
</code></pre>
<p>I want to get the branch newBranch into my fork, h... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,329 | git | # How to get a new branch in my fork from the original repository?
I forked a repo and the original repo has gotten a new branch after I forked it.
```
OriginalRepo
|
+-BranchA
|
+-newBranch
MyFork
|
+-BranchA
```
I want to get the branch newBranch into my fork, how can I do this? | ```
git remote add OriginalRepo repository-URL
git fetch OriginalRepo
git checkout newBranch
git push origin newBranch
``` |
16368605 | Is there a tool to have git show "detached heads" in a graph? | 42 | 2013-05-03 22:45:25 | <p>I often refer to <code>git log --graph --decorate --oneline --all --full-history</code> to see the current state of my branches, but it does not show detached heads/anonymous branches. Is there a way to get detached heads to appear in this graph?</p>
<p>I know that <code>git reflog</code> exists, but that is pretty... | 27,347 | 3,829 | 2025-05-26 08:40:36 | 16,368,880 | 82 | 2013-05-03 23:17:54 | 183,802 | 2013-05-04 05:24:03 | https://stackoverflow.com/q/16368605 | https://stackoverflow.com/a/16368880 | <p>It sounds like you're trying to use a workflow that doesn't quite match the way git works.</p>
<p>First of all, a "detached head" in git isn't the same as Mercurial's concept of a "head". Git has exactly one HEAD, which is just the currently checked-out commit. "Detached" just means that you don't currently have a ... | <p>It sounds like you're trying to use a workflow that doesn't quite match the way git works.</p> <p>First of all, a "detached head" in git isn't the same as Mercurial's concept of a "head". Git has exactly one HEAD, which is just the currently checked-out commit. "Detached" just means that you don't currently have a ... | 119, 98582 | git, git-detached-head | <h1>Is there a tool to have git show "detached heads" in a graph?</h1>
<p>I often refer to <code>git log --graph --decorate --oneline --all --full-history</code> to see the current state of my branches, but it does not show detached heads/anonymous branches. Is there a way to get detached heads to appear in this graph?... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,331 | git | # Is there a tool to have git show "detached heads" in a graph?
I often refer to `git log --graph --decorate --oneline --all --full-history` to see the current state of my branches, but it does not show detached heads/anonymous branches. Is there a way to get detached heads to appear in this graph?
I know that `git r... | It sounds like you're trying to use a workflow that doesn't quite match the way git works.
First of all, a "detached head" in git isn't the same as Mercurial's concept of a "head". Git has exactly one HEAD, which is just the currently checked-out commit. "Detached" just means that you don't currently have a branch che... |
51587096 | Using .gitignore with *.pyc in subfolders | 41 | 2018-07-30 04:47:11 | <p>I see that with python 3, there is a __pycache__ in each subfolder of my application and of course *.pyc files will be created there as well. In my .gitignore of my app's root folder, can I simply place:</p>
<pre><code>**/__pycache__
**/*.pyc
</code></pre>
<p>to have these ignored in all future subfolders created... | 43,955 | 325,069 | 2019-12-17 20:04:34 | 51,587,124 | 82 | 2018-07-30 04:50:11 | 6,309 | 2019-12-17 20:04:34 | https://stackoverflow.com/q/51587096 | https://stackoverflow.com/a/51587124 | <p>You should not need the <code>**/</code>:</p>
<pre><code> __pycache__/
*.pyc
</code></pre>
<p>That should be enough.</p>
<p>See for instance <a href="https://www.gitignore.io/api/python" rel="noreferrer">gitignore.io/python</a>.<br />
Note the practice of adding a trailing <code>/</code> to ignore specifically a fo... | <p>You should not need the <code>**/</code>:</p> <pre><code> __pycache__/ *.pyc </code></pre> <p>That should be enough.</p> <p>See for instance <a href="https://www.gitignore.io/api/python" rel="noreferrer">gitignore.io/python</a>.<br /> Note the practice of adding a trailing <code>/</code> to ignore specifically a fo... | 16, 119, 25056 | git, gitignore, python | <h1>Using .gitignore with *.pyc in subfolders</h1>
<p>I see that with python 3, there is a __pycache__ in each subfolder of my application and of course *.pyc files will be created there as well. In my .gitignore of my app's root folder, can I simply place:</p>
<pre><code>**/__pycache__
**/*.pyc
</code></pre>
<p>to ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,332 | git | # Using .gitignore with *.pyc in subfolders
I see that with python 3, there is a __pycache__ in each subfolder of my application and of course *.pyc files will be created there as well. In my .gitignore of my app's root folder, can I simply place:
```
**/__pycache__
**/*.pyc
```
to have these ignored in all future s... | You should not need the `**/`:
```
__pycache__/
*.pyc
```
That should be enough.
See for instance [gitignore.io/python](https://www.gitignore.io/api/python).
Note the practice of adding a trailing `/` to ignore specifically a folder.
Use `git check-ignore -v -- afile` (that [I mentioned in Sept. 2013, with Git ... |
69355161 | `git filter-repo` commands output nothing on Windows | 17 | 2021-09-28 02:36:43 | <p>I installed <a href="https://github.com/newren/git-filter-repo" rel="noreferrer"><code>git-filter-repo</code></a> via <a href="https://scoop.sh/" rel="noreferrer"><code>scoop</code></a>, tried multiple <code>git filter-repo</code> commands e.g. <code>git filter-repo -h</code>, they all logged <em>nothing</em>, no wa... | 21,462 | 7,881,859 | 2024-11-26 06:08:24 | 69,356,543 | 82 | 2021-09-28 06:04:07 | 184,546 | 2022-10-09 01:18:31 | https://stackoverflow.com/q/69355161 | https://stackoverflow.com/a/69356543 | <p>(Now updated for newer Python installers.)</p>
<p>When I installed <code>git-filter-repo</code> on Windows earlier this year, the following steps worked for me:</p>
<ol>
<li><p>Download and install <a href="https://www.python.org/downloads/" rel="noreferrer">Python for Windows</a>. In newer installers you need to go... | <p>(Now updated for newer Python installers.)</p> <p>When I installed <code>git-filter-repo</code> on Windows earlier this year, the following steps worked for me:</p> <ol> <li><p>Download and install <a href="https://www.python.org/downloads/" rel="noreferrer">Python for Windows</a>. In newer installers you need to go... | 16, 64, 119, 133787, 141715 | git, git-filter-repo, python, scoop-installer, windows | <h1>`git filter-repo` commands output nothing on Windows</h1>
<p>I installed <a href="https://github.com/newren/git-filter-repo" rel="noreferrer"><code>git-filter-repo</code></a> via <a href="https://scoop.sh/" rel="noreferrer"><code>scoop</code></a>, tried multiple <code>git filter-repo</code> commands e.g. <code>git ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,336 | git | # `git filter-repo` commands output nothing on Windows
I installed [`git-filter-repo`](https://github.com/newren/git-filter-repo) via [`scoop`](https://scoop.sh/), tried multiple `git filter-repo` commands e.g. `git filter-repo -h`, they all logged *nothing*, no warning or error, just *nothing*.
Tried rebooting, rein... | (Now updated for newer Python installers.)
When I installed `git-filter-repo` on Windows earlier this year, the following steps worked for me:
1. Download and install [Python for Windows](https://www.python.org/downloads/). In newer installers you need to go into the Advanced Options to make sure Python is added to y... |
37219 | How do you remove a specific revision in the git history? | 252 | 2008-08-31 22:51:21 | <p>Suppose your git history looks like this:</p>
<p>1
2
3
4
5</p>
<p>1–5 are separate revisions. You need to remove 3 while still keeping 1, 2, 4 and 5. How can this be done?</p>
<p>Is there an efficient method when there are hundreds of revisions after the one to be deleted?</p>
| 149,728 | 3,146 | 2024-11-04 09:25:00 | 37,267 | 81 | 2008-08-31 23:46:33 | 2,219 | 2014-11-06 02:19:40 | https://stackoverflow.com/q/37219 | https://stackoverflow.com/a/37267 | <p>To combine revision 3 and 4 into a single revision, you can use git rebase. If you want to remove the changes in revision 3, you need to use the edit command in the interactive rebase mode. If you want to combine the changes into a single revision, use squash.</p>
<p>I have successfully used this squash technique, ... | <p>To combine revision 3 and 4 into a single revision, you can use git rebase. If you want to remove the changes in revision 3, you need to use the edit command in the interactive rebase mode. If you want to combine the changes into a single revision, use squash.</p> <p>I have successfully used this squash technique, ... | 119 | git | <h1>How do you remove a specific revision in the git history?</h1>
<p>Suppose your git history looks like this:</p>
<p>1
2
3
4
5</p>
<p>1–5 are separate revisions. You need to remove 3 while still keeping 1, 2, 4 and 5. How can this be done?</p>
<p>Is there an efficient method when there are hundreds of revisions af... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,337 | git | # How do you remove a specific revision in the git history?
Suppose your git history looks like this:
1
2
3
4
5
1–5 are separate revisions. You need to remove 3 while still keeping 1, 2, 4 and 5. How can this be done?
Is there an efficient method when there are hundreds of revisions after the one to be deleted? | To combine revision 3 and 4 into a single revision, you can use git rebase. If you want to remove the changes in revision 3, you need to use the edit command in the interactive rebase mode. If you want to combine the changes into a single revision, use squash.
I have successfully used this squash technique, but have n... |
2190409 | What's the difference between `git add .` and `git add -u`? | 79 | 2010-02-03 07:50:19 | <p>I was assuming that both work in the same way. Both add every file onto index. But I seem wrong.</p>
<ul>
<li>What's the difference between <code>git add .</code> and <code>git add -u</code>?</li>
</ul>
| 34,602 | 227,171 | 2020-03-10 10:46:39 | 2,190,440 | 81 | 2010-02-03 07:56:58 | 6,309 | 2015-07-24 05:57:18 | https://stackoverflow.com/q/2190409 | https://stackoverflow.com/a/2190440 | <p>It is one of the git gotchas <a href="https://stackoverflow.com/questions/1597278/what-git-gotchas-have-you-been-caught-by/2117202#2117202">mentioned here</a> (pre Git 2.0).</p>
<p><code>git add .</code> only adds what is there, not what has been deleted (if tracked).</p>
<pre><code>git add .
git commit
git status... | <p>It is one of the git gotchas <a href="https://stackoverflow.com/questions/1597278/what-git-gotchas-have-you-been-caught-by/2117202#2117202">mentioned here</a> (pre Git 2.0).</p> <p><code>git add .</code> only adds what is there, not what has been deleted (if tracked).</p> <pre><code>git add . git commit git status... | 119, 34792 | git, git-add | <h1>What's the difference between `git add .` and `git add -u`?</h1>
<p>I was assuming that both work in the same way. Both add every file onto index. But I seem wrong.</p>
<ul>
<li>What's the difference between <code>git add .</code> and <code>git add -u</code>?</li>
</ul>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,339 | git | # What's the difference between `git add .` and `git add -u`?
I was assuming that both work in the same way. Both add every file onto index. But I seem wrong.
- What's the difference between `git add .` and `git add -u`? | It is one of the git gotchas [mentioned here](https://stackoverflow.com/questions/1597278/what-git-gotchas-have-you-been-caught-by/2117202#2117202) (pre Git 2.0).
`git add .` only adds what is there, not what has been deleted (if tracked).
```
git add .
git commit
git status
//hey! why didn't it commit my deletes?, O... |
33283350 | What happen to Git tags pointing to a removed commit | 66 | 2015-10-22 14:21:18 | <p>Say I do the following:</p>
<ol>
<li>Create branch <code>X</code></li>
<li>Create Tag <code>t</code> (to branch <code>X</code>)</li>
<li>Push</li>
<li>Remove branch <code>X</code></li>
</ol>
<p>What happen to tag <code>t</code>? is it just floating there? is it considered as garbage?</p>
<p>Should I remove all tags ... | 28,191 | 1,798,187 | 2021-05-12 04:43:57 | 33,284,908 | 81 | 2015-10-22 15:33:48 | 974,186 | 2021-05-12 04:43:57 | https://stackoverflow.com/q/33283350 | https://stackoverflow.com/a/33284908 | <blockquote>
<p>What happen to tag t?</p>
</blockquote>
<p>Let's say you created branch <code>x</code> from a commit <code>E</code> and then tagged that commit with tag <code>t</code>. E.g.</p>
<pre><code> x (branch)
|
V
A-----... | <blockquote> <p>What happen to tag t?</p> </blockquote> <p>Let's say you created branch <code>x</code> from a commit <code>E</code> and then tagged that commit with tag <code>t</code>. E.g.</p> <pre><code> x (branch) | V A-----... | 119, 60718, 76220 | git, git-branch, git-tag | <h1>What happen to Git tags pointing to a removed commit</h1>
<p>Say I do the following:</p>
<ol>
<li>Create branch <code>X</code></li>
<li>Create Tag <code>t</code> (to branch <code>X</code>)</li>
<li>Push</li>
<li>Remove branch <code>X</code></li>
</ol>
<p>What happen to tag <code>t</code>? is it just floating there?... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,342 | git | # What happen to Git tags pointing to a removed commit
Say I do the following:
1. Create branch `X`
2. Create Tag `t` (to branch `X`)
3. Push
4. Remove branch `X`
What happen to tag `t`? is it just floating there? is it considered as garbage?
Should I remove all tags pointing at branch before removing the branch it... | > What happen to tag t?
Let's say you created branch `x` from a commit `E` and then tagged that commit with tag `t`. E.g.
```
x (branch)
|
V
A-----B------C------D------E
^
... |
8576503 | How can I make git log order based on author's timestamp? | 65 | 2011-12-20 13:52:43 | <p>I use a fairly complex <code>git-log</code> command involving <code>--date-order</code> to get an overview of my repository's status; but unfortunately, <code>--date-order</code> seems to use the <em>committer</em> date, not the <em>author</em> date. That means that each time I bring my topic branches up to date by ... | 33,177 | 31,897 | 2019-01-24 21:43:09 | 18,871,907 | 81 | 2013-09-18 12:10:09 | 669,631 | 2013-09-18 12:10:09 | https://stackoverflow.com/q/8576503 | https://stackoverflow.com/a/18871907 | <p>git version 1.8.4 added an <code>--author-date-order</code> argument to <code>git log</code>; according to the <a href="https://raw.github.com/git/git/master/Documentation/RelNotes/1.8.4.txt" rel="noreferrer">release notes</a>, "the output is topologically sorted and commits in parallel histories are shown intermixe... | <p>git version 1.8.4 added an <code>--author-date-order</code> argument to <code>git log</code>; according to the <a href="https://raw.github.com/git/git/master/Documentation/RelNotes/1.8.4.txt" rel="noreferrer">release notes</a>, "the output is topologically sorted and commits in parallel histories are shown intermixe... | 119, 134, 2177, 47913 | git, git-log, sorting, timestamp | <h1>How can I make git log order based on author's timestamp?</h1>
<p>I use a fairly complex <code>git-log</code> command involving <code>--date-order</code> to get an overview of my repository's status; but unfortunately, <code>--date-order</code> seems to use the <em>committer</em> date, not the <em>author</em> date.... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,343 | git | # How can I make git log order based on author's timestamp?
I use a fairly complex `git-log` command involving `--date-order` to get an overview of my repository's status; but unfortunately, `--date-order` seems to use the *committer* date, not the *author* date. That means that each time I bring my topic branches up ... | git version 1.8.4 added an `--author-date-order` argument to `git log`; according to the [release notes](https://raw.github.com/git/git/master/Documentation/RelNotes/1.8.4.txt), "the output is topologically sorted and commits in parallel histories are shown intermixed together based on the author timestamp." |
18197705 | Adding your .vim ~/.vimrc to github (aka dot files) | 61 | 2013-08-12 22:28:10 | <p>I have seen a few people that have git repos with their dot files. I'm wondering if they just </p>
<pre><code>cd ~/
git init
git add .vimrc
// etc
</code></pre>
<p>? And then that's how they keep it up to date? Or do they probably make copies and sync them?</p>
<p>What strategy do you guys recommend or use? Mostl... | 24,403 | 2,637,044 | 2019-08-12 17:57:36 | 18,197,818 | 81 | 2013-08-12 22:38:54 | 551,779 | 2018-09-18 13:09:45 | https://stackoverflow.com/q/18197705 | https://stackoverflow.com/a/18197818 | <p>Making a git repository of your home is probably a bad idea (you would be spending more time creating your .gitignore file than on doing what you really want to do).</p>
<p>I suggest using a separate git directory for your dotfiles (eg. <code>~/git/dotfiles</code>) and them making symlinks to your home (eg. <code>l... | <p>Making a git repository of your home is probably a bad idea (you would be spending more time creating your .gitignore file than on doing what you really want to do).</p> <p>I suggest using a separate git directory for your dotfiles (eg. <code>~/git/dotfiles</code>) and them making symlinks to your home (eg. <code>l... | 119, 370, 54848 | dotfiles, git, vim | <h1>Adding your .vim ~/.vimrc to github (aka dot files)</h1>
<p>I have seen a few people that have git repos with their dot files. I'm wondering if they just </p>
<pre><code>cd ~/
git init
git add .vimrc
// etc
</code></pre>
<p>? And then that's how they keep it up to date? Or do they probably make copies and sync th... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,344 | git | # Adding your .vim ~/.vimrc to github (aka dot files)
I have seen a few people that have git repos with their dot files. I'm wondering if they just
```
cd ~/
git init
git add .vimrc
// etc
```
? And then that's how they keep it up to date? Or do they probably make copies and sync them?
What strategy do you guys rec... | Making a git repository of your home is probably a bad idea (you would be spending more time creating your .gitignore file than on doing what you really want to do).
I suggest using a separate git directory for your dotfiles (eg. `~/git/dotfiles`) and them making symlinks to your home (eg. `ln -s ~/git/dotfiles/.vim ~... |
8273823 | How can I discard modified files? | 60 | 2011-11-25 20:16:54 | <p>This is a Linux 2.6 kernel repository. I git clone it to my local host.</p>
<p>After that. I didn't make any change. But when I "git status". I found 13 modified files. I want to discard them, but I can't.</p>
<pre><code>> luke@Macbook-Pro~/Documents/workspace/linuxkernel/linux-2.6$ git
> status
> # On br... | 148,345 | 845,081 | 2020-06-09 02:20:33 | 8,273,847 | 81 | 2011-11-25 20:19:24 | 354,009 | 2011-11-25 20:19:24 | https://stackoverflow.com/q/8273823 | https://stackoverflow.com/a/8273847 | <p>A <code>git reset --hard HEAD</code> should solve the problem.</p>
| <p>A <code>git reset --hard HEAD</code> should solve the problem.</p> | 119 | git | <h1>How can I discard modified files?</h1>
<p>This is a Linux 2.6 kernel repository. I git clone it to my local host.</p>
<p>After that. I didn't make any change. But when I "git status". I found 13 modified files. I want to discard them, but I can't.</p>
<pre><code>> luke@Macbook-Pro~/Documents/workspace/linuxker... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,346 | git | # How can I discard modified files?
This is a Linux 2.6 kernel repository. I git clone it to my local host.
After that. I didn't make any change. But when I "git status". I found 13 modified files. I want to discard them, but I can't.
```
> luke@Macbook-Pro~/Documents/workspace/linuxkernel/linux-2.6$ git
> status
> ... | A `git reset --hard HEAD` should solve the problem. |
47216073 | Delete a local development branch | 49 | 2017-11-10 05:14:58 | <p>I have recently cloned a repo of our development code branch in my system:</p>
<pre><code>git clone https://gitserver.com/product
</code></pre>
<p>After the clone was successful I get the below status on query:</p>
<pre><code>$ git branch
* develop
</code></pre>
<p>I realized that now this branch needs to be del... | 61,586 | 304,974 | 2019-02-10 18:06:50 | 47,216,130 | 81 | 2017-11-10 05:21:04 | 4,724,167 | 2017-11-10 05:21:04 | https://stackoverflow.com/q/47216073 | https://stackoverflow.com/a/47216130 | <p>You cannot delete the branch you are currently on.</p>
<p>Try creating a new branch </p>
<pre><code>git checkout -b new-branch
</code></pre>
<p>Then delete the develop branch</p>
<pre><code>git branch -d develop
</code></pre>
| <p>You cannot delete the branch you are currently on.</p> <p>Try creating a new branch </p> <pre><code>git checkout -b new-branch </code></pre> <p>Then delete the develop branch</p> <pre><code>git branch -d develop </code></pre> | 119, 1879, 76220 | branch, git, git-branch | <h1>Delete a local development branch</h1>
<p>I have recently cloned a repo of our development code branch in my system:</p>
<pre><code>git clone https://gitserver.com/product
</code></pre>
<p>After the clone was successful I get the below status on query:</p>
<pre><code>$ git branch
* develop
</code></pre>
<p>I re... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,349 | git | # Delete a local development branch
I have recently cloned a repo of our development code branch in my system:
```
git clone https://gitserver.com/product
```
After the clone was successful I get the below status on query:
```
$ git branch
* develop
```
I realized that now this branch needs to be deleted, hence:
... | You cannot delete the branch you are currently on.
Try creating a new branch
```
git checkout -b new-branch
```
Then delete the develop branch
```
git branch -d develop
``` |
16346535 | Recursive git update-index --assume-unchanged | 46 | 2013-05-02 19:50:39 | <p>I'm trying to run the following:</p>
<pre><code>git update-index --assume-unchanged myFolderToIgnore
</code></pre>
<p>Where <code>myFolderToIgnore</code> is a folder. However it fails saying its "unable to mark" it.</p>
<p>So I tried:</p>
<pre><code>git update-index --assume-unchanged myFolderToIgnore/
</code><... | 14,336 | 500,270 | 2021-12-17 12:05:20 | 16,346,756 | 81 | 2013-05-02 20:05:14 | 758,345 | 2021-12-17 12:05:20 | https://stackoverflow.com/q/16346535 | https://stackoverflow.com/a/16346756 | <p><code>update-index</code> is an internal plumbing command and thus not as comfortable as the real front-end commands. You will have to handle the recursion bit yourself:</p>
<pre><code>git ls-files -z myFolderToIgnore/ | xargs -0 git update-index --assume-unchanged
</code></pre>
<hr />
<p><strong>PSA:</strong> There... | <p><code>update-index</code> is an internal plumbing command and thus not as comfortable as the real front-end commands. You will have to handle the recursion bit yourself:</p> <pre><code>git ls-files -z myFolderToIgnore/ | xargs -0 git update-index --assume-unchanged </code></pre> <hr /> <p><strong>PSA:</strong> There... | 119, 25056 | git, gitignore | <h1>Recursive git update-index --assume-unchanged</h1>
<p>I'm trying to run the following:</p>
<pre><code>git update-index --assume-unchanged myFolderToIgnore
</code></pre>
<p>Where <code>myFolderToIgnore</code> is a folder. However it fails saying its "unable to mark" it.</p>
<p>So I tried:</p>
<pre><code>git upd... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,351 | git | # Recursive git update-index --assume-unchanged
I'm trying to run the following:
```
git update-index --assume-unchanged myFolderToIgnore
```
Where `myFolderToIgnore` is a folder. However it fails saying its "unable to mark" it.
So I tried:
```
git update-index --assume-unchanged myFolderToIgnore/
```
Which GIT r... | `update-index` is an internal plumbing command and thus not as comfortable as the real front-end commands. You will have to handle the recursion bit yourself:
```
git ls-files -z myFolderToIgnore/ | xargs -0 git update-index --assume-unchanged
```
---
**PSA:** There is a high chance that `assume-unchanged` is not wh... |
8953206 | How do I "move" my commits from "no branch" to an actual branch? | 45 | 2012-01-21 13:10:48 | <p>I made a mistake, and started making commits "to the last tag", which lands my commits in "no branch". They should have been applied at the head of an already existing branch. I have <em>not</em> pushed my changes yet. I've found a few other question for when commits are in the <em>wrong</em> branch, but now I have ... | 48,791 | 1,147,744 | 2022-06-13 00:52:26 | 8,953,246 | 81 | 2012-01-21 13:15:26 | 54,175 | 2012-01-21 13:33:29 | https://stackoverflow.com/q/8953206 | https://stackoverflow.com/a/8953246 | <p>You are currently in a <strong>detached HEAD</strong> state. To resolve that, all you need to do is create a new branch with <code>git branch <branchname></code> or <code>git checkout -b <branchname></code>. That will leave you with a local branch you can play with, and even delete when you're done with ... | <p>You are currently in a <strong>detached HEAD</strong> state. To resolve that, all you need to do is create a new branch with <code>git branch <branchname></code> or <code>git checkout -b <branchname></code>. That will leave you with a local branch you can play with, and even delete when you're done with ... | 119, 717, 1879, 5597, 76220 | branch, commit, git, git-branch, merge | <h1>How do I "move" my commits from "no branch" to an actual branch?</h1>
<p>I made a mistake, and started making commits "to the last tag", which lands my commits in "no branch". They should have been applied at the head of an already existing branch. I have <em>not</em> pushed my changes yet. I've found a few other q... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,352 | git | # How do I "move" my commits from "no branch" to an actual branch?
I made a mistake, and started making commits "to the last tag", which lands my commits in "no branch". They should have been applied at the head of an already existing branch. I have *not* pushed my changes yet. I've found a few other question for when... | You are currently in a **detached HEAD** state. To resolve that, all you need to do is create a new branch with `git branch <branchname>` or `git checkout -b <branchname>`. That will leave you with a local branch you can play with, and even delete when you're done with it.
Branches in git are just *pointers* to commit... |
5375066 | Reverting an interactive git rebase | 42 | 2011-03-21 07:55:29 | <p>After completing a feature branch, during a <code>git rebase -i</code> I accidentally removed all my commits. I'm not completely sure but I suspect that instead of squashing my commits, I replaced the entire entry with a commit message.</p>
<p><a href="http://shafiulazam.com/gitbook/4_interactive_rebasing.html" rel... | 22,257 | 365,950 | 2017-06-16 10:48:59 | 5,375,113 | 81 | 2011-03-21 08:01:03 | 6,309 | 2011-03-21 08:01:03 | https://stackoverflow.com/q/5375066 | https://stackoverflow.com/a/5375113 | <p>If you have just done the rebase, you can try as <a href="https://stackoverflow.com/questions/964876/head-and-orig-head-in-git/964927#964927">mentioned here</a>:</p>
<pre><code>git reset --hard ORIG_HEAD
</code></pre>
<p>as <a href="https://stackoverflow.com/users/46058/jakub-narebski">Jakub Narębski</a> <a href="... | <p>If you have just done the rebase, you can try as <a href="https://stackoverflow.com/questions/964876/head-and-orig-head-in-git/964927#964927">mentioned here</a>:</p> <pre><code>git reset --hard ORIG_HEAD </code></pre> <p>as <a href="https://stackoverflow.com/users/46058/jakub-narebski">Jakub Narębski</a> <a href="... | 119, 29934 | git, git-rebase | <h1>Reverting an interactive git rebase</h1>
<p>After completing a feature branch, during a <code>git rebase -i</code> I accidentally removed all my commits. I'm not completely sure but I suspect that instead of squashing my commits, I replaced the entire entry with a commit message.</p>
<p><a href="http://shafiulazam... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,354 | git | # Reverting an interactive git rebase
After completing a feature branch, during a `git rebase -i` I accidentally removed all my commits. I'm not completely sure but I suspect that instead of squashing my commits, I replaced the entire entry with a commit message.
<http://shafiulazam.com/gitbook/4_interactive_rebasing... | If you have just done the rebase, you can try as [mentioned here](https://stackoverflow.com/questions/964876/head-and-orig-head-in-git/964927#964927):
```
git reset --hard ORIG_HEAD
```
as [Jakub Narębski](https://stackoverflow.com/users/46058/jakub-narebski) [details](https://stackoverflow.com/questions/964876/head-... |
33255285 | I get "fatal: unable to create threaded lstat" error when I run "git status" command | 33 | 2015-10-21 09:13:26 | <p>Hi StackOverflow Team!</p>
<p>Recently I got strange responses from git I use on my SiteGround hosting. When I run the <code>git status</code> command in my repository I get the following error:</p>
<pre><code>serv01.ams38.siteground.eu [~/www/cledu (cart-editor)] git status
fatal: unable to create threaded lstat
... | 22,710 | 2,007,056 | 2022-09-07 10:33:46 | 33,805,069 | 81 | 2015-11-19 13:18:38 | 3,043,709 | 2015-11-19 13:18:38 | https://stackoverflow.com/q/33255285 | https://stackoverflow.com/a/33805069 | <p>If the resource limit can't be removed by the hosting provider, you could consider using git config to disable preloading of the index (threaded lstat).</p>
<pre><code>git config core.preloadIndex false
</code></pre>
<p>If you need that setting when cloning the initial repository, then you will need to set it glob... | <p>If the resource limit can't be removed by the hosting provider, you could consider using git config to disable preloading of the index (threaded lstat).</p> <pre><code>git config core.preloadIndex false </code></pre> <p>If you need that setting when cloning the initial repository, then you will need to set it glob... | 58, 119, 386 | git, linux, ssh | <h1>I get "fatal: unable to create threaded lstat" error when I run "git status" command</h1>
<p>Hi StackOverflow Team!</p>
<p>Recently I got strange responses from git I use on my SiteGround hosting. When I run the <code>git status</code> command in my repository I get the following error:</p>
<pre><code>serv01.ams3... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,355 | git | # I get "fatal: unable to create threaded lstat" error when I run "git status" command
Hi StackOverflow Team!
Recently I got strange responses from git I use on my SiteGround hosting. When I run the `git status` command in my repository I get the following error:
```
serv01.ams38.siteground.eu [~/www/cledu (cart-edi... | If the resource limit can't be removed by the hosting provider, you could consider using git config to disable preloading of the index (threaded lstat).
```
git config core.preloadIndex false
```
If you need that setting when cloning the initial repository, then you will need to set it globally.
```
git config --glo... |
21198514 | Remove source control for Xcode project | 30 | 2014-01-18 00:35:02 | <p>I've been using source control on an Xcode project for awhile, but now I don't want to use source control.</p>
<p>How do you remove source control from a project in Xcode?</p>
| 41,133 | 3,201,059 | 2022-04-05 00:24:13 | 21,198,575 | 81 | 2014-01-18 00:41:09 | 1,143,874 | 2016-08-29 06:51:30 | https://stackoverflow.com/q/21198514 | https://stackoverflow.com/a/21198575 | <p>There are three ways. Method 1 will disable source control for all projects. Method 2 will delete the link to a single repository for all projects. Method 3 will remove the link to a repository for a single project. I think Method 3 is the one you are looking for.</p>
<p>1: Through Source Control Management Prefere... | <p>There are three ways. Method 1 will disable source control for all projects. Method 2 will delete the link to a single repository for all projects. Method 3 will remove the link to a repository for a single project. I think Method 3 is the one you are looking for.</p> <p>1: Through Source Control Management Prefere... | 119, 908 | git, xcode | <h1>Remove source control for Xcode project</h1>
<p>I've been using source control on an Xcode project for awhile, but now I don't want to use source control.</p>
<p>How do you remove source control from a project in Xcode?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,356 | git | # Remove source control for Xcode project
I've been using source control on an Xcode project for awhile, but now I don't want to use source control.
How do you remove source control from a project in Xcode? | There are three ways. Method 1 will disable source control for all projects. Method 2 will delete the link to a single repository for all projects. Method 3 will remove the link to a repository for a single project. I think Method 3 is the one you are looking for.
1: Through Source Control Management Preferences
In X... |
3954852 | How to complete a git clone for a big project on an unstable connection? | 273 | 2010-10-17 19:22:34 | <p>I am trying to git clone the LibreOffice codebase, but at the moment I have an internet connection of about 300kbps and it's just anything but stable. I can get the connection back any moment, but then the git clone process already stopped working, and no way to get it running again. Is there some way to have a more... | 112,766 | 241,927 | 2024-10-24 16:54:34 | 3,954,878 | 80 | 2010-10-17 19:28:09 | 399,268 | 2013-12-24 18:15:13 | https://stackoverflow.com/q/3954852 | https://stackoverflow.com/a/3954878 | <p>I don't think this is ready yet. There's <a href="https://git.wiki.kernel.org/index.php/SoC2008Ideas#head-bcfe9e77ab9670575d242059ce3bedacd7f73126" rel="noreferrer">an old GSoC page</a> that which planned to implement your desired feature. My best bet is, like you suggested download it as a directory. I'm assuming y... | <p>I don't think this is ready yet. There's <a href="https://git.wiki.kernel.org/index.php/SoC2008Ideas#head-bcfe9e77ab9670575d242059ce3bedacd7f73126" rel="noreferrer">an old GSoC page</a> that which planned to implement your desired feature. My best bet is, like you suggested download it as a directory. I'm assuming y... | 119, 34099 | git, git-clone | <h1>How to complete a git clone for a big project on an unstable connection?</h1>
<p>I am trying to git clone the LibreOffice codebase, but at the moment I have an internet connection of about 300kbps and it's just anything but stable. I can get the connection back any moment, but then the git clone process already sto... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,358 | git | # How to complete a git clone for a big project on an unstable connection?
I am trying to git clone the LibreOffice codebase, but at the moment I have an internet connection of about 300kbps and it's just anything but stable. I can get the connection back any moment, but then the git clone process already stopped work... | I don't think this is ready yet. There's [an old GSoC page](https://git.wiki.kernel.org/index.php/SoC2008Ideas#head-bcfe9e77ab9670575d242059ce3bedacd7f73126) that which planned to implement your desired feature. My best bet is, like you suggested download it as a directory. I'm assuming you are able to resume downloads... |
8903953 | How to revert last commit and remove it from history? | 81 | 2012-01-18 01:14:30 | <p>I did a commit and reverted with </p>
<pre><code>git revert HEAD^
</code></pre>
<p>just git log</p>
<pre><code>➜ git:(master) git log
commit 45a0b1371e4705c4f875141232d7a97351f0ed8b
Author: Daniel Palacio <danpal@gmail.com>
Date: Tue Jan 17 16:32:15 2012 -0800
Production explanation
</code></pre>
<... | 128,454 | 98,151 | 2019-02-01 18:33:19 | 8,904,080 | 80 | 2012-01-18 01:33:03 | 582 | 2012-01-18 01:33:03 | https://stackoverflow.com/q/8903953 | https://stackoverflow.com/a/8904080 | <p>First off, <code>git revert</code> is the wrong command here. That creates a new commit that reverts an older one. That's not what you're asking for. Secondly, it looks like you want to revert <code>HEAD</code> instead of <code>HEAD^</code>.</p>
<p>If you haven't pushed this anywhere, you can use <code>git reset --... | <p>First off, <code>git revert</code> is the wrong command here. That creates a new commit that reverts an older one. That's not what you're asking for. Secondly, it looks like you want to revert <code>HEAD</code> instead of <code>HEAD^</code>.</p> <p>If you haven't pushed this anywhere, you can use <code>git reset --... | 119, 34403 | git, git-revert | <h1>How to revert last commit and remove it from history?</h1>
<p>I did a commit and reverted with </p>
<pre><code>git revert HEAD^
</code></pre>
<p>just git log</p>
<pre><code>➜ git:(master) git log
commit 45a0b1371e4705c4f875141232d7a97351f0ed8b
Author: Daniel Palacio <danpal@gmail.com>
Date: Tue Jan 17 1... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,360 | git | # How to revert last commit and remove it from history?
I did a commit and reverted with
```
git revert HEAD^
```
just git log
```
➜ git:(master) git log
commit 45a0b1371e4705c4f875141232d7a97351f0ed8b
Author: Daniel Palacio <danpal@gmail.com>
Date: Tue Jan 17 16:32:15 2012 -0800
Production explanation
```
... | First off, `git revert` is the wrong command here. That creates a new commit that reverts an older one. That's not what you're asking for. Secondly, it looks like you want to revert `HEAD` instead of `HEAD^`.
If you haven't pushed this anywhere, you can use `git reset --hard HEAD^` to throw away the latest commit (thi... |
16972031 | How to unpack all objects of a git repository? | 62 | 2013-06-06 20:56:41 | <p>How can I unpack <strong>all</strong> objects of a pack file? </p>
<p>I've just cloned a remote repository, so my local repository currently doesn't contain any loose object, only a .pack and a .idx files.</p>
<p>I've tried running <code>git unpack-objects < .git/objects/pack/pack-.pack</code>, but nothing happ... | 52,504 | 958,003 | 2024-06-19 22:35:46 | 16,972,155 | 80 | 2013-06-06 21:04:13 | 1,965,396 | 2021-01-18 11:32:39 | https://stackoverflow.com/q/16972031 | https://stackoverflow.com/a/16972155 | <p>You need to move the pack objects outside the <code>.git/objects/pack</code> directory before using the command. However, the pack files need to be inside the repository.</p>
<p>For example, create a directory name <code>SAMPLE</code> in your project's root. Then, move the pack files to <code>SAMPLE</code> directory... | <p>You need to move the pack objects outside the <code>.git/objects/pack</code> directory before using the command. However, the pack files need to be inside the repository.</p> <p>For example, create a directory name <code>SAMPLE</code> in your project's root. Then, move the pack files to <code>SAMPLE</code> directory... | 119, 11275 | git, unpack | <h1>How to unpack all objects of a git repository?</h1>
<p>How can I unpack <strong>all</strong> objects of a pack file? </p>
<p>I've just cloned a remote repository, so my local repository currently doesn't contain any loose object, only a .pack and a .idx files.</p>
<p>I've tried running <code>git unpack-objects &l... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,364 | git | # How to unpack all objects of a git repository?
How can I unpack **all** objects of a pack file?
I've just cloned a remote repository, so my local repository currently doesn't contain any loose object, only a .pack and a .idx files.
I've tried running `git unpack-objects < .git/objects/pack/pack-.pack`, but nothing... | You need to move the pack objects outside the `.git/objects/pack` directory before using the command. However, the pack files need to be inside the repository.
For example, create a directory name `SAMPLE` in your project's root. Then, move the pack files to `SAMPLE` directory. After that, inside the repository withou... |
14275856 | Merging but overwriting changes in Git | 62 | 2013-01-11 10:11:20 | <p>When I merge a branch in Git to master I often get merge conflicts. Is there a way to merge a branch and just overwrite the stuff in the current branch?</p>
| 56,705 | 421,398 | 2023-04-13 14:17:42 | 14,275,984 | 80 | 2013-01-11 10:18:38 | 50,902 | 2013-01-11 16:57:42 | https://stackoverflow.com/q/14275856 | https://stackoverflow.com/a/14275984 | <p>Add <code>-X ours</code> argument to your <code>git merge</code> command.</p>
<p>Say you are working in your local branch. Then you want to merge in what went in the <code>master</code>:</p>
<pre><code>git merge -X ours master
</code></pre>
<p>On the other hand if you <em>are</em> in <code>master</code> and want ... | <p>Add <code>-X ours</code> argument to your <code>git merge</code> command.</p> <p>Say you are working in your local branch. Then you want to merge in what went in the <code>master</code>:</p> <pre><code>git merge -X ours master </code></pre> <p>On the other hand if you <em>are</em> in <code>master</code> and want ... | 119, 3146 | conflict, git | <h1>Merging but overwriting changes in Git</h1>
<p>When I merge a branch in Git to master I often get merge conflicts. Is there a way to merge a branch and just overwrite the stuff in the current branch?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 16,365 | git | # Merging but overwriting changes in Git
When I merge a branch in Git to master I often get merge conflicts. Is there a way to merge a branch and just overwrite the stuff in the current branch? | Add `-X ours` argument to your `git merge` command.
Say you are working in your local branch. Then you want to merge in what went in the `master`:
```
git merge -X ours master
```
On the other hand if you *are* in `master` and want to merge your local branch into `master` then @elhadi rightly says you should use `th... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.