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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
4797462 | heroku-like workflow on personal server | 19 | 2011-01-25 18:35:41 | <p>I'm trying to set up a server with pure-git workflow similar to <a href="http://heroku.com">heroku</a>. I <em>don't</em> need help setting up git, but for informative purposes, I'm using <a href="https://github.com/sitaramc/gitolite">gitolite</a>. I'd like to (somehow) write custom hooks in the operating system (Ubu... | 7,767 | 365,738 | 2016-01-19 21:43:29 | 4,835,143 | 28 | 2011-01-29 04:22:48 | 339,701 | 2011-01-29 04:22:48 | https://stackoverflow.com/q/4797462 | https://stackoverflow.com/a/4835143 | <p>It sounds like you want to execute arbitrary functionality at a certain point in your Git workflow. Git hooks are the way to go.</p>
<p>If you look in any Git repo (inside the <code>.git</code> folder), you'll see a <code>hooks</code> folder. Inside it there are a number of example hook files with different names. ... | <p>It sounds like you want to execute arbitrary functionality at a certain point in your Git workflow. Git hooks are the way to go.</p> <p>If you look in any Git repo (inside the <code>.git</code> folder), you'll see a <code>hooks</code> folder. Inside it there are a number of example hook files with different names. ... | 119, 549, 758, 4984, 8279 | git, heroku, ruby-on-rails, ubuntu, workflow | <h1>heroku-like workflow on personal server</h1>
<p>I'm trying to set up a server with pure-git workflow similar to <a href="http://heroku.com">heroku</a>. I <em>don't</em> need help setting up git, but for informative purposes, I'm using <a href="https://github.com/sitaramc/gitolite">gitolite</a>. I'd like to (somehow... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,246 | git | # heroku-like workflow on personal server
I'm trying to set up a server with pure-git workflow similar to [heroku](http://heroku.com). I *don't* need help setting up git, but for informative purposes, I'm using [gitolite](https://github.com/sitaramc/gitolite). I'd like to (somehow) write custom hooks in the operating ... | It sounds like you want to execute arbitrary functionality at a certain point in your Git workflow. Git hooks are the way to go.
If you look in any Git repo (inside the `.git` folder), you'll see a `hooks` folder. Inside it there are a number of example hook files with different names. Based on your explanation above,... |
1830353 | Git: removing a file from being versioned, but not deleting it | 19 | 2009-12-02 02:45:42 | <p>I have a file which ended up being versioned in our repository but shouldn't have been. For arguments sake, the file is config.py. We instead version config.py.tpl but never the actual production config for the obvious reasons.</p>
<p>What's the right way to stop versioning this file without deleting it locally fro... | 3,330 | 175,836 | 2017-12-03 01:49:04 | 1,830,372 | 28 | 2009-12-02 02:50:14 | 213,284 | 2017-12-03 01:49:04 | https://stackoverflow.com/q/1830353 | https://stackoverflow.com/a/1830372 | <p>To remove it from the repository use the following command and keep <code>config.py</code> in the gitignore:</p>
<pre><code>git rm --cached config.py
</code></pre>
| <p>To remove it from the repository use the following command and keep <code>config.py</code> in the gitignore:</p> <pre><code>git rm --cached config.py </code></pre> | 119, 456 | git, version-control | <h1>Git: removing a file from being versioned, but not deleting it</h1>
<p>I have a file which ended up being versioned in our repository but shouldn't have been. For arguments sake, the file is config.py. We instead version config.py.tpl but never the actual production config for the obvious reasons.</p>
<p>What's th... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,248 | git | # Git: removing a file from being versioned, but not deleting it
I have a file which ended up being versioned in our repository but shouldn't have been. For arguments sake, the file is config.py. We instead version config.py.tpl but never the actual production config for the obvious reasons.
What's the right way to s... | To remove it from the repository use the following command and keep `config.py` in the gitignore:
```
git rm --cached config.py
``` |
896832 | In gitk, why is my yellow button above master? | 19 | 2009-05-22 08:16:43 | <p>I couldn't find any documentation on gitk about what the colors mean, but the problem here I think is that my yellow button has passed my master. Now when I try to do:</p>
<p><code>git push origin master</code></p>
<p>It doesn't work. How did my yellow button get over master and how do I get them back together so ... | 19,953 | 94,633 | 2015-05-26 17:34:47 | 896,956 | 28 | 2009-05-22 08:54:28 | 43,582 | 2009-05-22 08:54:28 | https://stackoverflow.com/q/896832 | https://stackoverflow.com/a/896956 | <p>Looks you need to put that commit back into the <code>master</code> branch (if it belongs there). Also it looks like you’ve detached HEAD because that commit is not a branch head. If all this is true, try the following:</p>
<pre><code># git log -1
</code></pre>
<p>Remember the commit ID.</p>
<pre><code># git chec... | <p>Looks you need to put that commit back into the <code>master</code> branch (if it belongs there). Also it looks like you’ve detached HEAD because that commit is not a branch head. If all this is true, try the following:</p> <pre><code># git log -1 </code></pre> <p>Remember the commit ID.</p> <pre><code># git chec... | 119, 456, 30785 | git, gitk, version-control | <h1>In gitk, why is my yellow button above master?</h1>
<p>I couldn't find any documentation on gitk about what the colors mean, but the problem here I think is that my yellow button has passed my master. Now when I try to do:</p>
<p><code>git push origin master</code></p>
<p>It doesn't work. How did my yellow button... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,249 | git | # In gitk, why is my yellow button above master?
I couldn't find any documentation on gitk about what the colors mean, but the problem here I think is that my yellow button has passed my master. Now when I try to do:
`git push origin master`
It doesn't work. How did my yellow button get over master and how do I get ... | Looks you need to put that commit back into the `master` branch (if it belongs there). Also it looks like you’ve detached HEAD because that commit is not a branch head. If all this is true, try the following:
```
# git log -1
```
Remember the commit ID.
```
# git checkout master
# git reset --hard <commit-id>
```
N... |
63496368 | git: How to remove *all* files from the git history that are not currently present? | 18 | 2020-08-19 23:37:11 | <p>I've seen several articles and questions about how to remove a <em>single</em> file from all git history. Example: <a href="https://stackoverflow.com/questions/2100907/how-to-remove-delete-a-large-file-from-commit-history-in-git-repository">How to remove/delete a large file from commit history in Git repository?</a>... | 7,664 | 7,023,816 | 2024-01-19 15:16:23 | 68,368,158 | 28 | 2021-07-13 19:11:00 | 7,023,816 | 2021-09-02 16:26:30 | https://stackoverflow.com/q/63496368 | https://stackoverflow.com/a/68368158 | <p>I ended up using <code>git-filter-repo</code>. <strong>WARNING: This approach is NOT able to update tags on the remote, if there are any.</strong></p>
<ol>
<li><p>Install <code>git-filter-repo</code>.</p>
<pre><code>brew install git-filter-repo
</code></pre>
</li>
<li><p>Clone your desired repo, in mirror form.</p>
... | <p>I ended up using <code>git-filter-repo</code>. <strong>WARNING: This approach is NOT able to update tags on the remote, if there are any.</strong></p> <ol> <li><p>Install <code>git-filter-repo</code>.</p> <pre><code>brew install git-filter-repo </code></pre> </li> <li><p>Clone your desired repo, in mirror form.</p> ... | 119 | git | <h1>git: How to remove *all* files from the git history that are not currently present?</h1>
<p>I've seen several articles and questions about how to remove a <em>single</em> file from all git history. Example: <a href="https://stackoverflow.com/questions/2100907/how-to-remove-delete-a-large-file-from-commit-history-in... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,250 | git | # git: How to remove *all* files from the git history that are not currently present?
I've seen several articles and questions about how to remove a *single* file from all git history. Example: [How to remove/delete a large file from commit history in Git repository?](https://stackoverflow.com/questions/2100907/how-to... | I ended up using `git-filter-repo`. **WARNING: This approach is NOT able to update tags on the remote, if there are any.**
1. Install `git-filter-repo`.
```
brew install git-filter-repo
```
2. Clone your desired repo, in mirror form.
```
git clone --mirror <my-repo-url>
```
3. Enter the repo direct... |
19116545 | git tag: fatal: Failed to resolve 'HEAD' as a valid ref | 18 | 2013-10-01 12:46:29 | <p>I am cloning a single branch from a repository and creating a tag in a python script. The commands are as follows.</p>
<pre><code>git clone -b master --single-branch <repository adress>
git tag -a testag -m 'test'
</code></pre>
<p>It clones successfully but when it comes to adding the tag, it breaks with th... | 48,933 | 1,185,665 | 2017-08-11 09:10:55 | 31,640,816 | 28 | 2015-07-26 19:03:47 | 1,641,233 | 2017-08-11 09:10:55 | https://stackoverflow.com/q/19116545 | https://stackoverflow.com/a/31640816 | <p>I had the same issue. You have to commit first before tagging</p>
<pre><code>git commit
</code></pre>
<p>because you put tags on commits. So when there is no commit (like in your situation), you can't create a tag.</p>
| <p>I had the same issue. You have to commit first before tagging</p> <pre><code>git commit </code></pre> <p>because you put tags on commits. So when there is no commit (like in your situation), you can't create a tag.</p> | 119 | git | <h1>git tag: fatal: Failed to resolve 'HEAD' as a valid ref</h1>
<p>I am cloning a single branch from a repository and creating a tag in a python script. The commands are as follows.</p>
<pre><code>git clone -b master --single-branch <repository adress>
git tag -a testag -m 'test'
</code></pre>
<p>It clones su... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,252 | git | # git tag: fatal: Failed to resolve 'HEAD' as a valid ref
I am cloning a single branch from a repository and creating a tag in a python script. The commands are as follows.
```
git clone -b master --single-branch <repository adress>
git tag -a testag -m 'test'
```
It clones successfully but when it comes to adding ... | I had the same issue. You have to commit first before tagging
```
git commit
```
because you put tags on commits. So when there is no commit (like in your situation), you can't create a tag. |
11113322 | Remove 4 commits from my git history | 18 | 2012-06-20 05:29:07 | <p>I have done some commits and pushed them into my repository. Then I did a pull request but I realized there are some commits I don't want to be in the pull request.</p>
<p>They look like this:</p>
<pre><code>My commits look like this:
Correct HTML
ab1c41c
HTML escaping
8b38955
Merge branch 'master' in... | 17,879 | 1,196,150 | 2025-01-23 13:22:20 | 11,114,517 | 28 | 2012-06-20 07:09:08 | 32,384 | 2016-03-16 16:45:40 | https://stackoverflow.com/q/11113322 | https://stackoverflow.com/a/11114517 | <p>You can do an <a href="http://git-scm.com/book/en/Git-Tools-Rewriting-History" rel="noreferrer">interactive rebase</a>.</p>
<p>Assuming your head is at <code>ab1c41c</code> from your example, invoke the rebase as follows</p>
<pre><code>git rebase -i HEAD~7
</code></pre>
<p>This tells git you want to manipulate th... | <p>You can do an <a href="http://git-scm.com/book/en/Git-Tools-Rewriting-History" rel="noreferrer">interactive rebase</a>.</p> <p>Assuming your head is at <code>ab1c41c</code> from your example, invoke the rebase as follows</p> <pre><code>git rebase -i HEAD~7 </code></pre> <p>This tells git you want to manipulate th... | 119, 29934 | git, git-rebase | <h1>Remove 4 commits from my git history</h1>
<p>I have done some commits and pushed them into my repository. Then I did a pull request but I realized there are some commits I don't want to be in the pull request.</p>
<p>They look like this:</p>
<pre><code>My commits look like this:
Correct HTML
ab1c41c
HTML ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,253 | git | # Remove 4 commits from my git history
I have done some commits and pushed them into my repository. Then I did a pull request but I realized there are some commits I don't want to be in the pull request.
They look like this:
```
My commits look like this:
Correct HTML
ab1c41c
HTML escaping
8b38955
Merge ... | You can do an [interactive rebase](http://git-scm.com/book/en/Git-Tools-Rewriting-History).
Assuming your head is at `ab1c41c` from your example, invoke the rebase as follows
```
git rebase -i HEAD~7
```
This tells git you want to manipulate the last 8 or so commits. You'll be dropped into your editor with a listing... |
787797 | How do I commit a git tag? | 18 | 2009-04-24 22:26:45 | <p>I have successfully made, committed, and pushed changes to a central git repository. I realize now that I want to tag the current version of all files. So I do:</p>
<pre><code>git tag -a 0.5
</code></pre>
<p>That succeeds. But now I try a <code>git push</code> and I am told there's nothing to commit. How do I ... | 6,666 | 16,266 | 2017-04-26 20:48:30 | 787,802 | 28 | 2009-04-24 22:28:36 | 2,010 | 2009-04-24 22:42:39 | https://stackoverflow.com/q/787797 | https://stackoverflow.com/a/787802 | <p>I think you want</p>
<pre><code>git push --tags
</code></pre>
<p>as that, well, pushes all your tags :)</p>
<p>There are some alternatives of course, this being git and all (replace origin with your repo of choice):</p>
<pre><code>git push origin tag 0.5
</code></pre>
<p>or</p>
<pre><code>git push origin refs/... | <p>I think you want</p> <pre><code>git push --tags </code></pre> <p>as that, well, pushes all your tags :)</p> <p>There are some alternatives of course, this being git and all (replace origin with your repo of choice):</p> <pre><code>git push origin tag 0.5 </code></pre> <p>or</p> <pre><code>git push origin refs/... | 119, 456, 60718 | git, git-tag, version-control | <h1>How do I commit a git tag?</h1>
<p>I have successfully made, committed, and pushed changes to a central git repository. I realize now that I want to tag the current version of all files. So I do:</p>
<pre><code>git tag -a 0.5
</code></pre>
<p>That succeeds. But now I try a <code>git push</code> and I am told t... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,254 | git | # How do I commit a git tag?
I have successfully made, committed, and pushed changes to a central git repository. I realize now that I want to tag the current version of all files. So I do:
```
git tag -a 0.5
```
That succeeds. But now I try a `git push` and I am told there's nothing to commit. How do I push my new ... | I think you want
```
git push --tags
```
as that, well, pushes all your tags :)
There are some alternatives of course, this being git and all (replace origin with your repo of choice):
```
git push origin tag 0.5
```
or
```
git push origin refs/tags/0.5:refs/tags/0.5
```
See [git-push(1)](http://www.kernel.org/p... |
68154564 | Should we (git / version control) track .firebase folder for Firebase Hosting? | 17 | 2021-06-27 19:18:47 | <p>I have hosted my Flutter app using Firebase Hosting. After hosting it, I noticed that a <code>.firebase</code> folder was created that contains just one file, <code>hosting.<alphanumeric>.cache</code>.</p>
<p>Should I track the contents of the <code>.firebase</code> folder? Or should I add the <code>.firebase<... | 6,280 | 11,547,064 | 2021-06-27 19:24:03 | 68,154,599 | 28 | 2021-06-27 19:24:03 | 5,519,300 | 2021-06-27 19:24:03 | https://stackoverflow.com/q/68154564 | https://stackoverflow.com/a/68154599 | <p>It is there to make your hosting deplyoment faster. It is used to check if files have changed since the last deployment.</p>
<p>It is recommended to put it to your <code>.gitignore</code> file.</p>
| <p>It is there to make your hosting deplyoment faster. It is used to check if files have changed since the last deployment.</p> <p>It is recommended to put it to your <code>.gitignore</code> file.</p> | 119, 456, 79466, 106175, 115695 | firebase, firebase-hosting, flutter, git, version-control | <h1>Should we (git / version control) track .firebase folder for Firebase Hosting?</h1>
<p>I have hosted my Flutter app using Firebase Hosting. After hosting it, I noticed that a <code>.firebase</code> folder was created that contains just one file, <code>hosting.<alphanumeric>.cache</code>.</p>
<p>Should I track... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,255 | git | # Should we (git / version control) track .firebase folder for Firebase Hosting?
I have hosted my Flutter app using Firebase Hosting. After hosting it, I noticed that a `.firebase` folder was created that contains just one file, `hosting.<alphanumeric>.cache`.
Should I track the contents of the `.firebase` folder? Or... | It is there to make your hosting deplyoment faster. It is used to check if files have changed since the last deployment.
It is recommended to put it to your `.gitignore` file. |
48858262 | How to update time when git cherry pick | 16 | 2018-02-19 00:49:22 | <ol>
<li><p>Am I understanding correctly? When cherry pick a commit, the commit hash id and commit date will change, but <code>AuthorDate</code> remains the same as previous commit.</p></li>
<li><p>If 1 is true, how can I update <code>AuthorDate</code> too when cherry pick?</p></li>
</ol>
| 8,845 | 2,038,901 | 2023-10-19 02:17:29 | 48,858,373 | 28 | 2018-02-19 01:09:41 | 1,256,452 | 2018-02-19 01:09:41 | https://stackoverflow.com/q/48858262 | https://stackoverflow.com/a/48858373 | <ol>
<li><p>Yes: the new commit is a <em>new</em> commit, so it necessarily has a different hash ID. (The existing commit remains in the repository.) Since it's a new commit, Git will assign your name as the committer, and "now" (or the computer's best guess for "now") as the time of the new commit.</p>
<p>Meanwhile... | <ol> <li><p>Yes: the new commit is a <em>new</em> commit, so it necessarily has a different hash ID. (The existing commit remains in the repository.) Since it's a new commit, Git will assign your name as the committer, and "now" (or the computer's best guess for "now") as the time of the new commit.</p> <p>Meanwhile... | 119 | git | <h1>How to update time when git cherry pick</h1>
<ol>
<li><p>Am I understanding correctly? When cherry pick a commit, the commit hash id and commit date will change, but <code>AuthorDate</code> remains the same as previous commit.</p></li>
<li><p>If 1 is true, how can I update <code>AuthorDate</code> too when cherry pi... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,257 | git | # How to update time when git cherry pick
1. Am I understanding correctly? When cherry pick a commit, the commit hash id and commit date will change, but `AuthorDate` remains the same as previous commit.
2. If 1 is true, how can I update `AuthorDate` too when cherry pick? | 1. Yes: the new commit is a *new* commit, so it necessarily has a different hash ID. (The existing commit remains in the repository.) Since it's a new commit, Git will assign your name as the committer, and "now" (or the computer's best guess for "now") as the time of the new commit.
Meanwhile, `git commit` checks ... |
42857506 | How to automatically `git commit amend` to *append* to last commit message? | 16 | 2017-03-17 12:25:26 | <p>Trying to <strong>edit</strong> last commit message by appending a string in the end of the previous message.</p>
<p>Trying to do this from a CI server, so I'm looking for an automatic solution that doesn't require any interactive human intervention</p>
| 7,611 | 4,917,574 | 2021-11-11 11:28:01 | 42,857,774 | 28 | 2017-03-17 12:36:21 | 729,881 | 2017-03-17 12:36:21 | https://stackoverflow.com/q/42857506 | https://stackoverflow.com/a/42857774 | <p>If you want to amend the current commit and change the commit message without opening an editor, you can use the <code>-m</code> flag to supply a message. For example:</p>
<pre><code>git commit --amend -m"This is the commit message."
</code></pre>
<p>Will amend the current HEAD, using the message given as the new... | <p>If you want to amend the current commit and change the commit message without opening an editor, you can use the <code>-m</code> flag to supply a message. For example:</p> <pre><code>git commit --amend -m"This is the commit message." </code></pre> <p>Will amend the current HEAD, using the message given as the new... | 119 | git | <h1>How to automatically `git commit amend` to *append* to last commit message?</h1>
<p>Trying to <strong>edit</strong> last commit message by appending a string in the end of the previous message.</p>
<p>Trying to do this from a CI server, so I'm looking for an automatic solution that doesn't require any interactive ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,258 | git | # How to automatically `git commit amend` to *append* to last commit message?
Trying to **edit** last commit message by appending a string in the end of the previous message.
Trying to do this from a CI server, so I'm looking for an automatic solution that doesn't require any interactive human intervention | If you want to amend the current commit and change the commit message without opening an editor, you can use the `-m` flag to supply a message. For example:
```
git commit --amend -m"This is the commit message."
```
Will amend the current HEAD, using the message given as the new message:
```
% git log
commit adecdcf... |
7524169 | Automatic Staging with Git | 16 | 2011-09-23 04:17:05 | <p>I have a git repository and it is doing something I've never seen before and haven't found a solution anywhere. I initialized with <code>git init</code> and added everything with <code>git add *</code> and went on my way now when I try to commit after editing any number of files none are staged for commit so I have ... | 10,609 | 526,901 | 2011-09-23 04:26:17 | 7,524,204 | 28 | 2011-09-23 04:24:26 | 524,389 | 2011-09-23 04:24:26 | https://stackoverflow.com/q/7524169 | https://stackoverflow.com/a/7524204 | <p>You do have to add your changes to the commit, but you can just use:</p>
<pre><code>git commit -a
</code></pre>
<p>To add your changes AND commit or</p>
<pre><code>git commit -am 'commit message'
</code></pre>
<p>Which is how i usually roll.</p>
<p>Manually adding your changes lets you not commit everything if ... | <p>You do have to add your changes to the commit, but you can just use:</p> <pre><code>git commit -a </code></pre> <p>To add your changes AND commit or</p> <pre><code>git commit -am 'commit message' </code></pre> <p>Which is how i usually roll.</p> <p>Manually adding your changes lets you not commit everything if ... | 119 | git | <h1>Automatic Staging with Git</h1>
<p>I have a git repository and it is doing something I've never seen before and haven't found a solution anywhere. I initialized with <code>git init</code> and added everything with <code>git add *</code> and went on my way now when I try to commit after editing any number of files n... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,259 | git | # Automatic Staging with Git
I have a git repository and it is doing something I've never seen before and haven't found a solution anywhere. I initialized with `git init` and added everything with `git add *` and went on my way now when I try to commit after editing any number of files none are staged for commit so I ... | You do have to add your changes to the commit, but you can just use:
```
git commit -a
```
To add your changes AND commit or
```
git commit -am 'commit message'
```
Which is how i usually roll.
Manually adding your changes lets you not commit everything if you dont want to, which I'm sure you can tell is useful so... |
6001136 | How can I add current Eclipse project to git with EGit? | 16 | 2011-05-14 10:11:49 | <p>I have GAE project in my Eclipse and I want to add it to my local git repo, how can I do that?</p>
| 32,181 | 159,793 | 2014-06-27 12:10:55 | 6,001,346 | 28 | 2011-05-14 10:54:35 | 6,309 | 2014-06-27 12:10:55 | https://stackoverflow.com/q/6001136 | https://stackoverflow.com/a/6001346 | <p>Since creating a <a href="https://stackoverflow.com/questions/2919517/google-app-engine-and-git-best-practices">Git repo within a GAE project</a> is possible through command line, it is possible through Egit:<br>
Follow that <a href="http://www.vogella.de/articles/EGit/article.html#respository" rel="nofollow norefer... | <p>Since creating a <a href="https://stackoverflow.com/questions/2919517/google-app-engine-and-git-best-practices">Git repo within a GAE project</a> is possible through command line, it is possible through Egit:<br> Follow that <a href="http://www.vogella.de/articles/EGit/article.html#respository" rel="nofollow norefer... | 53, 119, 43702 | eclipse, egit, git | <h1>How can I add current Eclipse project to git with EGit?</h1>
<p>I have GAE project in my Eclipse and I want to add it to my local git repo, how can I do that?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,260 | git | # How can I add current Eclipse project to git with EGit?
I have GAE project in my Eclipse and I want to add it to my local git repo, how can I do that? | Since creating a [Git repo within a GAE project](https://stackoverflow.com/questions/2919517/google-app-engine-and-git-best-practices) is possible through command line, it is possible through Egit:
Follow that [Egit tutorial](http://www.vogella.de/articles/EGit/article.html#respository):
For a new repo:
> Right cli... |
5412599 | git is stating a branch is not merged after rebasing - why? | 16 | 2011-03-23 22:44:24 | <p>I'm using git-svn to manage my bugfix branches, but it tells me that I have unmerged changes, even though if I review the SVN repo directly, I can see they have been committed too. It's like the rebase of the bug fix is not setting the branch as merged.</p>
<p>What am I doing wrong, here?</p>
<pre><code>git checko... | 2,855 | 2,192 | 2011-03-23 23:35:45 | 5,412,868 | 28 | 2011-03-23 23:16:18 | 216,074 | 2011-03-23 23:16:18 | https://stackoverflow.com/q/5412599 | https://stackoverflow.com/a/5412868 | <p>The reason for that is that <code>git rebase</code> changes the commit objects. So while the actual content (or diff) is the same with those rebased commits, they are referring to a different parent, and as such are different.</p>
<p>That way <code>git branch -d</code> cannot verify that the changes of those commit... | <p>The reason for that is that <code>git rebase</code> changes the commit objects. So while the actual content (or diff) is the same with those rebased commits, they are referring to a different parent, and as such are different.</p> <p>That way <code>git branch -d</code> cannot verify that the changes of those commit... | 119, 6452 | git, git-svn | <h1>git is stating a branch is not merged after rebasing - why?</h1>
<p>I'm using git-svn to manage my bugfix branches, but it tells me that I have unmerged changes, even though if I review the SVN repo directly, I can see they have been committed too. It's like the rebase of the bug fix is not setting the branch as me... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,261 | git | # git is stating a branch is not merged after rebasing - why?
I'm using git-svn to manage my bugfix branches, but it tells me that I have unmerged changes, even though if I review the SVN repo directly, I can see they have been committed too. It's like the rebase of the bug fix is not setting the branch as merged.
Wh... | The reason for that is that `git rebase` changes the commit objects. So while the actual content (or diff) is the same with those rebased commits, they are referring to a different parent, and as such are different.
That way `git branch -d` cannot verify that the changes of those commits are included in some other com... |
2089560 | How do I merge a binary file? | 16 | 2010-01-18 22:03:08 | <p>I have a binary file in my_branch, and when I need to make changes to it, git will of course not merge it.</p>
<p>So what I do now is:</p>
<pre><code>git checkout my_branch
# make a change to gui.bin
mv gui.bin ~/
git commit -a
mv ~/gui.bin .
git commit -a
# git rebase to 1 commit
git checkout master
git merge my_... | 20,210 | 200,265 | 2010-01-18 22:45:21 | 2,089,754 | 28 | 2010-01-18 22:45:21 | 19,563 | 2010-01-18 22:45:21 | https://stackoverflow.com/q/2089560 | https://stackoverflow.com/a/2089754 | <p>I'm not quite sure what your test case is driving at. You seem to be moving gui.bin out of the way and then putting it back the way it was...</p>
<p>Often, binary files don't need to be merged, you just want to chose a definitive version from one place or another. Where they genuinely have to be merged you either n... | <p>I'm not quite sure what your test case is driving at. You seem to be moving gui.bin out of the way and then putting it back the way it was...</p> <p>Often, binary files don't need to be merged, you just want to chose a definitive version from one place or another. Where they genuinely have to be merged you either n... | 119 | git | <h1>How do I merge a binary file?</h1>
<p>I have a binary file in my_branch, and when I need to make changes to it, git will of course not merge it.</p>
<p>So what I do now is:</p>
<pre><code>git checkout my_branch
# make a change to gui.bin
mv gui.bin ~/
git commit -a
mv ~/gui.bin .
git commit -a
# git rebase to 1 c... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,262 | git | # How do I merge a binary file?
I have a binary file in my_branch, and when I need to make changes to it, git will of course not merge it.
So what I do now is:
```
git checkout my_branch
# make a change to gui.bin
mv gui.bin ~/
git commit -a
mv ~/gui.bin .
git commit -a
# git rebase to 1 commit
git checkout master
g... | I'm not quite sure what your test case is driving at. You seem to be moving gui.bin out of the way and then putting it back the way it was...
Often, binary files don't need to be merged, you just want to chose a definitive version from one place or another. Where they genuinely have to be merged you either need a cust... |
38462494 | How to git clone with external linked repositories in branch? | 15 | 2016-07-19 15:17:36 | <p>I trying git clone this case.</p>
<p>For example in git branch:</p>
<ul>
<li>external repo 1 @ 797131b</li>
<li>external repo 2 @ 04a1ffe</li>
<li>external repo 3 @ b8132df</li>
</ul>
<p>It is external linked repositories in branch.</p>
<p>I want git clone repository with external linked repositories.</p>
<p>Bu... | 15,696 | 3,702,603 | 2016-07-19 16:13:13 | 38,463,600 | 28 | 2016-07-19 16:09:12 | 5,048,383 | 2016-07-19 16:09:12 | https://stackoverflow.com/q/38462494 | https://stackoverflow.com/a/38463600 | <p>To automatically initialize and update each submodule in the repository, pass <code>--recursive</code> to the <code>git clone</code>:</p>
<pre><code>git clone --recursive <repoAddress>
</code></pre>
<p>More about submodules: <a href="https://git-scm.com/book/en/v2/Git-Tools-Submodules" rel="noreferrer">https... | <p>To automatically initialize and update each submodule in the repository, pass <code>--recursive</code> to the <code>git clone</code>:</p> <pre><code>git clone --recursive <repoAddress> </code></pre> <p>More about submodules: <a href="https://git-scm.com/book/en/v2/Git-Tools-Submodules" rel="noreferrer">https... | 119, 3050 | clone, git | <h1>How to git clone with external linked repositories in branch?</h1>
<p>I trying git clone this case.</p>
<p>For example in git branch:</p>
<ul>
<li>external repo 1 @ 797131b</li>
<li>external repo 2 @ 04a1ffe</li>
<li>external repo 3 @ b8132df</li>
</ul>
<p>It is external linked repositories in branch.</p>
<p>I ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,263 | git | # How to git clone with external linked repositories in branch?
I trying git clone this case.
For example in git branch:
- external repo 1 @ 797131b
- external repo 2 @ 04a1ffe
- external repo 3 @ b8132df
It is external linked repositories in branch.
I want git clone repository with external linked repositories.
... | To automatically initialize and update each submodule in the repository, pass `--recursive` to the `git clone`:
```
git clone --recursive <repoAddress>
```
More about submodules: <https://git-scm.com/book/en/v2/Git-Tools-Submodules> |
23608525 | How can I checkout an untracked file in a git stash? | 15 | 2014-05-12 12:04:14 | <p>Assume I have stashed some changes using one of:</p>
<pre><code>git stash -u
git stash --include-untracked
</code></pre>
<p>I can checkout an individual file from the stash via</p>
<pre><code>git checkout stash@{0} -- filename
</code></pre>
<p>That works if git knows about "filename", but doesn't work if "filena... | 3,898 | 1,415,138 | 2018-12-01 18:20:20 | 23,609,023 | 28 | 2014-05-12 12:26:09 | 12,471 | 2014-05-12 12:26:09 | https://stackoverflow.com/q/23608525 | https://stackoverflow.com/a/23609023 | <p><code>git stash</code> internally creates special black magic merge commits to store different parts of your changes. The merge commit has the original base commit (what you had at the top of the branch when you stashed) as its first parent, a throwaway commit representing the index contents at time of stashing as i... | <p><code>git stash</code> internally creates special black magic merge commits to store different parts of your changes. The merge commit has the original base commit (what you had at the top of the branch when you stashed) as its first parent, a throwaway commit representing the index contents at time of stashing as i... | 119 | git | <h1>How can I checkout an untracked file in a git stash?</h1>
<p>Assume I have stashed some changes using one of:</p>
<pre><code>git stash -u
git stash --include-untracked
</code></pre>
<p>I can checkout an individual file from the stash via</p>
<pre><code>git checkout stash@{0} -- filename
</code></pre>
<p>That wo... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,264 | git | # How can I checkout an untracked file in a git stash?
Assume I have stashed some changes using one of:
```
git stash -u
git stash --include-untracked
```
I can checkout an individual file from the stash via
```
git checkout stash@{0} -- filename
```
That works if git knows about "filename", but doesn't work if "f... | `git stash` internally creates special black magic merge commits to store different parts of your changes. The merge commit has the original base commit (what you had at the top of the branch when you stashed) as its first parent, a throwaway commit representing the index contents at time of stashing as its second pare... |
19636380 | How to delete "remote" branch that still shows locally? | 15 | 2013-10-28 13:42:08 | <p>A branch was created unintentionally. I want to delete it. In fact, I thought I deleted it last week, and it doesn't show up in searches on bitbucket, so I'm inclined to think the problem is just in my local repo. Why does the branch still show up in my local repo after doing this?</p>
<pre><code>$ git branch -d eb... | 8,225 | 418,413 | 2018-02-21 07:08:19 | 19,636,504 | 28 | 2013-10-28 13:48:12 | 176,922 | 2018-02-21 07:08:19 | https://stackoverflow.com/q/19636380 | https://stackoverflow.com/a/19636504 | <p>You are looking for <code>git remote prune</code> which removes stale remote branches.</p>
<blockquote>
<p>Deletes all stale remote-tracking branches under . These stale branches have already been removed
from the remote repository referenced by , but are still locally available in "remotes/".</p>
<p>With ... | <p>You are looking for <code>git remote prune</code> which removes stale remote branches.</p> <blockquote> <p>Deletes all stale remote-tracking branches under . These stale branches have already been removed from the remote repository referenced by , but are still locally available in "remotes/".</p> <p>With ... | 119, 76220 | git, git-branch | <h1>How to delete "remote" branch that still shows locally?</h1>
<p>A branch was created unintentionally. I want to delete it. In fact, I thought I deleted it last week, and it doesn't show up in searches on bitbucket, so I'm inclined to think the problem is just in my local repo. Why does the branch still show up in m... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,265 | git | # How to delete "remote" branch that still shows locally?
A branch was created unintentionally. I want to delete it. In fact, I thought I deleted it last week, and it doesn't show up in searches on bitbucket, so I'm inclined to think the problem is just in my local repo. Why does the branch still show up in my local r... | You are looking for `git remote prune` which removes stale remote branches.
> Deletes all stale remote-tracking branches under . These stale branches have already been removed
> from the remote repository referenced by , but are still locally available in "remotes/".
>
> With --dry-run option, report what branches wil... |
11148755 | How to import local git repository into svn? | 15 | 2012-06-22 00:33:39 | <p>I am working on local git repository and I need to push my local git into <em>existing</em> svn repository. My git repository is pure local git repository, it was <strong><em>not</em></strong> init using <code>git svn clone</code>.</p>
<p>How can I import this local git repo into svn?</p>
<p>Preferably I'ld like t... | 7,413 | 10,638 | 2018-06-12 13:51:26 | 11,320,775 | 28 | 2012-07-03 23:58:35 | 10,638 | 2018-06-12 13:51:26 | https://stackoverflow.com/q/11148755 | https://stackoverflow.com/a/11320775 | <p>I have finally solved this problem by the following steps:</p>
<ol>
<li><p>Setup appropriate project folder in svn to be imported to, for example <code>http://svnrepo/svn/trunk/newProject</code></p></li>
<li><p>Create a new git-svn repository</p>
<blockquote>
<p>git svn clone <code>http://svnrepo/svn/trunk/newPr... | <p>I have finally solved this problem by the following steps:</p> <ol> <li><p>Setup appropriate project folder in svn to be imported to, for example <code>http://svnrepo/svn/trunk/newProject</code></p></li> <li><p>Create a new git-svn repository</p> <blockquote> <p>git svn clone <code>http://svnrepo/svn/trunk/newPr... | 6452 | git-svn | <h1>How to import local git repository into svn?</h1>
<p>I am working on local git repository and I need to push my local git into <em>existing</em> svn repository. My git repository is pure local git repository, it was <strong><em>not</em></strong> init using <code>git svn clone</code>.</p>
<p>How can I import this l... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,266 | git | # How to import local git repository into svn?
I am working on local git repository and I need to push my local git into *existing* svn repository. My git repository is pure local git repository, it was ***not*** init using `git svn clone`.
How can I import this local git repo into svn?
Preferably I'ld like to keep ... | I have finally solved this problem by the following steps:
1. Setup appropriate project folder in svn to be imported to, for example `http://svnrepo/svn/trunk/newProject`
2. Create a new git-svn repository
> git svn clone `http://svnrepo/svn/trunk/newProject`
3. Add the git repo that we want to import as ***remote... |
32783295 | Unity Git - Ignore Library | 14 | 2015-09-25 13:26:19 | <p>We have been trying to setup Git with Unity past two days on our project between Mac and Pc. We got it kinda working, but we still have issues with the metadata and conflicts in Library/AssetDatabase3. </p>
<p>We got the whole Library folder in the .gitignore file but for some reason it seems some files in it are n... | 43,721 | 4,312,105 | 2020-01-21 15:16:49 | 59,844,105 | 28 | 2020-01-21 15:16:49 | 12,755,488 | 2020-01-21 15:16:49 | https://stackoverflow.com/q/32783295 | https://stackoverflow.com/a/59844105 | <p>I recently had this happen to me and found that the issue was that I had my entire Unity project in a folder in the repo, and the gitignore was using the syntax of</p>
<pre><code>/[Ll]ibrary/
</code></pre>
<p>which only searches folders at the same level as the gitignore itself, whereas</p>
<pre><code>[Ll]ibrary/... | <p>I recently had this happen to me and found that the issue was that I had my entire Unity project in a folder in the repo, and the gitignore was using the syntax of</p> <pre><code>/[Ll]ibrary/ </code></pre> <p>which only searches folders at the same level as the gitignore itself, whereas</p> <pre><code>[Ll]ibrary/... | 119, 3146, 3794, 25056, 28511 | conflict, git, gitignore, metadata, unity-game-engine | <h1>Unity Git - Ignore Library</h1>
<p>We have been trying to setup Git with Unity past two days on our project between Mac and Pc. We got it kinda working, but we still have issues with the metadata and conflicts in Library/AssetDatabase3. </p>
<p>We got the whole Library folder in the .gitignore file but for some re... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,267 | git | # Unity Git - Ignore Library
We have been trying to setup Git with Unity past two days on our project between Mac and Pc. We got it kinda working, but we still have issues with the metadata and conflicts in Library/AssetDatabase3.
We got the whole Library folder in the .gitignore file but for some reason it seems som... | I recently had this happen to me and found that the issue was that I had my entire Unity project in a folder in the repo, and the gitignore was using the syntax of
```
/[Ll]ibrary/
```
which only searches folders at the same level as the gitignore itself, whereas
```
[Ll]ibrary/
```
without the leading / searches a... |
36922197 | How does git status work internally? | 14 | 2016-04-28 17:59:15 | <p>From the <a href="https://git-scm.com/book/en/v2/Git-Internals-Git-Objects" rel="noreferrer">git object model</a>, files and folders are saved to locations in the .git folder by their sha1 hash. </p>
<p>How does git internally know if a file has been deleted, added, or edited (specifically, how does it compute the ... | 9,535 | 3,490,050 | 2017-06-16 11:07:38 | 36,922,283 | 28 | 2016-04-28 18:03:49 | 1,755,598 | 2017-06-16 11:07:38 | https://stackoverflow.com/q/36922197 | https://stackoverflow.com/a/36922283 | <p>The answer is bit too long and will take a while to write so here is the summary.</p>
<p>The short answer is that git uses the <code>SHA-1</code> to check track changes but the name of the file is stored somewhere else.</p>
<hr>
<p>The content is stored in a <code>pack</code> <sup>(*1- read below)</sup> while the... | <p>The answer is bit too long and will take a while to write so here is the summary.</p> <p>The short answer is that git uses the <code>SHA-1</code> to check track changes but the name of the file is stored somewhere else.</p> <hr> <p>The content is stored in a <code>pack</code> <sup>(*1- read below)</sup> while the... | 119 | git | <h1>How does git status work internally?</h1>
<p>From the <a href="https://git-scm.com/book/en/v2/Git-Internals-Git-Objects" rel="noreferrer">git object model</a>, files and folders are saved to locations in the .git folder by their sha1 hash. </p>
<p>How does git internally know if a file has been deleted, added, or ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,268 | git | # How does git status work internally?
From the [git object model](https://git-scm.com/book/en/v2/Git-Internals-Git-Objects), files and folders are saved to locations in the .git folder by their sha1 hash.
How does git internally know if a file has been deleted, added, or edited (specifically, how does it compute the... | The answer is bit too long and will take a while to write so here is the summary.
The short answer is that git uses the `SHA-1` to check track changes but the name of the file is stored somewhere else.
---
The content is stored in a `pack` (*1- read below) while the names are stored in a `idx`.
When you run `git s... |
28952102 | How can I set up gVim as my editor on Git for Windows? | 14 | 2015-03-09 21:29:44 | <p>I'd like to use gVim as my editor for Git commit messages. I realize Git has its own version of vim, but it's not quite the same as gVim (along with my _vimrc settings) which I use all day anyhow.</p>
| 6,374 | 198,369 | 2015-04-30 12:15:30 | 28,952,307 | 28 | 2015-03-09 21:42:58 | 198,369 | 2015-03-09 21:42:58 | https://stackoverflow.com/q/28952102 | https://stackoverflow.com/a/28952307 | <p>You can use gVim with Git by configuring your <code>core.editor</code> to contain the path where you have gVim installed. You'll also want to run it in the foreground and not load your _viminfo file, which would position your cursor in the place where you finished your previous commit message.</p>
<p>Taking note of... | <p>You can use gVim with Git by configuring your <code>core.editor</code> to contain the path where you have gVim installed. You'll also want to run it in the foreground and not load your _viminfo file, which would position your cursor in the place where you finished your previous commit message.</p> <p>Taking note of... | 64, 119, 370 | git, vim, windows | <h1>How can I set up gVim as my editor on Git for Windows?</h1>
<p>I'd like to use gVim as my editor for Git commit messages. I realize Git has its own version of vim, but it's not quite the same as gVim (along with my _vimrc settings) which I use all day anyhow.</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,269 | git | # How can I set up gVim as my editor on Git for Windows?
I'd like to use gVim as my editor for Git commit messages. I realize Git has its own version of vim, but it's not quite the same as gVim (along with my _vimrc settings) which I use all day anyhow. | You can use gVim with Git by configuring your `core.editor` to contain the path where you have gVim installed. You'll also want to run it in the foreground and not load your _viminfo file, which would position your cursor in the place where you finished your previous commit message.
Taking note of the single and doubl... |
8142058 | 'chcp' is not recognized as an internal or external command, operable program or batch file. on a Windows PC | 14 | 2011-11-15 19:33:00 | <p>I am receiving the error message below in the command prompt when using the <code>git init</code> command. I'm using a Windows PC running Windows 7.</p>
<pre><code>C:\rails_projects\first_app>git init
'chcp' is not recognized as an internal or external command,
operable program or batch file.
Reinitialized exis... | 64,732 | 899,904 | 2021-03-25 10:42:14 | 8,143,664 | 28 | 2011-11-15 21:52:22 | 526,535 | 2021-03-25 10:42:14 | https://stackoverflow.com/q/8142058 | https://stackoverflow.com/a/8143664 | <p>See if your PATH environment variable is setup properly. Any system should have atleast the below on PATH</p>
<pre><code>;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;
</code></pre>
<p>Add the above if not there.</p>
<p>Once added, open a new cmd / bash and try:</p>
<pre><code>where chcp
</code></pr... | <p>See if your PATH environment variable is setup properly. Any system should have atleast the below on PATH</p> <pre><code>;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem; </code></pre> <p>Add the above if not there.</p> <p>Once added, open a new cmd / bash and try:</p> <pre><code>where chcp </code></pr... | 64, 119, 1231, 9013 | command-line, environment-variables, git, windows | <h1>'chcp' is not recognized as an internal or external command, operable program or batch file. on a Windows PC</h1>
<p>I am receiving the error message below in the command prompt when using the <code>git init</code> command. I'm using a Windows PC running Windows 7.</p>
<pre><code>C:\rails_projects\first_app>gi... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,271 | git | # 'chcp' is not recognized as an internal or external command, operable program or batch file. on a Windows PC
I am receiving the error message below in the command prompt when using the `git init` command. I'm using a Windows PC running Windows 7.
```
C:\rails_projects\first_app>git init
'chcp' is not recognized as ... | See if your PATH environment variable is setup properly. Any system should have atleast the below on PATH
```
;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;
```
Add the above if not there.
Once added, open a new cmd / bash and try:
```
where chcp
```
It should give the path.
Then try with the `gi... |
6535150 | Git pull change log | 14 | 2011-06-30 13:01:58 | <p>After pulling from a git server, I'm trying to get a list of all changed files. I don't need any specific parts of code, just a list of files (with some kind of indication as to wether it's been added, removed or changed). </p>
<p>I first looked at using git log, but that appearantly only returns info from the last... | 21,591 | 499,139 | 2012-06-13 23:59:52 | 6,535,251 | 28 | 2011-06-30 13:10:30 | 85,134 | 2011-06-30 13:10:30 | https://stackoverflow.com/q/6535150 | https://stackoverflow.com/a/6535251 | <p>After a pull, <code>ORIG_HEAD</code> refers to where you were before, and <code>HEAD</code> refers to where you are now. So <code>ORIG_HEAD..</code> means the changes pulled into the current branch. <code>--max-count=1</code> means just the last commit, not what you want, as you discovered.</p>
<p>You probably want... | <p>After a pull, <code>ORIG_HEAD</code> refers to where you were before, and <code>HEAD</code> refers to where you are now. So <code>ORIG_HEAD..</code> means the changes pulled into the current branch. <code>--max-count=1</code> means just the last commit, not what you want, as you discovered.</p> <p>You probably want... | 119, 942, 4860, 5597 | commit, git, logging, pull | <h1>Git pull change log</h1>
<p>After pulling from a git server, I'm trying to get a list of all changed files. I don't need any specific parts of code, just a list of files (with some kind of indication as to wether it's been added, removed or changed). </p>
<p>I first looked at using git log, but that appearantly on... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,272 | git | # Git pull change log
After pulling from a git server, I'm trying to get a list of all changed files. I don't need any specific parts of code, just a list of files (with some kind of indication as to wether it's been added, removed or changed).
I first looked at using git log, but that appearantly only returns info f... | After a pull, `ORIG_HEAD` refers to where you were before, and `HEAD` refers to where you are now. So `ORIG_HEAD..` means the changes pulled into the current branch. `--max-count=1` means just the last commit, not what you want, as you discovered.
You probably want something like `git diff --name-status ORIG_HEAD..` w... |
41708925 | Are "git fetch --tags --force" and "git pull <branch>" conmutative operations? | 13 | 2017-01-17 23:33:26 | <p>Normally the git tags are a fixed reference to a commit. But sometimes they are used to mark some event (<code>last-build</code>, <code>base-line</code>, etc..) and they change frequently. </p>
<p>I have an script that refreshes those kind of "floating" tags from the reference repository.</p>
<pre><code>git fetc... | 31,978 | 469,294 | 2020-03-05 09:12:11 | 41,710,011 | 28 | 2017-01-18 01:33:57 | 1,256,452 | 2017-01-19 09:39:18 | https://stackoverflow.com/q/41708925 | https://stackoverflow.com/a/41710011 | <p>This gets into one of the more obscure corners of Git, but in the end the answer is "it doesn't matter initially which order you use". However, I'd recommend avoiding <code>git pull</code> in general, and never using it in scripts anyway. Plus, it does matter, in a different way, precisely <em>when</em> you fetch,... | <p>This gets into one of the more obscure corners of Git, but in the end the answer is "it doesn't matter initially which order you use". However, I'd recommend avoiding <code>git pull</code> in general, and never using it in scripts anyway. Plus, it does matter, in a different way, precisely <em>when</em> you fetch,... | 119, 28896, 33720 | git, git-fetch, git-pull | <h1>Are "git fetch --tags --force" and "git pull <branch>" conmutative operations?</h1>
<p>Normally the git tags are a fixed reference to a commit. But sometimes they are used to mark some event (<code>last-build</code>, <code>base-line</code>, etc..) and they change frequently. </p>
<p>I have an script that refresh... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,273 | git | # Are "git fetch --tags --force" and "git pull " conmutative operations?
Normally the git tags are a fixed reference to a commit. But sometimes they are used to mark some event (`last-build`, `base-line`, etc..) and they change frequently.
I have an script that refreshes those kind of "floating" tags from the referen... | This gets into one of the more obscure corners of Git, but in the end the answer is "it doesn't matter initially which order you use". However, I'd recommend avoiding `git pull` in general, and never using it in scripts anyway. Plus, it does matter, in a different way, precisely *when* you fetch, as we will see below. ... |
12323128 | GIT: The following untracked working tree files would be overwritten by checkout | 13 | 2012-09-07 17:59:09 | <p>I have two branches one is called master the other is called dev
I am currently in the master branch and I want to go to the dev branch to move a file to the development server. however when I perform a </p>
<pre><code>$ git checkout dev
</code></pre>
<p>I get the message:</p>
<blockquote>
<p>The following untr... | 26,479 | 975,243 | 2013-01-25 09:25:21 | 12,323,348 | 28 | 2012-09-07 18:15:19 | 1,198,509 | 2012-09-07 18:24:21 | https://stackoverflow.com/q/12323128 | https://stackoverflow.com/a/12323348 | <p>First you'll want to add the files in question so that they're tracked by Git (you don't have to commit any changes, but Git needs to know about the files):</p>
<pre><code>git add pages/memclub/images/subheaders/leadership.png pages/memclub/images/subheaders/male.png
git add pages/memclub/images/subheaders/marketi... | <p>First you'll want to add the files in question so that they're tracked by Git (you don't have to commit any changes, but Git needs to know about the files):</p> <pre><code>git add pages/memclub/images/subheaders/leadership.png pages/memclub/images/subheaders/male.png git add pages/memclub/images/subheaders/marketi... | 119, 37230 | git, git-checkout | <h1>GIT: The following untracked working tree files would be overwritten by checkout</h1>
<p>I have two branches one is called master the other is called dev
I am currently in the master branch and I want to go to the dev branch to move a file to the development server. however when I perform a </p>
<pre><code>$ git c... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,275 | git | # GIT: The following untracked working tree files would be overwritten by checkout
I have two branches one is called master the other is called dev
I am currently in the master branch and I want to go to the dev branch to move a file to the development server. however when I perform a
```
$ git checkout dev
```
I ge... | First you'll want to add the files in question so that they're tracked by Git (you don't have to commit any changes, but Git needs to know about the files):
```
git add pages/memclub/images/subheaders/leadership.png pages/memclub/images/subheaders/male.png
git add pages/memclub/images/subheaders/marketing.png pages/m... |
10973063 | Sublime Text 2 on OS X Lion not finding git binary in PATH | 13 | 2012-06-10 23:05:20 | <p>I'm just getting started with my dev environment on OS X Lion and recently installed Sublime Text 2 and git integration using Package Control. So, when I press <kbd>CMD</kbd>+<kbd>SHIFT</kbd>+<kbd>P</kbd> I get all the relevant git commands.</p>
<p>However, whenever I use one, I get the same error message: <a href=... | 8,140 | 1,444,541 | 2015-07-03 11:29:25 | 10,973,146 | 28 | 2012-06-10 23:22:03 | 393,804 | 2013-01-29 14:59:56 | https://stackoverflow.com/q/10973063 | https://stackoverflow.com/a/10973146 | <p>Basically you need to set</p>
<pre><code>"git_command": "/usr/local/git/bin/git"
</code></pre>
<p>in Packages/User/Git.sublime-settings
or in Packages/Git/Git.sublime-settings</p>
<p>For more details have a look at this issue => <a href="https://github.com/kemayo/sublime-text-2-git/issues/96" rel="noreferrer">ht... | <p>Basically you need to set</p> <pre><code>"git_command": "/usr/local/git/bin/git" </code></pre> <p>in Packages/User/Git.sublime-settings or in Packages/Git/Git.sublime-settings</p> <p>For more details have a look at this issue => <a href="https://github.com/kemayo/sublime-text-2-git/issues/96" rel="noreferrer">ht... | 119, 657, 71219, 78970 | git, integration, osx-lion, sublimetext2 | <h1>Sublime Text 2 on OS X Lion not finding git binary in PATH</h1>
<p>I'm just getting started with my dev environment on OS X Lion and recently installed Sublime Text 2 and git integration using Package Control. So, when I press <kbd>CMD</kbd>+<kbd>SHIFT</kbd>+<kbd>P</kbd> I get all the relevant git commands.</p>
<p... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,276 | git | # Sublime Text 2 on OS X Lion not finding git binary in PATH
I'm just getting started with my dev environment on OS X Lion and recently installed Sublime Text 2 and git integration using Package Control. So, when I press `CMD`+`SHIFT`+`P` I get all the relevant git commands.
However, whenever I use one, I get the sam... | Basically you need to set
```
"git_command": "/usr/local/git/bin/git"
```
in Packages/User/Git.sublime-settings
or in Packages/Git/Git.sublime-settings
For more details have a look at this issue => <https://github.com/kemayo/sublime-text-2-git/issues/96> |
3646057 | How do I get changes from my trunk into a branch? | 13 | 2010-09-05 12:31:12 | <p>I've just started using Git and find that whilst I am implementing a feature in a branch, I will encounter some bug that really needs to be pushed to the trunk as soon as possible. In order to do so, I use checkout to switch back to the trunk, make my changes and commit them. I now have a trunk that is bug free.</p>... | 24,697 | 236,587 | 2015-08-11 18:37:24 | 3,646,082 | 28 | 2010-09-05 12:40:06 | 205,756 | 2010-09-05 12:40:06 | https://stackoverflow.com/q/3646057 | https://stackoverflow.com/a/3646082 | <p>Make sure you have your branch checked out (<code>git checkout branch-name</code>) and run</p>
<p><code>git rebase master</code></p>
<p>And resolve any conflicts that arrive.</p>
<p>If you aren't sure what these commands do, try not using TortoiseGit and use the terminal. It will help you really understand the co... | <p>Make sure you have your branch checked out (<code>git checkout branch-name</code>) and run</p> <p><code>git rebase master</code></p> <p>And resolve any conflicts that arrive.</p> <p>If you aren't sure what these commands do, try not using TortoiseGit and use the terminal. It will help you really understand the co... | 119, 3346, 31409 | dvcs, git, tortoisegit | <h1>How do I get changes from my trunk into a branch?</h1>
<p>I've just started using Git and find that whilst I am implementing a feature in a branch, I will encounter some bug that really needs to be pushed to the trunk as soon as possible. In order to do so, I use checkout to switch back to the trunk, make my change... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,277 | git | # How do I get changes from my trunk into a branch?
I've just started using Git and find that whilst I am implementing a feature in a branch, I will encounter some bug that really needs to be pushed to the trunk as soon as possible. In order to do so, I use checkout to switch back to the trunk, make my changes and com... | Make sure you have your branch checked out (`git checkout branch-name`) and run
`git rebase master`
And resolve any conflicts that arrive.
If you aren't sure what these commands do, try not using TortoiseGit and use the terminal. It will help you really understand the commands.
WARNING: This assumes a local branch.... |
47342905 | What type files should be put into .gitignore file in Django project | 12 | 2017-11-17 03:41:29 | <p>From my other <a href="https://stackoverflow.com/questions/47342829/whats-the-pycache-in-django-project?noredirect=1#comment81637886_47342829">post</a>, I know the <code>__pycache__</code> should be put into the <code>.gitignore</code> when I use git. </p>
<p>And in the other <a href="https://stackoverflow.com/que... | 12,802 | 7,646,621 | 2017-11-17 06:31:17 | 47,343,019 | 28 | 2017-11-17 03:53:46 | 2,335,675 | 2017-11-17 03:53:46 | https://stackoverflow.com/q/47342905 | https://stackoverflow.com/a/47343019 | <p>There is a popular web service called <a href="https://www.gitignore.io/" rel="noreferrer">Gitignore.io</a> that help developers generate gitignore files for popular framework and languages. You can see the Django one <a href="https://www.gitignore.io/api/django" rel="noreferrer">here</a>.</p>
<pre><code>*.log
*.po... | <p>There is a popular web service called <a href="https://www.gitignore.io/" rel="noreferrer">Gitignore.io</a> that help developers generate gitignore files for popular framework and languages. You can see the Django one <a href="https://www.gitignore.io/api/django" rel="noreferrer">here</a>.</p> <pre><code>*.log *.po... | 16, 119, 243, 25056 | django, git, gitignore, python | <h1>What type files should be put into .gitignore file in Django project</h1>
<p>From my other <a href="https://stackoverflow.com/questions/47342829/whats-the-pycache-in-django-project?noredirect=1#comment81637886_47342829">post</a>, I know the <code>__pycache__</code> should be put into the <code>.gitignore</code> whe... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,280 | git | # What type files should be put into .gitignore file in Django project
From my other [post](https://stackoverflow.com/questions/47342829/whats-the-pycache-in-django-project?noredirect=1#comment81637886_47342829), I know the `__pycache__` should be put into the `.gitignore` when I use git.
And in the other [post](http... | There is a popular web service called [Gitignore.io](https://www.gitignore.io/) that help developers generate gitignore files for popular framework and languages. You can see the Django one [here](https://www.gitignore.io/api/django).
```
*.log
*.pot
*.pyc
__pycache__/
local_settings.py
db.sqlite3
media
```
On top of... |
22949068 | Using GitPython, how do I do git submodule update --init | 12 | 2014-04-08 22:01:27 | <p>My code so far is working doing the following. I'd like to get rid of the subprocess.call() stuff</p>
<pre><code>import git
from subprocess import call
repo = git.Repo(repo_path)
repo.remotes.origin.fetch(prune=True)
repo.head.reset(commit='origin/master', index=True, working_tree=True)
# I don't know how to do t... | 15,353 | 538,507 | 2015-07-29 06:06:02 | 30,644,293 | 28 | 2015-06-04 12:48:51 | 4,973,698 | 2015-07-29 06:06:02 | https://stackoverflow.com/q/22949068 | https://stackoverflow.com/a/30644293 | <p>My short answer: it's convenient and simple.</p>
<p>Full answer follows. Suppose you have your repo variable:</p>
<pre><code>repo = git.Repo(repo_path)
</code></pre>
<p>Then, simply do:</p>
<pre><code>for submodule in repo.submodules:
submodule.update(init=True)
</code></pre>
<p>And you can do all the thing... | <p>My short answer: it's convenient and simple.</p> <p>Full answer follows. Suppose you have your repo variable:</p> <pre><code>repo = git.Repo(repo_path) </code></pre> <p>Then, simply do:</p> <pre><code>for submodule in repo.submodules: submodule.update(init=True) </code></pre> <p>And you can do all the thing... | 16, 61013 | gitpython, python | <h1>Using GitPython, how do I do git submodule update --init</h1>
<p>My code so far is working doing the following. I'd like to get rid of the subprocess.call() stuff</p>
<pre><code>import git
from subprocess import call
repo = git.Repo(repo_path)
repo.remotes.origin.fetch(prune=True)
repo.head.reset(commit='origin/m... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,282 | git | # Using GitPython, how do I do git submodule update --init
My code so far is working doing the following. I'd like to get rid of the subprocess.call() stuff
```
import git
from subprocess import call
repo = git.Repo(repo_path)
repo.remotes.origin.fetch(prune=True)
repo.head.reset(commit='origin/master', index=True, ... | My short answer: it's convenient and simple.
Full answer follows. Suppose you have your repo variable:
```
repo = git.Repo(repo_path)
```
Then, simply do:
```
for submodule in repo.submodules:
submodule.update(init=True)
```
And you can do all the things with your submodule that you do with your ordinary repo ... |
22796285 | Remove Git repository, but keep all files | 12 | 2014-04-01 20:33:07 | <p>At some point during my adventures with Linux, I decided that it would be a good idea to put everything in my home directory into source control. I'm not asking whether that was a good idea or not -- I'm asking how to undo it.</p>
<p>The reason for removing the repository is that I recently installed Oh My Zsh, and... | 16,924 | 1,068,062 | 2019-01-27 17:55:42 | 22,796,325 | 28 | 2014-04-01 20:35:09 | 1,219,295 | 2019-01-27 17:55:42 | https://stackoverflow.com/q/22796285 | https://stackoverflow.com/a/22796325 | <p>Just remove (or rename) the <code>.git</code> subdirectory. That subdirectory is the whole of the repository. This will not delete your files, but it <em>will</em> delete their history.</p>
<p>Additionally, there might be files like <code>.gitignore</code> and <code>.gitattributes</code> that are not necessary anym... | <p>Just remove (or rename) the <code>.git</code> subdirectory. That subdirectory is the whole of the repository. This will not delete your files, but it <em>will</em> delete their history.</p> <p>Additionally, there might be files like <code>.gitignore</code> and <code>.gitattributes</code> that are not necessary anym... | 58, 119 | git, linux | <h1>Remove Git repository, but keep all files</h1>
<p>At some point during my adventures with Linux, I decided that it would be a good idea to put everything in my home directory into source control. I'm not asking whether that was a good idea or not -- I'm asking how to undo it.</p>
<p>The reason for removing the rep... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,283 | git | # Remove Git repository, but keep all files
At some point during my adventures with Linux, I decided that it would be a good idea to put everything in my home directory into source control. I'm not asking whether that was a good idea or not -- I'm asking how to undo it.
The reason for removing the repository is that ... | Just remove (or rename) the `.git` subdirectory. That subdirectory is the whole of the repository. This will not delete your files, but it *will* delete their history.
Additionally, there might be files like `.gitignore` and `.gitattributes` that are not necessary anymore.
Make sure that all your files are present in... |
19055122 | How to recover lost commits after git submodule update and checkout? | 12 | 2013-09-27 15:55:02 | <p>This is a variant on similar questions, where commits end up in a headless branch. I am adding this question to cover this particular case. In my case, the issue is the following:</p>
<ul>
<li>I did a git submodule update, which left the repository in a headless state (and I forgot to checkout again to master)</li>... | 4,157 | 9,900 | 2013-09-27 15:55:02 | 19,055,123 | 28 | 2013-09-27 15:55:02 | 9,900 | 2013-09-27 15:55:02 | https://stackoverflow.com/q/19055122 | https://stackoverflow.com/a/19055123 | <p>Based on answers <a href="https://stackoverflow.com/questions/10099258/how-can-i-recover-a-lost-commit-in-git">here</a> and <a href="https://stackoverflow.com/questions/9041156/how-to-recover-commit-from-detached-head-state">there</a>, I found my way out using <code>git reflog</code>:</p>
<pre><code>> git reflog... | <p>Based on answers <a href="https://stackoverflow.com/questions/10099258/how-can-i-recover-a-lost-commit-in-git">here</a> and <a href="https://stackoverflow.com/questions/9041156/how-to-recover-commit-from-detached-head-state">there</a>, I found my way out using <code>git reflog</code>:</p> <pre><code>> git reflog... | 119 | git | <h1>How to recover lost commits after git submodule update and checkout?</h1>
<p>This is a variant on similar questions, where commits end up in a headless branch. I am adding this question to cover this particular case. In my case, the issue is the following:</p>
<ul>
<li>I did a git submodule update, which left the ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,284 | git | # How to recover lost commits after git submodule update and checkout?
This is a variant on similar questions, where commits end up in a headless branch. I am adding this question to cover this particular case. In my case, the issue is the following:
- I did a git submodule update, which left the repository in a head... | Based on answers [here](https://stackoverflow.com/questions/10099258/how-can-i-recover-a-lost-commit-in-git) and [there](https://stackoverflow.com/questions/9041156/how-to-recover-commit-from-detached-head-state), I found my way out using `git reflog`:
```
> git reflog
6b0da0d HEAD@{0}: rebase finished: returning to r... |
11077401 | Why doesn't "git branch" show anything in my new BitBucket clone? | 12 | 2012-06-18 05:35:44 | <p>My colleague created a repository in Bitbucket. I first created a folder in my computer and typed <code>git init</code>. After which,I made a clone from the repository to my computer using the command: <code>git clone address</code>.</p>
<p>But when i type <code>git branch</code>, there is no reply. It doesn't indi... | 18,370 | 1,152,000 | 2012-06-18 06:37:21 | 11,077,484 | 28 | 2012-06-18 05:46:40 | 19,563 | 2012-06-18 05:46:40 | https://stackoverflow.com/q/11077401 | https://stackoverflow.com/a/11077484 | <p>There are two ways to create a git repository. You can use <code>git init</code> to create a new one, or you can use <code>git clone</code> to clone an existing one. If you run both <code>init</code> and <code>clone</code> then git will first create a new empty repository in the current directory and then clone the ... | <p>There are two ways to create a git repository. You can use <code>git init</code> to create a new one, or you can use <code>git clone</code> to clone an existing one. If you run both <code>init</code> and <code>clone</code> then git will first create a new empty repository in the current directory and then clone the ... | 119, 8337 | bitbucket, git | <h1>Why doesn't "git branch" show anything in my new BitBucket clone?</h1>
<p>My colleague created a repository in Bitbucket. I first created a folder in my computer and typed <code>git init</code>. After which,I made a clone from the repository to my computer using the command: <code>git clone address</code>.</p>
<p>... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,285 | git | # Why doesn't "git branch" show anything in my new BitBucket clone?
My colleague created a repository in Bitbucket. I first created a folder in my computer and typed `git init`. After which,I made a clone from the repository to my computer using the command: `git clone address`.
But when i type `git branch`, there is... | There are two ways to create a git repository. You can use `git init` to create a new one, or you can use `git clone` to clone an existing one. If you run both `init` and `clone` then git will first create a new empty repository in the current directory and then clone the remote repository into a subdirectory of the em... |
9345856 | Checkout multiple files which have been moved in the working tree | 12 | 2012-02-19 01:36:33 | <p>I've moved files from <code>Project</code> to <code>Project/src</code>. Git is under the impression that I've deleted the files from <code>Project</code> and created new files in <code>Project/src</code>. </p>
<p>In addition, I have multiple other changes in the working tree, which I wish to commit. My <code>git st... | 18,400 | 1,084,945 | 2017-01-05 07:57:29 | 9,345,967 | 28 | 2012-02-19 01:53:58 | 189,186 | 2016-03-15 11:48:37 | https://stackoverflow.com/q/9345856 | https://stackoverflow.com/a/9345967 | <p>Escape the <code>*</code>:</p>
<pre><code>$ git checkout \*.{cpp,h}
</code></pre>
| <p>Escape the <code>*</code>:</p> <pre><code>$ git checkout \*.{cpp,h} </code></pre> | 119 | git | <h1>Checkout multiple files which have been moved in the working tree</h1>
<p>I've moved files from <code>Project</code> to <code>Project/src</code>. Git is under the impression that I've deleted the files from <code>Project</code> and created new files in <code>Project/src</code>. </p>
<p>In addition, I have multiple... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,286 | git | # Checkout multiple files which have been moved in the working tree
I've moved files from `Project` to `Project/src`. Git is under the impression that I've deleted the files from `Project` and created new files in `Project/src`.
In addition, I have multiple other changes in the working tree, which I wish to commit. M... | Escape the `*`:
```
$ git checkout \*.{cpp,h}
``` |
60865507 | Rebase after force push | 11 | 2020-03-26 10:47:07 | <p>I have a feature branch A. Then I start developing a second feature dependent on A, so I base my new feature branch B on A:</p>
<pre><code>git checkout A
git checkout -B B
</code></pre>
<p>I do some work on B, so now on B I have commit 1 (from A) and the new commit 2.
Our company always squashes all commits of one... | 5,549 | 5,857,551 | 2020-03-26 19:55:20 | 60,875,172 | 28 | 2020-03-26 19:55:20 | 1,256,452 | 2020-03-26 19:55:20 | https://stackoverflow.com/q/60865507 | https://stackoverflow.com/a/60875172 | <p>Ultimately, you'll want <code>git rebase --onto</code>. Sometimes you won't need to do anything special, though.</p>
<h3>The setup</h3>
<p>Let's draw your initial situation:</p>
<pre><code>...--A--B <-- master
\
C <-- feature/A
\
D <-- feature/B
</code></p... | <p>Ultimately, you'll want <code>git rebase --onto</code>. Sometimes you won't need to do anything special, though.</p> <h3>The setup</h3> <p>Let's draw your initial situation:</p> <pre><code>...--A--B <-- master \ C <-- feature/A \ D <-- feature/B </code></p... | 119, 1879, 8974 | branch, git, rebase | <h1>Rebase after force push</h1>
<p>I have a feature branch A. Then I start developing a second feature dependent on A, so I base my new feature branch B on A:</p>
<pre><code>git checkout A
git checkout -B B
</code></pre>
<p>I do some work on B, so now on B I have commit 1 (from A) and the new commit 2.
Our company a... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,287 | git | # Rebase after force push
I have a feature branch A. Then I start developing a second feature dependent on A, so I base my new feature branch B on A:
```
git checkout A
git checkout -B B
```
I do some work on B, so now on B I have commit 1 (from A) and the new commit 2.
Our company always squashes all commits of one... | Ultimately, you'll want `git rebase --onto`. Sometimes you won't need to do anything special, though.
### The setup
Let's draw your initial situation:
```
...--A--B <-- master
\
C <-- feature/A
\
D <-- feature/B
```
That is, there's some series of commits on some main... |
46469278 | Git fetch gives "cannot lock ref" error message but seems to work anyway | 11 | 2017-09-28 12:32:49 | <p>Sometimes when I try and run <code>git fetch</code> I get the following response:</p>
<blockquote>
<p>error: cannot lock ref 'refs/remotes/origin/<em>branchname</em>': is at <em>XXXXXX</em> but expected <em>YYYYYY</em></p>
</blockquote>
<p>The steps that I took that caused this were, to the best of my recollect... | 15,266 | 782,570 | 2022-01-12 16:04:28 | 49,490,072 | 28 | 2018-03-26 11:11:39 | 34,502 | 2018-03-26 11:11:39 | https://stackoverflow.com/q/46469278 | https://stackoverflow.com/a/49490072 | <p>Following @bernard-paulus's comment, you can try</p>
<pre><code>git gc --prune=now
</code></pre>
<p>which worked for me</p>
<p>You can also try</p>
<pre><code>git for-each-ref
</code></pre>
| <p>Following @bernard-paulus's comment, you can try</p> <pre><code>git gc --prune=now </code></pre> <p>which worked for me</p> <p>You can also try</p> <pre><code>git for-each-ref </code></pre> | 119, 8337 | bitbucket, git | <h1>Git fetch gives "cannot lock ref" error message but seems to work anyway</h1>
<p>Sometimes when I try and run <code>git fetch</code> I get the following response:</p>
<blockquote>
<p>error: cannot lock ref 'refs/remotes/origin/<em>branchname</em>': is at <em>XXXXXX</em> but expected <em>YYYYYY</em></p>
</blockqu... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,288 | git | # Git fetch gives "cannot lock ref" error message but seems to work anyway
Sometimes when I try and run `git fetch` I get the following response:
> error: cannot lock ref 'refs/remotes/origin/*branchname*': is at *XXXXXX* but expected *YYYYYY*
The steps that I took that caused this were, to the best of my recollecti... | Following @bernard-paulus's comment, you can try
```
git gc --prune=now
```
which worked for me
You can also try
```
git for-each-ref
``` |
44953037 | What is the difference between "git checkout -- ." and "git reset HEAD --hard"? | 11 | 2017-07-06 15:21:14 | <p>This is not a general question about what '--' does, as in the marked duplicate. This is a git-specific question asking for clarity on what the operational differences are between the mentioned commands.</p>
<p>If I want to clean out my current directory without stashing or committing, I usually use these commands:... | 11,266 | 884,502 | 2020-09-03 16:11:48 | 45,018,564 | 28 | 2017-07-10 17:46:10 | 1,256,452 | 2020-09-03 16:11:48 | https://stackoverflow.com/q/44953037 | https://stackoverflow.com/a/45018564 | <p>First, let's just address the double hyphen or double dash, to get it out of the way (especially since this question no longer has a marked duplicate).</p>
<p>Git mostly uses this in <a href="http://pubs.opengroup.org/onlinepubs/009696899/basedefs/xbd_chap12.html" rel="noreferrer">the POSIX-approved fashion (see Gui... | <p>First, let's just address the double hyphen or double dash, to get it out of the way (especially since this question no longer has a marked duplicate).</p> <p>Git mostly uses this in <a href="http://pubs.opengroup.org/onlinepubs/009696899/basedefs/xbd_chap12.html" rel="noreferrer">the POSIX-approved fashion (see Gui... | 119, 37230, 51381, 68596 | git, git-checkout, git-clean, git-reset | <h1>What is the difference between "git checkout -- ." and "git reset HEAD --hard"?</h1>
<p>This is not a general question about what '--' does, as in the marked duplicate. This is a git-specific question asking for clarity on what the operational differences are between the mentioned commands.</p>
<p>If I want to cle... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,289 | git | # What is the difference between "git checkout -- ." and "git reset HEAD --hard"?
This is not a general question about what '--' does, as in the marked duplicate. This is a git-specific question asking for clarity on what the operational differences are between the mentioned commands.
If I want to clean out my curren... | First, let's just address the double hyphen or double dash, to get it out of the way (especially since this question no longer has a marked duplicate).
Git mostly uses this in [the POSIX-approved fashion (see Guideline 10)](http://pubs.opengroup.org/onlinepubs/009696899/basedefs/xbd_chap12.html), to indicate a dividin... |
19445186 | git rebase with conflict not work | 11 | 2013-10-18 08:40:17 | <p>I have remote repository.
I do: </p>
<pre><code>git clone https://mylogin@bitbucket.org/mylogin/myrepo.git
</code></pre>
<p>Clone success.
I have git tree:<br/>
C(master)<br/>| B:A<br/>| /<br/>B /<br/>|<br>A<br>|<br>A0<br>|<br>A01(origin/head)(origin/master)<br>|<br>(some c... | 15,220 | 1,006,855 | 2013-10-18 11:47:34 | 19,448,916 | 28 | 2013-10-18 11:47:34 | 2,840,436 | 2013-10-18 11:47:34 | https://stackoverflow.com/q/19445186 | https://stackoverflow.com/a/19448916 | <p>Git will stop rebasing if it detects conflicts it cannot automatically resolve. In your case, you have a conflict in the file <code>index1.txt</code> (you can see it in the output, and later on as well when running <code>git status</code>). You must fix the conflicts before continuing. Edit the file, and you'll see ... | <p>Git will stop rebasing if it detects conflicts it cannot automatically resolve. In your case, you have a conflict in the file <code>index1.txt</code> (you can see it in the output, and later on as well when running <code>git status</code>). You must fix the conflicts before continuing. Edit the file, and you'll see ... | 119, 8974 | git, rebase | <h1>git rebase with conflict not work</h1>
<p>I have remote repository.
I do: </p>
<pre><code>git clone https://mylogin@bitbucket.org/mylogin/myrepo.git
</code></pre>
<p>Clone success.
I have git tree:<br/>
C(master)<br/>| B:A<br/>| /<br/>B /<br/>|<br>A<br>|<br>A0<br>|<br>A01(... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,291 | git | # git rebase with conflict not work
I have remote repository.
I do:
```
git clone https://mylogin@bitbucket.org/mylogin/myrepo.git
```
Clone success.
I have git tree:
C(master)
| B:A
| /
B /
|
A
|
A0
|
A01(origin/head)(origin/master)
|
(some commits)
I need:
I need rebase branch B to C... | Git will stop rebasing if it detects conflicts it cannot automatically resolve. In your case, you have a conflict in the file `index1.txt` (you can see it in the output, and later on as well when running `git status`). You must fix the conflicts before continuing. Edit the file, and you'll see `<<<<<<`, `======` and `>... |
10696718 | Git Fetch fails to work on bare repo, but git pull works on normal repo | 11 | 2012-05-22 06:20:32 | <p>First, the big picture: I'm trying to write a git post-receive script for a Redmine / Gitolite server I'm running. As per various recommendations, I'm creating a bare and local repository for Redmine to read from, and I'm setting up a post-receive script on Gitolite to push changes into the Redmine repo.</p>
<p>How... | 6,207 | 379,458 | 2017-09-07 02:43:25 | 10,697,486 | 28 | 2012-05-22 07:19:25 | 6,309 | 2013-07-25 18:45:15 | https://stackoverflow.com/q/10696718 | https://stackoverflow.com/a/10697486 | <p>Your fetch hasn't updated the <code>master</code> branch, only <code>FETCH_HEAD</code> (see "<a href="https://stackoverflow.com/questions/9237348/what-does-fetch-head-in-git-mean">What does <code>FETCH_HEAD</code> in Git mean?</a>").</p>
<p>As mentioned in "<a href="https://stackoverflow.com/questions/7274697/how-d... | <p>Your fetch hasn't updated the <code>master</code> branch, only <code>FETCH_HEAD</code> (see "<a href="https://stackoverflow.com/questions/9237348/what-does-fetch-head-in-git-mean">What does <code>FETCH_HEAD</code> in Git mean?</a>").</p> <p>As mentioned in "<a href="https://stackoverflow.com/questions/7274697/how-d... | 119 | git | <h1>Git Fetch fails to work on bare repo, but git pull works on normal repo</h1>
<p>First, the big picture: I'm trying to write a git post-receive script for a Redmine / Gitolite server I'm running. As per various recommendations, I'm creating a bare and local repository for Redmine to read from, and I'm setting up a p... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,292 | git | # Git Fetch fails to work on bare repo, but git pull works on normal repo
First, the big picture: I'm trying to write a git post-receive script for a Redmine / Gitolite server I'm running. As per various recommendations, I'm creating a bare and local repository for Redmine to read from, and I'm setting up a post-recei... | Your fetch hasn't updated the `master` branch, only `FETCH_HEAD` (see "[What does `FETCH_HEAD` in Git mean?](https://stackoverflow.com/questions/9237348/what-does-fetch-head-in-git-mean)").
As mentioned in "[how do I pull to a bare repository?](https://stackoverflow.com/questions/7274697/how-do-i-pull-to-a-bare-reposi... |
40907497 | "Not a git repository" after OS reset | 10 | 2016-12-01 09:58:03 | <p>This morning my Windows 10 crashed and rebooted once I lifted my laptop's screen. No special activity was progressing, so I don't think there was significant disk activity.</p>
<p>However one of my main Git repos crashed after that reset. Here is what I tried:</p>
<ul>
<li><code>$ git status</code>
fatal: Not a gi... | 3,299 | 471,213 | 2022-11-24 01:34:56 | 40,916,170 | 28 | 2016-12-01 16:52:50 | 1,256,452 | 2016-12-01 16:52:50 | https://stackoverflow.com/q/40907497 | https://stackoverflow.com/a/40916170 | <p>As <a href="https://stackoverflow.com/questions/40907497/not-a-git-repository-after-os-reset#comment69027497_40907497">kabanus said in a comment</a>, you should definitely save whatever you can before proceeding (and/or use some other existing clone as a backup).</p>
<p>When Git complains about this, though, it oft... | <p>As <a href="https://stackoverflow.com/questions/40907497/not-a-git-repository-after-os-reset#comment69027497_40907497">kabanus said in a comment</a>, you should definitely save whatever you can before proceeding (and/or use some other existing clone as a backup).</p> <p>When Git complains about this, though, it oft... | 64, 119 | git, windows | <h1>"Not a git repository" after OS reset</h1>
<p>This morning my Windows 10 crashed and rebooted once I lifted my laptop's screen. No special activity was progressing, so I don't think there was significant disk activity.</p>
<p>However one of my main Git repos crashed after that reset. Here is what I tried:</p>
<ul... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,294 | git | # "Not a git repository" after OS reset
This morning my Windows 10 crashed and rebooted once I lifted my laptop's screen. No special activity was progressing, so I don't think there was significant disk activity.
However one of my main Git repos crashed after that reset. Here is what I tried:
- `$ git status`
fata... | As [kabanus said in a comment](https://stackoverflow.com/questions/40907497/not-a-git-repository-after-os-reset#comment69027497_40907497), you should definitely save whatever you can before proceeding (and/or use some other existing clone as a backup).
When Git complains about this, though, it often means that the fil... |
36617106 | Git .gitignore not working with log files | 10 | 2016-04-14 08:03:42 | <p>I have git repository on <code>/var/www/html/projectx</code>. My goal is to tell git ignore two files <code>/var/www/html/projectx/error.log</code> and <code>/var/www/html/projectx/requsets.log</code>. </p>
<p>I try add .gitignore file</p>
<pre><code>[git@x]$ cd /var/www/html/projectx
[git@x projectx]$ nano .git... | 9,713 | 5,010,413 | 2016-04-14 08:13:13 | 36,617,279 | 28 | 2016-04-14 08:13:13 | 1,892,091 | 2016-04-14 08:13:13 | https://stackoverflow.com/q/36617106 | https://stackoverflow.com/a/36617279 | <p>.gitignore file won't affect files that are already tracked. You can remove them with:</p>
<pre><code>git rm --cached [file]
</code></pre>
<p>command.
If you want only to ignore it locally you may try make it ignored by:</p>
<pre><code>git update-index --assume-unchanged [file]
</code></pre>
<p>Or create explic... | <p>.gitignore file won't affect files that are already tracked. You can remove them with:</p> <pre><code>git rm --cached [file] </code></pre> <p>command. If you want only to ignore it locally you may try make it ignored by:</p> <pre><code>git update-index --assume-unchanged [file] </code></pre> <p>Or create explic... | 119 | git | <h1>Git .gitignore not working with log files</h1>
<p>I have git repository on <code>/var/www/html/projectx</code>. My goal is to tell git ignore two files <code>/var/www/html/projectx/error.log</code> and <code>/var/www/html/projectx/requsets.log</code>. </p>
<p>I try add .gitignore file</p>
<pre><code>[git@x]$ cd... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,295 | git | # Git .gitignore not working with log files
I have git repository on `/var/www/html/projectx`. My goal is to tell git ignore two files `/var/www/html/projectx/error.log` and `/var/www/html/projectx/requsets.log`.
I try add .gitignore file
```
[git@x]$ cd /var/www/html/projectx
[git@x projectx]$ nano .gitignore
```
... | .gitignore file won't affect files that are already tracked. You can remove them with:
```
git rm --cached [file]
```
command.
If you want only to ignore it locally you may try make it ignored by:
```
git update-index --assume-unchanged [file]
```
Or create explicit repository rules by editing `.git/info/exclude` f... |
29980827 | Name and email set in Git's per-user configuration file, however Git is still using the default generated name and email | 10 | 2015-05-01 02:28:51 | <p>The title says it, but I will explain it more thoroughly:</p>
<p>I have configured my user's name and email as recommended using the commands: </p>
<pre><code>git config --global user.name
git config --global user.email
</code></pre>
<p>I can verify that this is set by doing <code>git config --global --list</code... | 27,046 | 2,666,034 | 2015-05-01 02:36:10 | 29,980,873 | 28 | 2015-05-01 02:36:10 | 4,148,211 | 2015-05-01 02:36:10 | https://stackoverflow.com/q/29980827 | https://stackoverflow.com/a/29980873 | <p>The <code>name</code> and <code>email</code> settings should appear in the <code>[user]</code> section of <code>~/.gitconfig</code>. They are not set correctly. Your <code>~/.gitconfig</code> could have resulted from running the commands:</p>
<pre><code>git config --global core.user "Joshua Guerra"
git config --g... | <p>The <code>name</code> and <code>email</code> settings should appear in the <code>[user]</code> section of <code>~/.gitconfig</code>. They are not set correctly. Your <code>~/.gitconfig</code> could have resulted from running the commands:</p> <pre><code>git config --global core.user "Joshua Guerra" git config --g... | 119, 3574 | config, git | <h1>Name and email set in Git's per-user configuration file, however Git is still using the default generated name and email</h1>
<p>The title says it, but I will explain it more thoroughly:</p>
<p>I have configured my user's name and email as recommended using the commands: </p>
<pre><code>git config --global user.n... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,296 | git | # Name and email set in Git's per-user configuration file, however Git is still using the default generated name and email
The title says it, but I will explain it more thoroughly:
I have configured my user's name and email as recommended using the commands:
```
git config --global user.name
git config --global user... | The `name` and `email` settings should appear in the `[user]` section of `~/.gitconfig`. They are not set correctly. Your `~/.gitconfig` could have resulted from running the commands:
```
git config --global core.user "Joshua Guerra"
git config --global core.email joshua@allianceconsults.net
```
The commands that sho... |
48496920 | Git move all untracked files and folders to directory out of git? | 9 | 2018-01-29 08:11:41 | <p>I got PC from previous developer. There are many untracked files and folders (>400) in git. Project should work without them, but I don't want to delete or stash them. Maybe I'll have some usage later.</p>
<p>Is there way to move them with structure to Backup folder out of git? </p>
| 9,720 | 1,084,356 | 2020-08-05 00:38:04 | 48,497,708 | 28 | 2018-01-29 09:10:29 | 2,394,026 | 2018-02-05 15:32:29 | https://stackoverflow.com/q/48496920 | https://stackoverflow.com/a/48497708 | <p>Based on <a href="https://stackoverflow.com/a/3801554/2394026">this answer</a>, you can do something like follow assuming your can use bash command (I guess you can do this in git prompt).</p>
<pre><code>cd $Git_Repo
for file in $(git ls-files --others --exclude-standard); do mkdir -p ../backup/$(dirname $file) ; m... | <p>Based on <a href="https://stackoverflow.com/a/3801554/2394026">this answer</a>, you can do something like follow assuming your can use bash command (I guess you can do this in git prompt).</p> <pre><code>cd $Git_Repo for file in $(git ls-files --others --exclude-standard); do mkdir -p ../backup/$(dirname $file) ; m... | 119 | git | <h1>Git move all untracked files and folders to directory out of git?</h1>
<p>I got PC from previous developer. There are many untracked files and folders (>400) in git. Project should work without them, but I don't want to delete or stash them. Maybe I'll have some usage later.</p>
<p>Is there way to move them with s... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,297 | git | # Git move all untracked files and folders to directory out of git?
I got PC from previous developer. There are many untracked files and folders (>400) in git. Project should work without them, but I don't want to delete or stash them. Maybe I'll have some usage later.
Is there way to move them with structure to Back... | Based on [this answer](https://stackoverflow.com/a/3801554/2394026), you can do something like follow assuming your can use bash command (I guess you can do this in git prompt).
```
cd $Git_Repo
for file in $(git ls-files --others --exclude-standard); do mkdir -p ../backup/$(dirname $file) ; mv $file ../backup/$file ;... |
65008696 | How to run create-react-app without git (skipping git)? | 8 | 2020-11-25 16:20:11 | <p>I don't want git initialized in my folder when I create react app by</p>
<pre><code>npx create-react-app appName
</code></pre>
<p>When I was working with Angular, it was comparatively easier by just typing the command</p>
<pre><code>ng new my-app --skip-git
</code></pre>
<p>Can anyone please tell me the related comm... | 24,060 | 9,476,814 | 2024-01-08 23:39:43 | 65,008,756 | 28 | 2020-11-25 16:23:49 | 13,909,633 | 2020-11-25 16:23:49 | https://stackoverflow.com/q/65008696 | https://stackoverflow.com/a/65008756 | <p>There's an <a href="https://github.com/facebook/create-react-app/issues/9502" rel="noreferrer">open GitHub issue</a> for your case.</p>
<p>TL;DR: There are no current plans to include such an option. The React developers recommend you run <code>rm -rf .git</code> after <code>npx create-react-app appName</code> to ac... | <p>There's an <a href="https://github.com/facebook/create-react-app/issues/9502" rel="noreferrer">open GitHub issue</a> for your case.</p> <p>TL;DR: There are no current plans to include such an option. The React developers recommend you run <code>rm -rf .git</code> after <code>npx create-react-app appName</code> to ac... | 3, 119, 92497, 122108 | create-react-app, git, javascript, reactjs | <h1>How to run create-react-app without git (skipping git)?</h1>
<p>I don't want git initialized in my folder when I create react app by</p>
<pre><code>npx create-react-app appName
</code></pre>
<p>When I was working with Angular, it was comparatively easier by just typing the command</p>
<pre><code>ng new my-app --ski... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,298 | git | # How to run create-react-app without git (skipping git)?
I don't want git initialized in my folder when I create react app by
```
npx create-react-app appName
```
When I was working with Angular, it was comparatively easier by just typing the command
```
ng new my-app --skip-git
```
Can anyone please tell me the ... | There's an [open GitHub issue](https://github.com/facebook/create-react-app/issues/9502) for your case.
TL;DR: There are no current plans to include such an option. The React developers recommend you run `rm -rf .git` after `npx create-react-app appName` to achieve these results. |
7811147 | Impossible to git rm with special characters | 8 | 2011-10-18 17:17:02 | <p>I added files in my git repository that I want to remove now. I deleted it with <code>rm XXX</code>.
Now, <code>git status</code> shows me:</p>
<pre><code>Changed but not updated:
deleted: "Sche\314\201ma application + interface.graffle"
</code></pre>
<p>No matter how I <code>git rm</code> it, I still have ... | 2,738 | 595,223 | 2016-11-18 10:13:14 | 7,811,205 | 28 | 2011-10-18 17:22:15 | 31,610 | 2011-10-18 17:22:15 | https://stackoverflow.com/q/7811147 | https://stackoverflow.com/a/7811205 | <p>This will detect the remove:</p>
<pre><code>git add -u
</code></pre>
| <p>This will detect the remove:</p> <pre><code>git add -u </code></pre> | 119, 1124, 112901 | encoding, git, git-rm | <h1>Impossible to git rm with special characters</h1>
<p>I added files in my git repository that I want to remove now. I deleted it with <code>rm XXX</code>.
Now, <code>git status</code> shows me:</p>
<pre><code>Changed but not updated:
deleted: "Sche\314\201ma application + interface.graffle"
</code></pre>
<p... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,300 | git | # Impossible to git rm with special characters
I added files in my git repository that I want to remove now. I deleted it with `rm XXX`.
Now, `git status` shows me:
```
Changed but not updated:
deleted: "Sche\314\201ma application + interface.graffle"
```
No matter how I `git rm` it, I still have a :
```
fat... | This will detect the remove:
```
git add -u
``` |
2495978 | Lost my commit in GIT. Can you accidentally delete commits? | 8 | 2010-03-22 21:41:01 | <p>I'm using git gui and I can't see my branch. </p>
<p>I know I checked something in today. </p>
<p>I changed to an earlier branch after I did my commit and verified it with the branch viewer.
I made changes to the earlier branch and then wanted to go back to my current branch, but I can't see it any more.
Any hel... | 5,447 | 31,325 | 2010-03-22 21:45:08 | 2,496,001 | 28 | 2010-03-22 21:45:08 | 19,563 | 2010-03-22 21:45:08 | https://stackoverflow.com/q/2495978 | https://stackoverflow.com/a/2496001 | <p>In answer to your question, in most circumstances it is very hard to lose a recent commit by accident. Usually objects (including commits) only get removed after a <code>git gc</code> if they are no longer referred to by any branch and they are very old (by default 90 days IIRC).</p>
<p>Usually you can find the com... | <p>In answer to your question, in most circumstances it is very hard to lose a recent commit by accident. Usually objects (including commits) only get removed after a <code>git gc</code> if they are no longer referred to by any branch and they are very old (by default 90 days IIRC).</p> <p>Usually you can find the com... | 119, 5597 | commit, git | <h1>Lost my commit in GIT. Can you accidentally delete commits?</h1>
<p>I'm using git gui and I can't see my branch. </p>
<p>I know I checked something in today. </p>
<p>I changed to an earlier branch after I did my commit and verified it with the branch viewer.
I made changes to the earlier branch and then wanted t... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,301 | git | # Lost my commit in GIT. Can you accidentally delete commits?
I'm using git gui and I can't see my branch.
I know I checked something in today.
I changed to an earlier branch after I did my commit and verified it with the branch viewer.
I made changes to the earlier branch and then wanted to go back to my current br... | In answer to your question, in most circumstances it is very hard to lose a recent commit by accident. Usually objects (including commits) only get removed after a `git gc` if they are no longer referred to by any branch and they are very old (by default 90 days IIRC).
Usually you can find the commit in your reflog. T... |
19869192 | Azure Website Remote Debugging with git deploy not working | 7 | 2013-11-08 21:53:05 | <p>I've been trying out the new Remote Debugging feature for Azure Websites, but I think I may have come across an issue: I can only get it to work properly if I use Web Publish. If I deploy a site with local git deploy, the debugger attaches but the debug symbols aren't loaded (breakpoints show the warning).</p>
<p>I... | 4,654 | 2,970,493 | 2019-01-11 17:43:24 | 19,869,600 | 28 | 2013-11-08 22:23:09 | 111,888 | 2014-02-09 04:14:06 | https://stackoverflow.com/q/19869192 | https://stackoverflow.com/a/19869600 | <h2>Update 2/8/2014</h2>
<p>Some fixes were made in WAWS, and it is now possible to make debugging work when using git, by having VS correctly load the server-side PDBs. For it to work, you need to do one of two things (i.e. you don't need to do both). It can work in both VS 2012 and 2013.</p>
<ol>
<li><strong>Turn o... | <h2>Update 2/8/2014</h2> <p>Some fixes were made in WAWS, and it is now possible to make debugging work when using git, by having VS correctly load the server-side PDBs. For it to work, you need to do one of two things (i.e. you don't need to do both). It can work in both VS 2012 and 2013.</p> <ol> <li><strong>Turn o... | 4356, 14158, 84219, 116275 | azure, azure-git-deployment, azure-web-app-service, remote-debugging | <h1>Azure Website Remote Debugging with git deploy not working</h1>
<p>I've been trying out the new Remote Debugging feature for Azure Websites, but I think I may have come across an issue: I can only get it to work properly if I use Web Publish. If I deploy a site with local git deploy, the debugger attaches but the d... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,302 | git | # Azure Website Remote Debugging with git deploy not working
I've been trying out the new Remote Debugging feature for Azure Websites, but I think I may have come across an issue: I can only get it to work properly if I use Web Publish. If I deploy a site with local git deploy, the debugger attaches but the debug symb... | ## Update 2/8/2014
Some fixes were made in WAWS, and it is now possible to make debugging work when using git, by having VS correctly load the server-side PDBs. For it to work, you need to do one of two things (i.e. you don't need to do both). It can work in both VS 2012 and 2013.
1. **Turn off Just My Code debugging... |
7610549 | Android: DigitalClock remove seconds | 7 | 2011-09-30 12:45:18 | <p>I used this code for adding a clock to my app:</p>
<pre><code> <DigitalClock
android:id="@+id/digitalclock"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:textSize = "30sp"
/>
</code></pre>
<p>The problem is that it shows also seconds.... | 14,213 | 930,122 | 2013-02-01 15:01:56 | 14,472,443 | 28 | 2013-01-23 04:25:49 | 882,279 | 2013-02-01 15:01:56 | https://stackoverflow.com/q/7610549 | https://stackoverflow.com/a/14472443 | <p>Found the answer <a href="https://stackoverflow.com/questions/5579614/customized-digital-clock-in-android">here</a>, for anyone else looking for a working answer, here it is:</p>
<ol>
<li>Clone/copy <code>DigitalClock.java</code> from android source</li>
<li><p>Change format strings within new <code>CustomDigitalCl... | <p>Found the answer <a href="https://stackoverflow.com/questions/5579614/customized-digital-clock-in-android">here</a>, for anyone else looking for a working answer, here it is:</p> <ol> <li>Clone/copy <code>DigitalClock.java</code> from android source</li> <li><p>Change format strings within new <code>CustomDigitalCl... | 17, 1386, 7320, 19165 | android, clock, digital, java | <h1>Android: DigitalClock remove seconds</h1>
<p>I used this code for adding a clock to my app:</p>
<pre><code> <DigitalClock
android:id="@+id/digitalclock"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:textSize = "30sp"
/>
</code></pre>
... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,303 | git | # Android: DigitalClock remove seconds
I used this code for adding a clock to my app:
```
<DigitalClock
android:id="@+id/digitalclock"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:textSize = "30sp"
/>
```
The problem is that it shows also s... | Found the answer [here](https://stackoverflow.com/questions/5579614/customized-digital-clock-in-android), for anyone else looking for a working answer, here it is:
1. Clone/copy `DigitalClock.java` from android source
2. Change format strings within new `CustomDigitalClock`
```
package com.example;
import a... |
13451329 | UserInterfaceState.xcuserstate not getting committed while using git in Xcode | 6 | 2012-11-19 09:55:18 | <p>when I'm trying to commit my code project it shows a file called 'UserInterfaceState.xcuserstate' which has to be committed. once i commit it and try to push my project to git ,the Xcode gives me a popup message saying that 'The working copy "app" has uncommitted changes.' and when I try to commit again I get the sa... | 4,835 | 1,645,883 | 2013-05-29 14:58:34 | 16,535,092 | 28 | 2013-05-14 04:24:16 | 1,017,893 | 2013-05-14 04:24:16 | https://stackoverflow.com/q/13451329 | https://stackoverflow.com/a/16535092 | <p><code>UserInterfaceState.xcuserstate</code> is where Xcode saves your GUI states, such as window positions, open tabs, expanded nodes in the project inspector etc.</p>
<p>Simply resizing the Xcode window will cause this file to change and be flagged as modified by your source control system. You can make your SCM s... | <p><code>UserInterfaceState.xcuserstate</code> is where Xcode saves your GUI states, such as window positions, open tabs, expanded nodes in the project inspector etc.</p> <p>Simply resizing the Xcode window will cause this file to change and be flagged as modified by your source control system. You can make your SCM s... | 119, 7003, 81144 | git, objective-c, xcode4.5 | <h1>UserInterfaceState.xcuserstate not getting committed while using git in Xcode</h1>
<p>when I'm trying to commit my code project it shows a file called 'UserInterfaceState.xcuserstate' which has to be committed. once i commit it and try to push my project to git ,the Xcode gives me a popup message saying that 'The w... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,304 | git | # UserInterfaceState.xcuserstate not getting committed while using git in Xcode
when I'm trying to commit my code project it shows a file called 'UserInterfaceState.xcuserstate' which has to be committed. once i commit it and try to push my project to git ,the Xcode gives me a popup message saying that 'The working co... | `UserInterfaceState.xcuserstate` is where Xcode saves your GUI states, such as window positions, open tabs, expanded nodes in the project inspector etc.
Simply resizing the Xcode window will cause this file to change and be flagged as modified by your source control system. You can make your SCM system ignore specific... |
20655073 | How to see which commit a git submodule points at | 129 | 2013-12-18 10:06:32 | <p>As far as I understand, if you add a submodule in git, then the main repo contains a pointer to a certain commit of the submodule.</p>
<p>Is there any way to see to which commit the main repo points at for a specific submodule, without checking out the code of the submodule?</p>
| 101,672 | 1,248,175 | 2023-10-11 09:38:13 | 20,656,066 | 27 | 2013-12-18 10:48:49 | 12,471 | 2021-08-09 16:43:36 | https://stackoverflow.com/q/20655073 | https://stackoverflow.com/a/20656066 | <p>Sure; there are several ways:</p>
<ol>
<li><code>git ls-tree <commit> <relative path to submodule></code></li>
<li><code>git ls-tree <commit>:<absolute path to parent of submodule></code></li>
<li><code>git ls-tree <commit>:./<relative path to parent of submodule></code></li>
<li>... | <p>Sure; there are several ways:</p> <ol> <li><code>git ls-tree <commit> <relative path to submodule></code></li> <li><code>git ls-tree <commit>:<absolute path to parent of submodule></code></li> <li><code>git ls-tree <commit>:./<relative path to parent of submodule></code></li> <li>... | 119, 41612, 53850 | git, git-commit, git-submodules | <h1>How to see which commit a git submodule points at</h1>
<p>As far as I understand, if you add a submodule in git, then the main repo contains a pointer to a certain commit of the submodule.</p>
<p>Is there any way to see to which commit the main repo points at for a specific submodule, without checking out the code ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,305 | git | # How to see which commit a git submodule points at
As far as I understand, if you add a submodule in git, then the main repo contains a pointer to a certain commit of the submodule.
Is there any way to see to which commit the main repo points at for a specific submodule, without checking out the code of the submodul... | Sure; there are several ways:
1. `git ls-tree <commit> <relative path to submodule>`
2. `git ls-tree <commit>:<absolute path to parent of submodule>`
3. `git ls-tree <commit>:./<relative path to parent of submodule>`
4. `git ls-tree -r <commit> <relative path to parent of submodule>`
The first is easiest by far for c... |
13956207 | How can set an older commit to be HEAD? | 118 | 2012-12-19 15:57:18 | <p>I realized that I made some mistakes on HEAD, checked out an older commit and started coding from there. When I attempt a push I'm told that my current commit is behind and I need to merge with HEAD. Git recommends "git pull". However, HEAD has the code I want to ignore. How do I solve this problem?</p>
<p... | 176,989 | 1,449,855 | 2023-07-12 13:10:43 | 13,956,297 | 27 | 2012-12-19 16:01:19 | 229,044 | 2012-12-19 16:01:19 | https://stackoverflow.com/q/13956207 | https://stackoverflow.com/a/13956297 | <p>If your repository isn't being used by other people, you can safely do <code>git push -f</code> to overwrite the remote branch.</p>
| <p>If your repository isn't being used by other people, you can safely do <code>git push -f</code> to overwrite the remote branch.</p> | 119 | git | <h1>How can set an older commit to be HEAD?</h1>
<p>I realized that I made some mistakes on HEAD, checked out an older commit and started coding from there. When I attempt a push I'm told that my current commit is behind and I need to merge with HEAD. Git recommends "git pull". However, HEAD has the code I wa... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,306 | git | # How can set an older commit to be HEAD?
I realized that I made some mistakes on HEAD, checked out an older commit and started coding from there. When I attempt a push I'm told that my current commit is behind and I need to merge with HEAD. Git recommends "git pull". However, HEAD has the code I want to ignore. How d... | If your repository isn't being used by other people, you can safely do `git push -f` to overwrite the remote branch. |
15250070 | Running filter-branch over a range of commits | 67 | 2013-03-06 14:33:23 | <pre><code>git filter-branch --env-filter '
export GIT_AUTHOR_EMAIL="foo@example.com"
export GIT_AUTHOR_NAME="foo"' -- commita..commitb
</code></pre>
<p>Results in <code>Which ref do you want to rewrite?</code></p>
<p>So it seems that <code>filter-branch</code> doesn't allow you to <s>use range notation</s> use a ran... | 25,903 | 311,220 | 2019-08-30 13:10:18 | 15,256,575 | 27 | 2013-03-06 19:44:43 | 311,220 | 2013-03-07 11:06:02 | https://stackoverflow.com/q/15250070 | https://stackoverflow.com/a/15256575 | <p>The cleanest solution I found was to do the following:</p>
<ol>
<li>Create a temporary branch at <code>refb</code>.</li>
<li>Apply the branch filter on <code>refa..temp</code>.</li>
<li>Rebase onto the temporary branch and delete it.</li>
</ol>
<p><strong>ie.</strong></p>
<pre><code>git branch temp refb
git filt... | <p>The cleanest solution I found was to do the following:</p> <ol> <li>Create a temporary branch at <code>refb</code>.</li> <li>Apply the branch filter on <code>refa..temp</code>.</li> <li>Rebase onto the temporary branch and delete it.</li> </ol> <p><strong>ie.</strong></p> <pre><code>git branch temp refb git filt... | 119, 46509 | git, git-filter-branch | <h1>Running filter-branch over a range of commits</h1>
<pre><code>git filter-branch --env-filter '
export GIT_AUTHOR_EMAIL="foo@example.com"
export GIT_AUTHOR_NAME="foo"' -- commita..commitb
</code></pre>
<p>Results in <code>Which ref do you want to rewrite?</code></p>
<p>So it seems that <code>filter-branch</code> d... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,308 | git | # Running filter-branch over a range of commits
```
git filter-branch --env-filter '
export GIT_AUTHOR_EMAIL="foo@example.com"
export GIT_AUTHOR_NAME="foo"' -- commita..commitb
```
Results in `Which ref do you want to rewrite?`
So it seems that `filter-branch` doesn't allow you to ~~use range notation~~ use a range ... | The cleanest solution I found was to do the following:
1. Create a temporary branch at `refb`.
2. Apply the branch filter on `refa..temp`.
3. Rebase onto the temporary branch and delete it.
**ie.**
```
git branch temp refb
git filter-branch --env-filter '
export GIT_AUTHOR_EMAIL="foo@example.com"' refa..temp
git r... |
24786404 | Merge commits don't appear in git rebase --interactive | 64 | 2014-07-16 16:50:36 | <p><code>git log</code> reveals the following:</p>
<pre><code>commit 1abcd[...]
Author: [...]
Date: [...]
[Useful commit]
commit 2abcd[...]
Author: [...]
Date: [...]
Merge branch [...] of [etc. etc.]
commit 3abcd[...]
Author: [...]
Date: [...]
[Useful commit]
</code></pre>
<p>That merge commit is use... | 39,326 | 1,675,729 | 2021-05-19 10:26:17 | 67,601,454 | 27 | 2021-05-19 10:26:17 | 1,614,763 | 2021-05-19 10:26:17 | https://stackoverflow.com/q/24786404 | https://stackoverflow.com/a/67601454 | <p>Git offers a new way using <code>--rebase-merges</code> :</p>
<p>Before --rebase-merges I get 6 conflicts with my specific case.</p>
<pre><code>git rebase -i --rebase-merges origin/master
</code></pre>
<p>And you may see something like :</p>
<pre><code>label onto
reset 4127388 # Formatting
pick 87da5b5 feat: add so... | <p>Git offers a new way using <code>--rebase-merges</code> :</p> <p>Before --rebase-merges I get 6 conflicts with my specific case.</p> <pre><code>git rebase -i --rebase-merges origin/master </code></pre> <p>And you may see something like :</p> <pre><code>label onto reset 4127388 # Formatting pick 87da5b5 feat: add so... | 119, 84381 | git, git-interactive-rebase | <h1>Merge commits don't appear in git rebase --interactive</h1>
<p><code>git log</code> reveals the following:</p>
<pre><code>commit 1abcd[...]
Author: [...]
Date: [...]
[Useful commit]
commit 2abcd[...]
Author: [...]
Date: [...]
Merge branch [...] of [etc. etc.]
commit 3abcd[...]
Author: [...]
Date: [...]... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,309 | git | # Merge commits don't appear in git rebase --interactive
`git log` reveals the following:
```
commit 1abcd[...]
Author: [...]
Date: [...]
[Useful commit]
commit 2abcd[...]
Author: [...]
Date: [...]
Merge branch [...] of [etc. etc.]
commit 3abcd[...]
Author: [...]
Date: [...]
[Useful commit]
```
That... | Git offers a new way using `--rebase-merges` :
Before --rebase-merges I get 6 conflicts with my specific case.
```
git rebase -i --rebase-merges origin/master
```
And you may see something like :
```
label onto
reset 4127388 # Formatting
pick 87da5b5 feat: add something
pick 8fcdff4 feat: add ..
merge -C 80784fe o... |
9067283 | Is there a way to use a Mercurial repository as Git submodule? | 62 | 2012-01-30 16:34:01 | <p>I been happily using submodules to track all the libraries my project depends from.
The thing is I'm using a library called core-plot that only has a public mercurial repository.
I can probably mirror it in a readonly Git repository, but is this the best option I got?
I had seen there is modules in Mercurial to t... | 11,589 | 861,649 | 2024-09-03 12:52:45 | 9,100,572 | 27 | 2012-02-01 17:42:53 | 1,099,571 | 2013-08-07 18:43:25 | https://stackoverflow.com/q/9067283 | https://stackoverflow.com/a/9100572 | <p>Using <a href="https://github.com/offbytwo/git-hg" rel="noreferrer"><strong>git-hg</strong></a>. </p>
<p>First, make sure there is a (non-Mercurial) git submodule under your main repository. If you don't have other submodules yet, just create a dummy submodule for some library other than <code>core-plot</code>, for... | <p>Using <a href="https://github.com/offbytwo/git-hg" rel="noreferrer"><strong>git-hg</strong></a>. </p> <p>First, make sure there is a (non-Mercurial) git submodule under your main repository. If you don't have other submodules yet, just create a dummy submodule for some library other than <code>core-plot</code>, for... | 119, 802, 41612 | git, git-submodules, mercurial | <h1>Is there a way to use a Mercurial repository as Git submodule?</h1>
<p>I been happily using submodules to track all the libraries my project depends from.
The thing is I'm using a library called core-plot that only has a public mercurial repository.
I can probably mirror it in a readonly Git repository, but is th... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,310 | git | # Is there a way to use a Mercurial repository as Git submodule?
I been happily using submodules to track all the libraries my project depends from.
The thing is I'm using a library called core-plot that only has a public mercurial repository.
I can probably mirror it in a readonly Git repository, but is this the best... | Using [**git-hg**](https://github.com/offbytwo/git-hg).
First, make sure there is a (non-Mercurial) git submodule under your main repository. If you don't have other submodules yet, just create a dummy submodule for some library other than `core-plot`, for instance:
```
main-repo $ git submodule add https://repo.url.... |
42555410 | Is it possible to search through Git stash items? | 61 | 2017-03-02 12:22:13 | <p>So I'm learning about using Git stash this week and figured out all of these stashes have been accumulating on my system. I've misplaced some code and I now have a dozen stashes of code 0-11.</p>
<p>Is there a way that I can search through these stashes for a string value in the files within the stash to find the co... | 33,551 | 588,492 | 2025-04-09 10:56:16 | 42,555,576 | 27 | 2017-03-02 12:29:29 | 147,407 | 2017-03-02 12:29:29 | https://stackoverflow.com/q/42555410 | https://stackoverflow.com/a/42555576 | <p><code>git stash show -p stash@{n} | grep "john cena"</code> is the only option I think.</p>
<p>Of course you can write your own script around that.</p>
| <p><code>git stash show -p stash@{n} | grep "john cena"</code> is the only option I think.</p> <p>Of course you can write your own script around that.</p> | 119, 13091 | git, git-stash | <h1>Is it possible to search through Git stash items?</h1>
<p>So I'm learning about using Git stash this week and figured out all of these stashes have been accumulating on my system. I've misplaced some code and I now have a dozen stashes of code 0-11.</p>
<p>Is there a way that I can search through these stashes for ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,311 | git | # Is it possible to search through Git stash items?
So I'm learning about using Git stash this week and figured out all of these stashes have been accumulating on my system. I've misplaced some code and I now have a dozen stashes of code 0-11.
Is there a way that I can search through these stashes for a string value ... | `git stash show -p stash@{n} | grep "john cena"` is the only option I think.
Of course you can write your own script around that. |
49557737 | Should I add .idea/caches/build_file_checksums.ser to .gitignore? | 60 | 2018-03-29 13:45:22 | <p>I updated my Android Studio <a href="https://developer.android.com/studio/releases/index.html" rel="nofollow noreferrer">from 3.0.1 to 3.1</a>, and noticed an unfamiliar file in my existing project:</p>
<pre><code>.idea/caches/build_file_checksums.ser
</code></pre>
<p>It doesn't depend on whether you update the Andr... | 15,684 | 9,298,629 | 2022-08-22 12:11:27 | 49,557,986 | 27 | 2018-03-29 13:55:42 | 7,937,498 | 2022-08-22 12:11:27 | https://stackoverflow.com/q/49557737 | https://stackoverflow.com/a/49557986 | <p>All files in your <code>.idea</code> folders are related to your IDE (Android Studio in this case). And as you said this files is created at the opening of the project. So you should add this file to your <code>.gitignore</code> because these files can contains some content that is not necessary like your absolute p... | <p>All files in your <code>.idea</code> folders are related to your IDE (Android Studio in this case). And as you said this files is created at the opening of the project. So you should add this file to your <code>.gitignore</code> because these files can contains some content that is not necessary like your absolute p... | 1386, 25056, 91905, 94719, 129373 | android, android-gradle-plugin, android-studio, android-studio-3.1, gitignore | <h1>Should I add .idea/caches/build_file_checksums.ser to .gitignore?</h1>
<p>I updated my Android Studio <a href="https://developer.android.com/studio/releases/index.html" rel="nofollow noreferrer">from 3.0.1 to 3.1</a>, and noticed an unfamiliar file in my existing project:</p>
<pre><code>.idea/caches/build_file_chec... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,312 | git | # Should I add .idea/caches/build_file_checksums.ser to .gitignore?
I updated my Android Studio [from 3.0.1 to 3.1](https://developer.android.com/studio/releases/index.html), and noticed an unfamiliar file in my existing project:
```
.idea/caches/build_file_checksums.ser
```
It doesn't depend on whether you update t... | All files in your `.idea` folders are related to your IDE (Android Studio in this case). And as you said this files is created at the opening of the project. So you should add this file to your `.gitignore` because these files can contains some content that is not necessary like your absolute path. |
7131703 | How to know which branch a "git log" commit belongs to? | 60 | 2011-08-20 12:18:51 | <p>If I do <code>git log</code>, is there any parameter I could specify to be able to tell from the output which branch every commit belongs to?</p>
<p>Edit: to clarify, I understand that a commit may be part of two branches (for instance). What I want is to get the most recent branch that the commit in <code>log</cod... | 31,301 | 283,055 | 2011-08-20 15:30:17 | 7,131,735 | 27 | 2011-08-20 12:26:07 | 640,288 | 2011-08-20 15:27:05 | https://stackoverflow.com/q/7131703 | https://stackoverflow.com/a/7131735 | <p>With <code>git log</code> you already get all the commits from the current branch you are on. </p>
<p>If you want to see commits from merged branches you can use </p>
<pre><code>$ git log --pretty=oneline --graph
</code></pre>
<p>To create a log tree and see what merged branches a commit stems from.</p>
<p><code... | <p>With <code>git log</code> you already get all the commits from the current branch you are on. </p> <p>If you want to see commits from merged branches you can use </p> <pre><code>$ git log --pretty=oneline --graph </code></pre> <p>To create a log tree and see what merged branches a commit stems from.</p> <p><code... | 119 | git | <h1>How to know which branch a "git log" commit belongs to?</h1>
<p>If I do <code>git log</code>, is there any parameter I could specify to be able to tell from the output which branch every commit belongs to?</p>
<p>Edit: to clarify, I understand that a commit may be part of two branches (for instance). What I want i... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,313 | git | # How to know which branch a "git log" commit belongs to?
If I do `git log`, is there any parameter I could specify to be able to tell from the output which branch every commit belongs to?
Edit: to clarify, I understand that a commit may be part of two branches (for instance). What I want is to get the most recent br... | With `git log` you already get all the commits from the current branch you are on.
If you want to see commits from merged branches you can use
```
$ git log --pretty=oneline --graph
```
To create a log tree and see what merged branches a commit stems from.
`--graph` will make the commit tree and
`--pretty=oneline` ... |
26570242 | How to move master to HEAD? | 59 | 2014-10-26 05:57:20 | <pre><code>* [971f835] (HEAD, original_idea) Now working here. Some comment 9
* [692b673] Some comment 8
* [3ebff62] Reverted to original idea. Some comment 7
| * [72ea01d] (master) Decided it wasn't worth the effort. Some comment 6
| * [985c1ad] Some comment 5
| * [4d7d491] Some comment 4
| * [0c697bb] Branched to try... | 70,145 | 576,311 | 2014-10-28 06:24:34 | 26,570,472 | 27 | 2014-10-26 06:37:50 | 231,573 | 2014-10-28 05:28:41 | https://stackoverflow.com/q/26570242 | https://stackoverflow.com/a/26570472 | <blockquote>
<p>Is this the infamous "detached head" issue?</p>
</blockquote>
<p>No, HEAD is pointing at branch <em>original_idea</em></p>
<blockquote>
<p>Does master have to be aligned with HEAD for optimal health of the
repo?</p>
</blockquote>
<p>No, <em>master</em> is just a conventional name, usually taken... | <blockquote> <p>Is this the infamous "detached head" issue?</p> </blockquote> <p>No, HEAD is pointing at branch <em>original_idea</em></p> <blockquote> <p>Does master have to be aligned with HEAD for optimal health of the repo?</p> </blockquote> <p>No, <em>master</em> is just a conventional name, usually taken... | 119 | git | <h1>How to move master to HEAD?</h1>
<pre><code>* [971f835] (HEAD, original_idea) Now working here. Some comment 9
* [692b673] Some comment 8
* [3ebff62] Reverted to original idea. Some comment 7
| * [72ea01d] (master) Decided it wasn't worth the effort. Some comment 6
| * [985c1ad] Some comment 5
| * [4d7d491] Some co... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,314 | git | # How to move master to HEAD?
```
* [971f835] (HEAD, original_idea) Now working here. Some comment 9
* [692b673] Some comment 8
* [3ebff62] Reverted to original idea. Some comment 7
| * [72ea01d] (master) Decided it wasn't worth the effort. Some comment 6
| * [985c1ad] Some comment 5
| * [4d7d491] Some comment 4
| * [... | > Is this the infamous "detached head" issue?
No, HEAD is pointing at branch *original_idea*
> Does master have to be aligned with HEAD for optimal health of the
> repo?
No, *master* is just a conventional name, usually taken to be a branch which is readily buildable and hopefully a working snapshot.
> How do I fix... |
112839 | How to resolve a conflict with git-svn? | 54 | 2008-09-22 02:03:55 | <p>What is the best way to resolve a conflict when doing a <code>git svn rebase</code>, and the git branch you are on becomes "(no-branch)"?</p>
| 20,337 | 19,839 | 2017-06-07 19:28:40 | 112,853 | 27 | 2008-09-22 02:08:32 | 3,146 | 2008-09-22 02:08:32 | https://stackoverflow.com/q/112839 | https://stackoverflow.com/a/112853 | <p>You can use <code>git mergetool</code> to view and edit the conflicts in the usual fashion. Once you are sure the conflicts are resolved do <code>git rebase --continue</code> to continue the rebase, or if you don't want to include that revision do <code>git rebase --skip</code></p>
| <p>You can use <code>git mergetool</code> to view and edit the conflicts in the usual fashion. Once you are sure the conflicts are resolved do <code>git rebase --continue</code> to continue the rebase, or if you don't want to include that revision do <code>git rebase --skip</code></p> | 63, 119, 717, 3146 | conflict, git, merge, svn | <h1>How to resolve a conflict with git-svn?</h1>
<p>What is the best way to resolve a conflict when doing a <code>git svn rebase</code>, and the git branch you are on becomes "(no-branch)"?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,315 | git | # How to resolve a conflict with git-svn?
What is the best way to resolve a conflict when doing a `git svn rebase`, and the git branch you are on becomes "(no-branch)"? | You can use `git mergetool` to view and edit the conflicts in the usual fashion. Once you are sure the conflicts are resolved do `git rebase --continue` to continue the rebase, or if you don't want to include that revision do `git rebase --skip` |
15878622 | ignoring changes matching a string in git diff | 53 | 2013-04-08 12:06:20 | <p>I've made a single simple change to a large number of files that are version controlled in git and I'd like to be able to check that no other changes are slipping into this large commit.</p>
<p>The changes are all of the form</p>
<pre><code>- "main()",
+ OOMPH_CURRENT_FU... | 21,932 | 874,671 | 2025-03-14 02:46:01 | 15,899,142 | 27 | 2013-04-09 10:10:01 | 2,116,168 | 2017-10-20 09:35:18 | https://stackoverflow.com/q/15878622 | https://stackoverflow.com/a/15899142 | <p>Try the following:</p>
<pre><code>$ git diff > full_diff.txt
$ git diff -G "your pattern" > matching_diff.txt
</code></pre>
<p>You can then compare the two like so:</p>
<pre><code>$ diff matching_diff.txt full_diff.txt
</code></pre>
<p>If all changes match the pattern, <code>full_diff.txt</code> and <code>... | <p>Try the following:</p> <pre><code>$ git diff > full_diff.txt $ git diff -G "your pattern" > matching_diff.txt </code></pre> <p>You can then compare the two like so:</p> <pre><code>$ diff matching_diff.txt full_diff.txt </code></pre> <p>If all changes match the pattern, <code>full_diff.txt</code> and <code>... | 18, 119, 606 | diff, git, regex | <h1>ignoring changes matching a string in git diff</h1>
<p>I've made a single simple change to a large number of files that are version controlled in git and I'd like to be able to check that no other changes are slipping into this large commit.</p>
<p>The changes are all of the form</p>
<pre><code>- ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,316 | git | # ignoring changes matching a string in git diff
I've made a single simple change to a large number of files that are version controlled in git and I'd like to be able to check that no other changes are slipping into this large commit.
The changes are all of the form
```
- "main()",
+ ... | Try the following:
```
$ git diff > full_diff.txt
$ git diff -G "your pattern" > matching_diff.txt
```
You can then compare the two like so:
```
$ diff matching_diff.txt full_diff.txt
```
If all changes match the pattern, `full_diff.txt` and `matching_diff.txt` will be identical, and the last `diff` command will no... |
14127255 | remove .git/index.lock': Permission denied | 53 | 2013-01-02 18:32:56 | <p>I'm completely stuck as to why my git has completely locked me out. I have a laptop that I use at work and when I'm home. For both accounts I use git extensively and both are located in different paths. Today I came into work and I can't do anything, all I see is:</p>
<pre><code>/Applications/MAMP/htdocs/my_site/.g... | 118,308 | 1,760,561 | 2023-03-22 19:38:25 | 14,127,302 | 27 | 2013-01-02 18:37:46 | 141,200 | 2013-01-02 18:37:46 | https://stackoverflow.com/q/14127255 | https://stackoverflow.com/a/14127302 | <p>Check which user owns the git lock:</p>
<pre><code>ls -la /Applications/MAMP/htdocs/my_site/.git/index.lock
</code></pre>
<p>Then you can use <code>sudo</code> to remove it.</p>
| <p>Check which user owns the git lock:</p> <pre><code>ls -la /Applications/MAMP/htdocs/my_site/.git/index.lock </code></pre> <p>Then you can use <code>sudo</code> to remove it.</p> | 119, 369 | git, macos | <h1>remove .git/index.lock': Permission denied</h1>
<p>I'm completely stuck as to why my git has completely locked me out. I have a laptop that I use at work and when I'm home. For both accounts I use git extensively and both are located in different paths. Today I came into work and I can't do anything, all I see is:<... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,317 | git | # remove .git/index.lock': Permission denied
I'm completely stuck as to why my git has completely locked me out. I have a laptop that I use at work and when I'm home. For both accounts I use git extensively and both are located in different paths. Today I came into work and I can't do anything, all I see is:
```
/App... | Check which user owns the git lock:
```
ls -la /Applications/MAMP/htdocs/my_site/.git/index.lock
```
Then you can use `sudo` to remove it. |
15670692 | git equivalent of 'hg serve'? | 52 | 2013-03-27 22:24:01 | <p>Is there some sort of addon you can use to have a git equivalent of the Mercurial </p>
<pre><code>hg serve
</code></pre>
<p>('hg serve' starts a local web-server which allows you to browse the repository history/branches etc)</p>
| 11,024 | 364,088 | 2017-02-22 21:42:15 | 15,670,867 | 27 | 2013-03-27 22:37:01 | 380,757 | 2014-10-08 06:13:51 | https://stackoverflow.com/q/15670692 | https://stackoverflow.com/a/15670867 | <p>I think what you're looking for is <a href="https://www.kernel.org/pub/software/scm/git/docs/git-instaweb.html" rel="noreferrer"><code>git instaweb</code></a>.</p>
<p>By default it uses <code>lighttpd</code>, but any other web server like <code>webrick</code> also should work.</p>
<p>I prefer webrick because it is... | <p>I think what you're looking for is <a href="https://www.kernel.org/pub/software/scm/git/docs/git-instaweb.html" rel="noreferrer"><code>git instaweb</code></a>.</p> <p>By default it uses <code>lighttpd</code>, but any other web server like <code>webrick</code> also should work.</p> <p>I prefer webrick because it is... | 119, 802 | git, mercurial | <h1>git equivalent of 'hg serve'?</h1>
<p>Is there some sort of addon you can use to have a git equivalent of the Mercurial </p>
<pre><code>hg serve
</code></pre>
<p>('hg serve' starts a local web-server which allows you to browse the repository history/branches etc)</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,318 | git | # git equivalent of 'hg serve'?
Is there some sort of addon you can use to have a git equivalent of the Mercurial
```
hg serve
```
('hg serve' starts a local web-server which allows you to browse the repository history/branches etc) | I think what you're looking for is [`git instaweb`](https://www.kernel.org/pub/software/scm/git/docs/git-instaweb.html).
By default it uses `lighttpd`, but any other web server like `webrick` also should work.
I prefer webrick because it is much convenient (and I have `ruby` and `webrick` gem installed)
Examples:
`... |
70283510 | How to update a GitHub access token via command line | 41 | 2021-12-09 00:56:04 | <p>I use the git integration with VSCode. I have my new token (obtained through the GitHub web interface). How do I put it in?</p>
<p>The <a href="https://marketplace.visualstudio.com/items?itemName=KnisterPeter.vscode-github#:%7E:text=Setup%20Personal%20Access%20Token&text=To%20execute%20the%20%27GitHub%3A%20Set,t... | 154,073 | 8,605,685 | 2025-10-25 04:36:57 | 77,305,709 | 27 | 2023-10-17 01:20:20 | 8,605,685 | 2025-02-24 20:10:25 | https://stackoverflow.com/q/70283510 | https://stackoverflow.com/a/77305709 | <h1>This solution avoids the problem of exposing your token in plain text</h1>
<p>The problem with the top voted answer is that your token is written to the <code>.git/config</code> file in plain text which exposes it for use by others or potential unintentional redistribution.</p>
<p>First, <a href="https://stackoverf... | <h1>This solution avoids the problem of exposing your token in plain text</h1> <p>The problem with the top voted answer is that your token is written to the <code>.git/config</code> file in plain text which exposes it for use by others or potential unintentional redistribution.</p> <p>First, <a href="https://stackoverf... | 64, 119, 369, 58149, 111608 | access-token, git, macos, visual-studio-code, windows | <h1>How to update a GitHub access token via command line</h1>
<p>I use the git integration with VSCode. I have my new token (obtained through the GitHub web interface). How do I put it in?</p>
<p>The <a href="https://marketplace.visualstudio.com/items?itemName=KnisterPeter.vscode-github#:%7E:text=Setup%20Personal%20Acc... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,320 | git | # How to update a GitHub access token via command line
I use the git integration with VSCode. I have my new token (obtained through the GitHub web interface). How do I put it in?
The [VSCode docs](https://marketplace.visualstudio.com/items?itemName=KnisterPeter.vscode-github#:%7E:text=Setup%20Personal%20Access%20Toke... | # This solution avoids the problem of exposing your token in plain text
The problem with the top voted answer is that your token is written to the `.git/config` file in plain text which exposes it for use by others or potential unintentional redistribution.
First, [remove your existing git credentials](https://stacko... |
12913988 | Opposite of git branch --set-upstream | 41 | 2012-10-16 11:45:08 | <p>I would like to stop tracking certain branches.
I set up tracking using <code>git branch --set-upstream foo origin/foo</code>.</p>
<p>How do I undo this?</p>
| 19,200 | 1,177,738 | 2012-10-16 13:40:31 | 12,914,311 | 27 | 2012-10-16 12:05:31 | 526,535 | 2012-10-16 12:05:31 | https://stackoverflow.com/q/12913988 | https://stackoverflow.com/a/12914311 | <p>Try the below:</p>
<pre><code>git config --unset branch.<branch>.remote
git config --unset branch.<branch>.merge
</code></pre>
| <p>Try the below:</p> <pre><code>git config --unset branch.<branch>.remote git config --unset branch.<branch>.merge </code></pre> | 119, 1879 | branch, git | <h1>Opposite of git branch --set-upstream</h1>
<p>I would like to stop tracking certain branches.
I set up tracking using <code>git branch --set-upstream foo origin/foo</code>.</p>
<p>How do I undo this?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,321 | git | # Opposite of git branch --set-upstream
I would like to stop tracking certain branches.
I set up tracking using `git branch --set-upstream foo origin/foo`.
How do I undo this? | Try the below:
```
git config --unset branch.<branch>.remote
git config --unset branch.<branch>.merge
``` |
1441156 | Git how to save a preset git log --format | 40 | 2009-09-17 20:28:47 | <p>I really like the short git log format where I can see author, date and change description like this:</p>
<pre><code>git log --pretty=format:"%h%x09%an%x09%ad%x09%s"
</code></pre>
<p>Which outputs:</p>
<pre><code> fbc3503 mads Thu Dec 4 07:43:27 2008 +0000 show mobile if phone is null...
ec36490 jesper... | 21,303 | 109,305 | 2022-11-10 06:24:19 | 1,441,176 | 27 | 2009-09-17 20:31:50 | 6,309 | 2022-11-10 06:24:19 | https://stackoverflow.com/q/1441156 | https://stackoverflow.com/a/1441176 | <p>Considering the git log manual page mentions:</p>
<pre><code>--pretty[=<format>]
--format[=<format>]
</code></pre>
<blockquote>
<p>Pretty-print the contents of the commit logs in a given format, where can be one of oneline, short, medium, full, fuller, email, raw and format:. When omitted, the format de... | <p>Considering the git log manual page mentions:</p> <pre><code>--pretty[=<format>] --format[=<format>] </code></pre> <blockquote> <p>Pretty-print the contents of the commit logs in a given format, where can be one of oneline, short, medium, full, fuller, email, raw and format:. When omitted, the format de... | 119, 555, 942 | formatting, git, logging | <h1>Git how to save a preset git log --format</h1>
<p>I really like the short git log format where I can see author, date and change description like this:</p>
<pre><code>git log --pretty=format:"%h%x09%an%x09%ad%x09%s"
</code></pre>
<p>Which outputs:</p>
<pre><code> fbc3503 mads Thu Dec 4 07:43:27 2008 +0000 ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,322 | git | # Git how to save a preset git log --format
I really like the short git log format where I can see author, date and change description like this:
```
git log --pretty=format:"%h%x09%an%x09%ad%x09%s"
```
Which outputs:
```
fbc3503 mads Thu Dec 4 07:43:27 2008 +0000 show mobile if phone is null...
ec36490... | Considering the git log manual page mentions:
```
--pretty[=<format>]
--format[=<format>]
```
> Pretty-print the contents of the commit logs in a given format, where can be one of oneline, short, medium, full, fuller, email, raw and format:. When omitted, the format defaults to medium.
the `<format>` can only have p... |
5147537 | How do I fast-forward other tracking branches in git? | 39 | 2011-02-28 21:01:46 | <p>We are working with the model of a single remote repository that all of us use. We branch for new features and reintegrate into a trunk branch. Our workflow is that we should integrate from trunk into our working branches when other features are integrated into the trunk.</p>
<p>As such, it's not uncommon for us to... | 12,846 | 260,307 | 2024-06-13 12:51:38 | 5,147,590 | 27 | 2011-02-28 21:07:17 | 6,309 | 2015-03-17 09:29:20 | https://stackoverflow.com/q/5147537 | https://stackoverflow.com/a/5147590 | <p>Do you really need to update a local <code>trunk</code> branch?</p>
<p>Just <code>fetch origin/trunk</code> and <code>merge</code> it directly in the branch you are working on.<br>
And that is <a href="https://stackoverflow.com/users/223092/mark-longair">Mark Longair</a>'s advice: <strong><a href="http://longair.ne... | <p>Do you really need to update a local <code>trunk</code> branch?</p> <p>Just <code>fetch origin/trunk</code> and <code>merge</code> it directly in the branch you are working on.<br> And that is <a href="https://stackoverflow.com/users/223092/mark-longair">Mark Longair</a>'s advice: <strong><a href="http://longair.ne... | 119 | git | <h1>How do I fast-forward other tracking branches in git?</h1>
<p>We are working with the model of a single remote repository that all of us use. We branch for new features and reintegrate into a trunk branch. Our workflow is that we should integrate from trunk into our working branches when other features are integrat... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,323 | git | # How do I fast-forward other tracking branches in git?
We are working with the model of a single remote repository that all of us use. We branch for new features and reintegrate into a trunk branch. Our workflow is that we should integrate from trunk into our working branches when other features are integrated into t... | Do you really need to update a local `trunk` branch?
Just `fetch origin/trunk` and `merge` it directly in the branch you are working on.
And that is [Mark Longair](https://stackoverflow.com/users/223092/mark-longair)'s advice: **[git: `fetch` and `merge`, don’t `pull`](http://longair.net/blog/2009/04/16/git-fetch-an... |
8442695 | Git push failed - unpack-objects abnormal exit | 37 | 2011-12-09 08:07:24 | <p>I'm using remote git repository. I successfully commit my files and now I'm trying
to push it up to stream.</p>
<p>Operation fails with this messasge:</p>
<pre><code>git.exe push --progress "origin" master:master
error: unpack failed: unpack-objects abnormal exit
error: RPC failed; result=18, HTTP code = 200
</c... | 92,638 | 330,847 | 2024-02-27 23:40:02 | 8,442,817 | 27 | 2011-12-09 08:20:51 | 357,743 | 2011-12-09 08:26:40 | https://stackoverflow.com/q/8442695 | https://stackoverflow.com/a/8442817 | <p>According to <a href="http://www.andyjarrett.co.uk/blog/index.cfm/2009/10/8/unpacker-error-when-pushing-git">this</a> article <code>git repack remote/origin/master</code> might help in case your local repository was corrupted. To check that you can try cloning your remote repo into new directory and test push from i... | <p>According to <a href="http://www.andyjarrett.co.uk/blog/index.cfm/2009/10/8/unpacker-error-when-pushing-git">this</a> article <code>git repack remote/origin/master</code> might help in case your local repository was corrupted. To check that you can try cloning your remote repo into new directory and test push from i... | 119, 456 | git, version-control | <h1>Git push failed - unpack-objects abnormal exit</h1>
<p>I'm using remote git repository. I successfully commit my files and now I'm trying
to push it up to stream.</p>
<p>Operation fails with this messasge:</p>
<pre><code>git.exe push --progress "origin" master:master
error: unpack failed: unpack-objects abnorma... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,324 | git | # Git push failed - unpack-objects abnormal exit
I'm using remote git repository. I successfully commit my files and now I'm trying
to push it up to stream.
Operation fails with this messasge:
```
git.exe push --progress "origin" master:master
error: unpack failed: unpack-objects abnormal exit
error: RPC failed; r... | According to [this](http://www.andyjarrett.co.uk/blog/index.cfm/2009/10/8/unpacker-error-when-pushing-git) article `git repack remote/origin/master` might help in case your local repository was corrupted. To check that you can try cloning your remote repo into new directory and test push from it. |
63440623 | No GPG passphrase prompt in Visual Studio Code on Windows 10 for signed git commits using WSL2 | 36 | 2020-08-16 18:34:20 | <p>I am unable to use signed commits within Visual Studio Code when committing code in WSL2 from Windows 10.</p>
<p><strong>THE ISSUE</strong></p>
<p>No passphrase prompt is shown within Windows 10 resulting in git failing with <code>error: gpg failed to sign the data</code></p>
<hr />
<p><strong>SETUP</strong></p>
<p>... | 18,929 | 13,595,283 | 2023-09-01 09:40:06 | 63,474,095 | 27 | 2020-08-18 17:52:12 | 13,595,283 | 2020-08-18 17:52:12 | https://stackoverflow.com/q/63440623 | https://stackoverflow.com/a/63474095 | <p>I found a solution...but it has caveats at the time of writing.</p>
<p>Since Visual Studio Code is running in Windows 10 and git & gpg are within WSL2 I thought of trying a visual pinentry on the Windows 10 side.</p>
<p>This didn't work until I subscribed to the Windows Insider's track and updated to the latest ... | <p>I found a solution...but it has caveats at the time of writing.</p> <p>Since Visual Studio Code is running in Windows 10 and git & gpg are within WSL2 I thought of trying a visual pinentry on the Windows 10 side.</p> <p>This didn't work until I subscribed to the Windows Insider's track and updated to the latest ... | 119, 6735, 111608, 119526 | git, gnupg, visual-studio-code, windows-subsystem-for-linux | <h1>No GPG passphrase prompt in Visual Studio Code on Windows 10 for signed git commits using WSL2</h1>
<p>I am unable to use signed commits within Visual Studio Code when committing code in WSL2 from Windows 10.</p>
<p><strong>THE ISSUE</strong></p>
<p>No passphrase prompt is shown within Windows 10 resulting in git f... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,325 | git | # No GPG passphrase prompt in Visual Studio Code on Windows 10 for signed git commits using WSL2
I am unable to use signed commits within Visual Studio Code when committing code in WSL2 from Windows 10.
**THE ISSUE**
No passphrase prompt is shown within Windows 10 resulting in git failing with `error: gpg failed to ... | I found a solution...but it has caveats at the time of writing.
Since Visual Studio Code is running in Windows 10 and git & gpg are within WSL2 I thought of trying a visual pinentry on the Windows 10 side.
This didn't work until I subscribed to the Windows Insider's track and updated to the latest Dev Build (2004 Bui... |
35296680 | How to configure "git pull --ff-only" and "git merge --no-ff" | 36 | 2016-02-09 16:07:35 | <p>A typical git workflow for me is to clone a remote repository and use git pull to keep it up-to-date. I don't want merge commits when I pull, so i use the --ff-only option.</p>
<p>I also make local branches for feature work. I want to preserve the branch history, so when I merge the local branch back to my local cl... | 45,488 | 4,014,635 | 2016-02-09 17:24:56 | 35,298,178 | 27 | 2016-02-09 17:19:40 | 1,288,760 | 2016-02-09 17:24:56 | https://stackoverflow.com/q/35296680 | https://stackoverflow.com/a/35298178 | <p>That shouldn't be the case, according to <a href="https://www.kernel.org/pub/software/scm/git/docs/git-config.html" rel="noreferrer">the <code>git-config</code> man page</a> on <code>pull.ff</code>:</p>
<blockquote>
<p>(...) When set to only, only such fast-forward merges are allowed (equivalent to giving the --f... | <p>That shouldn't be the case, according to <a href="https://www.kernel.org/pub/software/scm/git/docs/git-config.html" rel="noreferrer">the <code>git-config</code> man page</a> on <code>pull.ff</code>:</p> <blockquote> <p>(...) When set to only, only such fast-forward merges are allowed (equivalent to giving the --f... | 119, 28896, 28897, 32868 | git, git-config, git-merge, git-pull | <h1>How to configure "git pull --ff-only" and "git merge --no-ff"</h1>
<p>A typical git workflow for me is to clone a remote repository and use git pull to keep it up-to-date. I don't want merge commits when I pull, so i use the --ff-only option.</p>
<p>I also make local branches for feature work. I want to preserve t... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,326 | git | # How to configure "git pull --ff-only" and "git merge --no-ff"
A typical git workflow for me is to clone a remote repository and use git pull to keep it up-to-date. I don't want merge commits when I pull, so i use the --ff-only option.
I also make local branches for feature work. I want to preserve the branch histor... | That shouldn't be the case, according to [the `git-config` man page](https://www.kernel.org/pub/software/scm/git/docs/git-config.html) on `pull.ff`:
> (...) When set to only, only such fast-forward merges are allowed (equivalent to giving the --ff-only option from the command line). **This setting overrides merge.ff w... |
35221147 | What is the sequence for tagging commit in git? | 34 | 2016-02-05 09:59:09 | <p>I cloned a git repo and made some changes.
I have to commit changes and then tag those committed changes.
What should be the sequence of commands? Is it like: <code>git clone</code>, <code>git add</code>, <code>git commit</code>, <code>git push</code>, and then <code>git tag</code>?</p>
<p>If not, what is the sequ... | 16,844 | 1,197,140 | 2016-02-05 18:55:12 | 35,221,463 | 27 | 2016-02-05 10:13:33 | 5,222,966 | 2016-02-05 10:13:33 | https://stackoverflow.com/q/35221147 | https://stackoverflow.com/a/35221463 | <p>You can tag a revision right after your commit or later (after a push). Then, you can push your tag with: <code>git push origin [tagname]</code>.</p>
<p>So, yes, your sequence is ok. Take a look at this, for more details: <a href="https://git-scm.com/book/en/v2/Git-Basics-Tagging" rel="noreferrer">https://git-scm.c... | <p>You can tag a revision right after your commit or later (after a push). Then, you can push your tag with: <code>git push origin [tagname]</code>.</p> <p>So, yes, your sequence is ok. Take a look at this, for more details: <a href="https://git-scm.com/book/en/v2/Git-Basics-Tagging" rel="noreferrer">https://git-scm.c... | 115, 119, 60718 | git, git-tag, tags | <h1>What is the sequence for tagging commit in git?</h1>
<p>I cloned a git repo and made some changes.
I have to commit changes and then tag those committed changes.
What should be the sequence of commands? Is it like: <code>git clone</code>, <code>git add</code>, <code>git commit</code>, <code>git push</code>, and th... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,328 | git | # What is the sequence for tagging commit in git?
I cloned a git repo and made some changes.
I have to commit changes and then tag those committed changes.
What should be the sequence of commands? Is it like: `git clone`, `git add`, `git commit`, `git push`, and then `git tag`?
If not, what is the sequence ? | You can tag a revision right after your commit or later (after a push). Then, you can push your tag with: `git push origin [tagname]`.
So, yes, your sequence is ok. Take a look at this, for more details: <https://git-scm.com/book/en/v2/Git-Basics-Tagging>. |
31392513 | Git - diff3 Conflict Style - Temporary merge branch | 33 | 2015-07-13 20:10:52 | <p>I am doing a merge with <code>merge.conflictStyle</code> set to <code>diff3</code>. Normally, this inserts three (3) sections separated by four (4) sets of characters.</p>
<p>The <a href="http://git-scm.com/docs/git-merge" rel="noreferrer">Git Documentation for Merge</a> clearly explains what these symbols mean for... | 7,741 | 4,354,956 | 2018-08-05 09:50:38 | 31,393,044 | 27 | 2015-07-13 20:41:02 | 1,256,452 | 2015-07-13 20:41:02 | https://stackoverflow.com/q/31392513 | https://stackoverflow.com/a/31393044 | <p>What you have here (with the <code>Temporary merge branch 1</code> and same with 2) is due to git's "recursive merge" method:</p>
<pre><code> o->branch1 = "Temporary merge branch 1";
o->branch2 = "Temporary merge branch 2";
merge_recursive(o, merged_common_ancestors, iter-&g... | <p>What you have here (with the <code>Temporary merge branch 1</code> and same with 2) is due to git's "recursive merge" method:</p> <pre><code> o->branch1 = "Temporary merge branch 1"; o->branch2 = "Temporary merge branch 2"; merge_recursive(o, merged_common_ancestors, iter-&g... | 119, 717, 28897, 30103 | diff3, git, git-merge, merge | <h1>Git - diff3 Conflict Style - Temporary merge branch</h1>
<p>I am doing a merge with <code>merge.conflictStyle</code> set to <code>diff3</code>. Normally, this inserts three (3) sections separated by four (4) sets of characters.</p>
<p>The <a href="http://git-scm.com/docs/git-merge" rel="noreferrer">Git Documentati... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,331 | git | # Git - diff3 Conflict Style - Temporary merge branch
I am doing a merge with `merge.conflictStyle` set to `diff3`. Normally, this inserts three (3) sections separated by four (4) sets of characters.
The [Git Documentation for Merge](http://git-scm.com/docs/git-merge) clearly explains what these symbols mean for a si... | What you have here (with the `Temporary merge branch 1` and same with 2) is due to git's "recursive merge" method:
```
o->branch1 = "Temporary merge branch 1";
o->branch2 = "Temporary merge branch 2";
merge_recursive(o, merged_common_ancestors, iter->item,
... |
28462083 | git branch -d <branchname> throws error: branch <branchname> not found | 33 | 2015-02-11 18:47:40 | <p>When I type <code>git branch</code>, I get</p>
<pre><code>* master
localbranch
</code></pre>
<p>But when I try to remove the branch, <code>git branch -d localbranch</code>, I get a not found error: </p>
<pre><code>error: branch 'localbranch' not found.
</code></pre>
<p>I have also tried to force the delete with ... | 25,277 | 3,749,288 | 2023-02-08 08:07:43 | 28,462,212 | 27 | 2015-02-11 18:54:09 | 1,860,929 | 2015-02-11 20:14:57 | https://stackoverflow.com/q/28462083 | https://stackoverflow.com/a/28462212 | <p>Branches are stored as files containing the SHA they point to. Try deleting the file for this branch, named <code>localbranch</code>, from the <code>.git/refs/head/</code> directory within your project:</p>
<pre><code>rm .git/refs/heads/localbranch
</code></pre>
| <p>Branches are stored as files containing the SHA they point to. Try deleting the file for this branch, named <code>localbranch</code>, from the <code>.git/refs/head/</code> directory within your project:</p> <pre><code>rm .git/refs/heads/localbranch </code></pre> | 119, 76220 | git, git-branch | <h1>git branch -d <branchname> throws error: branch <branchname> not found</h1>
<p>When I type <code>git branch</code>, I get</p>
<pre><code>* master
localbranch
</code></pre>
<p>But when I try to remove the branch, <code>git branch -d localbranch</code>, I get a not found error: </p>
<pre><code>error: branch 'local... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,332 | git | # git branch -d throws error: branch not found
When I type `git branch`, I get
```
* master
localbranch
```
But when I try to remove the branch, `git branch -d localbranch`, I get a not found error:
```
error: branch 'localbranch' not found.
```
I have also tried to force the delete with `git branch -D localbranch... | Branches are stored as files containing the SHA they point to. Try deleting the file for this branch, named `localbranch`, from the `.git/refs/head/` directory within your project:
```
rm .git/refs/heads/localbranch
``` |
1461909 | Evil merges in git? | 33 | 2009-09-22 18:48:25 | <p>"man <a href="http://www.kernel.org/pub/software/scm/git/docs/gitglossary.html" rel="noreferrer" title="gitglossary - A GIT Glossary">gitglossary</a>" contains this definition of an <em>evil merge</em>:</p>
<blockquote>
<p>An evil merge is a merge that introduces changes that do not appear
in any parent.</p>
</... | 11,744 | 23,691 | 2017-06-15 03:52:35 | 1,461,929 | 27 | 2009-09-22 18:51:11 | 47,529 | 2009-09-22 18:51:11 | https://stackoverflow.com/q/1461909 | https://stackoverflow.com/a/1461929 | <p>Because it's putting things in the code that no one ever asked to be there. As if you had this code:</p>
<pre><code>$foo = bar;
$baz = qxx;
</code></pre>
<p>and this change:</p>
<pre><code>$foo = bar;
$foo++;
$baz = qxx;
</code></pre>
<p>got merged with this change:</p>
<pre><code>$foo = bar;
$foo--;
$baz = qx... | <p>Because it's putting things in the code that no one ever asked to be there. As if you had this code:</p> <pre><code>$foo = bar; $baz = qxx; </code></pre> <p>and this change:</p> <pre><code>$foo = bar; $foo++; $baz = qxx; </code></pre> <p>got merged with this change:</p> <pre><code>$foo = bar; $foo--; $baz = qx... | 119, 717 | git, merge | <h1>Evil merges in git?</h1>
<p>"man <a href="http://www.kernel.org/pub/software/scm/git/docs/gitglossary.html" rel="noreferrer" title="gitglossary - A GIT Glossary">gitglossary</a>" contains this definition of an <em>evil merge</em>:</p>
<blockquote>
<p>An evil merge is a merge that introduces changes that do not a... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,333 | git | # Evil merges in git?
"man [gitglossary](http://www.kernel.org/pub/software/scm/git/docs/gitglossary.html "gitglossary - A GIT Glossary")" contains this definition of an *evil merge*:
> An evil merge is a merge that introduces changes that do not appear
> in any parent.
I am not sure I understand the point the autho... | Because it's putting things in the code that no one ever asked to be there. As if you had this code:
```
$foo = bar;
$baz = qxx;
```
and this change:
```
$foo = bar;
$foo++;
$baz = qxx;
```
got merged with this change:
```
$foo = bar;
$foo--;
$baz = qxx;
```
in a fashion that somehow produced:
```
$foo = bar;
$f... |
6839781 | What happens when you run `git add .git` in a Git repository? | 32 | 2011-07-27 05:24:40 | <p>While it seemed to do nothing, it gave no warning or error message. Any ideas?</p>
| 7,024 | 237,285 | 2015-11-23 05:09:02 | 6,840,103 | 27 | 2011-07-27 06:14:24 | 526,535 | 2015-11-23 05:09:02 | https://stackoverflow.com/q/6839781 | https://stackoverflow.com/a/6840103 | <p>Comment from Git source:</p>
<pre><code>/*
* Read a directory tree. We currently ignore anything but
* directories, regular files and symlinks. That's because git
* doesn't handle them at all yet. Maybe that will change some
* day.
*
* Also, we ignore the name ".git" (even if it is not a directory).
* That l... | <p>Comment from Git source:</p> <pre><code>/* * Read a directory tree. We currently ignore anything but * directories, regular files and symlinks. That's because git * doesn't handle them at all yet. Maybe that will change some * day. * * Also, we ignore the name ".git" (even if it is not a directory). * That l... | 119, 34792 | git, git-add | <h1>What happens when you run `git add .git` in a Git repository?</h1>
<p>While it seemed to do nothing, it gave no warning or error message. Any ideas?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,335 | git | # What happens when you run `git add .git` in a Git repository?
While it seemed to do nothing, it gave no warning or error message. Any ideas? | Comment from Git source:
```
/*
* Read a directory tree. We currently ignore anything but
* directories, regular files and symlinks. That's because git
* doesn't handle them at all yet. Maybe that will change some
* day.
*
* Also, we ignore the name ".git" (even if it is not a directory).
* That likely will not... |
1554222 | Git svn clone: How to defer fetch of revision history | 32 | 2009-10-12 12:13:53 | <p>I often have the case that I want to work on a SVN repository right away. But an ordinary <code>git svn clone [url]</code> also clones the entire history. So I want to speed things up. The first part is to fetch only the last revision into your Git repository. I do it like so:</p>
<pre><code>URL=http://google-web-t... | 16,612 | 109,305 | 2013-03-26 18:57:56 | 1,556,919 | 27 | 2009-10-12 21:02:20 | 109,305 | 2009-10-14 10:16:37 | https://stackoverflow.com/q/1554222 | https://stackoverflow.com/a/1556919 | <p>I found out how it can be done. The trick is <strong>not to use <code>git svn clone</code></strong>. Instead, use <code>git svn init</code> and <code>git svn fetch</code> individually. Modified the example:</p>
<pre><code>URL=http://google-web-toolkit.googlecode.com/svn/trunk/
REV=`svn info $URL |grep Revision: | a... | <p>I found out how it can be done. The trick is <strong>not to use <code>git svn clone</code></strong>. Instead, use <code>git svn init</code> and <code>git svn fetch</code> individually. Modified the example:</p> <pre><code>URL=http://google-web-toolkit.googlecode.com/svn/trunk/ REV=`svn info $URL |grep Revision: | a... | 119, 3050, 6452, 34099 | clone, git, git-clone, git-svn | <h1>Git svn clone: How to defer fetch of revision history</h1>
<p>I often have the case that I want to work on a SVN repository right away. But an ordinary <code>git svn clone [url]</code> also clones the entire history. So I want to speed things up. The first part is to fetch only the last revision into your Git repos... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,336 | git | # Git svn clone: How to defer fetch of revision history
I often have the case that I want to work on a SVN repository right away. But an ordinary `git svn clone [url]` also clones the entire history. So I want to speed things up. The first part is to fetch only the last revision into your Git repository. I do it like ... | I found out how it can be done. The trick is **not to use `git svn clone`**. Instead, use `git svn init` and `git svn fetch` individually. Modified the example:
```
URL=http://google-web-toolkit.googlecode.com/svn/trunk/
REV=`svn info $URL |grep Revision: | awk '{print $2}'`
PROJECT_FOLDER=google-web-toolkit-readonly
... |
7147699 | Limiting file size in git repository | 31 | 2011-08-22 12:48:17 | <p>I'm currently thinking of changing my VCS (from subversion) to git. Is it possible to limit the file size within a commit in a git repository? For e. g. subversion there is a hook: <a href="http://www.davidgrant.ca/limit_size_of_subversion_commits_with_this_hook">http://www.davidgrant.ca/limit_size_of_subversion_com... | 16,228 | 203,506 | 2023-06-16 21:19:01 | 9,126,745 | 27 | 2012-02-03 09:56:44 | 365,237 | 2018-09-17 06:47:01 | https://stackoverflow.com/q/7147699 | https://stackoverflow.com/a/9126745 | <p>As I was struggling with it for a while, even with the description, and I think this is relevant for others too, I thought I'd post an implementation of how what <a href="https://stackoverflow.com/a/7147764/365237">J16 SDiZ described</a> could be implemented.</p>
<p>So, my take on the server-side <a href="http://gi... | <p>As I was struggling with it for a while, even with the description, and I think this is relevant for others too, I thought I'd post an implementation of how what <a href="https://stackoverflow.com/a/7147764/365237">J16 SDiZ described</a> could be implemented.</p> <p>So, my take on the server-side <a href="http://gi... | 119, 456 | git, version-control | <h1>Limiting file size in git repository</h1>
<p>I'm currently thinking of changing my VCS (from subversion) to git. Is it possible to limit the file size within a commit in a git repository? For e. g. subversion there is a hook: <a href="http://www.davidgrant.ca/limit_size_of_subversion_commits_with_this_hook">http://... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,337 | git | # Limiting file size in git repository
I'm currently thinking of changing my VCS (from subversion) to git. Is it possible to limit the file size within a commit in a git repository? For e. g. subversion there is a hook: <http://www.davidgrant.ca/limit_size_of_subversion_commits_with_this_hook>
From my experience peop... | As I was struggling with it for a while, even with the description, and I think this is relevant for others too, I thought I'd post an implementation of how what [J16 SDiZ described](https://stackoverflow.com/a/7147764/365237) could be implemented.
So, my take on the server-side [`update`](http://git-scm.com/book/en/v... |
5004237 | Git: Revert to previous commit status | 30 | 2011-02-15 13:29:07 | <p>I'm confused. I want to go back to a previous commit that I identified in "git log".</p>
<p>But when I do "git checkout ", I don't get said commit. Nothing changes.
It tells me I'm in detached HEAD mode, but the files I want are not there.</p>
<p>What the eff am I doing wrong?</p>
<p>MrB</p>
| 31,711 | 592,263 | 2021-11-30 09:30:20 | 5,004,265 | 27 | 2011-02-15 13:31:28 | 102,529 | 2014-04-22 23:00:55 | https://stackoverflow.com/q/5004237 | https://stackoverflow.com/a/5004265 | <p><code>git reset --hard <commit></code> From the manpage:</p>
<blockquote>
<p>Matches the working tree and index to that of the tree being switched to. Any changes to tracked files in the working tree since are lost.</p>
</blockquote>
<p><code>git checkout</code> is for switching your working directory to ... | <p><code>git reset --hard <commit></code> From the manpage:</p> <blockquote> <p>Matches the working tree and index to that of the tree being switched to. Any changes to tracked files in the working tree since are lost.</p> </blockquote> <p><code>git checkout</code> is for switching your working directory to ... | 119, 5597, 12626 | commit, git, reset | <h1>Git: Revert to previous commit status</h1>
<p>I'm confused. I want to go back to a previous commit that I identified in "git log".</p>
<p>But when I do "git checkout ", I don't get said commit. Nothing changes.
It tells me I'm in detached HEAD mode, but the files I want are not there.</p>
<p>What the eff am I doi... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,340 | git | # Git: Revert to previous commit status
I'm confused. I want to go back to a previous commit that I identified in "git log".
But when I do "git checkout ", I don't get said commit. Nothing changes.
It tells me I'm in detached HEAD mode, but the files I want are not there.
What the eff am I doing wrong?
MrB | `git reset --hard <commit>` From the manpage:
> Matches the working tree and index to that of the tree being switched to. Any changes to tracked files in the working tree since are lost.
`git checkout` is for switching your working directory to a different branch or commit. This does not move the `HEAD` there. |
8021063 | hg addremove in git | 29 | 2011-11-05 15:11:40 | <p>I really need this command in git</p>
<pre><code>hg addremove
</code></pre>
<p>So now look at scenario and see how mercurial would save me in here:</p>
<p>I had some kind of dir in here var/htdocs/static/static. I accidentally moved files to wrong location (with git-mv). anyway... now I moved some folders around ... | 11,164 | 310,662 | 2018-01-29 09:02:54 | 8,032,772 | 27 | 2011-11-07 04:34:41 | 284,969 | 2011-11-07 07:53:54 | https://stackoverflow.com/q/8021063 | https://stackoverflow.com/a/8032772 | <p>Basically, git always automatically does something sort of like "addremove" when it applies a commit to update the working tree: it looks at added and removed files in the commit and detects pairs of added and removed files that are probably renames (using a "amount of change" heuristic). So you don't have to use ... | <p>Basically, git always automatically does something sort of like "addremove" when it applies a commit to update the working tree: it looks at added and removed files in the commit and detects pairs of added and removed files that are probably renames (using a "amount of change" heuristic). So you don't have to use ... | 119, 802 | git, mercurial | <h1>hg addremove in git</h1>
<p>I really need this command in git</p>
<pre><code>hg addremove
</code></pre>
<p>So now look at scenario and see how mercurial would save me in here:</p>
<p>I had some kind of dir in here var/htdocs/static/static. I accidentally moved files to wrong location (with git-mv). anyway... now... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,341 | git | # hg addremove in git
I really need this command in git
```
hg addremove
```
So now look at scenario and see how mercurial would save me in here:
I had some kind of dir in here var/htdocs/static/static. I accidentally moved files to wrong location (with git-mv). anyway... now I moved some folders around by hand:
`... | Basically, git always automatically does something sort of like "addremove" when it applies a commit to update the working tree: it looks at added and removed files in the commit and detects pairs of added and removed files that are probably renames (using a "amount of change" heuristic). So you don't have to use a spe... |
15796528 | Partial git apply | 28 | 2013-04-03 19:40:09 | <p>How can I get <code>git apply --index</code> to not abort completely just because a single hunk fails? I have a 100K+ patch with dozens of files deleted and added, it'd be a pain to do the <code>patch -p1</code>, <code>git add</code>, <code>git rm</code> dance manually.</p>
<p>Edit: <code>git apply --reject --inde... | 17,968 | 308,851 | 2020-02-26 09:09:24 | 27,281,070 | 27 | 2014-12-03 20:33:02 | 198,426 | 2014-12-03 20:33:02 | https://stackoverflow.com/q/15796528 | https://stackoverflow.com/a/27281070 | <p>Since git version 1.7.12, <a href="http://git-scm.com/docs/git-apply"><code>git apply</code> has a <code>--3way</code> (or <code>-3</code>) option</a> which will:</p>
<ol>
<li>Apply any changes it can figure out and stage them (i.e.: add them to the working tree and index),</li>
<li>Add any new files and stage them... | <p>Since git version 1.7.12, <a href="http://git-scm.com/docs/git-apply"><code>git apply</code> has a <code>--3way</code> (or <code>-3</code>) option</a> which will:</p> <ol> <li>Apply any changes it can figure out and stage them (i.e.: add them to the working tree and index),</li> <li>Add any new files and stage them... | 119 | git | <h1>Partial git apply</h1>
<p>How can I get <code>git apply --index</code> to not abort completely just because a single hunk fails? I have a 100K+ patch with dozens of files deleted and added, it'd be a pain to do the <code>patch -p1</code>, <code>git add</code>, <code>git rm</code> dance manually.</p>
<p>Edit: <cod... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,342 | git | # Partial git apply
How can I get `git apply --index` to not abort completely just because a single hunk fails? I have a 100K+ patch with dozens of files deleted and added, it'd be a pain to do the `patch -p1`, `git add`, `git rm` dance manually.
Edit: `git apply --reject --index` seems to do two thirds of the work: ... | Since git version 1.7.12, [`git apply` has a `--3way` (or `-3`) option](http://git-scm.com/docs/git-apply) which will:
1. Apply any changes it can figure out and stage them (i.e.: add them to the working tree and index),
2. Add any new files and stage them (i.e.: add them to the working tree and index), and,
3. When i... |
2089882 | Create branch from current working tree and reset to HEAD | 28 | 2010-01-18 23:08:18 | <p>I currently work on a feature that turns out to be bigger than expected, so it's probably the best to create a branch to work on it. So I need to create a new branch from my current working directory and reset the master branch to the current HEAD so that some fixes to the production environment can be done.</p>
<p>... | 19,377 | 223,852 | 2022-06-07 12:07:40 | 2,089,922 | 27 | 2010-01-18 23:16:31 | 129,404 | 2010-01-18 23:16:31 | https://stackoverflow.com/q/2089882 | https://stackoverflow.com/a/2089922 | <p>So, create a working branch:</p>
<pre><code>git checkout -b working_branch
</code></pre>
<p>either commit or stash your changes</p>
<pre><code>git add <files>
git commit -m "message"
</code></pre>
<p>OR</p>
<pre><code>git stash
</code></pre>
<p>Go back to master</p>
<pre><code>git checkout master
git re... | <p>So, create a working branch:</p> <pre><code>git checkout -b working_branch </code></pre> <p>either commit or stash your changes</p> <pre><code>git add <files> git commit -m "message" </code></pre> <p>OR</p> <pre><code>git stash </code></pre> <p>Go back to master</p> <pre><code>git checkout master git re... | 119, 1879 | branch, git | <h1>Create branch from current working tree and reset to HEAD</h1>
<p>I currently work on a feature that turns out to be bigger than expected, so it's probably the best to create a branch to work on it. So I need to create a new branch from my current working directory and reset the master branch to the current HEAD so... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,343 | git | # Create branch from current working tree and reset to HEAD
I currently work on a feature that turns out to be bigger than expected, so it's probably the best to create a branch to work on it. So I need to create a new branch from my current working directory and reset the master branch to the current HEAD so that som... | So, create a working branch:
```
git checkout -b working_branch
```
either commit or stash your changes
```
git add <files>
git commit -m "message"
```
OR
```
git stash
```
Go back to master
```
git checkout master
git reset HEAD
``` |
60969659 | How to add file to existing stash in git? | 27 | 2020-04-01 11:17:42 | <p>When I did <code>git stash push <path/to/file></code> it created <code>stash@{0}</code> for it.
Reusing the same command with different file creates another stash -> <code>stash@{1}</code>.
I have other files that logically belong to stash@{0}. </p>
<p>Can I somehow push file to existing stash?</p>
| 13,010 | 9,484,203 | 2020-04-01 11:47:05 | 60,970,089 | 27 | 2020-04-01 11:43:45 | 9,288,200 | 2020-04-01 11:43:45 | https://stackoverflow.com/q/60969659 | https://stackoverflow.com/a/60970089 | <p>If you mean akin to <code>git commit --amend</code>, I am afraid you are out of luck, but would it be acceptable for your use case, to:</p>
<p><code>git stash pop</code></p>
<p>and then</p>
<p><code>git stash push ORIGINAL_FILES MORE_FILES</code></p>
<p>to have the files grouped?</p>
| <p>If you mean akin to <code>git commit --amend</code>, I am afraid you are out of luck, but would it be acceptable for your use case, to:</p> <p><code>git stash pop</code></p> <p>and then</p> <p><code>git stash push ORIGINAL_FILES MORE_FILES</code></p> <p>to have the files grouped?</p> | 119, 13091 | git, git-stash | <h1>How to add file to existing stash in git?</h1>
<p>When I did <code>git stash push <path/to/file></code> it created <code>stash@{0}</code> for it.
Reusing the same command with different file creates another stash -> <code>stash@{1}</code>.
I have other files that logically belong to stash@{0}. </p>
<p>Can I ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,344 | git | # How to add file to existing stash in git?
When I did `git stash push <path/to/file>` it created `stash@{0}` for it.
Reusing the same command with different file creates another stash -> `stash@{1}`.
I have other files that logically belong to stash@{0}.
Can I somehow push file to existing stash? | If you mean akin to `git commit --amend`, I am afraid you are out of luck, but would it be acceptable for your use case, to:
`git stash pop`
and then
`git stash push ORIGINAL_FILES MORE_FILES`
to have the files grouped? |
55155550 | Control Freak: Commit rejected. Foxtrot merges not allowed in Bitbucket | 27 | 2019-03-14 05:31:48 | <p>What exactly is the reason for <code>Control Freak: Commit rejected. Foxtrot merges not allowed</code></p>
<p>We keep receiving this error quite often, is this is caused due to a combination of <code>pull</code>, <code>rebase</code> and <code>amend</code> by users while committing?</p>
<p>Need clarity to get rid o... | 46,695 | 4,057,790 | 2024-10-03 09:42:48 | 55,155,643 | 27 | 2019-03-14 05:40:47 | 6,309 | 2024-09-10 19:22:32 | https://stackoverflow.com/q/55155550 | https://stackoverflow.com/a/55155643 | <p>That is related to <a href="https://developer.atlassian.com/blog/2016/04/stop-foxtrots-now/" rel="nofollow noreferrer">Foxtrot merges</a>, specifcally prohibited on BitBucket:</p>
<blockquote>
<p>A foxtrot merge is a specific sequence of git commits. A particularly nefarious sequence. Out in the open, in lush open g... | <p>That is related to <a href="https://developer.atlassian.com/blog/2016/04/stop-foxtrots-now/" rel="nofollow noreferrer">Foxtrot merges</a>, specifcally prohibited on BitBucket:</p> <blockquote> <p>A foxtrot merge is a specific sequence of git commits. A particularly nefarious sequence. Out in the open, in lush open g... | 119, 8337, 28896 | bitbucket, git, git-pull | <h1>Control Freak: Commit rejected. Foxtrot merges not allowed in Bitbucket</h1>
<p>What exactly is the reason for <code>Control Freak: Commit rejected. Foxtrot merges not allowed</code></p>
<p>We keep receiving this error quite often, is this is caused due to a combination of <code>pull</code>, <code>rebase</code> an... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,345 | git | # Control Freak: Commit rejected. Foxtrot merges not allowed in Bitbucket
What exactly is the reason for `Control Freak: Commit rejected. Foxtrot merges not allowed`
We keep receiving this error quite often, is this is caused due to a combination of `pull`, `rebase` and `amend` by users while committing?
Need clarit... | That is related to [Foxtrot merges](https://developer.atlassian.com/blog/2016/04/stop-foxtrots-now/), specifcally prohibited on BitBucket:
> A foxtrot merge is a specific sequence of git commits. A particularly nefarious sequence. Out in the open, in lush open grasslands, the sequence looks like this:
[ useful. Or, if you already have each old snapshot in a directory, you might do something like this:
```
# Assumes the v* glob will sort in the right order
# (... |
6577695 | How do I move the contents of my master branch to a new Git branch? | 26 | 2011-07-05 03:18:15 | <p>I've been making some vast changes on the master branch of my Git repository. I'm pretty new to Git and so I'm wondering:</p>
<p>How can I move my current master branch to a new branch and recreate my master branch from scratch for a particular folder of files?</p>
<p>As an example, I have another folder, like <co... | 14,226 | 1,580,201 | 2014-08-03 19:41:58 | 6,577,702 | 27 | 2011-07-05 03:20:11 | 548,696 | 2011-07-05 10:15:39 | https://stackoverflow.com/q/6577695 | https://stackoverflow.com/a/6577702 | <p>Within the directory of the repository, in the command line type the following:</p>
<pre><code>git branch -m master old_master
git branch master
</code></pre>
<p>This should be enough :)</p>
| <p>Within the directory of the repository, in the command line type the following:</p> <pre><code>git branch -m master old_master git branch master </code></pre> <p>This should be enough :)</p> | 119 | git | <h1>How do I move the contents of my master branch to a new Git branch?</h1>
<p>I've been making some vast changes on the master branch of my Git repository. I'm pretty new to Git and so I'm wondering:</p>
<p>How can I move my current master branch to a new branch and recreate my master branch from scratch for a parti... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,349 | git | # How do I move the contents of my master branch to a new Git branch?
I've been making some vast changes on the master branch of my Git repository. I'm pretty new to Git and so I'm wondering:
How can I move my current master branch to a new branch and recreate my master branch from scratch for a particular folder of ... | Within the directory of the repository, in the command line type the following:
```
git branch -m master old_master
git branch master
```
This should be enough :) |
52179463 | How to exclude a specific git submodule from update? | 25 | 2018-09-05 07:29:29 | <p>I have list of submodules in .gitmodules.
I want to download a specific submodule i.e grpc only if there is some option enabled as true in config file.
Since grpc is not required at times for my build.
All submodules are in third-party directory.
So .gitmodules is like:</p>
<pre><code>[submodule "third-party/libzi... | 24,695 | 8,257,877 | 2018-09-06 16:03:45 | 52,185,169 | 27 | 2018-09-05 12:30:06 | 6,881,240 | 2018-09-06 16:03:45 | https://stackoverflow.com/q/52179463 | https://stackoverflow.com/a/52185169 | <p>From the git help:</p>
<blockquote>
<p>update</p>
<p>Update the registered submodules to match what the superproject expects by cloning missing submodules and updating the
working tree of the submodules.
The "updating" can be done in several ways depending on command line options and the value... | <p>From the git help:</p> <blockquote> <p>update</p> <p>Update the registered submodules to match what the superproject expects by cloning missing submodules and updating the working tree of the submodules. The "updating" can be done in several ways depending on command line options and the value... | 119, 456, 41612 | git, git-submodules, version-control | <h1>How to exclude a specific git submodule from update?</h1>
<p>I have list of submodules in .gitmodules.
I want to download a specific submodule i.e grpc only if there is some option enabled as true in config file.
Since grpc is not required at times for my build.
All submodules are in third-party directory.
So .git... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,350 | git | # How to exclude a specific git submodule from update?
I have list of submodules in .gitmodules.
I want to download a specific submodule i.e grpc only if there is some option enabled as true in config file.
Since grpc is not required at times for my build.
All submodules are in third-party directory.
So .gitmodules is... | From the git help:
> update
>
> Update the registered submodules to match what the superproject expects by cloning missing submodules and updating the
> working tree of the submodules.
> The "updating" can be done in several ways depending on command line options and the value of submodule..update
> configuration vari... |
12117957 | Global git file location linux | 25 | 2012-08-24 23:41:05 | <p>I am using a Centos
I am looking for my global git config file
Could anyone let me know where would I find the file?</p>
| 57,973 | null | 2014-04-17 13:41:41 | 12,118,155 | 27 | 2012-08-25 00:16:54 | 1,198,509 | 2012-08-25 00:16:54 | https://stackoverflow.com/q/12117957 | https://stackoverflow.com/a/12118155 | <p>Typing <code>man git config</code> has a section called FILES that lists the locations of all the system files. The global Git config file is in <code>~/.gitconfig</code>, but there's also a "system" config file, that's usually in <code>/etc/gitconfig</code>.</p>
| <p>Typing <code>man git config</code> has a section called FILES that lists the locations of all the system files. The global Git config file is in <code>~/.gitconfig</code>, but there's also a "system" config file, that's usually in <code>/etc/gitconfig</code>.</p> | 119, 4956 | centos, git | <h1>Global git file location linux</h1>
<p>I am using a Centos
I am looking for my global git config file
Could anyone let me know where would I find the file?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,351 | git | # Global git file location linux
I am using a Centos
I am looking for my global git config file
Could anyone let me know where would I find the file? | Typing `man git config` has a section called FILES that lists the locations of all the system files. The global Git config file is in `~/.gitconfig`, but there's also a "system" config file, that's usually in `/etc/gitconfig`. |
9087883 | Reading a Git commit message from PHP | 25 | 2012-01-31 22:21:02 | <p>I'm looking for a way to read a Git commit message with PHP. I suspect I need to use a Git hook, but I've never worked with them before, so I need a <em>push</em> in the right direction. Specifically, I'd like to implement the following process:</p>
<ul>
<li>A PHP script is executed automatically after every commit... | 13,260 | 13,281 | 2016-07-28 08:52:55 | 9,193,040 | 27 | 2012-02-08 12:09:06 | 761,202 | 2014-06-10 19:16:16 | https://stackoverflow.com/q/9087883 | https://stackoverflow.com/a/9193040 | <p>To get the commit hash, you can use</p>
<pre><code>git rev-parse --verify HEAD 2> /dev/null
</code></pre>
<p>From within php:</p>
<pre><code>exec('git rev-parse --verify HEAD 2> /dev/null', $output);
$hash = $output[0];
</code></pre>
<p>You can get the commit message, author and time (though - the time wil... | <p>To get the commit hash, you can use</p> <pre><code>git rev-parse --verify HEAD 2> /dev/null </code></pre> <p>From within php:</p> <pre><code>exec('git rev-parse --verify HEAD 2> /dev/null', $output); $hash = $output[0]; </code></pre> <p>You can get the commit message, author and time (though - the time wil... | 5, 119 | git, php | <h1>Reading a Git commit message from PHP</h1>
<p>I'm looking for a way to read a Git commit message with PHP. I suspect I need to use a Git hook, but I've never worked with them before, so I need a <em>push</em> in the right direction. Specifically, I'd like to implement the following process:</p>
<ul>
<li>A PHP scri... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,352 | git | # Reading a Git commit message from PHP
I'm looking for a way to read a Git commit message with PHP. I suspect I need to use a Git hook, but I've never worked with them before, so I need a *push* in the right direction. Specifically, I'd like to implement the following process:
- A PHP script is executed automaticall... | To get the commit hash, you can use
```
git rev-parse --verify HEAD 2> /dev/null
```
From within php:
```
exec('git rev-parse --verify HEAD 2> /dev/null', $output);
$hash = $output[0];
```
You can get the commit message, author and time (though - the time will simply be "now" if it's run as part of a post-commit ho... |
53533093 | Revert only a single file of a pushed commit | 24 | 2018-11-29 06:32:01 | <p>Below is the the pushed commits history.</p>
<pre><code>Commit Changed Files
Commit 1| (File a, File b, File c)
Commit 2| (File a, File b, File c)
Commit 3| (File a, File b, File c)
Commit 4| (File a, File b, File c)
Commit 5| (File a, File b, File c)
</code></pre>
<p>I want to revert the changes happened ... | 20,691 | 7,010,959 | 2023-02-17 16:30:19 | 53,544,830 | 27 | 2018-11-29 17:46:45 | 1,256,452 | 2018-11-29 17:52:13 | https://stackoverflow.com/q/53533093 | https://stackoverflow.com/a/53544830 | <p>In Git, each commit saves a <em>snapshot</em>—that is, the state of <em>every</em> file—rather than a set of changes.</p>
<p>However, every commit—well, <em>almost</em> every commit—also has a <em>parent</em> (previous) commit. If you ask Git, e.g., <em>what happened in commit <code>a123456</code>?</em>, what Git ... | <p>In Git, each commit saves a <em>snapshot</em>—that is, the state of <em>every</em> file—rather than a set of changes.</p> <p>However, every commit—well, <em>almost</em> every commit—also has a <em>parent</em> (previous) commit. If you ask Git, e.g., <em>what happened in commit <code>a123456</code>?</em>, what Git ... | 119, 456, 34403, 51381 | git, git-reset, git-revert, version-control | <h1>Revert only a single file of a pushed commit</h1>
<p>Below is the the pushed commits history.</p>
<pre><code>Commit Changed Files
Commit 1| (File a, File b, File c)
Commit 2| (File a, File b, File c)
Commit 3| (File a, File b, File c)
Commit 4| (File a, File b, File c)
Commit 5| (File a, File b, File c)
<... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,354 | git | # Revert only a single file of a pushed commit
Below is the the pushed commits history.
```
Commit Changed Files
Commit 1| (File a, File b, File c)
Commit 2| (File a, File b, File c)
Commit 3| (File a, File b, File c)
Commit 4| (File a, File b, File c)
Commit 5| (File a, File b, File c)
```
I want to rever... | In Git, each commit saves a *snapshot*—that is, the state of *every* file—rather than a set of changes.
However, every commit—well, *almost* every commit—also has a *parent* (previous) commit. If you ask Git, e.g., *what happened in commit `a123456`?*, what Git does is find the *parent* of `a123456`, extract *that* sn... |
26873622 | git log with line break when exported to text file | 24 | 2014-11-11 20:09:36 | <p>How do I add a line break for my custom git log?</p>
<pre><code>git log --pretty=tformat:"%ai %s" > log.log
</code></pre>
<p>I want a line break after <code>%s</code></p>
| 17,112 | 4,096,653 | 2021-11-30 19:25:53 | 26,873,732 | 27 | 2014-11-11 20:16:30 | 64,217 | 2014-11-11 20:16:30 | https://stackoverflow.com/q/26873622 | https://stackoverflow.com/a/26873732 | <p>You can use <code>%n</code> as a new line:</p>
<pre><code>git log --pretty=tformat:"%ai %s%n" > log.log
</code></pre>
| <p>You can use <code>%n</code> as a new line:</p> <pre><code>git log --pretty=tformat:"%ai %s%n" > log.log </code></pre> | 119, 9313 | git, line-breaks | <h1>git log with line break when exported to text file</h1>
<p>How do I add a line break for my custom git log?</p>
<pre><code>git log --pretty=tformat:"%ai %s" > log.log
</code></pre>
<p>I want a line break after <code>%s</code></p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,355 | git | # git log with line break when exported to text file
How do I add a line break for my custom git log?
```
git log --pretty=tformat:"%ai %s" > log.log
```
I want a line break after `%s` | You can use `%n` as a new line:
```
git log --pretty=tformat:"%ai %s%n" > log.log
``` |
19898557 | How to recover last commit after git hard reset? | 24 | 2013-11-11 03:55:17 | <p>Can I recover the following commit after a hard reset?</p>
<p>Steps:</p>
<pre><code>1) $ (master) // ....made a bunch of changes to files thinking I was working on a branch
2) $ git checkout -b 001-branch // copy changes to a branch to work with
3) $ (001-branch) // make some more changes to files
4) $ (001-branc... | 14,431 | 897,756 | 2013-11-11 04:04:23 | 19,898,634 | 27 | 2013-11-11 04:04:23 | 10,474 | 2013-11-11 04:04:23 | https://stackoverflow.com/q/19898557 | https://stackoverflow.com/a/19898634 | <p>To see all the changes made to your 001-branch, you can do <code>git reflog 001-branch</code>, however, chances are what you think you did in 001-branch maybe you did another branch, so you probably need to look into all the changes with <code>git reflog</code>.</p>
| <p>To see all the changes made to your 001-branch, you can do <code>git reflog 001-branch</code>, however, chances are what you think you did in 001-branch maybe you did another branch, so you probably need to look into all the changes with <code>git reflog</code>.</p> | 119 | git | <h1>How to recover last commit after git hard reset?</h1>
<p>Can I recover the following commit after a hard reset?</p>
<p>Steps:</p>
<pre><code>1) $ (master) // ....made a bunch of changes to files thinking I was working on a branch
2) $ git checkout -b 001-branch // copy changes to a branch to work with
3) $ (001-... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,356 | git | # How to recover last commit after git hard reset?
Can I recover the following commit after a hard reset?
Steps:
```
1) $ (master) // ....made a bunch of changes to files thinking I was working on a branch
2) $ git checkout -b 001-branch // copy changes to a branch to work with
3) $ (001-branch) // make some more c... | To see all the changes made to your 001-branch, you can do `git reflog 001-branch`, however, chances are what you think you did in 001-branch maybe you did another branch, so you probably need to look into all the changes with `git reflog`. |
11032661 | why does it say "Your branch is ahead of origin/master by 857 commits" when I need to *pull* origin master | 24 | 2012-06-14 12:03:34 | <p>Firstly, I'm aware of a number of similarly worded questions, eg: </p>
<ul>
<li><a href="https://stackoverflow.com/questions/277077/why-is-git-telling-me-your-branch-is-ahead-of-origin-master-by-11-commits-a">How can I find the location of origin/master in git, and how do I change it?</a></li>
<li><a href="https:/... | 24,850 | 202,168 | 2019-04-26 06:58:58 | 11,036,264 | 27 | 2012-06-14 15:19:49 | 877,115 | 2012-06-14 15:19:49 | https://stackoverflow.com/q/11032661 | https://stackoverflow.com/a/11036264 | <p>You are over thinking this. The message isn't saying the remote is behind. It's saying your local repository's recorded commit for 'origin/master' is. At no point in generating that message did git communicate with a remote. It simply looked into the .git directory, and returned the contents of <code>.git/refs/remot... | <p>You are over thinking this. The message isn't saying the remote is behind. It's saying your local repository's recorded commit for 'origin/master' is. At no point in generating that message did git communicate with a remote. It simply looked into the .git directory, and returned the contents of <code>.git/refs/remot... | 119 | git | <h1>why does it say "Your branch is ahead of origin/master by 857 commits" when I need to *pull* origin master</h1>
<p>Firstly, I'm aware of a number of similarly worded questions, eg: </p>
<ul>
<li><a href="https://stackoverflow.com/questions/277077/why-is-git-telling-me-your-branch-is-ahead-of-origin-master-by-11-c... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,357 | git | # why does it say "Your branch is ahead of origin/master by 857 commits" when I need to *pull* origin master
Firstly, I'm aware of a number of similarly worded questions, eg:
- [How can I find the location of origin/master in git, and how do I change it?](https://stackoverflow.com/questions/277077/why-is-git-telling-... | You are over thinking this. The message isn't saying the remote is behind. It's saying your local repository's recorded commit for 'origin/master' is. At no point in generating that message did git communicate with a remote. It simply looked into the .git directory, and returned the contents of `.git/refs/remotes/origi... |
7423893 | git alias for HEAD:refs/for/master | 24 | 2011-09-14 22:46:24 | <p>I am configuring <code>Gerrit</code> and I would like to avoid writing:</p>
<pre><code>git push gerrit HEAD:refs/for/master
</code></pre>
<p>I would like to write:</p>
<pre><code>git push review
</code></pre>
<p>I am sure it's possible modifying <code>.git/config</code> but I can't make it work.</p>
| 20,647 | 119,895 | 2017-04-25 09:25:03 | 8,703,295 | 27 | 2012-01-02 16:50:52 | 1,126,536 | 2012-11-23 14:23:08 | https://stackoverflow.com/q/7423893 | https://stackoverflow.com/a/8703295 | <p>I set up two different push types, review and noreview:</p>
<p>for reviews:</p>
<pre><code>git config remote.review.pushurl ssh://<GERRIT_HOST>:29418/<PROJECT_PATH>.git
git config remote.review.push refs/heads/*:refs/for/*
git push review # this will push your current branch up for review
</code></pre>... | <p>I set up two different push types, review and noreview:</p> <p>for reviews:</p> <pre><code>git config remote.review.pushurl ssh://<GERRIT_HOST>:29418/<PROJECT_PATH>.git git config remote.review.push refs/heads/*:refs/for/* git push review # this will push your current branch up for review </code></pre>... | 119, 52272 | gerrit, git | <h1>git alias for HEAD:refs/for/master</h1>
<p>I am configuring <code>Gerrit</code> and I would like to avoid writing:</p>
<pre><code>git push gerrit HEAD:refs/for/master
</code></pre>
<p>I would like to write:</p>
<pre><code>git push review
</code></pre>
<p>I am sure it's possible modifying <code>.git/config</code... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,358 | git | # git alias for HEAD:refs/for/master
I am configuring `Gerrit` and I would like to avoid writing:
```
git push gerrit HEAD:refs/for/master
```
I would like to write:
```
git push review
```
I am sure it's possible modifying `.git/config` but I can't make it work. | I set up two different push types, review and noreview:
for reviews:
```
git config remote.review.pushurl ssh://<GERRIT_HOST>:29418/<PROJECT_PATH>.git
git config remote.review.push refs/heads/*:refs/for/*
git push review # this will push your current branch up for review
```
to bypass review:
```
git config remote.... |
3575712 | What to do if git-am fails with "does not match index"? | 24 | 2010-08-26 13:49:06 | <p>I'm trying to apply a git patch created by someone else with <code>git-format-patch</code>. The patch was made against one commit behind HEAD, but as I understand it this shouldn't matter. When I run <code>git am 0001.patch</code>, I get the error:</p>
<p><code>error: source.c: does not match index</code></p>
<p>I... | 38,467 | 403,491 | 2024-09-25 15:11:17 | 3,578,262 | 27 | 2010-08-26 18:28:25 | 6,309 | 2010-08-26 20:22:49 | https://stackoverflow.com/q/3575712 | https://stackoverflow.com/a/3578262 | <p>From <a href="http://gitster.livejournal.com/29060.html" rel="noreferrer">J.C. Hamano (Git maintainer) himself</a>, this is about:</p>
<blockquote>
<p>patch applications and merges in a dirty work tree with a clean index.</p>
<ul>
<li>A <strong>dirty work tree</strong> is where you have changes that are no... | <p>From <a href="http://gitster.livejournal.com/29060.html" rel="noreferrer">J.C. Hamano (Git maintainer) himself</a>, this is about:</p> <blockquote> <p>patch applications and merges in a dirty work tree with a clean index.</p> <ul> <li>A <strong>dirty work tree</strong> is where you have changes that are no... | 119, 2132 | git, patch | <h1>What to do if git-am fails with "does not match index"?</h1>
<p>I'm trying to apply a git patch created by someone else with <code>git-format-patch</code>. The patch was made against one commit behind HEAD, but as I understand it this shouldn't matter. When I run <code>git am 0001.patch</code>, I get the error:</p>... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,359 | git | # What to do if git-am fails with "does not match index"?
I'm trying to apply a git patch created by someone else with `git-format-patch`. The patch was made against one commit behind HEAD, but as I understand it this shouldn't matter. When I run `git am 0001.patch`, I get the error:
`error: source.c: does not match ... | From [J.C. Hamano (Git maintainer) himself](http://gitster.livejournal.com/29060.html), this is about:
> patch applications and merges in a dirty work tree with a clean index.
>
> - A **dirty work tree** is where you have changes that are not added to the index.
> A work tree that is not dirty is a clean work tree... |
677393 | Tracking 3rd party code with Git | 24 | 2009-03-24 13:28:04 | <p>I can't seem to grok the different solutions I've found and studied
for tracking external code. Let alone understand how to apply them to
my use case...</p>
<p>Would you guys be so kind to shed some light on this and help me with
my specific use case? What would be the best solution for the
following, concrete prob... | 11,524 | 82,011 | 2013-08-26 21:08:00 | 679,346 | 27 | 2009-03-24 21:35:15 | 12,089 | 2009-03-24 22:03:44 | https://stackoverflow.com/q/677393 | https://stackoverflow.com/a/679346 | <p>There are two separate problems here:</p>
<ol>
<li>How do you maintain local forks of remote projects, and</li>
<li>How do you keep a copy of remote projects in your own tree?</li>
</ol>
<p>Problem 1 is pretty easy by itself. Just do something like:</p>
<pre><code>git clone git://example.com/foo.git
cd foo
git r... | <p>There are two separate problems here:</p> <ol> <li>How do you maintain local forks of remote projects, and</li> <li>How do you keep a copy of remote projects in your own tree?</li> </ol> <p>Problem 1 is pretty easy by itself. Just do something like:</p> <pre><code>git clone git://example.com/foo.git cd foo git r... | 119 | git | <h1>Tracking 3rd party code with Git</h1>
<p>I can't seem to grok the different solutions I've found and studied
for tracking external code. Let alone understand how to apply them to
my use case...</p>
<p>Would you guys be so kind to shed some light on this and help me with
my specific use case? What would be the best... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,360 | git | # Tracking 3rd party code with Git
I can't seem to grok the different solutions I've found and studied
for tracking external code. Let alone understand how to apply them to
my use case...
Would you guys be so kind to shed some light on this and help me with
my specific use case? What would be the best solution for th... | There are two separate problems here:
1. How do you maintain local forks of remote projects, and
2. How do you keep a copy of remote projects in your own tree?
Problem 1 is pretty easy by itself. Just do something like:
```
git clone git://example.com/foo.git
cd foo
git remote add upstream git://example.com/foo.git
... |
19698352 | can't clone git repos via http; info/refs not found | 23 | 2013-10-31 04:17:14 | <p>I am trying to make a git repository available for read-only access over http. </p>
<p>I am doing it the old-style way because <code>git-http-backend</code> is not available on my host system. That is, I am simply putting the bare repository in a http accessible location.</p>
<p>I created the bare repository suc... | 20,203 | 2,918,239 | 2017-05-10 06:27:00 | 19,707,416 | 27 | 2013-10-31 13:09:32 | 216,074 | 2013-10-31 13:09:32 | https://stackoverflow.com/q/19698352 | https://stackoverflow.com/a/19707416 | <p>You will need to run <a href="http://git-scm.com/docs/git-update-server-info.html"><code>git update-server-info</code></a> on the server to generate the files necessary for the “dumb protocol” to work.</p>
| <p>You will need to run <a href="http://git-scm.com/docs/git-update-server-info.html"><code>git update-server-info</code></a> on the server to generate the files necessary for the “dumb protocol” to work.</p> | 119, 3050, 5210, 7330, 64465 | clone, git, git-bare, http, repository | <h1>can't clone git repos via http; info/refs not found</h1>
<p>I am trying to make a git repository available for read-only access over http. </p>
<p>I am doing it the old-style way because <code>git-http-backend</code> is not available on my host system. That is, I am simply putting the bare repository in a http a... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,362 | git | # can't clone git repos via http; info/refs not found
I am trying to make a git repository available for read-only access over http.
I am doing it the old-style way because `git-http-backend` is not available on my host system. That is, I am simply putting the bare repository in a http accessible location.
I created... | You will need to run [`git update-server-info`](http://git-scm.com/docs/git-update-server-info.html) on the server to generate the files necessary for the “dumb protocol” to work. |
7587257 | Blame on an earlier version of a file in a different location | 23 | 2011-09-28 17:37:44 | <p>At one point my git repository had its paths reorganized.</p>
<p>I often want to do a blame on a file at a revision before the move.</p>
<p>What's the git blame incantation to blame a file that doesn't exist in the current repository?</p>
<p>I tried:</p>
<pre><code>> git blame new/path/to/file old_rev
fatal: ... | 6,548 | 124,497 | 2011-09-28 17:57:27 | 7,587,439 | 27 | 2011-09-28 17:57:27 | 112,968 | 2011-09-28 17:57:27 | https://stackoverflow.com/q/7587257 | https://stackoverflow.com/a/7587439 | <p>You can use <code>git blame --follow</code> to make blame follow your renames.</p>
<p>I also see your parameters are in the wrong order, try the following:</p>
<pre><code>git blame old_rev -- old/path/to/file
</code></pre>
| <p>You can use <code>git blame --follow</code> to make blame follow your renames.</p> <p>I also see your parameters are in the wrong order, try the following:</p> <pre><code>git blame old_rev -- old/path/to/file </code></pre> | 119, 21455 | blame, git | <h1>Blame on an earlier version of a file in a different location</h1>
<p>At one point my git repository had its paths reorganized.</p>
<p>I often want to do a blame on a file at a revision before the move.</p>
<p>What's the git blame incantation to blame a file that doesn't exist in the current repository?</p>
<p>I... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,363 | git | # Blame on an earlier version of a file in a different location
At one point my git repository had its paths reorganized.
I often want to do a blame on a file at a revision before the move.
What's the git blame incantation to blame a file that doesn't exist in the current repository?
I tried:
```
> git blame new/p... | You can use `git blame --follow` to make blame follow your renames.
I also see your parameters are in the wrong order, try the following:
```
git blame old_rev -- old/path/to/file
``` |
5574195 | Make git highlight tab characters in a diff? | 23 | 2011-04-06 23:31:09 | <p>I'm trying to ensure that I don't commit code that uses tab characters for indentation. This is a soft constraint that I'm applying to my own commits (right now we don't have a standard for indentation characters, but I'd like to use spaces, since there's no disagreement on the width of a space, but some people use ... | 13,062 | 329,781 | 2017-07-16 15:08:47 | 5,578,165 | 27 | 2011-04-07 08:32:34 | 193,688 | 2011-04-07 08:37:42 | https://stackoverflow.com/q/5574195 | https://stackoverflow.com/a/5578165 | <p>Git learned the <code>tab-in-indent</code> whitespace category in 1.7.2 (2010 July 21).<br>
From <a href="http://www.kernel.org/pub/software/scm/git/docs/RelNotes/1.7.2.txt" rel="noreferrer">Documentation/RelNotes/1.7.2.txt</a>:</p>
<blockquote>
<ul>
<li>The whitespace rules used in "git apply --whitespace" and... | <p>Git learned the <code>tab-in-indent</code> whitespace category in 1.7.2 (2010 July 21).<br> From <a href="http://www.kernel.org/pub/software/scm/git/docs/RelNotes/1.7.2.txt" rel="noreferrer">Documentation/RelNotes/1.7.2.txt</a>:</p> <blockquote> <ul> <li>The whitespace rules used in "git apply --whitespace" and... | 119, 9033 | git, git-diff | <h1>Make git highlight tab characters in a diff?</h1>
<p>I'm trying to ensure that I don't commit code that uses tab characters for indentation. This is a soft constraint that I'm applying to my own commits (right now we don't have a standard for indentation characters, but I'd like to use spaces, since there's no disa... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,364 | git | # Make git highlight tab characters in a diff?
I'm trying to ensure that I don't commit code that uses tab characters for indentation. This is a soft constraint that I'm applying to my own commits (right now we don't have a standard for indentation characters, but I'd like to use spaces, since there's no disagreement ... | Git learned the `tab-in-indent` whitespace category in 1.7.2 (2010 July 21).
From [Documentation/RelNotes/1.7.2.txt](http://www.kernel.org/pub/software/scm/git/docs/RelNotes/1.7.2.txt):
> - The whitespace rules used in "git apply --whitespace" and "git diff"
> gained a new member in the family (tab-in-indent) to h... |
3313561 | What are the limitations of Git on Windows? | 23 | 2010-07-22 21:14:20 | <p>Everywhere I read about Mercurial and Git they generally throw in a line or two which implies Git has limited ability on Windows (because of some Shell scrips cannot be ported, etc.) but I've never come across some page which explicitly mentions them. And most pages are a tad old.</p>
<p>What are the limitations of... | 9,039 | 399,268 | 2016-03-25 06:49:15 | 3,313,897 | 27 | 2010-07-22 22:08:34 | 170,656 | 2016-03-25 06:49:15 | https://stackoverflow.com/q/3313561 | https://stackoverflow.com/a/3313897 | <p><em>EDIT: So it's 2016, six years on from when I wrote the original answer below. I've used git and mercurial heavily for several years now, and I've been developing on a mac for several years too. I've become very familiar and comfortable with git usage on the command line, but for day-to-day work I use SourceTree ... | <p><em>EDIT: So it's 2016, six years on from when I wrote the original answer below. I've used git and mercurial heavily for several years now, and I've been developing on a mac for several years too. I've become very familiar and comfortable with git usage on the command line, but for day-to-day work I use SourceTree ... | 119, 456, 21628 | git, msysgit, version-control | <h1>What are the limitations of Git on Windows?</h1>
<p>Everywhere I read about Mercurial and Git they generally throw in a line or two which implies Git has limited ability on Windows (because of some Shell scrips cannot be ported, etc.) but I've never come across some page which explicitly mentions them. And most pag... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,367 | git | # What are the limitations of Git on Windows?
Everywhere I read about Mercurial and Git they generally throw in a line or two which implies Git has limited ability on Windows (because of some Shell scrips cannot be ported, etc.) but I've never come across some page which explicitly mentions them. And most pages are a ... | *EDIT: So it's 2016, six years on from when I wrote the original answer below. I've used git and mercurial heavily for several years now, and I've been developing on a mac for several years too. I've become very familiar and comfortable with git usage on the command line, but for day-to-day work I use SourceTree from A... |
32116776 | git, change on local branch affects other local branches? | 22 | 2015-08-20 11:15:45 | <p>I have a master branch</p>
<p>now for some testing other things I made a branch A</p>
<p>I checkout branch A modify the file and when I checkout master again the changes are there as well.</p>
<p>On other repositories I have the right behaviour</p>
| 10,999 | 2,071,938 | 2021-01-06 06:13:39 | 32,117,039 | 27 | 2015-08-20 11:28:32 | 585,675 | 2016-08-16 15:26:38 | https://stackoverflow.com/q/32116776 | https://stackoverflow.com/a/32117039 | <p>Uncommitted changes will move from one branch to other. To keep them separated, you must <code>stash</code> those changes before moving to another branch. When you return to your branch, you can <code>apply</code> those changes to retrieve them. </p>
<p>As seen below:</p>
<pre><code>>$ git status
On branch bran... | <p>Uncommitted changes will move from one branch to other. To keep them separated, you must <code>stash</code> those changes before moving to another branch. When you return to your branch, you can <code>apply</code> those changes to retrieve them. </p> <p>As seen below:</p> <pre><code>>$ git status On branch bran... | 119, 76220 | git, git-branch | <h1>git, change on local branch affects other local branches?</h1>
<p>I have a master branch</p>
<p>now for some testing other things I made a branch A</p>
<p>I checkout branch A modify the file and when I checkout master again the changes are there as well.</p>
<p>On other repositories I have the right behaviour</p... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,368 | git | # git, change on local branch affects other local branches?
I have a master branch
now for some testing other things I made a branch A
I checkout branch A modify the file and when I checkout master again the changes are there as well.
On other repositories I have the right behaviour | Uncommitted changes will move from one branch to other. To keep them separated, you must `stash` those changes before moving to another branch. When you return to your branch, you can `apply` those changes to retrieve them.
As seen below:
```
>$ git status
On branch branch_1
Your branch is up-to-date with 'origin/bra... |
12798767 | fast forward when using pull and no-ff when merging branch | 22 | 2012-10-09 11:10:45 | <p>I have many short-lived branches in my workflow and I would like them to be separated. So, I plan to use <code>git config --add merge.ff false</code>. However, when I am doing a pull (which I understand is fetch+merge) - then I want a fast-forward behavior, to avoid unnecessary extra commit here. </p>
<p>Is this a ... | 40,635 | 408,358 | 2017-10-12 08:13:14 | 12,798,995 | 27 | 2012-10-09 11:24:40 | 6,309 | 2014-03-12 14:20:44 | https://stackoverflow.com/q/12798767 | https://stackoverflow.com/a/12798995 | <p>Note: Git 2.0 (Q2 2014) will introduce with <a href="https://github.com/git/git/commit/b814da891e8261b909fc5d9fb07b4e8b13989c2d" rel="noreferrer">commit b814da8</a> a config <code>push.ff</code>:</p>
<pre><code>pull.ff::
</code></pre>
<blockquote>
<p>By default, Git does not create an extra merge commit when mer... | <p>Note: Git 2.0 (Q2 2014) will introduce with <a href="https://github.com/git/git/commit/b814da891e8261b909fc5d9fb07b4e8b13989c2d" rel="noreferrer">commit b814da8</a> a config <code>push.ff</code>:</p> <pre><code>pull.ff:: </code></pre> <blockquote> <p>By default, Git does not create an extra merge commit when mer... | 119 | git | <h1>fast forward when using pull and no-ff when merging branch</h1>
<p>I have many short-lived branches in my workflow and I would like them to be separated. So, I plan to use <code>git config --add merge.ff false</code>. However, when I am doing a pull (which I understand is fetch+merge) - then I want a fast-forward b... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 19,369 | git | # fast forward when using pull and no-ff when merging branch
I have many short-lived branches in my workflow and I would like them to be separated. So, I plan to use `git config --add merge.ff false`. However, when I am doing a pull (which I understand is fetch+merge) - then I want a fast-forward behavior, to avoid un... | Note: Git 2.0 (Q2 2014) will introduce with [commit b814da8](https://github.com/git/git/commit/b814da891e8261b909fc5d9fb07b4e8b13989c2d) a config `push.ff`:
```
pull.ff::
```
> By default, Git does not create an extra merge commit when merging a commit that is a descendant of the current commit. Instead, the tip of t... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.