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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
15943434 | How to reset a branch to another branch with git? | 135 | 2013-04-11 07:54:09 | <p>let's say that we have an <code>hotfixes</code> branch which was created from <code>master</code>. we added commits to <code>hotfixes</code>, but those commits were not useful, so now we want to start from a fresh copy of <code>master</code> again.</p>
<p>to clarify better, this is the reference workflow: <a href="... | 155,839 | 393,758 | 2019-11-15 17:16:22 | 15,943,471 | 57 | 2013-04-11 07:56:16 | 159,834 | 2014-07-03 09:15:19 | https://stackoverflow.com/q/15943434 | https://stackoverflow.com/a/15943471 | <p>You mean you want to push your local <code>master</code> to the remote <code>hotfixes</code> branch? Like this:</p>
<pre><code>git push origin +master:hotfixes
</code></pre>
<p>However, this requires that you are allowed to re-write the history on the remote side.</p>
| <p>You mean you want to push your local <code>master</code> to the remote <code>hotfixes</code> branch? Like this:</p> <pre><code>git push origin +master:hotfixes </code></pre> <p>However, this requires that you are allowed to re-write the history on the remote side.</p> | 119 | git | <h1>How to reset a branch to another branch with git?</h1>
<p>let's say that we have an <code>hotfixes</code> branch which was created from <code>master</code>. we added commits to <code>hotfixes</code>, but those commits were not useful, so now we want to start from a fresh copy of <code>master</code> again.</p>
<p>t... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,078 | git | # How to reset a branch to another branch with git?
let's say that we have an `hotfixes` branch which was created from `master`. we added commits to `hotfixes`, but those commits were not useful, so now we want to start from a fresh copy of `master` again.
to clarify better, this is the reference workflow: <http://nv... | You mean you want to push your local `master` to the remote `hotfixes` branch? Like this:
```
git push origin +master:hotfixes
```
However, this requires that you are allowed to re-write the history on the remote side. |
8598639 | Why is my Git pre-commit hook not executable by default? | 115 | 2011-12-22 01:55:14 | <p>If you see the accepted answer in:
<a href="https://stackoverflow.com/questions/8598246/aggregating-and-uglifying-javascript-in-a-git-pre-commit-hook">Aggregating and uglifying JavaScript in a Git pre-commit hook</a>, you'll see that I had to do a <code>chmod +x</code> on my pre-commit hook to get it to work.</p>
<p... | 135,482 | 373,496 | 2024-06-22 16:26:00 | 8,598,684 | 57 | 2011-12-22 02:05:05 | 438,992 | 2013-04-09 21:22:04 | https://stackoverflow.com/q/8598639 | https://stackoverflow.com/a/8598684 | <p>Because files are not executable by default; they must be set to be executable.</p>
<p>The sample files from a <code>git init</code> are all executable; if it's copied or renamed to a non-sample file, it will retain the original file's <code>x</code> flag.</p>
<p>New files will be created with current defaults. In... | <p>Because files are not executable by default; they must be set to be executable.</p> <p>The sample files from a <code>git init</code> are all executable; if it's copied or renamed to a non-sample file, it will retain the original file's <code>x</code> flag.</p> <p>New files will be created with current defaults. In... | 119, 43087 | git, githooks | <h1>Why is my Git pre-commit hook not executable by default?</h1>
<p>If you see the accepted answer in:
<a href="https://stackoverflow.com/questions/8598246/aggregating-and-uglifying-javascript-in-a-git-pre-commit-hook">Aggregating and uglifying JavaScript in a Git pre-commit hook</a>, you'll see that I had to do a <co... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,079 | git | # Why is my Git pre-commit hook not executable by default?
If you see the accepted answer in:
[Aggregating and uglifying JavaScript in a Git pre-commit hook](https://stackoverflow.com/questions/8598246/aggregating-and-uglifying-javascript-in-a-git-pre-commit-hook), you'll see that I had to do a `chmod +x` on my pre-co... | Because files are not executable by default; they must be set to be executable.
The sample files from a `git init` are all executable; if it's copied or renamed to a non-sample file, it will retain the original file's `x` flag.
New files will be created with current defaults. In your case, view those defaults with `u... |
363908 | How do I use 'git rebase -i' to rebase all changes in a branch? | 104 | 2008-12-12 19:45:16 | <p>Here's an example:</p>
<pre><code>>git status
# On branch master
nothing to commit (working directory clean)
>git checkout -b test-branch
>vi test.c
>git add test.c
>git commit -m "modified test.c"
>vi README
>git add README
>git commit -m "modified README"
</code></pre>
<p>Now I want to do... | 111,081 | 45,824 | 2024-07-11 01:45:02 | 364,065 | 57 | 2008-12-12 20:35:20 | 28,888 | 2015-05-04 22:57:04 | https://stackoverflow.com/q/363908 | https://stackoverflow.com/a/364065 | <p>Have you tried: <code>git rebase -i master</code>?</p>
| <p>Have you tried: <code>git rebase -i master</code>?</p> | 119 | git | <h1>How do I use 'git rebase -i' to rebase all changes in a branch?</h1>
<p>Here's an example:</p>
<pre><code>>git status
# On branch master
nothing to commit (working directory clean)
>git checkout -b test-branch
>vi test.c
>git add test.c
>git commit -m "modified test.c"
>vi README
>git add READ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,080 | git | # How do I use 'git rebase -i' to rebase all changes in a branch?
Here's an example:
```
>git status
# On branch master
nothing to commit (working directory clean)
>git checkout -b test-branch
>vi test.c
>git add test.c
>git commit -m "modified test.c"
>vi README
>git add README
>git commit -m "modified README"
```
... | Have you tried: `git rebase -i master`? |
4111728 | How do I deal with corrupted Git object files? | 103 | 2010-11-06 03:20:28 | <p>I did a Git pull when I was near my quota, and as a result (so I think), got a corrupted file:</p>
<pre><code>$ git pull
walk dffbfa18916a9db95ef8fafc6d7d769c29a445aa
fatal: object d4a0e7599494bfee2b5351113895b43c351496b3 is corrupted
$ git fsck --full
bad sha1 file: .git/objects/66/b55c76947b1d38983e0944f1e6388c... | 172,584 | 139,685 | 2025-10-06 16:48:30 | 4,112,008 | 57 | 2010-11-06 05:06:47 | 119,963 | 2010-11-06 05:06:47 | https://stackoverflow.com/q/4111728 | https://stackoverflow.com/a/4112008 | <p>In general, fixing corrupt objects can be pretty difficult. However, in this case, we're confident that the problem is an aborted transfer, meaning that the object is in a remote repository, so we should be able to safely remove our copy and let git get it from the remote, correctly this time.</p>
<p>The temporary ... | <p>In general, fixing corrupt objects can be pretty difficult. However, in this case, we're confident that the problem is an aborted transfer, meaning that the object is in a remote repository, so we should be able to safely remove our copy and let git get it from the remote, correctly this time.</p> <p>The temporary ... | 119 | git | <h1>How do I deal with corrupted Git object files?</h1>
<p>I did a Git pull when I was near my quota, and as a result (so I think), got a corrupted file:</p>
<pre><code>$ git pull
walk dffbfa18916a9db95ef8fafc6d7d769c29a445aa
fatal: object d4a0e7599494bfee2b5351113895b43c351496b3 is corrupted
$ git fsck --full
bad s... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,081 | git | # How do I deal with corrupted Git object files?
I did a Git pull when I was near my quota, and as a result (so I think), got a corrupted file:
```
$ git pull
walk dffbfa18916a9db95ef8fafc6d7d769c29a445aa
fatal: object d4a0e7599494bfee2b5351113895b43c351496b3 is corrupted
$ git fsck --full
bad sha1 file: .git/object... | In general, fixing corrupt objects can be pretty difficult. However, in this case, we're confident that the problem is an aborted transfer, meaning that the object is in a remote repository, so we should be able to safely remove our copy and let git get it from the remote, correctly this time.
The temporary object fil... |
1899792 | Why is git submodule not updated automatically on git checkout? | 96 | 2009-12-14 09:05:38 | <p>When switching branches with git checkout I would assume that most of the time you would want to update your submodules.</p>
<ul>
<li>In what situation do you <strong>not</strong> want to update submodules after switching?</li>
<li>What would break if this was done automatically by git checkout?</li>
</ul>
<p>Upda... | 25,259 | 84,760 | 2023-03-04 10:15:56 | 43,854,593 | 57 | 2017-05-08 18:13:43 | 895,245 | 2023-03-04 10:15:56 | https://stackoverflow.com/q/1899792 | https://stackoverflow.com/a/43854593 | <p><strong><code>git checkout --recurse-submodules</code> was added to git 2.13</strong></p>
<p>This is mentioned on the release notes at: <a href="https://github.com/git/git/commit/e1104a5ee539408b81566066aaa6963cb87d5cd6#diff-c24776ff22455a30fbb78e378b7df0b0R139" rel="noreferrer">https://github.com/git/git/commit/e11... | <p><strong><code>git checkout --recurse-submodules</code> was added to git 2.13</strong></p> <p>This is mentioned on the release notes at: <a href="https://github.com/git/git/commit/e1104a5ee539408b81566066aaa6963cb87d5cd6#diff-c24776ff22455a30fbb78e378b7df0b0R139" rel="noreferrer">https://github.com/git/git/commit/e11... | 119, 41612 | git, git-submodules | <h1>Why is git submodule not updated automatically on git checkout?</h1>
<p>When switching branches with git checkout I would assume that most of the time you would want to update your submodules.</p>
<ul>
<li>In what situation do you <strong>not</strong> want to update submodules after switching?</li>
<li>What would ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,082 | git | # Why is git submodule not updated automatically on git checkout?
When switching branches with git checkout I would assume that most of the time you would want to update your submodules.
- In what situation do you **not** want to update submodules after switching?
- What would break if this was done automatically by ... | **`git checkout --recurse-submodules` was added to git 2.13**
This is mentioned on the release notes at: <https://github.com/git/git/commit/e1104a5ee539408b81566066aaa6963cb87d5cd6#diff-c24776ff22455a30fbb78e378b7df0b0R139>
**`submodule.recurse` option was added to git 2.14**
Set as:
```
git config --global submodu... |
19222708 | How to list only newly added files between two branches | 58 | 2013-10-07 10:40:52 | <p>How can I list newly created (added) files between two branches? I can list all files that have been changed with:</p>
<pre><code>git diff --color --name-only branch1..branch2
</code></pre>
<p>But that also contains files, that just changed their content, not necessarily new files. Is there some Git command for this... | 19,464 | 958,766 | 2023-01-10 08:21:10 | 19,222,748 | 57 | 2013-10-07 10:43:08 | 1,870,481 | 2016-07-08 18:57:01 | https://stackoverflow.com/q/19222708 | https://stackoverflow.com/a/19222748 | <p>Just replace <code>--name-only</code> with <code>--name-status</code>. This way git will show if the file is added, deleted or just modified.</p>
<p>If you are only interested in the new (=added) files you can simply grep for <code>^A</code>:</p>
<pre><code>git diff --name-status branch1..branch2 | grep ^A
</code>... | <p>Just replace <code>--name-only</code> with <code>--name-status</code>. This way git will show if the file is added, deleted or just modified.</p> <p>If you are only interested in the new (=added) files you can simply grep for <code>^A</code>:</p> <pre><code>git diff --name-status branch1..branch2 | grep ^A </code>... | 119, 9033 | git, git-diff | <h1>How to list only newly added files between two branches</h1>
<p>How can I list newly created (added) files between two branches? I can list all files that have been changed with:</p>
<pre><code>git diff --color --name-only branch1..branch2
</code></pre>
<p>But that also contains files, that just changed their conte... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,086 | git | # How to list only newly added files between two branches
How can I list newly created (added) files between two branches? I can list all files that have been changed with:
```
git diff --color --name-only branch1..branch2
```
But that also contains files, that just changed their content, not necessarily new files. ... | Just replace `--name-only` with `--name-status`. This way git will show if the file is added, deleted or just modified.
If you are only interested in the new (=added) files you can simply grep for `^A`:
```
git diff --name-status branch1..branch2 | grep ^A
``` |
66538106 | Git rebase in Visual Studio | 56 | 2021-03-08 22:22:49 | <p>I suppose I'm getting confused about the wording within the Visual Studio 2019 Git Rebase UI. Silly question.</p>
<p>Scenario: I'm working in a branch called <code>COREv2.0</code> . Bug fixes and other such things have been committed to <code>master</code>. <code>COREv2.0</code> is still a work in progress, but I... | 65,632 | 1,368,050 | 2024-10-13 13:07:06 | 66,538,576 | 57 | 2021-03-08 23:14:08 | 717,372 | 2024-10-13 13:07:06 | https://stackoverflow.com/q/66538106 | https://stackoverflow.com/a/66538576 | <blockquote>
<p>In Visual Studio, do I need to rebase FROM the current branch (<code>COREv2.0</code>) ONTO <code>master</code>?</p>
</blockquote>
<p>Yes.</p>
<p>One of the first rule of Git is that you can only change the branch you have checked out i.e. the "current branch".</p>
<p>(Side note: The reason is ... | <blockquote> <p>In Visual Studio, do I need to rebase FROM the current branch (<code>COREv2.0</code>) ONTO <code>master</code>?</p> </blockquote> <p>Yes.</p> <p>One of the first rule of Git is that you can only change the branch you have checked out i.e. the "current branch".</p> <p>(Side note: The reason is ... | 119, 8974, 33953 | git, rebase, visual-studio | <h1>Git rebase in Visual Studio</h1>
<p>I suppose I'm getting confused about the wording within the Visual Studio 2019 Git Rebase UI. Silly question.</p>
<p>Scenario: I'm working in a branch called <code>COREv2.0</code> . Bug fixes and other such things have been committed to <code>master</code>. <code>COREv2.0</cod... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,087 | git | # Git rebase in Visual Studio
I suppose I'm getting confused about the wording within the Visual Studio 2019 Git Rebase UI. Silly question.
Scenario: I'm working in a branch called `COREv2.0` . Bug fixes and other such things have been committed to `master`. `COREv2.0` is still a work in progress, but I want to pull ... | > In Visual Studio, do I need to rebase FROM the current branch (`COREv2.0`) ONTO `master`?
Yes.
One of the first rule of Git is that you can only change the branch you have checked out i.e. the "current branch".
(Side note: The reason is because a lot of git actions could end up with conflicts to solve by the user ... |
14507510 | Git: move a commit "on top" | 53 | 2013-01-24 17:47:03 | <p>Let's say in <code>master</code> I have a feature disabled.
I work on that feature on branch <code>feature</code>, so I have a special commit <code>$</code> there that just enables that feature.
Now I want to merge the changes I did in <code>feature</code> into <code>master</code>, but keep the enabling commit out. ... | 56,621 | 111,160 | 2013-01-24 17:53:00 | 14,507,590 | 57 | 2013-01-24 17:51:44 | 116,908 | 2013-01-24 17:51:44 | https://stackoverflow.com/q/14507510 | https://stackoverflow.com/a/14507590 | <p><code>git rebase -i B</code>, and then move <code>$</code> to the end of the list that shows up in your editor. It will start out as the first line in the file that opens. You could also just delete that line entirely, which will just drop that commit out of your branch's history.</p>
| <p><code>git rebase -i B</code>, and then move <code>$</code> to the end of the list that shows up in your editor. It will start out as the first line in the file that opens. You could also just delete that line entirely, which will just drop that commit out of your branch's history.</p> | 119, 1879, 29934 | branch, git, git-rebase | <h1>Git: move a commit "on top"</h1>
<p>Let's say in <code>master</code> I have a feature disabled.
I work on that feature on branch <code>feature</code>, so I have a special commit <code>$</code> there that just enables that feature.
Now I want to merge the changes I did in <code>feature</code> into <code>master</code... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,089 | git | # Git: move a commit "on top"
Let's say in `master` I have a feature disabled.
I work on that feature on branch `feature`, so I have a special commit `$` there that just enables that feature.
Now I want to merge the changes I did in `feature` into `master`, but keep the enabling commit out. So it's like
```
main: ... | `git rebase -i B`, and then move `$` to the end of the list that shows up in your editor. It will start out as the first line in the file that opens. You could also just delete that line entirely, which will just drop that commit out of your branch's history. |
392332 | Retroactively Correct Authors with Git SVN? | 51 | 2008-12-24 23:22:03 | <p>I have a repository which I have <em>already</em> cloned from Subversion. I've been doing some work in this repository in its Git form and I would hate to lose that structure by cloning again.</p>
<p>However, when I originally cloned the repository, I failed to correctly specify the <code>svn.authors</code> proper... | 10,456 | 9,815 | 2019-04-10 08:45:52 | 392,427 | 57 | 2008-12-25 01:52:40 | 39,975 | 2009-02-19 19:08:02 | https://stackoverflow.com/q/392332 | https://stackoverflow.com/a/392427 | <p>Start out by seeing what you've got to clean up:</p>
<pre><code>git shortlog -s
</code></pre>
<p>For each one of those names, create an entry in a script that looks like this (assuming you want all the authors and committers to be the same):</p>
<pre><code>#!/bin/sh
git filter-branch --env-filter '
n=$GIT_AUTHO... | <p>Start out by seeing what you've got to clean up:</p> <pre><code>git shortlog -s </code></pre> <p>For each one of those names, create an entry in a script that looks like this (assuming you want all the authors and committers to be the same):</p> <pre><code>#!/bin/sh git filter-branch --env-filter ' n=$GIT_AUTHO... | 63, 119, 6452 | git, git-svn, svn | <h1>Retroactively Correct Authors with Git SVN?</h1>
<p>I have a repository which I have <em>already</em> cloned from Subversion. I've been doing some work in this repository in its Git form and I would hate to lose that structure by cloning again.</p>
<p>However, when I originally cloned the repository, I failed to ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,090 | git | # Retroactively Correct Authors with Git SVN?
I have a repository which I have *already* cloned from Subversion. I've been doing some work in this repository in its Git form and I would hate to lose that structure by cloning again.
However, when I originally cloned the repository, I failed to correctly specify the `s... | Start out by seeing what you've got to clean up:
```
git shortlog -s
```
For each one of those names, create an entry in a script that looks like this (assuming you want all the authors and committers to be the same):
```
#!/bin/sh
git filter-branch --env-filter '
n=$GIT_AUTHOR_NAME
m=$GIT_AUTHOR_EMAIL
case ${GIT... |
1389307 | Convert a Mercurial Repository to Git | 49 | 2009-09-07 12:55:31 | <p>I've already tried hg2git through fast-export and I've already tried hg-git.</p>
<p>Both with no success. hg2git actually worked, but I had to ask a friend who runs a Unix machine to do it. And that messed up all the linefeeds throughout the files. </p>
<p>hg-git simply failed with some libzip compression error. <... | 22,738 | 21,699 | 2021-11-21 06:40:30 | 6,917,665 | 57 | 2011-08-02 19:44:11 | 704,703 | 2013-10-06 01:32:32 | https://stackoverflow.com/q/1389307 | https://stackoverflow.com/a/6917665 | <p>Did the following on my Mac to successfully export a Mercurial repo to Git (with full branches):</p>
<pre><code>mkdir myrepo; cd myrepo;
git clone git://repo.or.cz/fast-export.git .
rm -rf .git .gitignore
git init
./hg-fast-export.sh -r ../path/to/local/hg/repo
git clean -f # remove fast-export files
</code></pre>
| <p>Did the following on my Mac to successfully export a Mercurial repo to Git (with full branches):</p> <pre><code>mkdir myrepo; cd myrepo; git clone git://repo.or.cz/fast-export.git . rm -rf .git .gitignore git init ./hg-fast-export.sh -r ../path/to/local/hg/repo git clean -f # remove fast-export files </code></pre> | 119, 802 | git, mercurial | <h1>Convert a Mercurial Repository to Git</h1>
<p>I've already tried hg2git through fast-export and I've already tried hg-git.</p>
<p>Both with no success. hg2git actually worked, but I had to ask a friend who runs a Unix machine to do it. And that messed up all the linefeeds throughout the files. </p>
<p>hg-git simp... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,091 | git | # Convert a Mercurial Repository to Git
I've already tried hg2git through fast-export and I've already tried hg-git.
Both with no success. hg2git actually worked, but I had to ask a friend who runs a Unix machine to do it. And that messed up all the linefeeds throughout the files.
hg-git simply failed with some libz... | Did the following on my Mac to successfully export a Mercurial repo to Git (with full branches):
```
mkdir myrepo; cd myrepo;
git clone git://repo.or.cz/fast-export.git .
rm -rf .git .gitignore
git init
./hg-fast-export.sh -r ../path/to/local/hg/repo
git clean -f # remove fast-export files
``` |
7908597 | Merging one change to multiple branches in Git | 43 | 2011-10-26 20:35:01 | <p>I am used to having one main branch (master) and working in topic branches. But I'm working on a project now with two main branches (master and experimental) and I am unsure how to best merge my topic branch into both?</p>
<p>Is this the right way to do it? If not can someone let me know the right way.</p>
<pre><c... | 34,449 | 1,015,384 | 2011-10-26 20:37:52 | 7,908,629 | 57 | 2011-10-26 20:37:52 | 112,968 | 2011-10-26 20:37:52 | https://stackoverflow.com/q/7908597 | https://stackoverflow.com/a/7908629 | <p>Don't do the rebase and you're set. Simply merge your <code>bugfix</code> branch into each branch you need it</p>
<pre><code>(master)$ git checkout -b bugfix
# do bug fix here
(bugfix)$ git commit -a -m 'Fixed bug.'
(bugfix)$ git checkout master
(master)$ git merge bugfix
(bugfix)$ git checkout experimental
(exper... | <p>Don't do the rebase and you're set. Simply merge your <code>bugfix</code> branch into each branch you need it</p> <pre><code>(master)$ git checkout -b bugfix # do bug fix here (bugfix)$ git commit -a -m 'Fixed bug.' (bugfix)$ git checkout master (master)$ git merge bugfix (bugfix)$ git checkout experimental (exper... | 119, 456, 53847, 76220 | branching-and-merging, git, git-branch, version-control | <h1>Merging one change to multiple branches in Git</h1>
<p>I am used to having one main branch (master) and working in topic branches. But I'm working on a project now with two main branches (master and experimental) and I am unsure how to best merge my topic branch into both?</p>
<p>Is this the right way to do it? If... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,094 | git | # Merging one change to multiple branches in Git
I am used to having one main branch (master) and working in topic branches. But I'm working on a project now with two main branches (master and experimental) and I am unsure how to best merge my topic branch into both?
Is this the right way to do it? If not can someone... | Don't do the rebase and you're set. Simply merge your `bugfix` branch into each branch you need it
```
(master)$ git checkout -b bugfix
# do bug fix here
(bugfix)$ git commit -a -m 'Fixed bug.'
(bugfix)$ git checkout master
(master)$ git merge bugfix
(bugfix)$ git checkout experimental
(experimental)$ git merge bugfi... |
38001223 | What is the difference between git rm --cached and git reset <file>? | 41 | 2016-06-23 20:27:48 | <p>According to the <a href="https://git-scm.com/docs/git-rm/" rel="noreferrer" title="git rm documentation">git rm documentation</a>, </p>
<pre><code>--cached
Use this option to unstage and remove paths only from the index.
Working tree files, whether modified or not, will be left alone.
</code></pre>
<p>But acc... | 113,693 | 1,887,370 | 2024-03-13 16:14:10 | 38,001,958 | 57 | 2016-06-23 21:12:12 | 974,186 | 2024-03-13 16:14:10 | https://stackoverflow.com/q/38001223 | https://stackoverflow.com/a/38001958 | <p>With <code>git rm --cached</code> you stage a file for removal, but you don't remove it from the working dir. The file will then be shown as untracked.</p>
<p>Take a test drive</p>
<pre><code>git init test_repo
cd test_repo
touch test
git add test
git commit -m 'Added file test'
git rm --cached test
git status
Ch... | <p>With <code>git rm --cached</code> you stage a file for removal, but you don't remove it from the working dir. The file will then be shown as untracked.</p> <p>Take a test drive</p> <pre><code>git init test_repo cd test_repo touch test git add test git commit -m 'Added file test' git rm --cached test git status Ch... | 119 | git | <h1>What is the difference between git rm --cached and git reset <file>?</h1>
<p>According to the <a href="https://git-scm.com/docs/git-rm/" rel="noreferrer" title="git rm documentation">git rm documentation</a>, </p>
<pre><code>--cached
Use this option to unstage and remove paths only from the index.
Working tree... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,095 | git | # What is the difference between git rm --cached and git reset ?
According to the [git rm documentation](https://git-scm.com/docs/git-rm/ "git rm documentation"),
```
--cached
Use this option to unstage and remove paths only from the index.
Working tree files, whether modified or not, will be left alone.
```
But... | With `git rm --cached` you stage a file for removal, but you don't remove it from the working dir. The file will then be shown as untracked.
Take a test drive
```
git init test_repo
cd test_repo
touch test
git add test
git commit -m 'Added file test'
git rm --cached test
git status
Changes to be committed:
(use ... |
14736453 | git: List just the files modified for all stashes | 40 | 2013-02-06 18:45:22 | <p>According to the <a href="http://www.kernel.org/pub/software/scm/git/docs/git-stash.html#_options" rel="noreferrer">git docs</a>, <code>git stash list</code> will accept any of the options that you could pass to <code>git log</code>.</p>
<p>What I want to do is to pass the <code>--stat</code> option to <code>git st... | 26,149 | 905,036 | 2019-12-31 10:13:16 | 25,656,397 | 57 | 2014-09-04 02:25:47 | 1,036,728 | 2019-02-04 06:42:01 | https://stackoverflow.com/q/14736453 | https://stackoverflow.com/a/25656397 | <p><strong>Update for Git v2.2 onwards:</strong></p>
<p><code>git stash list --stat</code> works.</p>
<p><a href="https://github.com/git/git/blob/master/Documentation/RelNotes/2.2.0.txt#L29-L32" rel="noreferrer">Things have changed</a> since the question was asked and OP's dilemma no longer applies. From Git v2.2 on... | <p><strong>Update for Git v2.2 onwards:</strong></p> <p><code>git stash list --stat</code> works.</p> <p><a href="https://github.com/git/git/blob/master/Documentation/RelNotes/2.2.0.txt#L29-L32" rel="noreferrer">Things have changed</a> since the question was asked and OP's dilemma no longer applies. From Git v2.2 on... | 119 | git | <h1>git: List just the files modified for all stashes</h1>
<p>According to the <a href="http://www.kernel.org/pub/software/scm/git/docs/git-stash.html#_options" rel="noreferrer">git docs</a>, <code>git stash list</code> will accept any of the options that you could pass to <code>git log</code>.</p>
<p>What I want to d... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,096 | git | # git: List just the files modified for all stashes
According to the [git docs](http://www.kernel.org/pub/software/scm/git/docs/git-stash.html#_options), `git stash list` will accept any of the options that you could pass to `git log`.
What I want to do is to pass the `--stat` option to `git stash list`. This works, ... | **Update for Git v2.2 onwards:**
`git stash list --stat` works.
[Things have changed](https://github.com/git/git/blob/master/Documentation/RelNotes/2.2.0.txt#L29-L32) since the question was asked and OP's dilemma no longer applies. From Git v2.2 onwards, you *can* simply pass `--stat` to `git stash list` and it will ... |
43765914 | What's the difference between .npmignore and .gitignore? | 39 | 2017-05-03 16:54:10 | <p>What's the difference between <code>.npmignore</code> and <code>.gitignore</code>? What kind of files should I ignore in each?</p>
| 22,755 | 1,751,946 | 2023-05-24 02:19:02 | 43,766,015 | 57 | 2017-05-03 16:59:48 | 2,980,607 | 2023-05-24 02:19:02 | https://stackoverflow.com/q/43765914 | https://stackoverflow.com/a/43766015 | <p><code>.gitignore</code> lists which files & folders should be omitted from any commits to the repository. You can use <a href="https://github.com/github/gitignore" rel="noreferrer">this repo</a> for templates of files/folders to in your <code>.gitignore</code> depending on your environment.</p>
<p><code>.npmigno... | <p><code>.gitignore</code> lists which files & folders should be omitted from any commits to the repository. You can use <a href="https://github.com/github/gitignore" rel="noreferrer">this repo</a> for templates of files/folders to in your <code>.gitignore</code> depending on your environment.</p> <p><code>.npmigno... | 119, 25056, 61387, 112853 | git, gitignore, npm, npmignore | <h1>What's the difference between .npmignore and .gitignore?</h1>
<p>What's the difference between <code>.npmignore</code> and <code>.gitignore</code>? What kind of files should I ignore in each?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,097 | git | # What's the difference between .npmignore and .gitignore?
What's the difference between `.npmignore` and `.gitignore`? What kind of files should I ignore in each? | `.gitignore` lists which files & folders should be omitted from any commits to the repository. You can use [this repo](https://github.com/github/gitignore) for templates of files/folders to in your `.gitignore` depending on your environment.
`.npmignore` works similarly to `.gitignore`, it is used to specify which fil... |
26384166 | What is the difference between merging master into branch and merging branch into master? | 39 | 2014-10-15 13:44:06 | <p>I have a branch called <code>master</code> and another called <code>dev</code>. Usually, I do tests and improvements on <code>dev</code>; when done, I merge it into <code>master</code>, tag it, and release new version of the application. </p>
<p>Now, I face a decision to make in regard to merging:</p>
<ol>
<li>mer... | 16,684 | 3,062,311 | 2025-02-08 13:21:10 | 26,384,695 | 57 | 2014-10-15 14:10:12 | 2,541,573 | 2018-02-02 22:44:11 | https://stackoverflow.com/q/26384166 | https://stackoverflow.com/a/26384695 | <h1>TL;DR</h1>
<p>The main difference lies in where the <code>master</code> and <code>dev</code> branches end up pointing.
<img src="https://i.sstatic.net/jzI8N.png" alt="enter image description here"></p>
<h1>Full explanation</h1>
<p>Merging one branch into another is not a symmetric operation:</p>
<ul>
<li>mergin... | <h1>TL;DR</h1> <p>The main difference lies in where the <code>master</code> and <code>dev</code> branches end up pointing. <img src="https://i.sstatic.net/jzI8N.png" alt="enter image description here"></p> <h1>Full explanation</h1> <p>Merging one branch into another is not a symmetric operation:</p> <ul> <li>mergin... | 119, 717 | git, merge | <h1>What is the difference between merging master into branch and merging branch into master?</h1>
<p>I have a branch called <code>master</code> and another called <code>dev</code>. Usually, I do tests and improvements on <code>dev</code>; when done, I merge it into <code>master</code>, tag it, and release new version ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,098 | git | # What is the difference between merging master into branch and merging branch into master?
I have a branch called `master` and another called `dev`. Usually, I do tests and improvements on `dev`; when done, I merge it into `master`, tag it, and release new version of the application.
Now, I face a decision to make i... | # TL;DR
The main difference lies in where the `master` and `dev` branches end up pointing.

# Full explanation
Merging one branch into another is not a symmetric operation:
- merging `dev` into `master`, and
- merging `master` into `dev`,
are, in gene... |
24502669 | How to find out if letter is Alphanumeric or Digit in Swift | 39 | 2014-07-01 04:51:32 | <p>I want to count the number of letters, digits and special characters in the following string:</p>
<pre><code>let phrase = "The final score was 32-31!"
</code></pre>
<p>I tried:</p>
<pre><code>for tempChar in phrase {
if (tempChar >= "a" && tempChar <= "z") {
letterCounter++
}
// etc.
... | 44,073 | 1,010,171 | 2021-04-20 18:55:24 | 24,502,779 | 57 | 2014-07-01 05:04:25 | 1,187,415 | 2020-10-29 10:35:30 | https://stackoverflow.com/q/24502669 | https://stackoverflow.com/a/24502779 | <p>For <strong>Swift 5</strong> see <a href="https://stackoverflow.com/a/57824574/1187415">rustylepord's answer</a>.</p>
<p><strong>Update for Swift 3:</strong></p>
<pre><code>let letters = CharacterSet.letters
let digits = CharacterSet.decimalDigits
var letterCount = 0
var digitCount = 0
for uni in phrase.unicodeSca... | <p>For <strong>Swift 5</strong> see <a href="https://stackoverflow.com/a/57824574/1187415">rustylepord's answer</a>.</p> <p><strong>Update for Swift 3:</strong></p> <pre><code>let letters = CharacterSet.letters let digits = CharacterSet.decimalDigits var letterCount = 0 var digitCount = 0 for uni in phrase.unicodeSca... | 588, 6067, 9914, 104797 | character, comparison, digits, swift | <h1>How to find out if letter is Alphanumeric or Digit in Swift</h1>
<p>I want to count the number of letters, digits and special characters in the following string:</p>
<pre><code>let phrase = "The final score was 32-31!"
</code></pre>
<p>I tried:</p>
<pre><code>for tempChar in phrase {
if (tempChar >= "a" &... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,099 | git | # How to find out if letter is Alphanumeric or Digit in Swift
I want to count the number of letters, digits and special characters in the following string:
```
let phrase = "The final score was 32-31!"
```
I tried:
```
for tempChar in phrase {
if (tempChar >= "a" && tempChar <= "z") {
letterCounter++
... | For **Swift 5** see [rustylepord's answer](https://stackoverflow.com/a/57824574/1187415).
**Update for Swift 3:**
```
let letters = CharacterSet.letters
let digits = CharacterSet.decimalDigits
var letterCount = 0
var digitCount = 0
for uni in phrase.unicodeScalars {
if letters.contains(uni) {
letterCoun... |
13751319 | git - push current vs. push upstream (tracking) | 38 | 2012-12-06 19:46:49 | <p>I have read the git man about push command, but I still don't understand the EXACT difference between <em>current</em> and <em>upstream</em> to be set in the <strong>push.default</strong></p>
<p>I want that our team will just do push, and only changes on the branch that they are currently working on, will be pushed... | 39,517 | 1,130,872 | 2019-12-04 17:03:57 | 13,751,847 | 57 | 2012-12-06 20:20:19 | 6,309 | 2015-04-01 13:38:17 | https://stackoverflow.com/q/13751319 | https://stackoverflow.com/a/13751847 | <p>The question is <em>what</em> are you pushing, and <em>to where</em>:</p>
<ul>
<li><p><strong><code>current</code></strong>: </p>
<ul>
<li>"<strong>what</strong>" is only your current branch (no other branches),</li>
<li>"<strong>to where</strong>" is a branch of the same name (created if it doesn't exist) in the ... | <p>The question is <em>what</em> are you pushing, and <em>to where</em>:</p> <ul> <li><p><strong><code>current</code></strong>: </p> <ul> <li>"<strong>what</strong>" is only your current branch (no other branches),</li> <li>"<strong>to where</strong>" is a branch of the same name (created if it doesn't exist) in the ... | 119 | git | <h1>git - push current vs. push upstream (tracking)</h1>
<p>I have read the git man about push command, but I still don't understand the EXACT difference between <em>current</em> and <em>upstream</em> to be set in the <strong>push.default</strong></p>
<p>I want that our team will just do push, and only changes on the ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,100 | git | # git - push current vs. push upstream (tracking)
I have read the git man about push command, but I still don't understand the EXACT difference between *current* and *upstream* to be set in the **push.default**
I want that our team will just do push, and only changes on the branch that they are currently working on, ... | The question is *what* are you pushing, and *to where*:
- **`current`**:
- "**what**" is only your current branch (no other branches),
- "**to where**" is a branch of the same name (created if it doesn't exist) in the **[upstream repo](https://stackoverflow.com/questions/2739376/definition-of-downstream-and-upstr... |
615816 | Git : How to get a snapshot of a git repository | 38 | 2009-03-05 17:46:26 | <p>I'm looking for the right way to get an archive of a git repository without the .git/ directory in order to send a daily snapshot to testers.</p>
| 26,572 | 61,838 | 2011-05-27 11:50:42 | 615,828 | 57 | 2009-03-05 17:50:04 | 4,590 | 2009-03-05 17:50:04 | https://stackoverflow.com/q/615816 | https://stackoverflow.com/a/615828 | <pre><code>git archive HEAD --format=zip > archive.zip
</code></pre>
<p>This does what it says on the tin.</p>
<p>More info here: <a href="http://gitready.com/intermediate/2009/01/29/exporting-your-repository.html" rel="noreferrer">http://gitready.com/intermediate/2009/01/29/exporting-your-repository.html</a></p>
| <pre><code>git archive HEAD --format=zip > archive.zip </code></pre> <p>This does what it says on the tin.</p> <p>More info here: <a href="http://gitready.com/intermediate/2009/01/29/exporting-your-repository.html" rel="noreferrer">http://gitready.com/intermediate/2009/01/29/exporting-your-repository.html</a></p> | 119, 5951, 9655 | archive, git, snapshot | <h1>Git : How to get a snapshot of a git repository</h1>
<p>I'm looking for the right way to get an archive of a git repository without the .git/ directory in order to send a daily snapshot to testers.</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,102 | git | # Git : How to get a snapshot of a git repository
I'm looking for the right way to get an archive of a git repository without the .git/ directory in order to send a daily snapshot to testers. | ```
git archive HEAD --format=zip > archive.zip
```
This does what it says on the tin.
More info here: <http://gitready.com/intermediate/2009/01/29/exporting-your-repository.html> |
39026156 | How to git stash only untracked files? | 37 | 2016-08-18 19:31:16 | <p>I want to only stash all untracked files. I know it can be done with two commands, by first stashing tracked changes and then untracked, but can it be done with one line command?</p>
| 18,513 | 2,190,425 | 2022-06-13 11:24:08 | 39,026,300 | 57 | 2016-08-18 19:40:55 | 3,239,417 | 2016-08-24 18:00:02 | https://stackoverflow.com/q/39026156 | https://stackoverflow.com/a/39026300 | <p>You can do it with alias in <a href="https://git-scm.com/book/en/v2/Git-Basics-Git-Aliases" rel="noreferrer"><code>~/.gitconfig</code></a>:</p>
<pre class="lang-sh prettyprint-override"><code>stash-untracked = "!f() { \
git stash; \
git stash -u; \
git stash pop stash@{1}; \
... | <p>You can do it with alias in <a href="https://git-scm.com/book/en/v2/Git-Basics-Git-Aliases" rel="noreferrer"><code>~/.gitconfig</code></a>:</p> <pre class="lang-sh prettyprint-override"><code>stash-untracked = "!f() { \ git stash; \ git stash -u; \ git stash pop stash@{1}; \ ... | 119 | git | <h1>How to git stash only untracked files?</h1>
<p>I want to only stash all untracked files. I know it can be done with two commands, by first stashing tracked changes and then untracked, but can it be done with one line command?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,103 | git | # How to git stash only untracked files?
I want to only stash all untracked files. I know it can be done with two commands, by first stashing tracked changes and then untracked, but can it be done with one line command? | You can do it with alias in [`~/.gitconfig`](https://git-scm.com/book/en/v2/Git-Basics-Git-Aliases):
```
stash-untracked = "!f() { \
git stash; \
git stash -u; \
git stash pop stash@{1}; \
}; f"
```
And then just do
```
git stash-untracked
``` |
52108832 | What is the difference between 'git pull' and 'git pull origin master'? | 36 | 2018-08-31 05:14:45 | <p>What is the difference between <code>git pull</code> and <code>git pull origin master</code>?</p>
<p>What if I am on a branch other than <code>master</code>, will the two commands achieve a different result?</p>
| 73,708 | 7,381,859 | 2019-02-07 10:56:09 | 52,108,897 | 57 | 2018-08-31 05:23:09 | 10,034,173 | 2018-08-31 05:23:09 | https://stackoverflow.com/q/52108832 | https://stackoverflow.com/a/52108897 | <p>Remember, a pull is a fetch and a merge.</p>
<ul>
<li><p><strong><em>git pull origin master</em></strong> fetches commits from the master branch of the origin remote (into the local origin/master branch), and then it merges origin/master into the branch you currently have checked out.</p></li>
<li><p><strong><em>gi... | <p>Remember, a pull is a fetch and a merge.</p> <ul> <li><p><strong><em>git pull origin master</em></strong> fetches commits from the master branch of the origin remote (into the local origin/master branch), and then it merges origin/master into the branch you currently have checked out.</p></li> <li><p><strong><em>gi... | 119 | git | <h1>What is the difference between 'git pull' and 'git pull origin master'?</h1>
<p>What is the difference between <code>git pull</code> and <code>git pull origin master</code>?</p>
<p>What if I am on a branch other than <code>master</code>, will the two commands achieve a different result?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,104 | git | # What is the difference between 'git pull' and 'git pull origin master'?
What is the difference between `git pull` and `git pull origin master`?
What if I am on a branch other than `master`, will the two commands achieve a different result? | Remember, a pull is a fetch and a merge.
- ***git pull origin master*** fetches commits from the master branch of the origin remote (into the local origin/master branch), and then it merges origin/master into the branch you currently have checked out.
- ***git pull*** only works if the branch you have checked out is t... |
10451330 | Clean git repo on Heroku | 36 | 2012-05-04 14:59:45 | <p>The situation is as follows:</p>
<p>We have some project which persists on Github, and deploy it to Heroku, which has its own mini-Git. Some changes were applied directly to Heroku (cloned repository from Heroku, made changes and pushed). In a meanwhile the master branch on Github has gained also some changes.</p>
... | 63,201 | 999,355 | 2018-02-17 10:32:58 | 10,452,926 | 57 | 2012-05-04 16:46:32 | 247,451 | 2012-05-04 16:46:32 | https://stackoverflow.com/q/10451330 | https://stackoverflow.com/a/10452926 | <p>You can just use the <code>-f</code> flag in git (it's a standard git flag) to force the push. See the side note in the Dev Center <a href="https://devcenter.heroku.com/articles/git" rel="noreferrer">Git</a> doc. This will overwrite those changes you've made on Heroku obviously.</p>
| <p>You can just use the <code>-f</code> flag in git (it's a standard git flag) to force the push. See the side note in the Dev Center <a href="https://devcenter.heroku.com/articles/git" rel="noreferrer">Git</a> doc. This will overwrite those changes you've made on Heroku obviously.</p> | 119, 7330, 8279, 12626 | git, heroku, repository, reset | <h1>Clean git repo on Heroku</h1>
<p>The situation is as follows:</p>
<p>We have some project which persists on Github, and deploy it to Heroku, which has its own mini-Git. Some changes were applied directly to Heroku (cloned repository from Heroku, made changes and pushed). In a meanwhile the master branch on Github ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,105 | git | # Clean git repo on Heroku
The situation is as follows:
We have some project which persists on Github, and deploy it to Heroku, which has its own mini-Git. Some changes were applied directly to Heroku (cloned repository from Heroku, made changes and pushed). In a meanwhile the master branch on Github has gained also ... | You can just use the `-f` flag in git (it's a standard git flag) to force the push. See the side note in the Dev Center [Git](https://devcenter.heroku.com/articles/git) doc. This will overwrite those changes you've made on Heroku obviously. |
9429922 | git svn cherry pick ignored warning | 36 | 2012-02-24 11:23:43 | <p>When I run <code>git svn fetch</code> it sometimes prints following warning:</p>
<pre><code>W:svn cherry-pick ignored (/path/in/svn:<svn revision number list>) missing 55 commit(s) (eg 9129b28e5397c41f0a527818edd344bf264359af)
</code></pre>
<p>What this warning is about?</p>
| 5,188 | 471,149 | 2012-06-01 11:23:18 | 9,437,882 | 57 | 2012-02-24 20:54:19 | 220,155 | 2012-06-01 11:23:18 | https://stackoverflow.com/q/9429922 | https://stackoverflow.com/a/9437882 | <p>When someone does a "cherry-pick merge" with Subversion, Subversion records the commit that was merged in the metadata for the files and folders involved.</p>
<p>When you do a <code>git svn fetch</code>, Git sees that merge metadata, and tries to interpret it as a merge between the Git remote branches. All this mes... | <p>When someone does a "cherry-pick merge" with Subversion, Subversion records the commit that was merged in the metadata for the files and folders involved.</p> <p>When you do a <code>git svn fetch</code>, Git sees that merge metadata, and tries to interpret it as a merge between the Git remote branches. All this mes... | 119, 6452 | git, git-svn | <h1>git svn cherry pick ignored warning</h1>
<p>When I run <code>git svn fetch</code> it sometimes prints following warning:</p>
<pre><code>W:svn cherry-pick ignored (/path/in/svn:<svn revision number list>) missing 55 commit(s) (eg 9129b28e5397c41f0a527818edd344bf264359af)
</code></pre>
<p>What this warning is... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,106 | git | # git svn cherry pick ignored warning
When I run `git svn fetch` it sometimes prints following warning:
```
W:svn cherry-pick ignored (/path/in/svn:<svn revision number list>) missing 55 commit(s) (eg 9129b28e5397c41f0a527818edd344bf264359af)
```
What this warning is about? | When someone does a "cherry-pick merge" with Subversion, Subversion records the commit that was merged in the metadata for the files and folders involved.
When you do a `git svn fetch`, Git sees that merge metadata, and tries to interpret it as a merge between the Git remote branches. All this message means is that Gi... |
28028740 | Git tab completion in zsh throwing errors | 31 | 2015-01-19 16:01:57 | <p>After struggling to get tab completion for git setup on osx, I've gotten some odd errors that I can't find the source too. </p>
<pre><code>zsh:12: command not found: ___main
_default:compcall:12: can only be called from completion function
</code></pre>
<p>I'm not sure what is causing the error as everything is se... | 16,709 | 2,055,617 | 2023-07-23 11:51:02 | 28,035,917 | 57 | 2015-01-20 00:32:15 | 4,387,039 | 2015-01-20 00:32:15 | https://stackoverflow.com/q/28028740 | https://stackoverflow.com/a/28035917 | <p>It seems that the <code>git-completion.zsh</code> is <strong>not</strong> designed to be <code>source</code>ed. You could copy the <code>git-completion.zsh</code> file to somewhere in the <code>$fpath</code> and rename it to <code>_git</code> instead.</p>
<p>For example: (if you decide to have <code>~/.zsh/function... | <p>It seems that the <code>git-completion.zsh</code> is <strong>not</strong> designed to be <code>source</code>ed. You could copy the <code>git-completion.zsh</code> file to somewhere in the <code>$fpath</code> and rename it to <code>_git</code> instead.</p> <p>For example: (if you decide to have <code>~/.zsh/function... | 119, 3791 | git, zsh | <h1>Git tab completion in zsh throwing errors</h1>
<p>After struggling to get tab completion for git setup on osx, I've gotten some odd errors that I can't find the source too. </p>
<pre><code>zsh:12: command not found: ___main
_default:compcall:12: can only be called from completion function
</code></pre>
<p>I'm not... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,108 | git | # Git tab completion in zsh throwing errors
After struggling to get tab completion for git setup on osx, I've gotten some odd errors that I can't find the source too.
```
zsh:12: command not found: ___main
_default:compcall:12: can only be called from completion function
```
I'm not sure what is causing the error as... | It seems that the `git-completion.zsh` is **not** designed to be `source`ed. You could copy the `git-completion.zsh` file to somewhere in the `$fpath` and rename it to `_git` instead.
For example: (if you decide to have `~/.zsh/functions/_git`.)
First, you could copy the `git-completion.zsh` to there and rename it to... |
16770282 | How to gitignore *only* files? | 27 | 2013-05-27 09:35:28 | <p>I'm surprised that simple patterns like *.user in a .gitignore file seem to match files <strong>and</strong> folder names. </p>
<pre><code>ringods$ mkdir TestIgnore
ringods$ cd TestIgnore/
ringods$ git init
Initialized empty Git repository in /Users/ringods/Projects/hostbasket/TestIgnore/.git/
ringods$ git status
#... | 9,641 | 2,028,560 | 2013-05-27 09:46:41 | 16,770,464 | 57 | 2013-05-27 09:46:41 | 19,563 | 2013-05-27 09:46:41 | https://stackoverflow.com/q/16770282 | https://stackoverflow.com/a/16770464 | <p><code>.gitignore</code> patterns just match directory entries or paths. There's no specific way to say "only match a regular file", however if you supply a trailing <code>/</code> then the pattern will only match a directory. You can use this to match non-directories (which is almost what you want) with two patterns... | <p><code>.gitignore</code> patterns just match directory entries or paths. There's no specific way to say "only match a regular file", however if you supply a trailing <code>/</code> then the pattern will only match a directory. You can use this to match non-directories (which is almost what you want) with two patterns... | 119, 25056 | git, gitignore | <h1>How to gitignore *only* files?</h1>
<p>I'm surprised that simple patterns like *.user in a .gitignore file seem to match files <strong>and</strong> folder names. </p>
<pre><code>ringods$ mkdir TestIgnore
ringods$ cd TestIgnore/
ringods$ git init
Initialized empty Git repository in /Users/ringods/Projects/hostbaske... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,112 | git | # How to gitignore *only* files?
I'm surprised that simple patterns like *.user in a .gitignore file seem to match files **and** folder names.
```
ringods$ mkdir TestIgnore
ringods$ cd TestIgnore/
ringods$ git init
Initialized empty Git repository in /Users/ringods/Projects/hostbasket/TestIgnore/.git/
ringods$ git st... | `.gitignore` patterns just match directory entries or paths. There's no specific way to say "only match a regular file", however if you supply a trailing `/` then the pattern will only match a directory. You can use this to match non-directories (which is almost what you want) with two patterns:
```
*.user # ignor... |
6913263 | Is there a way to see all changed files on a branch in Git? | 27 | 2011-08-02 13:59:16 | <p>I apologise if this isn't very clear, but in Git, is there a way to see all changed files on a branch, by name only?</p>
<p>As far as I know, I can use <code>git log</code> to see files that have changed in a single commit, but I want to see all files that have changed since the branch was created, over several comm... | 21,868 | 228,049 | 2021-06-15 06:57:12 | 6,913,546 | 57 | 2011-08-02 14:17:40 | 223,092 | 2011-08-02 14:17:40 | https://stackoverflow.com/q/6913263 | https://stackoverflow.com/a/6913546 | <p>Supposing you're on branch <code>foo</code>, and you're interested in which files have changed since the point when it diverged from <code>master</code>, you can just do:</p>
<pre><code>git diff --name-only master...
</code></pre>
<p>(Note the three dots.) If you're not <code>foo</code>, you can use the full form... | <p>Supposing you're on branch <code>foo</code>, and you're interested in which files have changed since the point when it diverged from <code>master</code>, you can just do:</p> <pre><code>git diff --name-only master... </code></pre> <p>(Note the three dots.) If you're not <code>foo</code>, you can use the full form... | 119 | git | <h1>Is there a way to see all changed files on a branch in Git?</h1>
<p>I apologise if this isn't very clear, but in Git, is there a way to see all changed files on a branch, by name only?</p>
<p>As far as I know, I can use <code>git log</code> to see files that have changed in a single commit, but I want to see all fi... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,113 | git | # Is there a way to see all changed files on a branch in Git?
I apologise if this isn't very clear, but in Git, is there a way to see all changed files on a branch, by name only?
As far as I know, I can use `git log` to see files that have changed in a single commit, but I want to see all files that have changed sinc... | Supposing you're on branch `foo`, and you're interested in which files have changed since the point when it diverged from `master`, you can just do:
```
git diff --name-only master...
```
(Note the three dots.) If you're not `foo`, you can use the full form:
```
git diff --name-only master...foo
```
I made some gra... |
57044187 | git: error: you need to resolve your current index first | 26 | 2019-07-15 16:57:10 | <p>I was trying to merge a branch with my branch, but had merge conflicts.</p>
<p>After seeing the conflicts, I've decided to revert my branch, but am unsure how to do so, as my usual approach of running the following doesnt seem to work to reset my branch</p>
<pre><code>git fetch origin
git reset --hard origin/BRANC... | 49,936 | 26,510 | 2019-07-15 18:31:23 | 57,044,188 | 57 | 2019-07-15 16:57:10 | 26,510 | 2019-07-15 16:57:10 | https://stackoverflow.com/q/57044187 | https://stackoverflow.com/a/57044188 | <p>Found out you can abort your merge using:</p>
<p><code>$ git reset --merge</code></p>
<p>from <a href="https://stackoverflow.com/a/6007083/26510">this similar question/answer</a></p>
| <p>Found out you can abort your merge using:</p> <p><code>$ git reset --merge</code></p> <p>from <a href="https://stackoverflow.com/a/6007083/26510">this similar question/answer</a></p> | 119, 28897 | git, git-merge | <h1>git: error: you need to resolve your current index first</h1>
<p>I was trying to merge a branch with my branch, but had merge conflicts.</p>
<p>After seeing the conflicts, I've decided to revert my branch, but am unsure how to do so, as my usual approach of running the following doesnt seem to work to reset my bra... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,114 | git | # git: error: you need to resolve your current index first
I was trying to merge a branch with my branch, but had merge conflicts.
After seeing the conflicts, I've decided to revert my branch, but am unsure how to do so, as my usual approach of running the following doesnt seem to work to reset my branch
```
git fet... | Found out you can abort your merge using:
`$ git reset --merge`
from [this similar question/answer](https://stackoverflow.com/a/6007083/26510) |
5340790 | Easiest way to replay commits on new git repository | 26 | 2011-03-17 14:56:35 | <p>I've been using git-svn, and recently, I've been getting errors when trying to commit (I think this is due to a bug in libneon, but this is beyond the scope of this question). The solution has been to re-clone my git repository using <code>git svn clone</code>. However, I have changes on the master branch in my old ... | 10,967 | 366,856 | 2011-10-27 08:38:17 | 5,341,526 | 57 | 2011-03-17 15:48:58 | 157,852 | 2011-03-17 16:57:44 | https://stackoverflow.com/q/5340790 | https://stackoverflow.com/a/5341526 | <p>From your new repository, add a remote reference to your old repository:</p>
<pre><code>git remote add temp file:///path/to/old/repo/on/your/machine
</code></pre>
<p>Fetch from the old repo:</p>
<pre><code>git fetch temp
</code></pre>
<p>Check out your master branch from the old repo:</p>
<pre><code>git checkou... | <p>From your new repository, add a remote reference to your old repository:</p> <pre><code>git remote add temp file:///path/to/old/repo/on/your/machine </code></pre> <p>Fetch from the old repo:</p> <pre><code>git fetch temp </code></pre> <p>Check out your master branch from the old repo:</p> <pre><code>git checkou... | 119, 6452 | git, git-svn | <h1>Easiest way to replay commits on new git repository</h1>
<p>I've been using git-svn, and recently, I've been getting errors when trying to commit (I think this is due to a bug in libneon, but this is beyond the scope of this question). The solution has been to re-clone my git repository using <code>git svn clone</c... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,115 | git | # Easiest way to replay commits on new git repository
I've been using git-svn, and recently, I've been getting errors when trying to commit (I think this is due to a bug in libneon, but this is beyond the scope of this question). The solution has been to re-clone my git repository using `git svn clone`. However, I hav... | From your new repository, add a remote reference to your old repository:
```
git remote add temp file:///path/to/old/repo/on/your/machine
```
Fetch from the old repo:
```
git fetch temp
```
Check out your master branch from the old repo:
```
git checkout temp/master -b wip
```
(wip stands for work-in-progress)
R... |
6346221 | What is the reason for "Procfile declares types -> (none)" in Heroku? | 24 | 2011-06-14 15:39:52 | <p>I am trying to deploy a test app to Heroku --stack cedar but every time I do my Procfile is being ignored.</p>
<p>It should be saying this:</p>
<pre><code>Procfile declares types -> web
</code></pre>
<p>But says this</p>
<pre><code>Procfile declares types -> (none)
</code></pre>
<p>Because of this problem... | 21,248 | 499,537 | 2022-06-09 09:46:50 | 7,641,259 | 57 | 2011-10-03 22:10:20 | 414,376 | 2011-10-04 08:55:09 | https://stackoverflow.com/q/6346221 | https://stackoverflow.com/a/7641259 | <p>I had the same problem and I just now I found what was wrong. I first accidently called the file <code>ProcFile</code> instead of <code>Procfile</code>. Simply renaming that file did not get picked up by git. I had to do a <code>git rm ProcFile -f</code> first and then add a new (correctly named) <code>Procfile</cod... | <p>I had the same problem and I just now I found what was wrong. I first accidently called the file <code>ProcFile</code> instead of <code>Procfile</code>. Simply renaming that file did not get picked up by git. I had to do a <code>git rm ProcFile -f</code> first and then add a new (correctly named) <code>Procfile</cod... | 119, 8279 | git, heroku | <h1>What is the reason for "Procfile declares types -> (none)" in Heroku?</h1>
<p>I am trying to deploy a test app to Heroku --stack cedar but every time I do my Procfile is being ignored.</p>
<p>It should be saying this:</p>
<pre><code>Procfile declares types -> web
</code></pre>
<p>But says this</p>
<pre><code... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,116 | git | # What is the reason for "Procfile declares types -> (none)" in Heroku?
I am trying to deploy a test app to Heroku --stack cedar but every time I do my Procfile is being ignored.
It should be saying this:
```
Procfile declares types -> web
```
But says this
```
Procfile declares types -> (none)
```
Because of thi... | I had the same problem and I just now I found what was wrong. I first accidently called the file `ProcFile` instead of `Procfile`. Simply renaming that file did not get picked up by git. I had to do a `git rm ProcFile -f` first and then add a new (correctly named) `Procfile`. After that, it got pushed correctly by git ... |
9143865 | How to combine multiple stashes in git | 94 | 2012-02-04 19:35:39 | <p>This is a pipeline on branch <code>frontend</code> over the last two weeks.</p>
<p>| <code>Stash@{3}</code> is all code since <code>Stash@{1}</code> (excluding the two tiny commits)<br>
| Tiny Commit<br>
| Tiny commit<br>
| Huge bulk commit two weeks ago, now rebased and moved to <code>Stash@{1}</code> </p>
<p>My... | 49,573 | 341,583 | 2025-05-05 21:29:57 | 9,143,921 | 56 | 2012-02-04 19:41:19 | 211,563 | 2016-12-02 05:37:26 | https://stackoverflow.com/q/9143865 | https://stackoverflow.com/a/9143921 | <p>You can only apply a stash if there are no conflicts with modified files in the working tree, so, first, ensure there are no modified files in <code>git status</code>, if there are, commit them. Then do:</p>
<pre><code>git stash apply stash@{1}
git commit -a
# Enter your commit message
git stash apply stash@{3}
</c... | <p>You can only apply a stash if there are no conflicts with modified files in the working tree, so, first, ensure there are no modified files in <code>git status</code>, if there are, commit them. Then do:</p> <pre><code>git stash apply stash@{1} git commit -a # Enter your commit message git stash apply stash@{3} </c... | 119, 13091 | git, git-stash | <h1>How to combine multiple stashes in git</h1>
<p>This is a pipeline on branch <code>frontend</code> over the last two weeks.</p>
<p>| <code>Stash@{3}</code> is all code since <code>Stash@{1}</code> (excluding the two tiny commits)<br>
| Tiny Commit<br>
| Tiny commit<br>
| Huge bulk commit two weeks ago, now rebased ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,118 | git | # How to combine multiple stashes in git
This is a pipeline on branch `frontend` over the last two weeks.
| `Stash@{3}` is all code since `Stash@{1}` (excluding the two tiny commits)
| Tiny Commit
| Tiny commit
| Huge bulk commit two weeks ago, now rebased and moved to `Stash@{1}`
My working tree is currently ... | You can only apply a stash if there are no conflicts with modified files in the working tree, so, first, ensure there are no modified files in `git status`, if there are, commit them. Then do:
```
git stash apply stash@{1}
git commit -a
# Enter your commit message
git stash apply stash@{3}
```
Then you can either mak... |
7597748 | Linking a single file from another git repository | 83 | 2011-09-29 13:04:37 | <p>How do you link a <strong>single file</strong> from another git repository to your own repository? I don't want the full repository, just a single file. Using <code>git submodule</code> seems like the right route to go, but it wants to grab the whole thing.</p>
| 68,270 | 968,218 | 2019-05-11 21:08:29 | 7,597,867 | 56 | 2011-09-29 13:14:13 | 6,309 | 2019-05-11 21:08:29 | https://stackoverflow.com/q/7597748 | https://stackoverflow.com/a/7597867 | <p>Considering that the unit of work for git is a repository (or more precisely a repository <em>content</em>), I don't think you can easily integrate one file.</p>
<p>If you don't need its history, you could consider simply copy it in your repo.<br>
But if you do need the history, then some <code>git filter-branch</c... | <p>Considering that the unit of work for git is a repository (or more precisely a repository <em>content</em>), I don't think you can easily integrate one file.</p> <p>If you don't need its history, you could consider simply copy it in your repo.<br> But if you do need the history, then some <code>git filter-branch</c... | 119, 7330, 41612 | git, git-submodules, repository | <h1>Linking a single file from another git repository</h1>
<p>How do you link a <strong>single file</strong> from another git repository to your own repository? I don't want the full repository, just a single file. Using <code>git submodule</code> seems like the right route to go, but it wants to grab the whole thing... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,119 | git | # Linking a single file from another git repository
How do you link a **single file** from another git repository to your own repository? I don't want the full repository, just a single file. Using `git submodule` seems like the right route to go, but it wants to grab the whole thing. | Considering that the unit of work for git is a repository (or more precisely a repository *content*), I don't think you can easily integrate one file.
If you don't need its history, you could consider simply copy it in your repo.
But if you do need the history, then some `git filter-branch` (as in "[git: How to spli... |
18126297 | When to use the '--no-ff' merge option in Git | 74 | 2013-08-08 12:41:00 | <p><a href="http://nvie.com/posts/a-successful-git-branching-model/">A Successful Git Branching Model</a> recommends to use <code>--no-ff</code> when merging branches:</p>
<blockquote>
<p>The <code>--no-ff</code> flag causes the merge to always create a new commit
object, even if the merge could be performed with ... | 40,076 | 195,964 | 2021-06-28 21:12:53 | 18,128,086 | 56 | 2013-08-08 14:02:44 | 23,360 | 2021-06-28 21:12:53 | https://stackoverflow.com/q/18126297 | https://stackoverflow.com/a/18128086 | <p>It's really dependent on what you're trying to do. My rule of thumb is that if the merge "means something" I use the <code>--no-ff</code> option. When the merge doesn't really mean anything and you might have used a rebase there's no reason to use <code>--no-ff</code>.</p>
<p>The thing with git is that it'... | <p>It's really dependent on what you're trying to do. My rule of thumb is that if the merge "means something" I use the <code>--no-ff</code> option. When the merge doesn't really mean anything and you might have used a rebase there's no reason to use <code>--no-ff</code>.</p> <p>The thing with git is that it'... | 119, 28897, 52842 | fast-forward, git, git-merge | <h1>When to use the '--no-ff' merge option in Git</h1>
<p><a href="http://nvie.com/posts/a-successful-git-branching-model/">A Successful Git Branching Model</a> recommends to use <code>--no-ff</code> when merging branches:</p>
<blockquote>
<p>The <code>--no-ff</code> flag causes the merge to always create a new comm... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,120 | git | # When to use the '--no-ff' merge option in Git
[A Successful Git Branching Model](http://nvie.com/posts/a-successful-git-branching-model/) recommends to use `--no-ff` when merging branches:
> The `--no-ff` flag causes the merge to always create a new commit
> object, even if the merge could be performed with a fast-... | It's really dependent on what you're trying to do. My rule of thumb is that if the merge "means something" I use the `--no-ff` option. When the merge doesn't really mean anything and you might have used a rebase there's no reason to use `--no-ff`.
The thing with git is that it's a very powerful tool, and you can use i... |
17556250 | How to ignore Icon? in git | 70 | 2013-07-09 19:07:39 | <p>While trying to setup a dropbox folder with git, I saw a "Icon\r" file which is not created by me. I try to ignore it in the ~/.gitignore file. But adding <code>Icon\r</code> <code>Icon\r\r</code> <code>Icon?</code> won't work at all. </p>
| 19,708 | 768,823 | 2023-05-23 21:12:04 | 30,755,378 | 56 | 2015-06-10 11:45:58 | 4,994,572 | 2021-12-03 14:19:38 | https://stackoverflow.com/q/17556250 | https://stackoverflow.com/a/30755378 | <p>(This improves on the original answer, following a suggestion by <strong>robotspacer</strong>, according to <strong>hidn</strong>'s <a href="https://stackoverflow.com/a/33974028/192740">explanation</a>.)</p>
<p>The <code>Icon?</code> is the file of OS X folder icon. The "<code>?</code>" is a special charac... | <p>(This improves on the original answer, following a suggestion by <strong>robotspacer</strong>, according to <strong>hidn</strong>'s <a href="https://stackoverflow.com/a/33974028/192740">explanation</a>.)</p> <p>The <code>Icon?</code> is the file of OS X folder icon. The "<code>?</code>" is a special charac... | 119, 369 | git, macos | <h1>How to ignore Icon? in git</h1>
<p>While trying to setup a dropbox folder with git, I saw a "Icon\r" file which is not created by me. I try to ignore it in the ~/.gitignore file. But adding <code>Icon\r</code> <code>Icon\r\r</code> <code>Icon?</code> won't work at all. </p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,121 | git | # How to ignore Icon? in git
While trying to setup a dropbox folder with git, I saw a "Icon\r" file which is not created by me. I try to ignore it in the ~/.gitignore file. But adding `Icon\r` `Icon\r\r` `Icon?` won't work at all. | (This improves on the original answer, following a suggestion by **robotspacer**, according to **hidn**'s [explanation](https://stackoverflow.com/a/33974028/192740).)
The `Icon?` is the file of OS X folder icon. The "`?`" is a special character for double carriage return (`\r\r`).
To tell `git` to ignore it, open a t... |
8650310 | Switch to another branch without changing the workspace files | 69 | 2011-12-27 23:28:24 | <p>I cloned a git repository from GitHub, made some changes and some commits; I made quite a lot and all are quite dirty, so they're not suitable for a pull request. Now I created the branch <code>cleanchanges</code> from <code>origin/master</code>, so it's clean, and I want to commit my changes there as one commit wit... | 254,387 | 121,595 | 2025-01-19 10:20:04 | 8,650,342 | 56 | 2011-12-27 23:33:14 | 893 | 2011-12-27 23:39:31 | https://stackoverflow.com/q/8650310 | https://stackoverflow.com/a/8650342 | <p><strong>Edit:</strong> I just noticed that you said you had already created some commits. In that case, use <code>git merge --squash</code> to make a single commit:</p>
<pre><code>git checkout cleanchanges
git merge --squash master
git commit -m "nice commit comment for all my changes"
</code></pre>
<hr>
<p>(<str... | <p><strong>Edit:</strong> I just noticed that you said you had already created some commits. In that case, use <code>git merge --squash</code> to make a single commit:</p> <pre><code>git checkout cleanchanges git merge --squash master git commit -m "nice commit comment for all my changes" </code></pre> <hr> <p>(<str... | 119, 1879, 76220 | branch, git, git-branch | <h1>Switch to another branch without changing the workspace files</h1>
<p>I cloned a git repository from GitHub, made some changes and some commits; I made quite a lot and all are quite dirty, so they're not suitable for a pull request. Now I created the branch <code>cleanchanges</code> from <code>origin/master</code>,... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,122 | git | # Switch to another branch without changing the workspace files
I cloned a git repository from GitHub, made some changes and some commits; I made quite a lot and all are quite dirty, so they're not suitable for a pull request. Now I created the branch `cleanchanges` from `origin/master`, so it's clean, and I want to c... | **Edit:** I just noticed that you said you had already created some commits. In that case, use `git merge --squash` to make a single commit:
```
git checkout cleanchanges
git merge --squash master
git commit -m "nice commit comment for all my changes"
```
---
(**Edit:** The following answer applies if you have *unco... |
11085795 | Git: Exclude a file with git clean | 66 | 2012-06-18 15:14:52 | <p>i'm working on a big python project, and i'm really sick if .pyc and *~ files. I'd like to remove them. I've seen that the <code>-X</code> flag of git clean would remove untracked files. As you can imagine, i'm not tracking <code>.pyc</code> nor <code>*~</code> files. And that would make the trick. The problem is th... | 42,198 | 198,212 | 2022-11-18 06:24:03 | 11,086,103 | 56 | 2012-06-18 15:33:40 | 262,456 | 2020-08-21 18:20:22 | https://stackoverflow.com/q/11085795 | https://stackoverflow.com/a/11086103 | <p>The difference is the capital <code>X</code> you're using. Use a small <code>x</code> instead of the capital one. Like in: <code>git clean -x</code>.</p>
<pre><code>git clean -x -n -e local_settings.py # Shows what would remove (-n flag)
git clean -x -f -e local_settings.py # Removes it (note the -f flag)
</code></p... | <p>The difference is the capital <code>X</code> you're using. Use a small <code>x</code> instead of the capital one. Like in: <code>git clean -x</code>.</p> <pre><code>git clean -x -n -e local_settings.py # Shows what would remove (-n flag) git clean -x -f -e local_settings.py # Removes it (note the -f flag) </code></p... | 119, 456, 68596 | git, git-clean, version-control | <h1>Git: Exclude a file with git clean</h1>
<p>i'm working on a big python project, and i'm really sick if .pyc and *~ files. I'd like to remove them. I've seen that the <code>-X</code> flag of git clean would remove untracked files. As you can imagine, i'm not tracking <code>.pyc</code> nor <code>*~</code> files. And ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,123 | git | # Git: Exclude a file with git clean
i'm working on a big python project, and i'm really sick if .pyc and *~ files. I'd like to remove them. I've seen that the `-X` flag of git clean would remove untracked files. As you can imagine, i'm not tracking `.pyc` nor `*~` files. And that would make the trick. The problem is ... | The difference is the capital `X` you're using. Use a small `x` instead of the capital one. Like in: `git clean -x`.
```
git clean -x -n -e local_settings.py # Shows what would remove (-n flag)
git clean -x -f -e local_settings.py # Removes it (note the -f flag)
```
From [the git documentation](http://git-scm.com/doc... |
23740734 | Logout and login as another user git bash | 61 | 2014-05-19 14:45:38 | <p>I want to logout from Git bash and login it again as another user .</p>
<p>I have googled but can't find any solution.</p>
| 188,786 | 2,545,270 | 2021-12-12 15:05:48 | 23,741,253 | 56 | 2014-05-19 15:09:27 | 6,309 | 2021-02-22 15:35:05 | https://stackoverflow.com/q/23740734 | https://stackoverflow.com/a/23741253 | <p>You don't have to "logout" or "login": regarding git, who you are is determined by:</p>
<pre><code>git config user.name
git config user.email
</code></pre>
<p>Change those two settings while being in a repo, if you are someone else, when it comes to creating commits.</p>
<p>If you want to change ... | <p>You don't have to "logout" or "login": regarding git, who you are is determined by:</p> <pre><code>git config user.name git config user.email </code></pre> <p>Change those two settings while being in a repo, if you are someone else, when it comes to creating commits.</p> <p>If you want to change ... | 119, 456 | git, version-control | <h1>Logout and login as another user git bash</h1>
<p>I want to logout from Git bash and login it again as another user .</p>
<p>I have googled but can't find any solution.</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,125 | git | # Logout and login as another user git bash
I want to logout from Git bash and login it again as another user .
I have googled but can't find any solution. | You don't have to "logout" or "login": regarding git, who you are is determined by:
```
git config user.name
git config user.email
```
Change those two settings while being in a repo, if you are someone else, when it comes to creating commits.
If you want to change it in your local machine for all repos, add --globa... |
12147042 | lost git stash changes | 58 | 2012-08-27 17:57:56 | <p>So here's what happened:
I was on a branch 'A' and did a Git stash on that branch. Then I switched to another branch 'B'. I navigated back to Branch 'A' but did not do a Git stash pop. I switched to the master branch and then back to branch 'A'. I am trying to go a git stash pop now but cant seem to get my changes b... | 67,693 | 1,620,574 | 2024-08-24 06:40:14 | 12,149,040 | 56 | 2012-08-27 20:22:11 | 1,864,976 | 2012-08-27 20:22:11 | https://stackoverflow.com/q/12147042 | https://stackoverflow.com/a/12149040 | <p>Stashes should be viewable via</p>
<pre><code>git stash list
</code></pre>
<p>or</p>
<pre><code>gitk --all
</code></pre>
<p>also, <code>git stash</code> does not stash untracked files. If you did this and subsequently did a <code>git checkout --force</code> of another branch to overwrite untracked files with tra... | <p>Stashes should be viewable via</p> <pre><code>git stash list </code></pre> <p>or</p> <pre><code>gitk --all </code></pre> <p>also, <code>git stash</code> does not stash untracked files. If you did this and subsequently did a <code>git checkout --force</code> of another branch to overwrite untracked files with tra... | 119, 13091 | git, git-stash | <h1>lost git stash changes</h1>
<p>So here's what happened:
I was on a branch 'A' and did a Git stash on that branch. Then I switched to another branch 'B'. I navigated back to Branch 'A' but did not do a Git stash pop. I switched to the master branch and then back to branch 'A'. I am trying to go a git stash pop now b... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,127 | git | # lost git stash changes
So here's what happened:
I was on a branch 'A' and did a Git stash on that branch. Then I switched to another branch 'B'. I navigated back to Branch 'A' but did not do a Git stash pop. I switched to the master branch and then back to branch 'A'. I am trying to go a git stash pop now but cant s... | Stashes should be viewable via
```
git stash list
```
or
```
gitk --all
```
also, `git stash` does not stash untracked files. If you did this and subsequently did a `git checkout --force` of another branch to overwrite untracked files with tracked ones in another branch, you have lost that content. The recommended ... |
15288712 | .gitignore whitelist on directory and its contents | 52 | 2013-03-08 07:18:52 | <p>I'm trying to whitelist the directory (and its contents) SupplierName in my Zend Framework 2 vendor directory.</p>
<p>The original .gitignore file in /vendor looks like this:</p>
<pre><code># Add here the vendor path to be whitelisted
# Ex: for composer directory write here "!composer" (without quotes)
!.gitignore... | 53,066 | 2,111,178 | 2019-07-26 10:15:18 | 15,320,746 | 56 | 2013-03-10 09:25:10 | 380,757 | 2013-03-10 09:32:47 | https://stackoverflow.com/q/15288712 | https://stackoverflow.com/a/15320746 | <p>You can use 2 <code>.gitignore</code> files to achieve the desired result:</p>
<pre><code># vendor/.gitignore
*
!.gitignore
!SupplierName/
!SupplierName/*
# vendor/SupplierName/.gitignore
!*
</code></pre>
<p>I tested this with a test repo and seems to work for me in adding files as many levels deep underneath the... | <p>You can use 2 <code>.gitignore</code> files to achieve the desired result:</p> <pre><code># vendor/.gitignore * !.gitignore !SupplierName/ !SupplierName/* # vendor/SupplierName/.gitignore !* </code></pre> <p>I tested this with a test repo and seems to work for me in adding files as many levels deep underneath the... | 119, 25056 | git, gitignore | <h1>.gitignore whitelist on directory and its contents</h1>
<p>I'm trying to whitelist the directory (and its contents) SupplierName in my Zend Framework 2 vendor directory.</p>
<p>The original .gitignore file in /vendor looks like this:</p>
<pre><code># Add here the vendor path to be whitelisted
# Ex: for composer d... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,129 | git | # .gitignore whitelist on directory and its contents
I'm trying to whitelist the directory (and its contents) SupplierName in my Zend Framework 2 vendor directory.
The original .gitignore file in /vendor looks like this:
```
# Add here the vendor path to be whitelisted
# Ex: for composer directory write here "!compo... | You can use 2 `.gitignore` files to achieve the desired result:
```
# vendor/.gitignore
*
!.gitignore
!SupplierName/
!SupplierName/*
# vendor/SupplierName/.gitignore
!*
```
I tested this with a test repo and seems to work for me in adding files as many levels deep underneath the `vendor/SupplierName` directory.
```... |
29094595 | Git interactive rebase without opening the editor | 51 | 2015-03-17 08:43:24 | <p>Git allows certain commands to create or modify commits without opening the editor first, for example:</p>
<pre><code>git commit --amend --no-edit
git commit --fixup=HEAD^
</code></pre>
<p>I have set <code>rebase.autosquash</code> to <code>true</code>, so that the todo list for an interactive rebase is automatical... | 14,060 | 154,133 | 2024-07-30 11:26:13 | 29,094,904 | 56 | 2015-03-17 08:59:27 | 1,256,452 | 2015-03-17 08:59:27 | https://stackoverflow.com/q/29094595 | https://stackoverflow.com/a/29094904 | <h3>TL;DR answer: <code>GIT_SEQUENCE_EDITOR=: git rebase -i HEAD~3</code></h3>
<p>You can't stop <code>git rebase --interactive</code> from running the "sequence editor" (that's the edit command on the "sequence file" containing the various pick, etc., commands). However, if you examine the interactive rebase script:... | <h3>TL;DR answer: <code>GIT_SEQUENCE_EDITOR=: git rebase -i HEAD~3</code></h3> <p>You can't stop <code>git rebase --interactive</code> from running the "sequence editor" (that's the edit command on the "sequence file" containing the various pick, etc., commands). However, if you examine the interactive rebase script:... | 119, 8974, 29934 | git, git-rebase, rebase | <h1>Git interactive rebase without opening the editor</h1>
<p>Git allows certain commands to create or modify commits without opening the editor first, for example:</p>
<pre><code>git commit --amend --no-edit
git commit --fixup=HEAD^
</code></pre>
<p>I have set <code>rebase.autosquash</code> to <code>true</code>, so ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,130 | git | # Git interactive rebase without opening the editor
Git allows certain commands to create or modify commits without opening the editor first, for example:
```
git commit --amend --no-edit
git commit --fixup=HEAD^
```
I have set `rebase.autosquash` to `true`, so that the todo list for an interactive rebase is automat... | ### TL;DR answer: `GIT_SEQUENCE_EDITOR=: git rebase -i HEAD~3`
You can't stop `git rebase --interactive` from running the "sequence editor" (that's the edit command on the "sequence file" containing the various pick, etc., commands). However, if you examine the interactive rebase script:
```
$ vim $(git --exec-path)/... |
4539384 | Installing git on Windows: Git Bash Here or git-cheetah shell extension? | 51 | 2010-12-27 14:38:56 | <p>I'm installing Git on Windows XP. During the setup, the installer asks whether I want:</p>
<blockquote>
<p>1: Context menu entries: "Git Bash Here" (and the "Git GUI Here" option)</p>
</blockquote>
<p>or</p>
<blockquote>
<p>2: "git-cheetah shell extension (32-bit only)"</p>
</blockquote>
<p>Basically, which ... | 23,367 | 128,463 | 2010-12-27 15:13:31 | 4,539,401 | 56 | 2010-12-27 14:41:37 | 35,060 | 2010-12-27 14:41:37 | https://stackoverflow.com/q/4539384 | https://stackoverflow.com/a/4539401 | <p><code>git bash here</code> will give you a console window with access to git commands, <code>shell extension</code> will give you right click menu access to git commands creating an environment similar to <code>TortoiseSVN</code> and such.</p>
| <p><code>git bash here</code> will give you a console window with access to git commands, <code>shell extension</code> will give you right click menu access to git commands creating an environment similar to <code>TortoiseSVN</code> and such.</p> | 119, 529 | git, installation | <h1>Installing git on Windows: Git Bash Here or git-cheetah shell extension?</h1>
<p>I'm installing Git on Windows XP. During the setup, the installer asks whether I want:</p>
<blockquote>
<p>1: Context menu entries: "Git Bash Here" (and the "Git GUI Here" option)</p>
</blockquote>
<p>or</p>
<blockquote>
<p>2: "... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,131 | git | # Installing git on Windows: Git Bash Here or git-cheetah shell extension?
I'm installing Git on Windows XP. During the setup, the installer asks whether I want:
> 1: Context menu entries: "Git Bash Here" (and the "Git GUI Here" option)
or
> 2: "git-cheetah shell extension (32-bit only)"
Basically, which should I ... | `git bash here` will give you a console window with access to git commands, `shell extension` will give you right click menu access to git commands creating an environment similar to `TortoiseSVN` and such. |
4248237 | How do I reverse a specific hunk of a commit in git? | 50 | 2010-11-22 17:24:57 | <p>I'm wondering if there is a way to quickly reverse specific hunk of a commit.</p>
<p>I can generate a <code>diff</code> between two commits or <code>HEAD</code> to see the difference.</p>
<p>How do I reverse just one of those hunks (or better yet, a set of specific hunks)?</p>
| 16,004 | 256,854 | 2024-06-20 05:19:55 | 4,248,269 | 56 | 2010-11-22 17:27:59 | 501,250 | 2020-08-21 05:05:50 | https://stackoverflow.com/q/4248237 | https://stackoverflow.com/a/4248269 | <pre><code>git checkout -p $REF -- path/to/file
</code></pre>
<p>e.g.,</p>
<pre><code>git checkout -p HEAD^ myfile
</code></pre>
<p>Where <code>$REF</code> is a ref name or commit ID that specifies the commit you want to take the file state from. For example, to selectively revert changes made in the last commit, use ... | <pre><code>git checkout -p $REF -- path/to/file </code></pre> <p>e.g.,</p> <pre><code>git checkout -p HEAD^ myfile </code></pre> <p>Where <code>$REF</code> is a ref name or commit ID that specifies the commit you want to take the file state from. For example, to selectively revert changes made in the last commit, use ... | 119, 55606 | git, git-workflow | <h1>How do I reverse a specific hunk of a commit in git?</h1>
<p>I'm wondering if there is a way to quickly reverse specific hunk of a commit.</p>
<p>I can generate a <code>diff</code> between two commits or <code>HEAD</code> to see the difference.</p>
<p>How do I reverse just one of those hunks (or better yet, a s... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,132 | git | # How do I reverse a specific hunk of a commit in git?
I'm wondering if there is a way to quickly reverse specific hunk of a commit.
I can generate a `diff` between two commits or `HEAD` to see the difference.
How do I reverse just one of those hunks (or better yet, a set of specific hunks)? | ```
git checkout -p $REF -- path/to/file
```
e.g.,
```
git checkout -p HEAD^ myfile
```
Where `$REF` is a ref name or commit ID that specifies the commit you want to take the file state from. For example, to selectively revert changes made in the last commit, use `HEAD^`. |
8716130 | Git: branches diverged; how shoud I proceed? | 48 | 2012-01-03 17:23:01 | <p>My local tree has diverged from the master:</p>
<pre class="lang-none prettyprint-override"><code>git status
</code></pre>
<p>Output:</p>
<pre class="lang-none prettyprint-override"><code># On branch master
# Your branch and 'origin/master' have diverged,
# and have 7 and 3 different commit(s) each, respectively.
#
... | 100,365 | 850,781 | 2025-05-03 02:22:17 | 8,716,401 | 56 | 2012-01-03 17:44:08 | 825 | 2012-01-03 17:44:08 | https://stackoverflow.com/q/8716130 | https://stackoverflow.com/a/8716401 | <p>There are, of course, several ways you could do this manually. You'll still have the same conflicts because git is basically doing this for you under the hood. But if you want to do this manually, here are a couple of ways.</p>
<p>First, export your commits as a series of patches. The easiest way to do this is usin... | <p>There are, of course, several ways you could do this manually. You'll still have the same conflicts because git is basically doing this for you under the hood. But if you want to do this manually, here are a couple of ways.</p> <p>First, export your commits as a series of patches. The easiest way to do this is usin... | 119, 29934 | git, git-rebase | <h1>Git: branches diverged; how shoud I proceed?</h1>
<p>My local tree has diverged from the master:</p>
<pre class="lang-none prettyprint-override"><code>git status
</code></pre>
<p>Output:</p>
<pre class="lang-none prettyprint-override"><code># On branch master
# Your branch and 'origin/master' have diverged,
# and h... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,133 | git | # Git: branches diverged; how shoud I proceed?
My local tree has diverged from the master:
```
git status
```
Output:
```
# On branch master
# Your branch and 'origin/master' have diverged,
# and have 7 and 3 different commit(s) each, respectively.
#
nothing to commit (working directory clean)
```
I tried **git pu... | There are, of course, several ways you could do this manually. You'll still have the same conflicts because git is basically doing this for you under the hood. But if you want to do this manually, here are a couple of ways.
First, export your commits as a series of patches. The easiest way to do this is using `git for... |
23295986 | Undo local changes interactive | 47 | 2014-04-25 14:30:02 | <p>I often add some debug code while developing so I need to remove these changes later. </p>
<p>Currently, I check the <code>git diff</code> and remove the changes manually or just type <code>git checkout -- myfilename</code> if I would like to undo the entire file.</p>
<p>I love the interactive patch function (<cod... | 10,281 | 1,171,460 | 2024-12-24 12:13:20 | 23,296,148 | 56 | 2014-04-25 14:37:52 | 1,843,331 | 2024-12-24 12:13:20 | https://stackoverflow.com/q/23295986 | https://stackoverflow.com/a/23296148 | <p>The command you are looking for is</p>
<pre><code>git checkout -p
</code></pre>
<p>The <a href="http://git-scm.com/docs/git-checkout" rel="nofollow noreferrer">git checkout Manual Page</a> says:</p>
<blockquote>
<p>-p</p>
<p>--patch</p>
<p>Interactively select hunks in the difference between the (or the index, if u... | <p>The command you are looking for is</p> <pre><code>git checkout -p </code></pre> <p>The <a href="http://git-scm.com/docs/git-checkout" rel="nofollow noreferrer">git checkout Manual Page</a> says:</p> <blockquote> <p>-p</p> <p>--patch</p> <p>Interactively select hunks in the difference between the (or the index, if u... | 119, 758 | git, workflow | <h1>Undo local changes interactive</h1>
<p>I often add some debug code while developing so I need to remove these changes later. </p>
<p>Currently, I check the <code>git diff</code> and remove the changes manually or just type <code>git checkout -- myfilename</code> if I would like to undo the entire file.</p>
<p>I l... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,134 | git | # Undo local changes interactive
I often add some debug code while developing so I need to remove these changes later.
Currently, I check the `git diff` and remove the changes manually or just type `git checkout -- myfilename` if I would like to undo the entire file.
I love the interactive patch function (`git add -... | The command you are looking for is
```
git checkout -p
```
The [git checkout Manual Page](http://git-scm.com/docs/git-checkout) says:
> -p
>
> --patch
>
> Interactively select hunks in the difference between the (or the index, if unspecified) and the working tree. The chosen hunks are then applied in reverse to the ... |
13877014 | Git-Repo searching for String in all committed files (unknown branch and commit) | 47 | 2012-12-14 10:38:27 | <p>I have a piece of code in another than my current branch in my git repo, and I am not sure which commit and which branch. How can I search in all files that I committed until now for a specific string (and afterwards show the surrounding of that line of code)?</p>
| 41,373 | 1,627,888 | 2018-04-07 14:58:27 | 13,878,026 | 56 | 2012-12-14 11:41:59 | 683,080 | 2012-12-14 11:41:59 | https://stackoverflow.com/q/13877014 | https://stackoverflow.com/a/13878026 | <p>Use <code>git grep</code> to locate the commit:</p>
<pre><code>git grep "string" $(git rev-list --all)
</code></pre>
<p>The <code>git rev-list --all</code> makes it search the entire history of the project.</p>
<p>That will give an output like this:</p>
<pre><code><commit>:<path>:<matched line>... | <p>Use <code>git grep</code> to locate the commit:</p> <pre><code>git grep "string" $(git rev-list --all) </code></pre> <p>The <code>git rev-list --all</code> makes it search the entire history of the project.</p> <p>That will give an output like this:</p> <pre><code><commit>:<path>:<matched line>... | 119 | git | <h1>Git-Repo searching for String in all committed files (unknown branch and commit)</h1>
<p>I have a piece of code in another than my current branch in my git repo, and I am not sure which commit and which branch. How can I search in all files that I committed until now for a specific string (and afterwards show the s... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,135 | git | # Git-Repo searching for String in all committed files (unknown branch and commit)
I have a piece of code in another than my current branch in my git repo, and I am not sure which commit and which branch. How can I search in all files that I committed until now for a specific string (and afterwards show the surroundin... | Use `git grep` to locate the commit:
```
git grep "string" $(git rev-list --all)
```
The `git rev-list --all` makes it search the entire history of the project.
That will give an output like this:
```
<commit>:<path>:<matched line>
```
Then you can use `git branch --contains` to find out which branch the commit is... |
20837080 | git merge --no-commit vs git cherry-pick --no-commit | 41 | 2013-12-30 09:49:51 | <p>Is there any difference between <code>git merge --no-commit</code> and <code>git cherry-pick --no-commit</code>?</p>
<p>And is there any difference in history if I commit after these two commands?</p>
| 48,673 | 1,127,094 | 2015-03-05 10:35:14 | 20,837,136 | 56 | 2013-12-30 09:54:09 | 1,796,345 | 2013-12-30 09:54:09 | https://stackoverflow.com/q/20837080 | https://stackoverflow.com/a/20837136 | <p>If you commit after <code>git merge --no-commit</code>, you'll actually get a merge commit. Whereas after a <code>git cherry-pick --no-commit</code> you'll get a commit with a single parent.</p>
<p>Hence, yes, there is a difference between those two commands.</p>
<p>In particular if you have something like</p>
<p... | <p>If you commit after <code>git merge --no-commit</code>, you'll actually get a merge commit. Whereas after a <code>git cherry-pick --no-commit</code> you'll get a commit with a single parent.</p> <p>Hence, yes, there is a difference between those two commands.</p> <p>In particular if you have something like</p> <p... | 119, 28897, 78810 | git, git-cherry-pick, git-merge | <h1>git merge --no-commit vs git cherry-pick --no-commit</h1>
<p>Is there any difference between <code>git merge --no-commit</code> and <code>git cherry-pick --no-commit</code>?</p>
<p>And is there any difference in history if I commit after these two commands?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,138 | git | # git merge --no-commit vs git cherry-pick --no-commit
Is there any difference between `git merge --no-commit` and `git cherry-pick --no-commit`?
And is there any difference in history if I commit after these two commands? | If you commit after `git merge --no-commit`, you'll actually get a merge commit. Whereas after a `git cherry-pick --no-commit` you'll get a commit with a single parent.
Hence, yes, there is a difference between those two commands.
In particular if you have something like
```
A -- B -- C
\ L HEAD
\
-- D ... |
19323513 | Heroku & Django: "OSError: No such file or directory: '/app/{myappname}/static'" | 41 | 2013-10-11 16:59:14 | <p>I have a Django app on Heroku. I am having some problems with static files (they are loading in one Heroku <a href="https://devcenter.heroku.com/articles/multiple-environments" rel="noreferrer">environment</a> but not another), so I tried the debug command recommended <a href="https://devcenter.heroku.com/articles/d... | 24,261 | 38,146 | 2016-06-07 00:11:07 | 19,323,823 | 56 | 2013-10-11 17:19:56 | 382,749 | 2013-10-11 17:19:56 | https://stackoverflow.com/q/19323513 | https://stackoverflow.com/a/19323823 | <p>It's looking for a folder named 'static' that's next to the settings.py, i.e. in the project folder, not at the root of the git repo.</p>
<pre><code>git root/
git root/{app name}
git root/{app name}/settings.py
git root/{app name}/static/ <- this is what you're missing
</code></pre>
<p>Note that empty f... | <p>It's looking for a folder named 'static' that's next to the settings.py, i.e. in the project folder, not at the root of the git repo.</p> <pre><code>git root/ git root/{app name} git root/{app name}/settings.py git root/{app name}/static/ <- this is what you're missing </code></pre> <p>Note that empty f... | 16, 119, 243, 8279, 70828 | django, django-staticfiles, git, heroku, python | <h1>Heroku & Django: "OSError: No such file or directory: '/app/{myappname}/static'"</h1>
<p>I have a Django app on Heroku. I am having some problems with static files (they are loading in one Heroku <a href="https://devcenter.heroku.com/articles/multiple-environments" rel="noreferrer">environment</a> but not another),... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,139 | git | # Heroku & Django: "OSError: No such file or directory: '/app/{myappname}/static'"
I have a Django app on Heroku. I am having some problems with static files (they are loading in one Heroku [environment](https://devcenter.heroku.com/articles/multiple-environments) but not another), so I tried the debug command recomme... | It's looking for a folder named 'static' that's next to the settings.py, i.e. in the project folder, not at the root of the git repo.
```
git root/
git root/{app name}
git root/{app name}/settings.py
git root/{app name}/static/ <- this is what you're missing
```
Note that empty folders aren't tracked by git, ... |
59797272 | Receiving fatal: could not read Username for 'https://github.com': terminal prompts disabled while building project in terminal | 39 | 2020-01-18 03:26:34 | <p>I have started working on Golang project. While building with make, I am getting following error:</p>
<pre><code>fatal: could not read Username for 'https://github.com': terminal prompts disabled
</code></pre>
<p>To handle this, I have done following after going through similar post <a href="https://stackoverflow.... | 82,873 | 1,823,822 | 2023-08-02 16:18:47 | 59,803,903 | 56 | 2020-01-18 19:05:40 | 7,025,824 | 2020-01-18 19:05:40 | https://stackoverflow.com/q/59797272 | https://stackoverflow.com/a/59803903 | <p>Create an SSH key instead and use it as a default login method for you git repo.
You can follow this link to create an ssh key for authentication on your machine:</p>
<p><a href="https://help.github.com/en/enterprise/2.17/user/github/authenticating-to-github/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent" ... | <p>Create an SSH key instead and use it as a default login method for you git repo. You can follow this link to create an ssh key for authentication on your machine:</p> <p><a href="https://help.github.com/en/enterprise/2.17/user/github/authenticating-to-github/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent" ... | 119 | git | <h1>Receiving fatal: could not read Username for 'https://github.com': terminal prompts disabled while building project in terminal</h1>
<p>I have started working on Golang project. While building with make, I am getting following error:</p>
<pre><code>fatal: could not read Username for 'https://github.com': terminal ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,140 | git | # Receiving fatal: could not read Username for 'https://github.com': terminal prompts disabled while building project in terminal
I have started working on Golang project. While building with make, I am getting following error:
```
fatal: could not read Username for 'https://github.com': terminal prompts disabled
```... | Create an SSH key instead and use it as a default login method for you git repo.
You can follow this link to create an ssh key for authentication on your machine:
[Generating a new SSH key and adding it to the ssh-agent](https://help.github.com/en/enterprise/2.17/user/github/authenticating-to-github/generating-a-new-s... |
41606853 | Error in commiting to git saying stCommitMsg file not found | 39 | 2017-01-12 06:53:16 | <p>While trying to make a commit (with <code>git commit</code>) to my local git branch I got this error:</p>
<blockquote>
<p>fatal: could not read '/Users/<username>/.stCommitMsg': No such
file or directory</p>
</blockquote>
<p>Note that I am able to commit using the <code>-m</code> switch:</p>
<pre><code>git com... | 14,082 | 5,077,507 | 2022-12-08 20:20:01 | 41,607,044 | 56 | 2017-01-12 07:04:53 | 2,890,575 | 2022-12-08 20:15:08 | https://stackoverflow.com/q/41606853 | https://stackoverflow.com/a/41607044 | <p>When you run <code>git commit</code>, Git will read from the configure variable <code>commit.template</code> to find a <em>commit message template</em> and load it into your editor for you to write your commit message.</p>
<p>Regarding your error, it seems that Git is trying to find the template file <code>/Users/&l... | <p>When you run <code>git commit</code>, Git will read from the configure variable <code>commit.template</code> to find a <em>commit message template</em> and load it into your editor for you to write your commit message.</p> <p>Regarding your error, it seems that Git is trying to find the template file <code>/Users/&l... | 119 | git | <h1>Error in commiting to git saying stCommitMsg file not found</h1>
<p>While trying to make a commit (with <code>git commit</code>) to my local git branch I got this error:</p>
<blockquote>
<p>fatal: could not read '/Users/<username>/.stCommitMsg': No such
file or directory</p>
</blockquote>
<p>Note that I am ab... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,141 | git | # Error in commiting to git saying stCommitMsg file not found
While trying to make a commit (with `git commit`) to my local git branch I got this error:
> fatal: could not read '/Users/<username>/.stCommitMsg': No such
> file or directory
Note that I am able to commit using the `-m` switch:
```
git commit -m "commi... | When you run `git commit`, Git will read from the configure variable `commit.template` to find a *commit message template* and load it into your editor for you to write your commit message.
Regarding your error, it seems that Git is trying to find the template file `/Users/<username>/.stCommitMsg` - but it does not ex... |
39352644 | How to change tab width in git diff? | 39 | 2016-09-06 15:22:03 | <p>The standard spacing for a tab is 8 characters.</p>
<p>I prefer to view that as 4 characters in my editors and console. I can easily change this default behavior on console with the <code>tabs</code> command:</p>
<pre><code>tabs -4
</code></pre>
<p>However, when using <code>git diff</code> or <code>git show</code... | 15,226 | 4,233,593 | 2016-09-06 15:26:47 | 39,352,670 | 56 | 2016-09-06 15:23:36 | 440,564 | 2016-09-06 15:26:47 | https://stackoverflow.com/q/39352644 | https://stackoverflow.com/a/39352670 | <p>This actually has nothing to do with <code>git diff</code>.</p>
<p>git diff actually renders a tab, which is later converted by your terminal emulators (for instance, <code>gnome-terminal</code>) to <em>spaces</em>.</p>
<p>Go to the preference of your terminal emulator to change that setting.</p>
<hr>
<p>Also, g... | <p>This actually has nothing to do with <code>git diff</code>.</p> <p>git diff actually renders a tab, which is later converted by your terminal emulators (for instance, <code>gnome-terminal</code>) to <em>spaces</em>.</p> <p>Go to the preference of your terminal emulator to change that setting.</p> <hr> <p>Also, g... | 119, 1084, 9033 | git, git-diff, whitespace | <h1>How to change tab width in git diff?</h1>
<p>The standard spacing for a tab is 8 characters.</p>
<p>I prefer to view that as 4 characters in my editors and console. I can easily change this default behavior on console with the <code>tabs</code> command:</p>
<pre><code>tabs -4
</code></pre>
<p>However, when using... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,142 | git | # How to change tab width in git diff?
The standard spacing for a tab is 8 characters.
I prefer to view that as 4 characters in my editors and console. I can easily change this default behavior on console with the `tabs` command:
```
tabs -4
```
However, when using `git diff` or `git show` it displays in the defaul... | This actually has nothing to do with `git diff`.
git diff actually renders a tab, which is later converted by your terminal emulators (for instance, `gnome-terminal`) to *spaces*.
Go to the preference of your terminal emulator to change that setting.
---
Also, git may use a pager, so you might want to configure it ... |
2113889 | git difftool to give directory compare? | 39 | 2010-01-21 23:45:19 | <p>Is it possible to get the git difftool command to open a directory compare between the changed files and the staging/checked files?</p>
<p>So ideally, if 2 files have changed, they would be the only 2 shown, but within a directory compare.</p>
<p>I've read posts about getting git to give all file diffs in parallel... | 25,846 | 119,790 | 2022-04-21 22:13:32 | 2,115,188 | 56 | 2010-01-22 05:15:22 | 6,309 | 2022-04-21 22:13:32 | https://stackoverflow.com/q/2113889 | https://stackoverflow.com/a/2115188 | <p>Update June 2012 (2 and an half years later):</p>
<p>This (comparing directories instead of file-by-file) seems to be soon available:<br />
See <a href="http://article.gmane.org/gmane.linux.kernel/1307164" rel="noreferrer">[ANNOUNCE] Git 1.7.11.rc1</a>:</p>
<blockquote>
<p>"<code>git difftool</code>" learn... | <p>Update June 2012 (2 and an half years later):</p> <p>This (comparing directories instead of file-by-file) seems to be soon available:<br /> See <a href="http://article.gmane.org/gmane.linux.kernel/1307164" rel="noreferrer">[ANNOUNCE] Git 1.7.11.rc1</a>:</p> <blockquote> <p>"<code>git difftool</code>" learn... | 119, 606, 15129 | beyondcompare, diff, git | <h1>git difftool to give directory compare?</h1>
<p>Is it possible to get the git difftool command to open a directory compare between the changed files and the staging/checked files?</p>
<p>So ideally, if 2 files have changed, they would be the only 2 shown, but within a directory compare.</p>
<p>I've read posts abo... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,143 | git | # git difftool to give directory compare?
Is it possible to get the git difftool command to open a directory compare between the changed files and the staging/checked files?
So ideally, if 2 files have changed, they would be the only 2 shown, but within a directory compare.
I've read posts about getting git to give ... | Update June 2012 (2 and an half years later):
This (comparing directories instead of file-by-file) seems to be soon available:
See [[ANNOUNCE] Git 1.7.11.rc1](http://article.gmane.org/gmane.linux.kernel/1307164):
> "`git difftool`" learned the "`--dir-diff`" option to spawn external diff tools that can **compare tw... |
9529354 | Git rm several files? | 38 | 2012-03-02 07:06:51 | <p>How do I easily remove several files without manually typing the full paths of all of them to <code>git rm</code>? I have plenty of modified files I'd like to keep so removing all modified is not possible either.</p>
<p>And also it is possible to revert the changes of several files without manually typing <code>git... | 42,890 | 283,055 | 2021-01-15 01:36:27 | 9,529,431 | 56 | 2012-03-02 07:16:18 | 579,230 | 2012-03-02 07:16:18 | https://stackoverflow.com/q/9529354 | https://stackoverflow.com/a/9529431 | <p>You can give wildcards to <code>git rm</code>.</p>
<p>e.g.</p>
<pre><code>git rm *.c
</code></pre>
<p>Or you can just write down the names of all the files in another file, say <code>filesToRemove.txt</code>:</p>
<pre><code>path/to/file.c
path/to/another/file2.c
path/to/some/other/file3.c
</code></pre>
<p>You c... | <p>You can give wildcards to <code>git rm</code>.</p> <p>e.g.</p> <pre><code>git rm *.c </code></pre> <p>Or you can just write down the names of all the files in another file, say <code>filesToRemove.txt</code>:</p> <pre><code>path/to/file.c path/to/another/file2.c path/to/some/other/file3.c </code></pre> <p>You c... | 119, 112901 | git, git-rm | <h1>Git rm several files?</h1>
<p>How do I easily remove several files without manually typing the full paths of all of them to <code>git rm</code>? I have plenty of modified files I'd like to keep so removing all modified is not possible either.</p>
<p>And also it is possible to revert the changes of several files wi... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,144 | git | # Git rm several files?
How do I easily remove several files without manually typing the full paths of all of them to `git rm`? I have plenty of modified files I'd like to keep so removing all modified is not possible either.
And also it is possible to revert the changes of several files without manually typing `git ... | You can give wildcards to `git rm`.
e.g.
```
git rm *.c
```
Or you can just write down the names of all the files in another file, say `filesToRemove.txt`:
```
path/to/file.c
path/to/another/file2.c
path/to/some/other/file3.c
```
You can automate this:
```
find . -name '*.c' > filesToRemove.txt
```
Open the file... |
58550439 | Am I meant to commit yarn's `.pnp.js` file? | 35 | 2019-10-24 23:38:07 | <p>Yarn includes an optional <a href="https://yarnpkg.com/en/docs/pnp" rel="noreferrer">"Plug'n'Play" feature</a> which moves <code>node_modules</code> out of the project directory. In doing so it creates a <code>.pnp.js</code> file with references to various dependency paths on the hard drive.</p>
<p>The file is auto... | 13,577 | 7,003,127 | 2021-04-21 16:10:42 | 58,550,620 | 56 | 2019-10-25 00:12:23 | null | 2019-10-25 00:12:23 | https://stackoverflow.com/q/58550439 | https://stackoverflow.com/a/58550620 | <p>I found <a href="https://github.com/yarnpkg/berry/issues/454#issuecomment-530312089" rel="noreferrer">this comment by Arcanis</a> (the lead maintainer of Yarn) on an issue asking about what to include in a <code>.gitignore</code>. It may answer your question:</p>
<blockquote>
<ul>
<li><p><code>.yarn/plugins</co... | <p>I found <a href="https://github.com/yarnpkg/berry/issues/454#issuecomment-530312089" rel="noreferrer">this comment by Arcanis</a> (the lead maintainer of Yarn) on an issue asking about what to include in a <code>.gitignore</code>. It may answer your question:</p> <blockquote> <ul> <li><p><code>.yarn/plugins</co... | 3, 119, 46426, 122493 | git, javascript, node.js, yarnpkg | <h1>Am I meant to commit yarn's `.pnp.js` file?</h1>
<p>Yarn includes an optional <a href="https://yarnpkg.com/en/docs/pnp" rel="noreferrer">"Plug'n'Play" feature</a> which moves <code>node_modules</code> out of the project directory. In doing so it creates a <code>.pnp.js</code> file with references to various depende... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,145 | git | # Am I meant to commit yarn's `.pnp.js` file?
Yarn includes an optional ["Plug'n'Play" feature](https://yarnpkg.com/en/docs/pnp) which moves `node_modules` out of the project directory. In doing so it creates a `.pnp.js` file with references to various dependency paths on the hard drive.
The file is auto-generated, i... | I found [this comment by Arcanis](https://github.com/yarnpkg/berry/issues/454#issuecomment-530312089) (the lead maintainer of Yarn) on an issue asking about what to include in a `.gitignore`. It may answer your question:
> - `.yarn/plugins` and `.yarn/releases` contain the Yarn releases used in the current repository ... |
9302681 | C: how to break apart a multi digit number into separate variables? | 32 | 2012-02-15 22:46:51 | <p>Say I have a multi-digit integer in C. I want to break it up into single-digit integers.</p>
<p><code>123</code> would turn into <code>1</code>, <code>2</code>, and <code>3</code>.</p>
<p>How can I do this, especially if I don't know how many digits the integer has?</p>
| 166,948 | 949,275 | 2025-10-22 07:16:42 | 9,302,745 | 56 | 2012-02-15 22:52:02 | 1,211,744 | 2012-02-15 22:52:02 | https://stackoverflow.com/q/9302681 | https://stackoverflow.com/a/9302745 | <pre><code>int value = 123;
while (value > 0) {
int digit = value % 10;
// do something with digit
value /= 10;
}
</code></pre>
| <pre><code>int value = 123; while (value > 0) { int digit = value % 10; // do something with digit value /= 10; } </code></pre> | 8, 259, 3496, 9914, 48894 | c, digit, digits, math, numbers | <h1>C: how to break apart a multi digit number into separate variables?</h1>
<p>Say I have a multi-digit integer in C. I want to break it up into single-digit integers.</p>
<p><code>123</code> would turn into <code>1</code>, <code>2</code>, and <code>3</code>.</p>
<p>How can I do this, especially if I don't know how ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,147 | git | # C: how to break apart a multi digit number into separate variables?
Say I have a multi-digit integer in C. I want to break it up into single-digit integers.
`123` would turn into `1`, `2`, and `3`.
How can I do this, especially if I don't know how many digits the integer has? | ```
int value = 123;
while (value > 0) {
int digit = value % 10;
// do something with digit
value /= 10;
}
``` |
47559855 | Git: move repository to a subfolder of another repository | 30 | 2017-11-29 18:56:35 | <p>I have two separate git repositories(in BitBucket), <code>Repo A</code> and <code>Repo B</code>. I would like to move <code>Repo B</code> into a subfolder of <code>Repo A</code>. I also need ensure that the commit history etc. in <code>Repo B</code> is preserved and not lost. </p>
<p>How can I achieve this with git... | 14,127 | 7,128,479 | 2020-04-01 23:21:39 | 47,571,452 | 56 | 2017-11-30 10:43:37 | 2,618,670 | 2017-11-30 10:43:37 | https://stackoverflow.com/q/47559855 | https://stackoverflow.com/a/47571452 | <p>To merge a Repo B into Repo A as a subfolder, run this command inside Repo A;</p>
<pre><code>git subtree add -P <prefix> <repo> <rev>
</code></pre>
<p>Set <code><prefix></code> to the name of the subdirectory, <code><repo></code> to the clone URL of Repo B, and <code><rev></code... | <p>To merge a Repo B into Repo A as a subfolder, run this command inside Repo A;</p> <pre><code>git subtree add -P <prefix> <repo> <rev> </code></pre> <p>Set <code><prefix></code> to the name of the subdirectory, <code><repo></code> to the clone URL of Repo B, and <code><rev></code... | 119, 8337 | bitbucket, git | <h1>Git: move repository to a subfolder of another repository</h1>
<p>I have two separate git repositories(in BitBucket), <code>Repo A</code> and <code>Repo B</code>. I would like to move <code>Repo B</code> into a subfolder of <code>Repo A</code>. I also need ensure that the commit history etc. in <code>Repo B</code> ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,148 | git | # Git: move repository to a subfolder of another repository
I have two separate git repositories(in BitBucket), `Repo A` and `Repo B`. I would like to move `Repo B` into a subfolder of `Repo A`. I also need ensure that the commit history etc. in `Repo B` is preserved and not lost.
How can I achieve this with git? | To merge a Repo B into Repo A as a subfolder, run this command inside Repo A;
```
git subtree add -P <prefix> <repo> <rev>
```
Set `<prefix>` to the name of the subdirectory, `<repo>` to the clone URL of Repo B, and `<rev>` to the revision of Repo B you want (HEAD if latest)
This will take the history of Repo B and ... |
31744852 | npm install giving error while accessing GIT url | 30 | 2015-07-31 11:15:32 | <p>my package.json has the following dependency,</p>
<pre><code> {
"name": "AppName",
"version": "0.0.0",
"description": "App Description",
"author": "@author",
"dependencies": {},
"devDependencies": {
"css-flip": "git://github.com/geedmo/css-flip",
"gulp": "^3.8.10",
"gulp-angular-htmlify":... | 76,572 | 1,822,974 | 2022-12-29 19:03:12 | 31,745,910 | 56 | 2015-07-31 12:12:32 | 1,822,974 | 2016-01-28 14:42:07 | https://stackoverflow.com/q/31744852 | https://stackoverflow.com/a/31745910 | <p><strong>This question has an answer in an other <a href="https://stackoverflow.com/q/16298986/1822974">thread</a></strong>. The issue occurred since I was behind corporate proxy. And <a href="https://stackoverflow.com/questions/16298986/unable-to-connect-to-github-com-for-cloning/18889129#18889129">@bnguyen82</a>'s ... | <p><strong>This question has an answer in an other <a href="https://stackoverflow.com/q/16298986/1822974">thread</a></strong>. The issue occurred since I was behind corporate proxy. And <a href="https://stackoverflow.com/questions/16298986/unable-to-connect-to-github-com-for-cloning/18889129#18889129">@bnguyen82</a>'s ... | 119, 46426, 61387 | git, node.js, npm | <h1>npm install giving error while accessing GIT url</h1>
<p>my package.json has the following dependency,</p>
<pre><code> {
"name": "AppName",
"version": "0.0.0",
"description": "App Description",
"author": "@author",
"dependencies": {},
"devDependencies": {
"css-flip": "git://github.com/geedmo/css... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,149 | git | # npm install giving error while accessing GIT url
my package.json has the following dependency,
```
{
"name": "AppName",
"version": "0.0.0",
"description": "App Description",
"author": "@author",
"dependencies": {},
"devDependencies": {
"css-flip": "git://github.com/geedmo/css-flip",
"gulp": ... | **This question has an answer in an other [thread](https://stackoverflow.com/q/16298986/1822974)**. The issue occurred since I was behind corporate proxy. And [@bnguyen82](https://stackoverflow.com/questions/16298986/unable-to-connect-to-github-com-for-cloning/18889129#18889129)'s answer helped me finally.
I just used... |
1767980 | Merging two remote repositories in Git | 30 | 2009-11-20 02:40:56 | <p>I want to merge two remote repositories in Git. </p>
<p>One is mainstream repository, which I do not have write permission. I want to track its master branch.</p>
<p>The other is maintained by us, I have full rights on it.</p>
<p>I want to track the mainstream code. At the same time, our modification would be rec... | 21,698 | 458,058 | 2013-06-14 19:48:02 | 1,768,800 | 56 | 2009-11-20 06:58:24 | 6,309 | 2013-06-14 19:48:02 | https://stackoverflow.com/q/1767980 | https://stackoverflow.com/a/1768800 | <p>I would recommend:</p>
<ul>
<li>cloning <code>yourRemoteRepo</code> (that way, you can easily pull/push from that repo)</li>
<li><p>adding <code>mainstreamRepo</code> as a remote and fetch its branch, then track the one which interest you</p>
<pre><code>git clone git://yourRemoteRepo
git remote add mainStreamRepo ... | <p>I would recommend:</p> <ul> <li>cloning <code>yourRemoteRepo</code> (that way, you can easily pull/push from that repo)</li> <li><p>adding <code>mainstreamRepo</code> as a remote and fetch its branch, then track the one which interest you</p> <pre><code>git clone git://yourRemoteRepo git remote add mainStreamRepo ... | 119, 28897 | git, git-merge | <h1>Merging two remote repositories in Git</h1>
<p>I want to merge two remote repositories in Git. </p>
<p>One is mainstream repository, which I do not have write permission. I want to track its master branch.</p>
<p>The other is maintained by us, I have full rights on it.</p>
<p>I want to track the mainstream code.... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,150 | git | # Merging two remote repositories in Git
I want to merge two remote repositories in Git.
One is mainstream repository, which I do not have write permission. I want to track its master branch.
The other is maintained by us, I have full rights on it.
I want to track the mainstream code. At the same time, our modifica... | I would recommend:
- cloning `yourRemoteRepo` (that way, you can easily pull/push from that repo)
- adding `mainstreamRepo` as a remote and fetch its branch, then track the one which interest you
```
git clone git://yourRemoteRepo
git remote add mainStreamRepo http://mainStreamRepo
git fetch mainStreamRepo
... |
6748083 | How do I find out what Git thinks the top-level working directory is? | 28 | 2011-07-19 13:40:39 | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="https://stackoverflow.com/questions/957928/is-there-a-way-to-get-to-the-git-root-directory-in-one-command">Is there a way to get to the git root directory in one command?</a> </p>
</blockquote>
<p>Sometimes, I'm confused with git thinking that I'... | 18,785 | 94,687 | 2011-07-19 14:17:10 | 6,748,135 | 56 | 2011-07-19 13:44:37 | 385,478 | 2011-07-19 13:44:37 | https://stackoverflow.com/q/6748083 | https://stackoverflow.com/a/6748135 | <p>Try this:</p>
<pre><code>git rev-parse --show-toplevel
</code></pre>
| <p>Try this:</p> <pre><code>git rev-parse --show-toplevel </code></pre> | 119, 218, 10193, 32868 | directory, find, git, git-config | <h1>How do I find out what Git thinks the top-level working directory is?</h1>
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="https://stackoverflow.com/questions/957928/is-there-a-way-to-get-to-the-git-root-directory-in-one-command">Is there a way to get to the git root directory in one command?<... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,153 | git | # How do I find out what Git thinks the top-level working directory is?
> **Possible Duplicate:**
> [Is there a way to get to the git root directory in one command?](https://stackoverflow.com/questions/957928/is-there-a-way-to-get-to-the-git-root-directory-in-one-command)
Sometimes, I'm confused with git thinking t... | Try this:
```
git rev-parse --show-toplevel
``` |
65738611 | Why does Git ignore not work for __pycache__ folder? | 26 | 2021-01-15 15:12:29 | <p>I have 3 paths that I'm trying to ignore in my <code>.gitignore</code> file:</p>
<pre><code>aws_scripts/python/aws_tools/__pycache__/
.vscode/
aws_scripts/output_files/
aws_scripts/source_files/
</code></pre>
<p>Everything gets ignored except for <code>aws_scripts/python/aws_tools/__pycache__/</code></p>
<pre><code>... | 41,089 | 14,867,728 | 2022-12-23 05:52:24 | 65,738,996 | 56 | 2021-01-15 15:37:18 | 12,118,546 | 2022-12-23 05:52:24 | https://stackoverflow.com/q/65738611 | https://stackoverflow.com/a/65738996 | <p>Notice the <code>modified</code> in your <code>git status</code> output. That means you already added and commited the <code>__pycache__</code>.</p>
<p><code>git rm -rf <PATH></code> it, commit and it should start to be properly ignored.</p>
<p>It is not a bad idea to start with official <code>.gitignore</code... | <p>Notice the <code>modified</code> in your <code>git status</code> output. That means you already added and commited the <code>__pycache__</code>.</p> <p><code>git rm -rf <PATH></code> it, commit and it should start to be properly ignored.</p> <p>It is not a bad idea to start with official <code>.gitignore</code... | 119, 25056 | git, gitignore | <h1>Why does Git ignore not work for __pycache__ folder?</h1>
<p>I have 3 paths that I'm trying to ignore in my <code>.gitignore</code> file:</p>
<pre><code>aws_scripts/python/aws_tools/__pycache__/
.vscode/
aws_scripts/output_files/
aws_scripts/source_files/
</code></pre>
<p>Everything gets ignored except for <code>aw... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,154 | git | # Why does Git ignore not work for __pycache__ folder?
I have 3 paths that I'm trying to ignore in my `.gitignore` file:
```
aws_scripts/python/aws_tools/__pycache__/
.vscode/
aws_scripts/output_files/
aws_scripts/source_files/
```
Everything gets ignored except for `aws_scripts/python/aws_tools/__pycache__/`
```
g... | Notice the `modified` in your `git status` output. That means you already added and commited the `__pycache__`.
`git rm -rf <PATH>` it, commit and it should start to be properly ignored.
It is not a bad idea to start with official `.gitignore`s from the beginning and extend those: <https://github.com/github/gitignore... |
509859 | What is the best way to git patch a subrange of a branch? | 25 | 2009-02-04 02:22:23 | <p>In Subversion, it is easy to merge a range of changesets/diffs from a branch using "svn merge -r a:b mybranch". But in git, I found it is only possible to cherry-pick a single commit from a branch to apply that patch to my current working branch. So I am wondering if there is a fast way to apply all the commits in o... | 18,182 | 54,060 | 2021-07-30 18:55:26 | 510,453 | 56 | 2009-02-04 07:59:03 | 19,563 | 2009-02-04 07:59:03 | https://stackoverflow.com/q/509859 | https://stackoverflow.com/a/510453 | <p>The easiest way to perform the action that you are looking for is with <code>git rebase</code>. Here's a recipe. Assume that tag A is the commit on top of which the patch series that you want to select is based and that tag B is the commit of the final patch in the series. Also, assume that br is the name of the cur... | <p>The easiest way to perform the action that you are looking for is with <code>git rebase</code>. Here's a recipe. Assume that tag A is the commit on top of which the patch series that you want to select is based and that tag B is the commit of the final patch in the series. Also, assume that br is the name of the cur... | 119 | git | <h1>What is the best way to git patch a subrange of a branch?</h1>
<p>In Subversion, it is easy to merge a range of changesets/diffs from a branch using "svn merge -r a:b mybranch". But in git, I found it is only possible to cherry-pick a single commit from a branch to apply that patch to my current working branch. So ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,155 | git | # What is the best way to git patch a subrange of a branch?
In Subversion, it is easy to merge a range of changesets/diffs from a branch using "svn merge -r a:b mybranch". But in git, I found it is only possible to cherry-pick a single commit from a branch to apply that patch to my current working branch. So I am wond... | The easiest way to perform the action that you are looking for is with `git rebase`. Here's a recipe. Assume that tag A is the commit on top of which the patch series that you want to select is based and that tag B is the commit of the final patch in the series. Also, assume that br is the name of the current branch an... |
14465326 | How do I fix the path of my local git repo after move? | 24 | 2013-01-22 18:16:08 | <p>How do I fix the path of my local git repo after move?</p>
<pre><code>previous local location: /C/website
new local location: /C/Projects/website
remote location: git@bitbucket.org:username/website.git
</code></pre>
<p>I moved my git repository from one folder <code>/website</code> to another <code>/projects/websi... | 23,687 | 659,634 | 2015-08-11 08:35:12 | 14,465,358 | 56 | 2013-01-22 18:18:17 | 1,093,528 | 2013-01-22 20:07:13 | https://stackoverflow.com/q/14465326 | https://stackoverflow.com/a/14465358 | <p>Run <code>git config -e</code> and change the address of the remote, to the correct remote location. In your case that will be <code>url = git@bitbucket.org:username/website.git</code> This command will open for editing the <code>.git/config</code> file of the repository.</p>
<p>(thanks to @Richard for the command)... | <p>Run <code>git config -e</code> and change the address of the remote, to the correct remote location. In your case that will be <code>url = git@bitbucket.org:username/website.git</code> This command will open for editing the <code>.git/config</code> file of the repository.</p> <p>(thanks to @Richard for the command)... | 119, 5634 | git, move | <h1>How do I fix the path of my local git repo after move?</h1>
<p>How do I fix the path of my local git repo after move?</p>
<pre><code>previous local location: /C/website
new local location: /C/Projects/website
remote location: git@bitbucket.org:username/website.git
</code></pre>
<p>I moved my git repository from o... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,157 | git | # How do I fix the path of my local git repo after move?
How do I fix the path of my local git repo after move?
```
previous local location: /C/website
new local location: /C/Projects/website
remote location: git@bitbucket.org:username/website.git
```
I moved my git repository from one folder `/website` to another `... | Run `git config -e` and change the address of the remote, to the correct remote location. In your case that will be `url = git@bitbucket.org:username/website.git` This command will open for editing the `.git/config` file of the repository.
(thanks to @Richard for the command)
Shortcut command:
```
git config remote.... |
70051009 | amending a commit after it has been pushed | 21 | 2021-11-21 00:42:01 | <p>In my most recent commit to my repository that has already been pushed, I noticed I misspelled a single word in a file and now would like to change it. However, I do not want to create a whole new commit. Is there a way to amend my latest commit and push that into my repository without having to reset, remove, and p... | 49,097 | 12,549,160 | 2021-11-21 01:11:40 | 70,051,106 | 56 | 2021-11-21 01:11:40 | 1,256,452 | 2021-11-21 01:11:40 | https://stackoverflow.com/q/70051009 | https://stackoverflow.com/a/70051106 | <p>It's impossible to change <em>any</em> commit. That includes <em>before it's pushed</em>. The reason this is important to know—the reason you need to know that <code>git commit --amend</code> is a lie—is that what <code>git commit --amend</code> does locally, <em>can</em> be done here when pushing a commit to anot... | <p>It's impossible to change <em>any</em> commit. That includes <em>before it's pushed</em>. The reason this is important to know—the reason you need to know that <code>git commit --amend</code> is a lie—is that what <code>git commit --amend</code> does locally, <em>can</em> be done here when pushing a commit to anot... | 119, 5597, 30968 | commit, git, git-amend | <h1>amending a commit after it has been pushed</h1>
<p>In my most recent commit to my repository that has already been pushed, I noticed I misspelled a single word in a file and now would like to change it. However, I do not want to create a whole new commit. Is there a way to amend my latest commit and push that into ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,159 | git | # amending a commit after it has been pushed
In my most recent commit to my repository that has already been pushed, I noticed I misspelled a single word in a file and now would like to change it. However, I do not want to create a whole new commit. Is there a way to amend my latest commit and push that into my reposi... | It's impossible to change *any* commit. That includes *before it's pushed*. The reason this is important to know—the reason you need to know that `git commit --amend` is a lie—is that what `git commit --amend` does locally, *can* be done here when pushing a commit to another Git repository.
The (tiny) lie with `git co... |
26247614 | Files deleted after rebase with git, how to recover? | 17 | 2014-10-08 00:56:46 | <p>I had some files on my project which rebase deleted. I did not commit anything.
I lost some important files, how can I recover them?</p>
| 17,401 | 3,830,527 | 2020-07-28 21:14:51 | 26,247,673 | 56 | 2014-10-08 01:03:42 | 1,734,130 | 2014-10-08 01:03:42 | https://stackoverflow.com/q/26247614 | https://stackoverflow.com/a/26247673 | <p><code>git reflog</code> works wonders in such situations: simply use <code>git reflog</code> and note few recent commits that were active. Then use <code>git checkout commit_id</code> to checkout to any particular commit. Most likely, you need previous commit (current one is one you have screwed up).</p>
<p>Also, i... | <p><code>git reflog</code> works wonders in such situations: simply use <code>git reflog</code> and note few recent commits that were active. Then use <code>git checkout commit_id</code> to checkout to any particular commit. Most likely, you need previous commit (current one is one you have screwed up).</p> <p>Also, i... | 119 | git | <h1>Files deleted after rebase with git, how to recover?</h1>
<p>I had some files on my project which rebase deleted. I did not commit anything.
I lost some important files, how can I recover them?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,160 | git | # Files deleted after rebase with git, how to recover?
I had some files on my project which rebase deleted. I did not commit anything.
I lost some important files, how can I recover them? | `git reflog` works wonders in such situations: simply use `git reflog` and note few recent commits that were active. Then use `git checkout commit_id` to checkout to any particular commit. Most likely, you need previous commit (current one is one you have screwed up).
Also, if you rebase was not committed yet, you can... |
62072056 | What do characters like !1 at the end of my Powerlevel10k prompt mean? | 12 | 2020-05-28 18:33:57 | <p>I'm using Oh My Zsh with the Powerlevel10k theme.</p>
<p>I've installed the recommended fonts directly from the Powerlevel10k docs, updated the settings for fonts in Terminal, iTerm2, and VS Code according to the docs, and it mostly works, except that there is always some unexpected character at the end of the promp... | 12,084 | 5,745,269 | 2023-08-23 19:15:13 | 62,084,089 | 56 | 2020-05-29 10:42:31 | 1,095,235 | 2023-08-23 19:15:13 | https://stackoverflow.com/q/62072056 | https://stackoverflow.com/a/62084089 | <p>From the <a href="https://github.com/romkatv/powerlevel10k/blob/master/README.md#what-do-different-symbols-in-git-status-mean" rel="noreferrer">Powerlevel10k FAQ</a>:</p>
<blockquote>
<p><strong>Q: What do different symbols in Git status mean?</strong></p>
<p>When using <em>Lean</em>, <em>Classic</em> or <em>Rainbow... | <p>From the <a href="https://github.com/romkatv/powerlevel10k/blob/master/README.md#what-do-different-symbols-in-git-status-mean" rel="noreferrer">Powerlevel10k FAQ</a>:</p> <blockquote> <p><strong>Q: What do different symbols in Git status mean?</strong></p> <p>When using <em>Lean</em>, <em>Classic</em> or <em>Rainbow... | 119, 3791, 9938, 54839, 93854 | command-prompt, git, git-status, oh-my-zsh, zsh | <h1>What do characters like !1 at the end of my Powerlevel10k prompt mean?</h1>
<p>I'm using Oh My Zsh with the Powerlevel10k theme.</p>
<p>I've installed the recommended fonts directly from the Powerlevel10k docs, updated the settings for fonts in Terminal, iTerm2, and VS Code according to the docs, and it mostly work... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,161 | git | # What do characters like !1 at the end of my Powerlevel10k prompt mean?
I'm using Oh My Zsh with the Powerlevel10k theme.
I've installed the recommended fonts directly from the Powerlevel10k docs, updated the settings for fonts in Terminal, iTerm2, and VS Code according to the docs, and it mostly works, except that ... | From the [Powerlevel10k FAQ](https://github.com/romkatv/powerlevel10k/blob/master/README.md#what-do-different-symbols-in-git-status-mean):
> **Q: What do different symbols in Git status mean?**
>
> When using *Lean*, *Classic* or *Rainbow* style, Git status may look like this:
>
> ```
> feature:master wip ⇣42⇡42 ⇠42⇢4... |
32688688 | How to write setup.py to include a Git repository as a dependency | 181 | 2015-09-21 06:30:06 | <p>I am trying to write <code>setup.py</code> for my package. My package needs to specify a dependency on another Git repository.</p>
<p>This is what I have so far:</p>
<pre><code>from setuptools import setup, find_packages
setup(
name='abc',
packages=find_packages(),
url='https://github.abc.com/abc/myabc'... | 106,511 | 494,074 | 2024-04-16 14:41:32 | 32,689,886 | 55 | 2015-09-21 07:46:25 | 2,272,172 | 2023-03-23 15:13:09 | https://stackoverflow.com/q/32688688 | https://stackoverflow.com/a/32689886 | <p><strong>Note:</strong> this answer is now outdated. Have a look at this answer for up-to-date instructions: <a href="https://stackoverflow.com/a/54701434/212774">https://stackoverflow.com/a/54701434/212774</a></p>
<hr />
<p>You can find the right way to do it <a href="https://python-packaging.readthedocs.io/en/lates... | <p><strong>Note:</strong> this answer is now outdated. Have a look at this answer for up-to-date instructions: <a href="https://stackoverflow.com/a/54701434/212774">https://stackoverflow.com/a/54701434/212774</a></p> <hr /> <p>You can find the right way to do it <a href="https://python-packaging.readthedocs.io/en/lates... | 16, 119, 243, 2010, 11066 | django, git, packaging, python, setuptools | <h1>How to write setup.py to include a Git repository as a dependency</h1>
<p>I am trying to write <code>setup.py</code> for my package. My package needs to specify a dependency on another Git repository.</p>
<p>This is what I have so far:</p>
<pre><code>from setuptools import setup, find_packages
setup(
name='abc... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,162 | git | # How to write setup.py to include a Git repository as a dependency
I am trying to write `setup.py` for my package. My package needs to specify a dependency on another Git repository.
This is what I have so far:
```
from setuptools import setup, find_packages
setup(
name='abc',
packages=find_packages(),
... | **Note:** this answer is now outdated. Have a look at this answer for up-to-date instructions: <https://stackoverflow.com/a/54701434/212774>
---
You can find the right way to do it [here](https://python-packaging.readthedocs.io/en/latest/dependencies.html#packages-not-on-pypi).
```
dependency_links=['http://github.c... |
4931384 | git - Server host key not cached | 117 | 2011-02-08 09:31:08 | <p>I try to push changes from my local repo to a remote repo. When I type:</p>
<pre><code>git push origin
</code></pre>
<p>I get the following error:</p>
<pre><code>The server's host key is not cached in the registry. You
have no guarantee that the server is the computer you
think it is.
The server's rsa2 key finger... | 182,336 | 279,573 | 2023-05-09 13:44:52 | 4,931,445 | 55 | 2011-02-08 09:39:01 | 520,162 | 2018-02-14 16:09:26 | https://stackoverflow.com/q/4931384 | https://stackoverflow.com/a/4931445 | <p>The message means that the host key of <code>origin</code> is not present in your trusted hosts file.</p>
<p>To get around this, open a plain SSH connection to <code>origin</code> and SSH will ask you if you want to trust the remote host (from the Git console):</p>
<pre><code>$ ssh 127.0.0.1
The authenticity of ho... | <p>The message means that the host key of <code>origin</code> is not present in your trusted hosts file.</p> <p>To get around this, open a plain SSH connection to <code>origin</code> and SSH will ask you if you want to trust the remote host (from the Git console):</p> <pre><code>$ ssh 127.0.0.1 The authenticity of ho... | 64, 119, 386, 1768, 2306 | git, plink, putty, ssh, windows | <h1>git - Server host key not cached</h1>
<p>I try to push changes from my local repo to a remote repo. When I type:</p>
<pre><code>git push origin
</code></pre>
<p>I get the following error:</p>
<pre><code>The server's host key is not cached in the registry. You
have no guarantee that the server is the computer you... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,163 | git | # git - Server host key not cached
I try to push changes from my local repo to a remote repo. When I type:
```
git push origin
```
I get the following error:
```
The server's host key is not cached in the registry. You
have no guarantee that the server is the computer you
think it is.
The server's rsa2 key fingerpr... | The message means that the host key of `origin` is not present in your trusted hosts file.
To get around this, open a plain SSH connection to `origin` and SSH will ask you if you want to trust the remote host (from the Git console):
```
$ ssh 127.0.0.1
The authenticity of host '127.0.0.1 (127.0.0.1)' can't be establi... |
3921409 | How to know if there is a git rebase in progress? | 88 | 2010-10-13 06:58:11 | <p>When I start a <code>git rebase -i</code>, I can issue commands like <code>git rebase --continue</code>, or <code>git rebase --abort</code>. Those commands only work if a rebase is in progress.</p>
<p>How can I know if there is a rebase in progress?</p>
<p>(I would greatly appreciate some details on how rebase wor... | 50,093 | 262,667 | 2025-02-06 20:37:14 | 3,921,928 | 55 | 2010-10-13 08:29:55 | 6,309 | 2021-04-24 18:29:54 | https://stackoverflow.com/q/3921409 | https://stackoverflow.com/a/3921928 | <p>Update 2021:</p>
<p>As I mentioned in "<a href="https://stackoverflow.com/a/52318372/6309"><code>git stash</code> is slow on windows</a>", with <a href="https://github.com/git-for-windows/git/releases/tag/v2.19.0.windows.1" rel="nofollow noreferrer">Git for Windows 2.19</a> (Sept. 2018), <code>git stash</c... | <p>Update 2021:</p> <p>As I mentioned in "<a href="https://stackoverflow.com/a/52318372/6309"><code>git stash</code> is slow on windows</a>", with <a href="https://github.com/git-for-windows/git/releases/tag/v2.19.0.windows.1" rel="nofollow noreferrer">Git for Windows 2.19</a> (Sept. 2018), <code>git stash</c... | 119, 29934 | git, git-rebase | <h1>How to know if there is a git rebase in progress?</h1>
<p>When I start a <code>git rebase -i</code>, I can issue commands like <code>git rebase --continue</code>, or <code>git rebase --abort</code>. Those commands only work if a rebase is in progress.</p>
<p>How can I know if there is a rebase in progress?</p>
<p... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,165 | git | # How to know if there is a git rebase in progress?
When I start a `git rebase -i`, I can issue commands like `git rebase --continue`, or `git rebase --abort`. Those commands only work if a rebase is in progress.
How can I know if there is a rebase in progress?
(I would greatly appreciate some details on how rebase ... | Update 2021:
As I mentioned in "[`git stash` is slow on windows](https://stackoverflow.com/a/52318372/6309)", with [Git for Windows 2.19](https://github.com/git-for-windows/git/releases/tag/v2.19.0.windows.1) (Sept. 2018), `git stash` (and `git rebase`) are no longer script-only, but actually a binary compiled with `g... |
3124601 | Git: getting changes from another branch | 81 | 2010-06-26 16:28:27 | <p>I have a project which uses git and I'd like to start a new branch to add a major new feature.</p>
<p>Under the <code>main</code> branch, I'll continue to add bug fixes and minor features. At regular intervals I'd like to pull the changes from the main branch into my "major new feature" branch. What's the best way ... | 99,801 | 332,460 | 2020-05-28 07:56:48 | 3,124,613 | 55 | 2010-06-26 16:30:25 | 108,590 | 2010-06-26 16:30:25 | https://stackoverflow.com/q/3124601 | https://stackoverflow.com/a/3124613 | <p><code>git checkout featurebranch && git merge master</code></p>
<p>You can do this as many times as you like; it won't affect master and you will be able to easily do it the other way around whenever you find out you are done with the feature branch.</p>
| <p><code>git checkout featurebranch && git merge master</code></p> <p>You can do this as many times as you like; it won't affect master and you will be able to easily do it the other way around whenever you find out you are done with the feature branch.</p> | 119 | git | <h1>Git: getting changes from another branch</h1>
<p>I have a project which uses git and I'd like to start a new branch to add a major new feature.</p>
<p>Under the <code>main</code> branch, I'll continue to add bug fixes and minor features. At regular intervals I'd like to pull the changes from the main branch into m... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,166 | git | # Git: getting changes from another branch
I have a project which uses git and I'd like to start a new branch to add a major new feature.
Under the `main` branch, I'll continue to add bug fixes and minor features. At regular intervals I'd like to pull the changes from the main branch into my "major new feature" branc... | `git checkout featurebranch && git merge master`
You can do this as many times as you like; it won't affect master and you will be able to easily do it the other way around whenever you find out you are done with the feature branch. |
17743078 | Retrieve deleted stash in Git using SourceTree | 79 | 2013-07-19 09:49:44 | <p>I am using source tree. I had created a stash of multiple changes and by mistake deleted it. Is there a way to retrieve them back?</p>
| 41,591 | 1,040,006 | 2025-02-14 10:21:47 | 17,743,289 | 55 | 2013-07-19 09:59:33 | 12,471 | 2013-07-19 09:59:33 | https://stackoverflow.com/q/17743078 | https://stackoverflow.com/a/17743289 | <p>The stash is saved internally as a merge commit referenced from a list of stashes.</p>
<p><code>git fsck</code> can find dangling objects. It will find not just your deleted stash, but probably other stuff, too... so you'll be wanting to look for commits that look like they could be your stash (<code>git show <I... | <p>The stash is saved internally as a merge commit referenced from a list of stashes.</p> <p><code>git fsck</code> can find dangling objects. It will find not just your deleted stash, but probably other stuff, too... so you'll be wanting to look for commits that look like they could be your stash (<code>git show <I... | 119, 90056 | atlassian-sourcetree, git | <h1>Retrieve deleted stash in Git using SourceTree</h1>
<p>I am using source tree. I had created a stash of multiple changes and by mistake deleted it. Is there a way to retrieve them back?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,167 | git | # Retrieve deleted stash in Git using SourceTree
I am using source tree. I had created a stash of multiple changes and by mistake deleted it. Is there a way to retrieve them back? | The stash is saved internally as a merge commit referenced from a list of stashes.
`git fsck` can find dangling objects. It will find not just your deleted stash, but probably other stuff, too... so you'll be wanting to look for commits that look like they could be your stash (`git show <ID>` to display relevant info ... |
28357350 | What if two Git repositories share common code | 77 | 2015-02-06 01:56:00 | <p>I have a project which has client and server parts. I would like the client and the server code to be in different Git repositories for clear separation of the code, however, they share some files and ideally, the shared files will always be identical in both client and server.</p>
<p>How should I go about this? Is ... | 49,870 | 4,346,630 | 2024-02-09 16:40:27 | 28,357,671 | 55 | 2015-02-06 02:37:59 | 782,822 | 2015-02-06 02:37:59 | https://stackoverflow.com/q/28357350 | https://stackoverflow.com/a/28357671 | <p>I will not give advice on “How you should go about this”. But I'll explain how to accomplish integrating a third repository with common code into the other repositories: This is a job for git submodules. git submodules allow you to reference a snapshot of a git repository at a specified path:</p>
<pre><code>git sub... | <p>I will not give advice on “How you should go about this”. But I'll explain how to accomplish integrating a third repository with common code into the other repositories: This is a job for git submodules. git submodules allow you to reference a snapshot of a git repository at a specified path:</p> <pre><code>git sub... | 119 | git | <h1>What if two Git repositories share common code</h1>
<p>I have a project which has client and server parts. I would like the client and the server code to be in different Git repositories for clear separation of the code, however, they share some files and ideally, the shared files will always be identical in both c... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,168 | git | # What if two Git repositories share common code
I have a project which has client and server parts. I would like the client and the server code to be in different Git repositories for clear separation of the code, however, they share some files and ideally, the shared files will always be identical in both client and... | I will not give advice on “How you should go about this”. But I'll explain how to accomplish integrating a third repository with common code into the other repositories: This is a job for git submodules. git submodules allow you to reference a snapshot of a git repository at a specified path:
```
git submodule add git... |
1662205 | How to make a git repository read-only? | 70 | 2009-11-02 16:13:49 | <p>I have some git repositories accessed remotely through SSH and I want to make some of them read-only to prevent more pushes. Some people have remotes pointing to these repositories.</p>
<p>These bare repositories were initialised <code>--shared=group</code>, so is setting file permissions to 660 for all files good ... | 90,421 | 48,659 | 2021-09-02 14:53:31 | 1,663,441 | 55 | 2009-11-02 20:19:40 | 46,058 | 2015-02-16 19:28:03 | https://stackoverflow.com/q/1662205 | https://stackoverflow.com/a/1663441 | <p>There is more than one possible way to do this.</p>
<ul>
<li><p>If your users each have a shell account (perhaps limited), and each of them accessing git repositories via their own account, you can use <strong>filesystem permissions</strong> to control SSH access to git repositories. On Unix those would be write pe... | <p>There is more than one possible way to do this.</p> <ul> <li><p>If your users each have a shell account (perhaps limited), and each of them accessing git repositories via their own account, you can use <strong>filesystem permissions</strong> to control SSH access to git repositories. On Unix those would be write pe... | 119, 10407 | git, readonly | <h1>How to make a git repository read-only?</h1>
<p>I have some git repositories accessed remotely through SSH and I want to make some of them read-only to prevent more pushes. Some people have remotes pointing to these repositories.</p>
<p>These bare repositories were initialised <code>--shared=group</code>, so is se... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,170 | git | # How to make a git repository read-only?
I have some git repositories accessed remotely through SSH and I want to make some of them read-only to prevent more pushes. Some people have remotes pointing to these repositories.
These bare repositories were initialised `--shared=group`, so is setting file permissions to 6... | There is more than one possible way to do this.
- If your users each have a shell account (perhaps limited), and each of them accessing git repositories via their own account, you can use **filesystem permissions** to control SSH access to git repositories. On Unix those would be write permissions on *directories*, pe... |
29164321 | Git: difference between "git rebase origin/branch" and "git rebase origin branch" | 67 | 2015-03-20 10:25:31 | <p>Does anyone know what is the difference? Seems to me, it is the same. But when I run it, it didn't do the same thing:</p>
<p><code>git rebase origin/branch</code> - ok rebases from remote branch</p>
<p><code>git rebase origin branch</code> - makes conflicts</p>
| 196,121 | 3,540,591 | 2024-12-04 16:16:57 | 29,164,447 | 55 | 2015-03-20 10:31:35 | 1,005,230 | 2015-03-20 10:41:42 | https://stackoverflow.com/q/29164321 | https://stackoverflow.com/a/29164447 | <pre><code>git rebase <upstream> <branch>
</code></pre>
<p>is equal to</p>
<pre><code>git checkout <branch>
git rebase <upstream>
</code></pre>
<p>By default <code><branch></code> is <code>HEAD</code>.</p>
<p>[1] <a href="https://www.kernel.org/pub/software/scm/git/docs/git-rebase.html... | <pre><code>git rebase <upstream> <branch> </code></pre> <p>is equal to</p> <pre><code>git checkout <branch> git rebase <upstream> </code></pre> <p>By default <code><branch></code> is <code>HEAD</code>.</p> <p>[1] <a href="https://www.kernel.org/pub/software/scm/git/docs/git-rebase.html... | 119, 29934, 117536 | git, git-rebase, git-revision | <h1>Git: difference between "git rebase origin/branch" and "git rebase origin branch"</h1>
<p>Does anyone know what is the difference? Seems to me, it is the same. But when I run it, it didn't do the same thing:</p>
<p><code>git rebase origin/branch</code> - ok rebases from remote branch</p>
<p><code>git rebase origi... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,171 | git | # Git: difference between "git rebase origin/branch" and "git rebase origin branch"
Does anyone know what is the difference? Seems to me, it is the same. But when I run it, it didn't do the same thing:
`git rebase origin/branch` - ok rebases from remote branch
`git rebase origin branch` - makes conflicts | ```
git rebase <upstream> <branch>
```
is equal to
```
git checkout <branch>
git rebase <upstream>
```
By default `<branch>` is `HEAD`.
[1] <https://www.kernel.org/pub/software/scm/git/docs/git-rebase.html> |
24609146 | Stop git merge from opening text editor | 63 | 2014-07-07 11:06:10 | <p>Every time I run a git merge command it opens the text editor asking me to add an extra message.</p>
<p>How can I stop git from opening the editor & simply merging my branches? Because when it opens the editor it doesn't complete the merge, even if I add an extra message & save the file, the terminal just h... | 26,995 | 1,814,446 | 2022-02-12 00:10:38 | 24,609,196 | 55 | 2014-07-07 11:09:41 | 2,274,224 | 2015-10-21 18:49:34 | https://stackoverflow.com/q/24609146 | https://stackoverflow.com/a/24609196 | <p>Use the <code>--no-edit</code> option, you can read about it in the <a href="https://www.kernel.org/pub/software/scm/git/docs/git-merge.html" rel="noreferrer">documentation</a>.</p>
<p>Note that using the default message is discuraged, since it provides no meaningful information about the changes introduced with th... | <p>Use the <code>--no-edit</code> option, you can read about it in the <a href="https://www.kernel.org/pub/software/scm/git/docs/git-merge.html" rel="noreferrer">documentation</a>.</p> <p>Note that using the default message is discuraged, since it provides no meaningful information about the changes introduced with th... | 119, 717 | git, merge | <h1>Stop git merge from opening text editor</h1>
<p>Every time I run a git merge command it opens the text editor asking me to add an extra message.</p>
<p>How can I stop git from opening the editor & simply merging my branches? Because when it opens the editor it doesn't complete the merge, even if I add an extra... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,172 | git | # Stop git merge from opening text editor
Every time I run a git merge command it opens the text editor asking me to add an extra message.
How can I stop git from opening the editor & simply merging my branches? Because when it opens the editor it doesn't complete the merge, even if I add an extra message & save the ... | Use the `--no-edit` option, you can read about it in the [documentation](https://www.kernel.org/pub/software/scm/git/docs/git-merge.html).
Note that using the default message is discuraged, since it provides no meaningful information about the changes introduced with this merge.
---
On a sidenote: To continue mergin... |
25814946 | How to find origin of a branch in git? | 61 | 2014-09-12 18:54:13 | <p>Say if my project contains two masters (master and master_ios) and I want to see what the origin of a feature branch is (by origin, i mean the branch the feature branch is based off), how would I accomplish this in git?</p>
| 102,793 | 812,215 | 2024-10-22 05:47:14 | 25,815,019 | 55 | 2014-09-12 18:58:35 | 2,279,909 | 2014-09-12 18:58:35 | https://stackoverflow.com/q/25814946 | https://stackoverflow.com/a/25815019 | <pre><code>git remote show origin
</code></pre>
<p>shows remote and local branches with tracking info.</p>
| <pre><code>git remote show origin </code></pre> <p>shows remote and local branches with tracking info.</p> | 119, 1879 | branch, git | <h1>How to find origin of a branch in git?</h1>
<p>Say if my project contains two masters (master and master_ios) and I want to see what the origin of a feature branch is (by origin, i mean the branch the feature branch is based off), how would I accomplish this in git?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,173 | git | # How to find origin of a branch in git?
Say if my project contains two masters (master and master_ios) and I want to see what the origin of a feature branch is (by origin, i mean the branch the feature branch is based off), how would I accomplish this in git? | ```
git remote show origin
```
shows remote and local branches with tracking info. |
34496806 | Difference between git merge master and origin/master? | 55 | 2015-12-28 16:08:01 | <p>Result of the command <code>git merge origin/master</code>:</p>
<pre><code>javanoob@DELL:~/workspace/PROJECT_One$ git merge origin/master
Updating d83ef9c..dd520ea
error: The following untracked working tree files would be overwritten by merge:
sample.txt
Please move or remove them before you can merge.
Aborti... | 140,229 | 305,684 | 2017-11-08 15:51:13 | 34,496,988 | 55 | 2015-12-28 16:22:00 | 2,961,170 | 2015-12-28 16:22:00 | https://stackoverflow.com/q/34496806 | https://stackoverflow.com/a/34496988 | <p><code>git fetch</code> fetches information on remote branches, but does not make any changes to your local <code>master</code> branch. Because of this, <code>master</code> and <code>origin/master</code> are still diverged. You'd have to merge them by using <code>git pull</code>.</p>
<p>When you make a commit, your ... | <p><code>git fetch</code> fetches information on remote branches, but does not make any changes to your local <code>master</code> branch. Because of this, <code>master</code> and <code>origin/master</code> are still diverged. You'd have to merge them by using <code>git pull</code>.</p> <p>When you make a commit, your ... | 119 | git | <h1>Difference between git merge master and origin/master?</h1>
<p>Result of the command <code>git merge origin/master</code>:</p>
<pre><code>javanoob@DELL:~/workspace/PROJECT_One$ git merge origin/master
Updating d83ef9c..dd520ea
error: The following untracked working tree files would be overwritten by merge:
sa... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,175 | git | # Difference between git merge master and origin/master?
Result of the command `git merge origin/master`:
```
javanoob@DELL:~/workspace/PROJECT_One$ git merge origin/master
Updating d83ef9c..dd520ea
error: The following untracked working tree files would be overwritten by merge:
sample.txt
Please move or remove ... | `git fetch` fetches information on remote branches, but does not make any changes to your local `master` branch. Because of this, `master` and `origin/master` are still diverged. You'd have to merge them by using `git pull`.
When you make a commit, your local `master` branch is ahead of `origin/master` until you push ... |
659467 | How to apply SVN diff to Git? | 54 | 2009-03-18 18:07:37 | <p>I have my projects in 2 repositories. One under SVN and one under Git.
Whenever I change something in SVN I want to do the same thing to the Git repository.</p>
<p>Say I make a change to SVN repository, producing revision 125. How would I apply these same changes to my Git repository (assuming my Git repository is ... | 29,136 | 74,865 | 2022-12-21 23:54:10 | 659,501 | 55 | 2009-03-18 18:17:49 | 74,865 | 2022-10-31 05:44:23 | https://stackoverflow.com/q/659467 | https://stackoverflow.com/a/659501 | <p>What I actually did for was:</p>
<pre class="lang-bash prettyprint-override"><code>cd /path/to/svn/repo
svn diff -r 125 > /tmp/patch.diff
cd /path/to/git/repo
patch -p0 < /tmp/patch.diff
</code></pre>
| <p>What I actually did for was:</p> <pre class="lang-bash prettyprint-override"><code>cd /path/to/svn/repo svn diff -r 125 > /tmp/patch.diff cd /path/to/git/repo patch -p0 < /tmp/patch.diff </code></pre> | 63, 119, 456, 606, 2132 | diff, git, patch, svn, version-control | <h1>How to apply SVN diff to Git?</h1>
<p>I have my projects in 2 repositories. One under SVN and one under Git.
Whenever I change something in SVN I want to do the same thing to the Git repository.</p>
<p>Say I make a change to SVN repository, producing revision 125. How would I apply these same changes to my Git rep... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,176 | git | # How to apply SVN diff to Git?
I have my projects in 2 repositories. One under SVN and one under Git.
Whenever I change something in SVN I want to do the same thing to the Git repository.
Say I make a change to SVN repository, producing revision 125. How would I apply these same changes to my Git repository (assumin... | What I actually did for was:
```
cd /path/to/svn/repo
svn diff -r 125 > /tmp/patch.diff
cd /path/to/git/repo
patch -p0 < /tmp/patch.diff
``` |
5393178 | Get commit message in Git hook | 51 | 2011-03-22 14:57:23 | <p>I would like to check the commit message before Git commit.</p>
<p>I use a pre-commit hook to do that, but I couldn't find the way to get the commit message in the <em>.git/pre-commit</em> script.
How could I get it?</p>
| 56,173 | 47,986 | 2022-10-27 03:15:25 | 5,393,266 | 55 | 2011-03-22 15:03:27 | 223,092 | 2019-11-12 16:19:46 | https://stackoverflow.com/q/5393178 | https://stackoverflow.com/a/5393266 | <p>In the <code>pre-commit</code> hook, the commit message usually hasn't been created yet <sup>1</sup>. You probably want to use one of the <code>prepare-commit-msg</code> or <code>commit-msg</code> hooks instead. There's a <a href="http://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks" rel="noreferrer">nice secti... | <p>In the <code>pre-commit</code> hook, the commit message usually hasn't been created yet <sup>1</sup>. You probably want to use one of the <code>prepare-commit-msg</code> or <code>commit-msg</code> hooks instead. There's a <a href="http://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks" rel="noreferrer">nice secti... | 119, 853 | git, hook | <h1>Get commit message in Git hook</h1>
<p>I would like to check the commit message before Git commit.</p>
<p>I use a pre-commit hook to do that, but I couldn't find the way to get the commit message in the <em>.git/pre-commit</em> script.
How could I get it?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,178 | git | # Get commit message in Git hook
I would like to check the commit message before Git commit.
I use a pre-commit hook to do that, but I couldn't find the way to get the commit message in the *.git/pre-commit* script.
How could I get it? | In the `pre-commit` hook, the commit message usually hasn't been created yet 1. You probably want to use one of the `prepare-commit-msg` or `commit-msg` hooks instead. There's a [nice section in Pro Git](http://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks) on the order in which these hooks are run, and what you typ... |
25608809 | git log -p vs. git show vs. git diff | 47 | 2014-09-01 15:13:54 | <p>How are the commands <code>git log -p</code>, <code>git show</code>, and <code>git diff</code> related and why would one be used over another? </p>
<p>Given a repo with the following 4 commits:</p>
<blockquote>
<p>commitd - last commit<br>
commitc<br>
commitb<br>
coomita - initial commit</p>
</blockquote>
... | 21,032 | 3,997,651 | 2018-07-17 04:12:01 | 25,609,305 | 55 | 2014-09-01 15:48:16 | 112,968 | 2017-02-28 07:55:36 | https://stackoverflow.com/q/25608809 | https://stackoverflow.com/a/25609305 | <p><code>git log A B</code> shows the history of both commits <code>A</code> and <code>B</code> (basically generating a union set of each commits' history). Usually you want <code>git log A..B</code>, which can also be written as <code>git log ^B A</code> (show everything reachable from A, but <em>not</em> (<code>^</co... | <p><code>git log A B</code> shows the history of both commits <code>A</code> and <code>B</code> (basically generating a union set of each commits' history). Usually you want <code>git log A..B</code>, which can also be written as <code>git log ^B A</code> (show everything reachable from A, but <em>not</em> (<code>^</co... | 119, 9033, 47913, 74295 | git, git-diff, git-log, git-show | <h1>git log -p vs. git show vs. git diff</h1>
<p>How are the commands <code>git log -p</code>, <code>git show</code>, and <code>git diff</code> related and why would one be used over another? </p>
<p>Given a repo with the following 4 commits:</p>
<blockquote>
<p>commitd - last commit<br>
commitc<br>
commitb<br>... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,180 | git | # git log -p vs. git show vs. git diff
How are the commands `git log -p`, `git show`, and `git diff` related and why would one be used over another?
Given a repo with the following 4 commits:
> commitd - last commit
> commitc
> commitb
> coomita - initial commit
What are the differences between the following ... | `git log A B` shows the history of both commits `A` and `B` (basically generating a union set of each commits' history). Usually you want `git log A..B`, which can also be written as `git log ^B A` (show everything reachable from A, but *not* (`^`) from B). This range can also be empty (for instance `B..A` would be emp... |
11519230 | apply svn patch to git repository | 47 | 2012-07-17 09:03:14 | <p>Ok, I've tried all answers i could find on stackoverflow, but apparently none seem to be able to solve my problem. I want to apply a patch made by SVN to a git repository. Apparently the easiest way to do it is by using 'git apply', but that does not seem to work.</p>
<pre><code>$ git apply --ignore-space-change --... | 28,938 | 1,341,314 | 2021-01-29 22:38:31 | 11,652,494 | 55 | 2012-07-25 14:51:03 | 438,117 | 2012-07-25 14:51:03 | https://stackoverflow.com/q/11519230 | https://stackoverflow.com/a/11652494 | <p>I've had a few issues applying SVN generated patches with git. I'd recommend applying any subversion patches directly with <code>patch</code> command, and use git to verify that said patch was successfully applied.</p>
<pre><code>$ patch -p0 < xxx_parser.patch
$ git diff
</code></pre>
| <p>I've had a few issues applying SVN generated patches with git. I'd recommend applying any subversion patches directly with <code>patch</code> command, and use git to verify that said patch was successfully applied.</p> <pre><code>$ patch -p0 < xxx_parser.patch $ git diff </code></pre> | 63, 119, 2132 | git, patch, svn | <h1>apply svn patch to git repository</h1>
<p>Ok, I've tried all answers i could find on stackoverflow, but apparently none seem to be able to solve my problem. I want to apply a patch made by SVN to a git repository. Apparently the easiest way to do it is by using 'git apply', but that does not seem to work.</p>
<pre... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,181 | git | # apply svn patch to git repository
Ok, I've tried all answers i could find on stackoverflow, but apparently none seem to be able to solve my problem. I want to apply a patch made by SVN to a git repository. Apparently the easiest way to do it is by using 'git apply', but that does not seem to work.
```
$ git apply -... | I've had a few issues applying SVN generated patches with git. I'd recommend applying any subversion patches directly with `patch` command, and use git to verify that said patch was successfully applied.
```
$ patch -p0 < xxx_parser.patch
$ git diff
``` |
47555448 | What is a back-merge | 45 | 2017-11-29 14:44:37 | <p>I’ve watched some videos on the git-flow scripts and one term that comes up is “back merge” - e.g. hotfix is merged into master and back merged into develop.</p>
<p>I’m assuming back merge is a concept and not a native git command. What exact commands comprise a back merge operation?</p>
| 76,665 | 295,686 | 2025-02-10 16:06:47 | 47,556,234 | 55 | 2017-11-29 15:24:45 | 7,050,130 | 2017-11-29 15:24:45 | https://stackoverflow.com/q/47555448 | https://stackoverflow.com/a/47556234 | <p>The use of the term "back merge" is usually somewhat arbitrary. </p>
<p>It just means to do a merge, like any other, but in a direction that is "backwards" compared to the normal flow of the branching conventions. If you visualize branches arranged like</p>
<pre><code>master hotfix release dev featur... | <p>The use of the term "back merge" is usually somewhat arbitrary. </p> <p>It just means to do a merge, like any other, but in a direction that is "backwards" compared to the normal flow of the branching conventions. If you visualize branches arranged like</p> <pre><code>master hotfix release dev featur... | 119, 3819, 64339 | git, git-flow, terminology | <h1>What is a back-merge</h1>
<p>I’ve watched some videos on the git-flow scripts and one term that comes up is “back merge” - e.g. hotfix is merged into master and back merged into develop.</p>
<p>I’m assuming back merge is a concept and not a native git command. What exact commands comprise a back merge operation?</p... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,183 | git | # What is a back-merge
I’ve watched some videos on the git-flow scripts and one term that comes up is “back merge” - e.g. hotfix is merged into master and back merged into develop.
I’m assuming back merge is a concept and not a native git command. What exact commands comprise a back merge operation? | The use of the term "back merge" is usually somewhat arbitrary.
It just means to do a merge, like any other, but in a direction that is "backwards" compared to the normal flow of the branching conventions. If you visualize branches arranged like
```
master hotfix release dev feature
| | ... |
42358448 | How to backup git stash content? | 40 | 2017-02-21 04:02:53 | <ul>
<li>I have pending uncommitted works</li>
<li>I need to switch to another branch for some urgent work</li>
<li>As my current Work in Progress is not finished, I don't want to commit it. I use <code>git stash</code> to put it aside.</li>
</ul>
<p>Additionally, I would like to backup that stash content on a shared... | 20,404 | 657,067 | 2023-01-19 10:42:54 | 42,358,522 | 55 | 2017-02-21 04:09:33 | 4,787,126 | 2017-02-23 05:46:39 | https://stackoverflow.com/q/42358448 | https://stackoverflow.com/a/42358522 | <p>You can get the diff by running show command:</p>
<pre><code>git stash show -p > stash.diff
</code></pre>
<p>This is the diff file which you can use as a backup.</p>
<p>Later you can apply the diff to the existing repository:</p>
<pre><code>git apply stash.diff
# and potentially stash again:
git stash
</code>... | <p>You can get the diff by running show command:</p> <pre><code>git stash show -p > stash.diff </code></pre> <p>This is the diff file which you can use as a backup.</p> <p>Later you can apply the diff to the existing repository:</p> <pre><code>git apply stash.diff # and potentially stash again: git stash </code>... | 119 | git | <h1>How to backup git stash content?</h1>
<ul>
<li>I have pending uncommitted works</li>
<li>I need to switch to another branch for some urgent work</li>
<li>As my current Work in Progress is not finished, I don't want to commit it. I use <code>git stash</code> to put it aside.</li>
</ul>
<p>Additionally, I would lik... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,185 | git | # How to backup git stash content?
- I have pending uncommitted works
- I need to switch to another branch for some urgent work
- As my current Work in Progress is not finished, I don't want to commit it. I use `git stash` to put it aside.
Additionally, I would like to backup that stash content on a shared drive. Jus... | You can get the diff by running show command:
```
git stash show -p > stash.diff
```
This is the diff file which you can use as a backup.
Later you can apply the diff to the existing repository:
```
git apply stash.diff
# and potentially stash again:
git stash
``` |
40172615 | How to list only file names that have changed between two branches | 40 | 2016-10-21 09:10:15 | <p>I have two branches in my repository which I want to diff for some files.</p>
<p>I want to list only newly added migrations between those two branches.</p>
<p>Something like:</p>
<pre><code>git diff branch1 branch2 | grep /db/migrate
</code></pre>
<p>How can I do it?</p>
| 26,335 | 4,758,119 | 2022-12-12 21:13:17 | 40,172,944 | 55 | 2016-10-21 09:25:39 | null | 2019-08-05 21:05:27 | https://stackoverflow.com/q/40172615 | https://stackoverflow.com/a/40172944 | <p>This command will diff their whole history:</p>
<blockquote>
<p>git diff branch1..branch2 --name-only</p>
</blockquote>
<p>If you want to compare from their last common ancestor, then:</p>
<blockquote>
<p>git diff branch1...branch2 --name-only</p>
</blockquote>
<p>And now you can grep files that you want. Fr... | <p>This command will diff their whole history:</p> <blockquote> <p>git diff branch1..branch2 --name-only</p> </blockquote> <p>If you want to compare from their last common ancestor, then:</p> <blockquote> <p>git diff branch1...branch2 --name-only</p> </blockquote> <p>And now you can grep files that you want. Fr... | 9033 | git-diff | <h1>How to list only file names that have changed between two branches</h1>
<p>I have two branches in my repository which I want to diff for some files.</p>
<p>I want to list only newly added migrations between those two branches.</p>
<p>Something like:</p>
<pre><code>git diff branch1 branch2 | grep /db/migrate
</co... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,186 | git | # How to list only file names that have changed between two branches
I have two branches in my repository which I want to diff for some files.
I want to list only newly added migrations between those two branches.
Something like:
```
git diff branch1 branch2 | grep /db/migrate
```
How can I do it? | This command will diff their whole history:
> git diff branch1..branch2 --name-only
If you want to compare from their last common ancestor, then:
> git diff branch1...branch2 --name-only
And now you can grep files that you want. From there it's easy to write a little shell script that diffs two branches, file by fi... |
19819252 | Can you arc diff against a particular git branch? | 38 | 2013-11-06 17:55:40 | <p>I'm pretty new to both Arcanist and git. I'd like to be able to create an arc diff (Phabricator Differential instance using Arcanist) against a git branch that I'm currently checked-out/working in (and I have one local un-pushed commit) rather than the master. To me the <a href="http://www.phabricator.com/docs/phabr... | 46,022 | 1,274,248 | 2017-11-08 11:45:44 | 19,879,865 | 55 | 2013-11-09 17:29:28 | 821,226 | 2017-11-08 11:45:44 | https://stackoverflow.com/q/19819252 | https://stackoverflow.com/a/19879865 | <p>In general, <code>arc diff <branch></code> will do what you want. (If you're already on the branch, rather than a local topic branch, try <code>arc diff origin/<branch></code> instead.)</p>
<p>When invoked like this, <code>arc</code> will actually diff against the <code>merge-base</code> of the branch's... | <p>In general, <code>arc diff <branch></code> will do what you want. (If you're already on the branch, rather than a local topic branch, try <code>arc diff origin/<branch></code> instead.)</p> <p>When invoked like this, <code>arc</code> will actually diff against the <code>merge-base</code> of the branch's... | 119, 80205, 95672 | arcanist, git, phabricator | <h1>Can you arc diff against a particular git branch?</h1>
<p>I'm pretty new to both Arcanist and git. I'd like to be able to create an arc diff (Phabricator Differential instance using Arcanist) against a git branch that I'm currently checked-out/working in (and I have one local un-pushed commit) rather than the maste... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,189 | git | # Can you arc diff against a particular git branch?
I'm pretty new to both Arcanist and git. I'd like to be able to create an arc diff (Phabricator Differential instance using Arcanist) against a git branch that I'm currently checked-out/working in (and I have one local un-pushed commit) rather than the master. To me ... | In general, `arc diff <branch>` will do what you want. (If you're already on the branch, rather than a local topic branch, try `arc diff origin/<branch>` instead.)
When invoked like this, `arc` will actually diff against the `merge-base` of the branch's tip and the current commit in the working copy, but generally thi... |
15255785 | Git: index file open failed: Permission denied on "git status". Hosted on Bitbucket | 38 | 2013-03-06 19:03:35 | <p>I've been having this issue for the last couple of days when trying to make, either, a git status or git pull. The repository is hosted on Bitbucket.</p>
<p>Tried several things to make this work (there are some posts related to this on stackoverflow, but they didn't work).</p>
<p>Here is the issue:</p>
<pre>
use... | 54,867 | 213,210 | 2020-07-06 14:41:53 | 18,565,462 | 55 | 2013-09-02 03:56:16 | 904,365 | 2013-09-02 03:56:16 | https://stackoverflow.com/q/15255785 | https://stackoverflow.com/a/18565462 | <p>Got the same error <code>fatal: index file open failed: Permission denied</code> by run <code>git status</code>, and I checked <code>.git/index</code> by</p>
<pre><code>$ ls -al .git/index
</code></pre>
<p>to my surprise, it's</p>
<pre><code>---------- 1 Kjuly staff 768248 Sep 2 11:07 .git/index
</code></pre>... | <p>Got the same error <code>fatal: index file open failed: Permission denied</code> by run <code>git status</code>, and I checked <code>.git/index</code> by</p> <pre><code>$ ls -al .git/index </code></pre> <p>to my surprise, it's</p> <pre><code>---------- 1 Kjuly staff 768248 Sep 2 11:07 .git/index </code></pre>... | 58, 119, 8337 | bitbucket, git, linux | <h1>Git: index file open failed: Permission denied on "git status". Hosted on Bitbucket</h1>
<p>I've been having this issue for the last couple of days when trying to make, either, a git status or git pull. The repository is hosted on Bitbucket.</p>
<p>Tried several things to make this work (there are some posts relat... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,190 | git | # Git: index file open failed: Permission denied on "git status". Hosted on Bitbucket
I've been having this issue for the last couple of days when trying to make, either, a git status or git pull. The repository is hosted on Bitbucket.
Tried several things to make this work (there are some posts related to this on st... | Got the same error `fatal: index file open failed: Permission denied` by run `git status`, and I checked `.git/index` by
```
$ ls -al .git/index
```
to my surprise, it's
```
---------- 1 Kjuly staff 768248 Sep 2 11:07 .git/index
```
I've no idea why & how it changed. Anyway, after I changed it's permission back... |
11308298 | How to list unpushed Git tags | 37 | 2012-07-03 09:44:42 | <p>I'd like to see which tags I have locally that aren't available on a particular remote. How can I do this? I know I can do <code>git push --tags</code> to push all of them. However, if there are some tags that I don't want pushed, how to I make sure I haven't missed some?</p>
| 12,107 | 41,012 | 2022-01-02 21:25:20 | 11,308,300 | 55 | 2012-07-03 09:44:43 | 41,012 | 2013-06-18 11:06:58 | https://stackoverflow.com/q/11308298 | https://stackoverflow.com/a/11308300 | <p>You can use the following to see the tags that exist locally but not in the specified remote:</p>
<pre><code>git show-ref --tags | grep -v -F "$(git ls-remote --tags <remote name> | grep -v '\^{}' | cut -f 2)"
</code></pre>
<p>Note that <code>git ls-remote</code> shows both the annotated tag and the commit i... | <p>You can use the following to see the tags that exist locally but not in the specified remote:</p> <pre><code>git show-ref --tags | grep -v -F "$(git ls-remote --tags <remote name> | grep -v '\^{}' | cut -f 2)" </code></pre> <p>Note that <code>git ls-remote</code> shows both the annotated tag and the commit i... | 119, 41346, 60718 | git, git-remote, git-tag | <h1>How to list unpushed Git tags</h1>
<p>I'd like to see which tags I have locally that aren't available on a particular remote. How can I do this? I know I can do <code>git push --tags</code> to push all of them. However, if there are some tags that I don't want pushed, how to I make sure I haven't missed some?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,191 | git | # How to list unpushed Git tags
I'd like to see which tags I have locally that aren't available on a particular remote. How can I do this? I know I can do `git push --tags` to push all of them. However, if there are some tags that I don't want pushed, how to I make sure I haven't missed some? | You can use the following to see the tags that exist locally but not in the specified remote:
```
git show-ref --tags | grep -v -F "$(git ls-remote --tags <remote name> | grep -v '\^{}' | cut -f 2)"
```
Note that `git ls-remote` shows both the annotated tag and the commit it points to with `^{}`, so we need to remove... |
11113896 | Use Git commands within Python code | 37 | 2012-06-20 06:23:18 | <p>I have been asked to write a script that pulls the latest code from Git, makes a build, and performs some automated unit tests.</p>
<p>I found that there are two built-in Python modules for interacting with Git that are readily available: <code>GitPython</code> and <code>libgit2</code>.</p>
<p>What approach/module... | 78,433 | 596,922 | 2022-11-24 16:33:29 | 11,114,028 | 55 | 2012-06-20 06:33:24 | 376,513 | 2017-06-08 15:12:06 | https://stackoverflow.com/q/11113896 | https://stackoverflow.com/a/11114028 | <p>An easier solution would be to use the Python <code>subprocess</code> module to call git. In your case, this would pull the latest code and build:</p>
<pre><code>import subprocess
subprocess.call(["git", "pull"])
subprocess.call(["make"])
subprocess.call(["make", "test"])
</code></pre>
<p>Docs:</p>
<ul>
<li><a hr... | <p>An easier solution would be to use the Python <code>subprocess</code> module to call git. In your case, this would pull the latest code and build:</p> <pre><code>import subprocess subprocess.call(["git", "pull"]) subprocess.call(["make"]) subprocess.call(["make", "test"]) </code></pre> <p>Docs:</p> <ul> <li><a hr... | 16, 119 | git, python | <h1>Use Git commands within Python code</h1>
<p>I have been asked to write a script that pulls the latest code from Git, makes a build, and performs some automated unit tests.</p>
<p>I found that there are two built-in Python modules for interacting with Git that are readily available: <code>GitPython</code> and <code... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,192 | git | # Use Git commands within Python code
I have been asked to write a script that pulls the latest code from Git, makes a build, and performs some automated unit tests.
I found that there are two built-in Python modules for interacting with Git that are readily available: `GitPython` and `libgit2`.
What approach/module... | An easier solution would be to use the Python `subprocess` module to call git. In your case, this would pull the latest code and build:
```
import subprocess
subprocess.call(["git", "pull"])
subprocess.call(["make"])
subprocess.call(["make", "test"])
```
Docs:
- [subprocess - Python 2.x](https://docs.python.org/2/li... |
5769568 | How to set up a Git hook so that after pushing to ssh://peter@foo.com/~/bar.com.git, it will go to ~/bar.com and do a git pull? | 37 | 2011-04-24 08:39:59 | <p>I was advised to set up on a remote server</p>
<pre><code>foo.com/~/bar.com # live webpage content
foo.com/~/bar.com.git # a bare repo
</code></pre>
<p>so, from my local machine, I can do a </p>
<pre><code>git push
</code></pre>
<p>and it will push to <code>foo.com/~/bar.com.git</code> on the remote mach... | 32,079 | 325,418 | 2017-08-06 22:58:08 | 5,769,715 | 55 | 2011-04-24 09:25:05 | 460,387 | 2017-08-06 22:58:08 | https://stackoverflow.com/q/5769568 | https://stackoverflow.com/a/5769715 | <p>You can add a <a href="http://git-scm.com/docs/githooks#post-receive" rel="noreferrer"><code>post-receive</code></a> hook to the <code>~/bar.com.git</code> repo for this. To do this add to the <code>~/bar.com.git/hooks/</code> directory an executable file <code>post-receive</code> with the content:</p>
<pre><code>#... | <p>You can add a <a href="http://git-scm.com/docs/githooks#post-receive" rel="noreferrer"><code>post-receive</code></a> hook to the <code>~/bar.com.git</code> repo for this. To do this add to the <code>~/bar.com.git/hooks/</code> directory an executable file <code>post-receive</code> with the content:</p> <pre><code>#... | 119, 43087 | git, githooks | <h1>How to set up a Git hook so that after pushing to ssh://peter@foo.com/~/bar.com.git, it will go to ~/bar.com and do a git pull?</h1>
<p>I was advised to set up on a remote server</p>
<pre><code>foo.com/~/bar.com # live webpage content
foo.com/~/bar.com.git # a bare repo
</code></pre>
<p>so, from my local ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,193 | git | # How to set up a Git hook so that after pushing to ssh://peter@foo.com/~/bar.com.git, it will go to ~/bar.com and do a git pull?
I was advised to set up on a remote server
```
foo.com/~/bar.com # live webpage content
foo.com/~/bar.com.git # a bare repo
```
so, from my local machine, I can do a
```
git push... | You can add a [`post-receive`](http://git-scm.com/docs/githooks#post-receive) hook to the `~/bar.com.git` repo for this. To do this add to the `~/bar.com.git/hooks/` directory an executable file `post-receive` with the content:
```
#!/bin/sh
unset $(git rev-parse --local-env-vars)
cd ~/bar.com
git pull
```
**Make su... |
3438311 | How can I git pull --rebase but taking all remote changes? | 37 | 2010-08-09 08:10:01 | <p>I did <code>git fetch</code> and then <code>git pull --rebase</code>. It is trying to merge changes from the remote branch to my local branch. And there are some merge conflicts. So I did a <code>git reset --hard</code>.</p>
<p>My question is it is possible for me to ask git pull to take the remote change whenever ... | 24,570 | 286,802 | 2017-05-16 14:36:39 | 3,443,225 | 55 | 2010-08-09 18:55:39 | 414,547 | 2010-08-09 18:55:39 | https://stackoverflow.com/q/3438311 | https://stackoverflow.com/a/3443225 | <p>I think what you want is this:</p>
<pre><code>git pull --rebase -s recursive -X ours
</code></pre>
<p>But it doesn't work (I'm using 1.7.0.4), even though the manpage says it should. I'm guessing this is due to the issue <a href="https://stackoverflow.com/questions/2945344/selecting-merge-strategy-options-for-git... | <p>I think what you want is this:</p> <pre><code>git pull --rebase -s recursive -X ours </code></pre> <p>But it doesn't work (I'm using 1.7.0.4), even though the manpage says it should. I'm guessing this is due to the issue <a href="https://stackoverflow.com/questions/2945344/selecting-merge-strategy-options-for-git... | 119 | git | <h1>How can I git pull --rebase but taking all remote changes?</h1>
<p>I did <code>git fetch</code> and then <code>git pull --rebase</code>. It is trying to merge changes from the remote branch to my local branch. And there are some merge conflicts. So I did a <code>git reset --hard</code>.</p>
<p>My question is it is... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,194 | git | # How can I git pull --rebase but taking all remote changes?
I did `git fetch` and then `git pull --rebase`. It is trying to merge changes from the remote branch to my local branch. And there are some merge conflicts. So I did a `git reset --hard`.
My question is it is possible for me to ask git pull to take the remo... | I think what you want is this:
```
git pull --rebase -s recursive -X ours
```
But it doesn't work (I'm using 1.7.0.4), even though the manpage says it should. I'm guessing this is due to the issue [mentioned here](https://stackoverflow.com/questions/2945344/selecting-merge-strategy-options-for-git-rebase).
Instead, ... |
24646065 | How to specify lib directory when installing development version R Packages from github repository | 35 | 2014-07-09 05:38:25 | <p>In Ubuntu, I am installing all the R packages in the directory, <code>/usr/lib/R/site-library</code> by specifying <code>lib</code> option in <code>install.packages()</code>. </p>
<p>But when I try to install the development version of the R packages using, <code>install_github()</code>, it always installs in a loc... | 27,106 | 2,101,765 | 2014-07-10 04:39:54 | 24,668,545 | 55 | 2014-07-10 04:34:13 | 2,101,765 | 2014-07-10 04:39:54 | https://stackoverflow.com/q/24646065 | https://stackoverflow.com/a/24668545 | <p>To add specified library paths in <code>devtools</code>, we need to use <code>with_libpaths()</code></p>
<p>Arguments for <code>with_libpaths()</code> are, <code>with_libpaths(new, code)</code></p>
<p>Following is an example for using <code>with_libpaths()</code>,</p>
<pre><code>library(devtools)
with_libpaths(ne... | <p>To add specified library paths in <code>devtools</code>, we need to use <code>with_libpaths()</code></p> <p>Arguments for <code>with_libpaths()</code> are, <code>with_libpaths(new, code)</code></p> <p>Following is an example for using <code>with_libpaths()</code>,</p> <pre><code>library(devtools) with_libpaths(ne... | 119, 4452, 7187, 67746 | devtools, git, r, rstudio | <h1>How to specify lib directory when installing development version R Packages from github repository</h1>
<p>In Ubuntu, I am installing all the R packages in the directory, <code>/usr/lib/R/site-library</code> by specifying <code>lib</code> option in <code>install.packages()</code>. </p>
<p>But when I try to install... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,195 | git | # How to specify lib directory when installing development version R Packages from github repository
In Ubuntu, I am installing all the R packages in the directory, `/usr/lib/R/site-library` by specifying `lib` option in `install.packages()`.
But when I try to install the development version of the R packages using, ... | To add specified library paths in `devtools`, we need to use `with_libpaths()`
Arguments for `with_libpaths()` are, `with_libpaths(new, code)`
Following is an example for using `with_libpaths()`,
```
library(devtools)
with_libpaths(new = "/usr/lib/R/site-library/", install_github('rCharts', 'ramnathv'))
```
Courtes... |
43037293 | What is the difference between git pull and git reset --hard origin/<branch>? | 34 | 2017-03-27 03:03:08 | <p>I find the latter to be faster than the first, so I usually do that after <code>git fetch</code> whenever I need to sync my local branch with the remote. What is the difference?</p>
| 16,849 | 3,930,247 | 2022-09-21 20:03:40 | 43,037,318 | 55 | 2017-03-27 03:06:30 | 5,766,144 | 2017-03-27 03:06:30 | https://stackoverflow.com/q/43037293 | https://stackoverflow.com/a/43037318 | <p>The following commands:</p>
<pre><code>git fetch
git reset --hard origin/<branch>
</code></pre>
<p>will discard all local changes.</p>
<p>Where as:</p>
<pre><code>git pull
</code></pre>
<p>Which is exactly the same as:</p>
<pre><code>git fetch
git merge origin/<branch>
</code></pre>
<p>will attemp... | <p>The following commands:</p> <pre><code>git fetch git reset --hard origin/<branch> </code></pre> <p>will discard all local changes.</p> <p>Where as:</p> <pre><code>git pull </code></pre> <p>Which is exactly the same as:</p> <pre><code>git fetch git merge origin/<branch> </code></pre> <p>will attemp... | 119, 456, 28896 | git, git-pull, version-control | <h1>What is the difference between git pull and git reset --hard origin/<branch>?</h1>
<p>I find the latter to be faster than the first, so I usually do that after <code>git fetch</code> whenever I need to sync my local branch with the remote. What is the difference?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,196 | git | # What is the difference between git pull and git reset --hard origin/?
I find the latter to be faster than the first, so I usually do that after `git fetch` whenever I need to sync my local branch with the remote. What is the difference? | The following commands:
```
git fetch
git reset --hard origin/<branch>
```
will discard all local changes.
Where as:
```
git pull
```
Which is exactly the same as:
```
git fetch
git merge origin/<branch>
```
will attempt to preserve local changes. |
5250650 | View diff of staged changes in git | 34 | 2011-03-09 18:48:49 | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="https://stackoverflow.com/questions/1587846/how-do-i-show-the-changes-which-have-been-staged">How do I show the changes which have been staged?</a> </p>
</blockquote>
<p>Is there a simple way to view the diff of only the <strong>staged</strong> c... | 27,021 | 9,453 | 2011-03-09 18:51:16 | 5,250,674 | 55 | 2011-03-09 18:51:16 | 9,453 | 2011-03-09 18:51:16 | https://stackoverflow.com/q/5250650 | https://stackoverflow.com/a/5250674 | <p>One more minute of Googling found the answer of course, answering my own question:</p>
<pre><code>git diff --cached
</code></pre>
| <p>One more minute of Googling found the answer of course, answering my own question:</p> <pre><code>git diff --cached </code></pre> | 119, 9033 | git, git-diff | <h1>View diff of staged changes in git</h1>
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="https://stackoverflow.com/questions/1587846/how-do-i-show-the-changes-which-have-been-staged">How do I show the changes which have been staged?</a> </p>
</blockquote>
<p>Is there a simple way to view th... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,197 | git | # View diff of staged changes in git
> **Possible Duplicate:**
> [How do I show the changes which have been staged?](https://stackoverflow.com/questions/1587846/how-do-i-show-the-changes-which-have-been-staged)
Is there a simple way to view the diff of only the **staged** changes I have pending in git? I've staged ... | One more minute of Googling found the answer of course, answering my own question:
```
git diff --cached
``` |
15596670 | Recovering a deleted branch from a remote on Bitbucket (git) | 32 | 2013-03-24 08:54:09 | <p>I want to recover a branch that was deleted from our remote shared repository on Bitbucket.
I know that <code>reflog</code> is the way to go with local repositories.</p>
<p>How would I got about achieving this on the remote one?</p>
| 45,162 | 954,514 | 2025-03-28 10:32:22 | 43,793,057 | 55 | 2017-05-04 21:28:53 | 360,509 | 2024-05-22 12:35:42 | https://stackoverflow.com/q/15596670 | https://stackoverflow.com/a/43793057 | <p>I came across this answer because I deleted a branch through the bitbucket.org UI that a team member wanted restored.</p>
<p>I discovered that <code>git branch --remote</code> shows all the branches on origin, even the ones that are deleted through the UI.</p>
<p>I checked out the origin branch locally with <code>gi... | <p>I came across this answer because I deleted a branch through the bitbucket.org UI that a team member wanted restored.</p> <p>I discovered that <code>git branch --remote</code> shows all the branches on origin, even the ones that are deleted through the UI.</p> <p>I checked out the origin branch locally with <code>gi... | 119, 8337 | bitbucket, git | <h1>Recovering a deleted branch from a remote on Bitbucket (git)</h1>
<p>I want to recover a branch that was deleted from our remote shared repository on Bitbucket.
I know that <code>reflog</code> is the way to go with local repositories.</p>
<p>How would I got about achieving this on the remote one?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,198 | git | # Recovering a deleted branch from a remote on Bitbucket (git)
I want to recover a branch that was deleted from our remote shared repository on Bitbucket.
I know that `reflog` is the way to go with local repositories.
How would I got about achieving this on the remote one? | I came across this answer because I deleted a branch through the bitbucket.org UI that a team member wanted restored.
I discovered that `git branch --remote` shows all the branches on origin, even the ones that are deleted through the UI.
I checked out the origin branch locally with `git checkout origin/<branch_name>... |
42735837 | Git Bash: remote error: You can't push to git://github.com/ | 32 | 2017-03-11 13:35:10 | <p>Please, help me, how can I fix this error ?</p>
<pre><code>$git push origin dev
fatal: remote error:
You can't push to git://github.com//name_of_repo.git
Use https:://github.com//name_of_repo.git
</code></pre>
| 24,345 | 7,625,043 | 2019-04-26 17:06:58 | 42,735,980 | 55 | 2017-03-11 13:47:35 | 298,479 | 2017-03-11 13:55:03 | https://stackoverflow.com/q/42735837 | https://stackoverflow.com/a/42735980 | <p>Use an HTTPS or SSH URL. Instead of <code>git://github.com/user/repo.git</code> use one of these:</p>
<ul>
<li><code>https://github.com/user/repo.git</code></li>
<li><code>git@github.com:user/repo.git</code></li>
</ul>
<p>You can change it in your clone like this:</p>
<pre><code>git remote set-url origin <THE-... | <p>Use an HTTPS or SSH URL. Instead of <code>git://github.com/user/repo.git</code> use one of these:</p> <ul> <li><code>https://github.com/user/repo.git</code></li> <li><code>git@github.com:user/repo.git</code></li> </ul> <p>You can change it in your clone like this:</p> <pre><code>git remote set-url origin <THE-... | 119, 28898 | git, git-push | <h1>Git Bash: remote error: You can't push to git://github.com/</h1>
<p>Please, help me, how can I fix this error ?</p>
<pre><code>$git push origin dev
fatal: remote error:
You can't push to git://github.com//name_of_repo.git
Use https:://github.com//name_of_repo.git
</code></pre>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,199 | git | # Git Bash: remote error: You can't push to git://github.com/
Please, help me, how can I fix this error ?
```
$git push origin dev
fatal: remote error:
You can't push to git://github.com//name_of_repo.git
Use https:://github.com//name_of_repo.git
``` | Use an HTTPS or SSH URL. Instead of `git://github.com/user/repo.git` use one of these:
- `https://github.com/user/repo.git`
- `git@github.com:user/repo.git`
You can change it in your clone like this:
```
git remote set-url origin <THE-URL-HERE>
``` |
35982610 | TortoiseGit: What's the difference between "Git Sync", "Fetch" and "Pull"? | 32 | 2016-03-14 08:26:15 | <p>I am moving from TortoiseSvn to TortoiseGit. But enountered some unexpected difficulties.</p>
<p>My working paradigm is as simple as:</p>
<ol>
<li>Check out code</li>
<li>Change some code</li>
<li>Share with others for code review</li>
<li>Commit changes</li>
</ol>
<p>Why bother to have the 3 <code>syntactically<... | 47,645 | 264,052 | 2020-06-05 03:28:54 | 35,982,780 | 55 | 2016-03-14 08:35:39 | 2,393,077 | 2016-03-14 08:42:11 | https://stackoverflow.com/q/35982610 | https://stackoverflow.com/a/35982780 | <p>These are three different commands:</p>
<ol>
<li>Git <code>pull</code> is a git <code>fetch</code> followed by git <code>merge</code> - <a href="https://stackoverflow.com/questions/292357/what-are-the-differences-between-git-pull-and-git-fetch">read here</a></li>
<li>Git <code>fetch</code> fetches info about remote... | <p>These are three different commands:</p> <ol> <li>Git <code>pull</code> is a git <code>fetch</code> followed by git <code>merge</code> - <a href="https://stackoverflow.com/questions/292357/what-are-the-differences-between-git-pull-and-git-fetch">read here</a></li> <li>Git <code>fetch</code> fetches info about remote... | 119, 31409 | git, tortoisegit | <h1>TortoiseGit: What's the difference between "Git Sync", "Fetch" and "Pull"?</h1>
<p>I am moving from TortoiseSvn to TortoiseGit. But enountered some unexpected difficulties.</p>
<p>My working paradigm is as simple as:</p>
<ol>
<li>Check out code</li>
<li>Change some code</li>
<li>Share with others for code review<... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,200 | git | # TortoiseGit: What's the difference between "Git Sync", "Fetch" and "Pull"?
I am moving from TortoiseSvn to TortoiseGit. But enountered some unexpected difficulties.
My working paradigm is as simple as:
1. Check out code
2. Change some code
3. Share with others for code review
4. Commit changes
Why bother to have ... | These are three different commands:
1. Git `pull` is a git `fetch` followed by git `merge` - [read here](https://stackoverflow.com/questions/292357/what-are-the-differences-between-git-pull-and-git-fetch)
2. Git `fetch` fetches info about remote repositories - [read here](https://git-scm.com/docs/git-fetch)
3. Git `sy... |
33915987 | Git-tf unable to find required JAR | 30 | 2015-11-25 12:00:38 | <p>I'm trying to setup git-tf bridge on my windows work station. When I try to execute one of the commands it always shows message:</p>
<p>Unable to find a required JAR: C:\my\path\to\git-tf/lib/com.microsoft.gittf.client.clc-*jar does not exist.</p>
<p>The problem is that slash changes in the middle of the path from... | 5,835 | 2,604,441 | 2020-10-14 13:37:33 | 34,066,941 | 55 | 2015-12-03 13:10:35 | 581,002 | 2015-12-03 13:10:35 | https://stackoverflow.com/q/33915987 | https://stackoverflow.com/a/34066941 | <p>I'm assuming you use the Git Bash.</p>
<p>You'll need to edit your <code>git-tf</code> bash script and change the line</p>
<pre><code>MINGW32_NT*)
</code></pre>
<p>to</p>
<pre><code>MINGW*)
</code></pre>
<p>because for you, <code>uname -s</code> will probably spit out “MINGW64_NT”.</p>
| <p>I'm assuming you use the Git Bash.</p> <p>You'll need to edit your <code>git-tf</code> bash script and change the line</p> <pre><code>MINGW32_NT*) </code></pre> <p>to</p> <pre><code>MINGW*) </code></pre> <p>because for you, <code>uname -s</code> will probably spit out “MINGW64_NT”.</p> | 119, 733, 83188 | git, git-tf, tfs | <h1>Git-tf unable to find required JAR</h1>
<p>I'm trying to setup git-tf bridge on my windows work station. When I try to execute one of the commands it always shows message:</p>
<p>Unable to find a required JAR: C:\my\path\to\git-tf/lib/com.microsoft.gittf.client.clc-*jar does not exist.</p>
<p>The problem is that ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,202 | git | # Git-tf unable to find required JAR
I'm trying to setup git-tf bridge on my windows work station. When I try to execute one of the commands it always shows message:
Unable to find a required JAR: C:\my\path\to\git-tf/lib/com.microsoft.gittf.client.clc-*jar does not exist.
The problem is that slash changes in the mi... | I'm assuming you use the Git Bash.
You'll need to edit your `git-tf` bash script and change the line
```
MINGW32_NT*)
```
to
```
MINGW*)
```
because for you, `uname -s` will probably spit out “MINGW64_NT”. |
14051525 | Intellij IDEA how to upload project to remote branch with git plugin? | 29 | 2012-12-27 08:19:19 | <p>I have Intellij IDEA 12.0.1
I am using build-in Git plugin. I am able to create local repository. Now I want to upload my source code to remote repository. Can I do this with Intellij IDEA plugin?</p>
<p>Thank you.</p>
| 42,793 | 1,056,263 | 2015-03-19 11:15:46 | 14,060,454 | 55 | 2012-12-27 19:52:36 | 1,056,263 | 2013-11-09 17:27:17 | https://stackoverflow.com/q/14051525 | https://stackoverflow.com/a/14060454 | <p>You can't upload your local Git repository to remote using IntelliJ IDEA plugin. For this you need to use <a href="http://git-scm.com/downloads" rel="noreferrer">Git Bash</a> or Git client, for example <a href="http://www.sourcetreeapp.com/" rel="noreferrer">Source Tree</a>.</p>
<h2>To create local Git repository w... | <p>You can't upload your local Git repository to remote using IntelliJ IDEA plugin. For this you need to use <a href="http://git-scm.com/downloads" rel="noreferrer">Git Bash</a> or Git client, for example <a href="http://www.sourcetreeapp.com/" rel="noreferrer">Source Tree</a>.</p> <h2>To create local Git repository w... | 119, 8945 | git, intellij-idea | <h1>Intellij IDEA how to upload project to remote branch with git plugin?</h1>
<p>I have Intellij IDEA 12.0.1
I am using build-in Git plugin. I am able to create local repository. Now I want to upload my source code to remote repository. Can I do this with Intellij IDEA plugin?</p>
<p>Thank you.</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,205 | git | # Intellij IDEA how to upload project to remote branch with git plugin?
I have Intellij IDEA 12.0.1
I am using build-in Git plugin. I am able to create local repository. Now I want to upload my source code to remote repository. Can I do this with Intellij IDEA plugin?
Thank you. | You can't upload your local Git repository to remote using IntelliJ IDEA plugin. For this you need to use [Git Bash](http://git-scm.com/downloads) or Git client, for example [Source Tree](http://www.sourcetreeapp.com/).
## To create local Git repository with IntelliJ IDEA plugin
1. In IntelliJ IDEA menu `VCS -> Impor... |
27371629 | How to tag a git repo in a bamboo build | 28 | 2014-12-09 04:49:11 | <p>I'm trying to tag the git repo of a ruby gem in a Bamboo build. I thought doing something like this in ruby would do the job </p>
<pre><code>`git tag v#{current_version}`
`git push --tags`
</code></pre>
<p>But the problem is that the repo does not have the origin. somehow Bamboo is getting rid of the <code>origin<... | 24,248 | 78,254 | 2020-02-22 16:09:51 | 27,441,732 | 55 | 2014-12-12 10:34:41 | 1,228,560 | 2014-12-12 10:51:31 | https://stackoverflow.com/q/27371629 | https://stackoverflow.com/a/27441732 | <p>Yes, if you navigate to the job workspace, you will find that Bamboo does not do a straightforward git clone "under the hood", and the the remote is set to an internal file path.</p>
<p>Fortunately, Bamboo does store the original repository URL as ${bamboo.repository.git.repositoryUrl}, so all you need to do is set... | <p>Yes, if you navigate to the job workspace, you will find that Bamboo does not do a straightforward git clone "under the hood", and the the remote is set to an internal file path.</p> <p>Fortunately, Bamboo does store the original repository URL as ${bamboo.repository.git.repositoryUrl}, so all you need to do is set... | 22832, 60718 | bamboo, git-tag | <h1>How to tag a git repo in a bamboo build</h1>
<p>I'm trying to tag the git repo of a ruby gem in a Bamboo build. I thought doing something like this in ruby would do the job </p>
<pre><code>`git tag v#{current_version}`
`git push --tags`
</code></pre>
<p>But the problem is that the repo does not have the origin. s... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,207 | git | # How to tag a git repo in a bamboo build
I'm trying to tag the git repo of a ruby gem in a Bamboo build. I thought doing something like this in ruby would do the job
```
`git tag v#{current_version}`
`git push --tags`
```
But the problem is that the repo does not have the origin. somehow Bamboo is getting rid of th... | Yes, if you navigate to the job workspace, you will find that Bamboo does not do a straightforward git clone "under the hood", and the the remote is set to an internal file path.
Fortunately, Bamboo does store the original repository URL as ${bamboo.repository.git.repositoryUrl}, so all you need to do is set a remote ... |
16608086 | Git and Bitbucket without SSH | 28 | 2013-05-17 11:39:49 | <p>I've set up a local git repository on my computer, and I'm trying to push that to a newly created Bitbucket account. </p>
<p>The problem is that Bitbucket gives me an <code>ssh</code> url to push to, but the network I'm on (university) has the ssh port blocked for external ssh. So that fails, and if I try to replac... | 25,621 | 1,765,768 | 2023-10-02 15:51:44 | 16,608,377 | 55 | 2013-05-17 11:54:59 | 216,074 | 2014-10-17 11:43:53 | https://stackoverflow.com/q/16608086 | https://stackoverflow.com/a/16608377 | <p>You can connect to GitHub and Bitbucket repositories via HTTPS. Both will also let you push.</p>
<p>These are the typical URLs for HTTPS access:</p>
<pre><code>https://username@bitbucket.org/username/repository.git
https://github.com/username/repository.git
</code></pre>
<p>Note that Git will prompt you for your ... | <p>You can connect to GitHub and Bitbucket repositories via HTTPS. Both will also let you push.</p> <p>These are the typical URLs for HTTPS access:</p> <pre><code>https://username@bitbucket.org/username/repository.git https://github.com/username/repository.git </code></pre> <p>Note that Git will prompt you for your ... | 119, 8337 | bitbucket, git | <h1>Git and Bitbucket without SSH</h1>
<p>I've set up a local git repository on my computer, and I'm trying to push that to a newly created Bitbucket account. </p>
<p>The problem is that Bitbucket gives me an <code>ssh</code> url to push to, but the network I'm on (university) has the ssh port blocked for external ssh... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,208 | git | # Git and Bitbucket without SSH
I've set up a local git repository on my computer, and I'm trying to push that to a newly created Bitbucket account.
The problem is that Bitbucket gives me an `ssh` url to push to, but the network I'm on (university) has the ssh port blocked for external ssh. So that fails, and if I tr... | You can connect to GitHub and Bitbucket repositories via HTTPS. Both will also let you push.
These are the typical URLs for HTTPS access:
```
https://username@bitbucket.org/username/repository.git
https://github.com/username/repository.git
```
Note that Git will prompt you for your password whenever you want to comm... |
38334652 | Sum all the digits of a number Javascript | 27 | 2016-07-12 16:40:37 | <p>I am newbie.</p>
<p>I want to make small app which will calculate the sum of all the digits of a number.</p>
<p>For example, if I have the number 2568, the app will calculate 2+5+6+8 which is equal with 21. Finally, it will calculate the sum of 21's digits and the final result will be 3 .</p>
<p>Please help me</p... | 151,747 | 5,889,056 | 2023-01-30 17:19:47 | 38,336,308 | 55 | 2016-07-12 18:21:38 | 1,447,675 | 2016-07-12 19:43:02 | https://stackoverflow.com/q/38334652 | https://stackoverflow.com/a/38336308 | <p>Basically you have two methods to get the sum of all parts of an integer number.</p>
<ul>
<li><p><strong>With numerical operations</strong></p>
<p>Take the number and build the remainder of ten and add that. Then take the integer part of the division of the number by 10. Proceed.</p>
</li>
</ul>
<p><div class="snipp... | <p>Basically you have two methods to get the sum of all parts of an integer number.</p> <ul> <li><p><strong>With numerical operations</strong></p> <p>Take the number and build the remainder of ten and add that. Then take the integer part of the division of the number by 10. Proceed.</p> </li> </ul> <p><div class="snipp... | 3, 3496, 4928, 9914 | digits, javascript, numbers, sum | <h1>Sum all the digits of a number Javascript</h1>
<p>I am newbie.</p>
<p>I want to make small app which will calculate the sum of all the digits of a number.</p>
<p>For example, if I have the number 2568, the app will calculate 2+5+6+8 which is equal with 21. Finally, it will calculate the sum of 21's digits and the... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,209 | git | # Sum all the digits of a number Javascript
I am newbie.
I want to make small app which will calculate the sum of all the digits of a number.
For example, if I have the number 2568, the app will calculate 2+5+6+8 which is equal with 21. Finally, it will calculate the sum of 21's digits and the final result will be 3... | Basically you have two methods to get the sum of all parts of an integer number.
- **With numerical operations**
Take the number and build the remainder of ten and add that. Then take the integer part of the division of the number by 10. Proceed.
```
var value = 2568,
sum = 0;
while (value) {
sum += value... |
6631694 | replace git submodule protocol from git to http | 27 | 2011-07-08 23:44:51 | <p>I add a submodule from a git@... URL, to be able to develop in it. Now I want to deploy the app and replace the URL with an git://... one, so it doesn't need authentication to the submodule's repo from Capistrano. Is editing the URL in .gitmodules totally enough to accomplish this?</p>
| 10,038 | 95,078 | 2017-08-01 03:48:28 | 6,632,693 | 55 | 2011-07-09 04:22:55 | 193,688 | 2011-07-09 04:22:55 | https://stackoverflow.com/q/6631694 | https://stackoverflow.com/a/6632693 | <p>Editing the <code>.gitmodules</code> file (then committing, and pushing it) will be adequate for any <em>new</em> clones.</p>
<p>Additionally, when a submodule is initialized (e.g. <code>git submodule init …</code>, <code>git submodule update --init …</code>, or <code>git clone --recursive …</code>, etc.) its URL i... | <p>Editing the <code>.gitmodules</code> file (then committing, and pushing it) will be adequate for any <em>new</em> clones.</p> <p>Additionally, when a submodule is initialized (e.g. <code>git submodule init …</code>, <code>git submodule update --init …</code>, or <code>git clone --recursive …</code>, etc.) its URL i... | 119, 2831 | capistrano, git | <h1>replace git submodule protocol from git to http</h1>
<p>I add a submodule from a git@... URL, to be able to develop in it. Now I want to deploy the app and replace the URL with an git://... one, so it doesn't need authentication to the submodule's repo from Capistrano. Is editing the URL in .gitmodules totally en... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,210 | git | # replace git submodule protocol from git to http
I add a submodule from a git@... URL, to be able to develop in it. Now I want to deploy the app and replace the URL with an git://... one, so it doesn't need authentication to the submodule's repo from Capistrano. Is editing the URL in .gitmodules totally enough to acc... | Editing the `.gitmodules` file (then committing, and pushing it) will be adequate for any *new* clones.
Additionally, when a submodule is initialized (e.g. `git submodule init …`, `git submodule update --init …`, or `git clone --recursive …`, etc.) its URL is copied from the `.gitmodules` file to the repository’s `.gi... |
17479630 | Why does "git pull" get all branches from repository but "git pull origin master" not do so? | 26 | 2013-07-05 00:35:11 | <p>Why does <code>git pull</code> get all branches from repository but <code>git pull origin master</code> doesn't? I discovered it the hard way. Is it the only functional difference between these two commands?</p>
<p>Explanation like this tells me nothing:</p>
<p><code>git pull</code> = <code>git fetch origin</code>... | 33,756 | 673,993 | 2020-12-07 10:07:37 | 17,479,654 | 55 | 2013-07-05 00:40:23 | 115,132 | 2013-07-05 00:40:23 | https://stackoverflow.com/q/17479630 | https://stackoverflow.com/a/17479654 | <p>The latter command, <code>git pull origin master</code>, tells git to fetch and merge specifically the <code>master</code> branch (from the remote named <code>origin</code>, to be even more precise).</p>
<p><code>git pull</code> fetches updates for all local branches, which track remote branches, and then merges th... | <p>The latter command, <code>git pull origin master</code>, tells git to fetch and merge specifically the <code>master</code> branch (from the remote named <code>origin</code>, to be even more precise).</p> <p><code>git pull</code> fetches updates for all local branches, which track remote branches, and then merges th... | 119 | git | <h1>Why does "git pull" get all branches from repository but "git pull origin master" not do so?</h1>
<p>Why does <code>git pull</code> get all branches from repository but <code>git pull origin master</code> doesn't? I discovered it the hard way. Is it the only functional difference between these two commands?</p>
<p... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,211 | git | # Why does "git pull" get all branches from repository but "git pull origin master" not do so?
Why does `git pull` get all branches from repository but `git pull origin master` doesn't? I discovered it the hard way. Is it the only functional difference between these two commands?
Explanation like this tells me nothin... | The latter command, `git pull origin master`, tells git to fetch and merge specifically the `master` branch (from the remote named `origin`, to be even more precise).
`git pull` fetches updates for all local branches, which track remote branches, and then merges the current branch. |
11058312 | How can I use git rebase without requiring a forced push? | 141 | 2012-06-15 21:18:30 | <p>In an attempt to achieve git nirvana, I'm spending the day learning how to leverage rebase for situations where I currently merge.</p>
<p>When running through what I consider to be a git 101 flow (which I spell out below), I have to <code>push --force</code> when pushing my changes back to the origin.</p>
<p>I'm not... | 69,096 | 295,797 | 2025-07-10 19:38:40 | 11,058,390 | 54 | 2012-06-15 21:26:09 | 1,301,972 | 2025-07-10 19:38:40 | https://stackoverflow.com/q/11058312 | https://stackoverflow.com/a/11058390 | <p>Rebasing is a great tool, but it works best when you use it to create fast-forward merges for topic branches onto master. For example, you might rebase your add-new-widget branch against master:</p>
<pre><code>git checkout add-new-widget
git rebase -i master
</code></pre>
<p>before performing a fast-forward merge of... | <p>Rebasing is a great tool, but it works best when you use it to create fast-forward merges for topic branches onto master. For example, you might rebase your add-new-widget branch against master:</p> <pre><code>git checkout add-new-widget git rebase -i master </code></pre> <p>before performing a fast-forward merge of... | 119, 29934 | git, git-rebase | <h1>How can I use git rebase without requiring a forced push?</h1>
<p>In an attempt to achieve git nirvana, I'm spending the day learning how to leverage rebase for situations where I currently merge.</p>
<p>When running through what I consider to be a git 101 flow (which I spell out below), I have to <code>push --forc... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,215 | git | # How can I use git rebase without requiring a forced push?
In an attempt to achieve git nirvana, I'm spending the day learning how to leverage rebase for situations where I currently merge.
When running through what I consider to be a git 101 flow (which I spell out below), I have to `push --force` when pushing my c... | Rebasing is a great tool, but it works best when you use it to create fast-forward merges for topic branches onto master. For example, you might rebase your add-new-widget branch against master:
```
git checkout add-new-widget
git rebase -i master
```
before performing a fast-forward merge of the branch into master. ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.