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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
4994772 | Ways to improve git status performance | 105 | 2011-02-14 16:49:04 | <p>I have a repo of 10 GB on a Linux machine which is on NFS. The first time <code>git status</code> takes 36 minutes and subsequent <code>git status</code> takes 8 minutes. Seems Git depends on the OS for caching files. Only the first <code>git</code> commands like <code>commit</code>, <code>status</code> that involve... | 98,223 | 289,715 | 2025-01-30 20:40:50 | 4,995,189 | 54 | 2011-02-14 17:27:46 | 19,750 | 2023-06-29 22:13:40 | https://stackoverflow.com/q/4994772 | https://stackoverflow.com/a/4995189 | <p>To be more precise, git depends on the efficiency of the <code>lstat(2)</code> system call, so tweaking your client’s <a href="https://serverfault.com/questions/127615/how-does-nfs-read-cache-work-on-debian">“attribute cache timeout”</a> might do the trick.</p>
<p>The manual for <code>git-update-index</code> — essen... | <p>To be more precise, git depends on the efficiency of the <code>lstat(2)</code> system call, so tweaking your client’s <a href="https://serverfault.com/questions/127615/how-does-nfs-read-cache-work-on-debian">“attribute cache timeout”</a> might do the trick.</p> <p>The manual for <code>git-update-index</code> — essen... | 119, 598, 3014 | git, nfs, performance | <h1>Ways to improve git status performance</h1>
<p>I have a repo of 10 GB on a Linux machine which is on NFS. The first time <code>git status</code> takes 36 minutes and subsequent <code>git status</code> takes 8 minutes. Seems Git depends on the OS for caching files. Only the first <code>git</code> commands like <code... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,217 | git | # Ways to improve git status performance
I have a repo of 10 GB on a Linux machine which is on NFS. The first time `git status` takes 36 minutes and subsequent `git status` takes 8 minutes. Seems Git depends on the OS for caching files. Only the first `git` commands like `commit`, `status` that involves pack/repack th... | To be more precise, git depends on the efficiency of the `lstat(2)` system call, so tweaking your client’s [“attribute cache timeout”](https://serverfault.com/questions/127615/how-does-nfs-read-cache-work-on-debian) might do the trick.
The manual for `git-update-index` — essentially a manual mode for `git-status` — de... |
7031729 | Publish to S3 using Git? | 101 | 2011-08-11 19:32:05 | <p>Does anyone know how to do this? So far I haven't been able to find anything useful via Google.</p>
<p>I'd really like to setup a local repo and use <code>git push</code> to publish it to S3, the idea being to have local version control over assets but remote storage on S3.</p>
<p>Can this be done, and if so, how?... | 65,592 | 417,872 | 2025-04-24 22:46:38 | 8,046,693 | 54 | 2011-11-08 06:24:49 | 398,820 | 2016-11-18 04:44:43 | https://stackoverflow.com/q/7031729 | https://stackoverflow.com/a/8046693 | <p>1 <strong>Use JGit</strong> via <a href="http://blog.spearce.org/2008/07/using-jgit-to-publish-on-amazon-s3.html" rel="noreferrer">http://blog.spearce.org/2008/07/using-jgit-to-publish-on-amazon-s3.html</a></p>
<p>Download jgit.sh, rename it to jgit and put it in your path (for example $HOME/bin).</p>
<p>Setup th... | <p>1 <strong>Use JGit</strong> via <a href="http://blog.spearce.org/2008/07/using-jgit-to-publish-on-amazon-s3.html" rel="noreferrer">http://blog.spearce.org/2008/07/using-jgit-to-publish-on-amazon-s3.html</a></p> <p>Download jgit.sh, rename it to jgit and put it in your path (for example $HOME/bin).</p> <p>Setup th... | 119, 11444 | amazon-s3, git | <h1>Publish to S3 using Git?</h1>
<p>Does anyone know how to do this? So far I haven't been able to find anything useful via Google.</p>
<p>I'd really like to setup a local repo and use <code>git push</code> to publish it to S3, the idea being to have local version control over assets but remote storage on S3.</p>
<p... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,218 | git | # Publish to S3 using Git?
Does anyone know how to do this? So far I haven't been able to find anything useful via Google.
I'd really like to setup a local repo and use `git push` to publish it to S3, the idea being to have local version control over assets but remote storage on S3.
Can this be done, and if so, how? | 1 **Use JGit** via <http://blog.spearce.org/2008/07/using-jgit-to-publish-on-amazon-s3.html>
Download jgit.sh, rename it to jgit and put it in your path (for example $HOME/bin).
Setup the .jgit config file and add the following (substituting your AWS keys):
$vim ~/.jgit
```
accesskey: aws access key
secretkey: aws ... |
33388210 | How to reorder last two commits in git? | 93 | 2015-10-28 10:11:17 | <p>I want to reorder last two commits in git:</p>
<p>I have:</p>
<pre><code>$ git log --oneline -3
1e0ecba (HEAD, my-branch) Fix for T255
82d45dc django_extensions
af3953b improvements according to CR
</code></pre>
<p>I want:</p>
<pre><code>$ git log --oneline -3
82d45dc (HEAD, my-branch) django_extensions
1e0ecba Fix ... | 55,252 | 338,581 | 2025-11-11 23:00:29 | 33,388,211 | 54 | 2015-10-28 10:11:17 | 338,581 | 2015-10-28 10:11:17 | https://stackoverflow.com/q/33388210 | https://stackoverflow.com/a/33388211 | <p>In general you have to use <code>git rebase --interactive</code> - here is detail answer <a href="https://stackoverflow.com/questions/2740537/reordering-of-commits">how to reorder any number of commits</a>:</p>
<p>But if you want to reorder <strong>last two commits</strong> you can use this git alias:</p>
<p>Add t... | <p>In general you have to use <code>git rebase --interactive</code> - here is detail answer <a href="https://stackoverflow.com/questions/2740537/reordering-of-commits">how to reorder any number of commits</a>:</p> <p>But if you want to reorder <strong>last two commits</strong> you can use this git alias:</p> <p>Add t... | 119 | git | <h1>How to reorder last two commits in git?</h1>
<p>I want to reorder last two commits in git:</p>
<p>I have:</p>
<pre><code>$ git log --oneline -3
1e0ecba (HEAD, my-branch) Fix for T255
82d45dc django_extensions
af3953b improvements according to CR
</code></pre>
<p>I want:</p>
<pre><code>$ git log --oneline -3
82d45dc... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,219 | git | # How to reorder last two commits in git?
I want to reorder last two commits in git:
I have:
```
$ git log --oneline -3
1e0ecba (HEAD, my-branch) Fix for T255
82d45dc django_extensions
af3953b improvements according to CR
```
I want:
```
$ git log --oneline -3
82d45dc (HEAD, my-branch) django_extensions
1e0ecba Fi... | In general you have to use `git rebase --interactive` - here is detail answer [how to reorder any number of commits](https://stackoverflow.com/questions/2740537/reordering-of-commits):
But if you want to reorder **last two commits** you can use this git alias:
Add to `~/.gitconfig`:
```
[alias]
reorder = "!GIT_S... |
9665399 | How do I ignore all files in a folder with a Git repository in Sourcetree? | 91 | 2012-03-12 10:30:29 | <p>I have a Bitbucket Git repository managed with Sourcetree.</p>
<p>I have two folders that I want to commit, but I need to ignore all the files in these folders, because they contain only temporary files.</p>
<p>How can I do that?</p>
| 188,733 | 271,804 | 2021-09-15 20:57:41 | 9,665,438 | 54 | 2012-03-12 10:32:49 | 775,443 | 2012-03-12 10:32:49 | https://stackoverflow.com/q/9665399 | https://stackoverflow.com/a/9665438 | <p>Add this to .gitignore:</p>
<pre><code>*
!.gitignore
</code></pre>
| <p>Add this to .gitignore:</p> <pre><code>* !.gitignore </code></pre> | 119, 25056, 90056 | atlassian-sourcetree, git, gitignore | <h1>How do I ignore all files in a folder with a Git repository in Sourcetree?</h1>
<p>I have a Bitbucket Git repository managed with Sourcetree.</p>
<p>I have two folders that I want to commit, but I need to ignore all the files in these folders, because they contain only temporary files.</p>
<p>How can I do that?</... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,220 | git | # How do I ignore all files in a folder with a Git repository in Sourcetree?
I have a Bitbucket Git repository managed with Sourcetree.
I have two folders that I want to commit, but I need to ignore all the files in these folders, because they contain only temporary files.
How can I do that? | Add this to .gitignore:
```
*
!.gitignore
``` |
42417294 | Why does git fail to fetch specific valid submodule for a given commit and how to fix it? | 90 | 2017-02-23 13:36:06 | <p>I have a <code>git</code> repo which has another one as a <code>submodule</code> dependency. In the root of my project (where the <code>.git</code>, <code>.gitsubmodules</code> etc. are) I called</p>
<pre><code>git submodule update
</code></pre>
<p>This failed with the following message:</p>
<blockquote>
<p>Fetched ... | 116,289 | 1,559,401 | 2023-06-13 16:48:59 | 42,425,599 | 54 | 2017-02-23 20:29:53 | 6,309 | 2021-09-08 09:31:03 | https://stackoverflow.com/q/42417294 | https://stackoverflow.com/a/42425599 | <blockquote>
<p>Yes, I can follow the link in my web browser (using GitLab)</p>
</blockquote>
<p>Can you clone that repo though, with that commit included?<br />
GitLab has <a href="https://docs.gitlab.com/ee/user/permissions.html" rel="noreferrer">permission level</a> which will restrict access, so make sure your git ... | <blockquote> <p>Yes, I can follow the link in my web browser (using GitLab)</p> </blockquote> <p>Can you clone that repo though, with that commit included?<br /> GitLab has <a href="https://docs.gitlab.com/ee/user/permissions.html" rel="noreferrer">permission level</a> which will restrict access, so make sure your git ... | 119, 41612, 53850 | git, git-commit, git-submodules | <h1>Why does git fail to fetch specific valid submodule for a given commit and how to fix it?</h1>
<p>I have a <code>git</code> repo which has another one as a <code>submodule</code> dependency. In the root of my project (where the <code>.git</code>, <code>.gitsubmodules</code> etc. are) I called</p>
<pre><code>git sub... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,221 | git | # Why does git fail to fetch specific valid submodule for a given commit and how to fix it?
I have a `git` repo which has another one as a `submodule` dependency. In the root of my project (where the `.git`, `.gitsubmodules` etc. are) I called
```
git submodule update
```
This failed with the following message:
> F... | > Yes, I can follow the link in my web browser (using GitLab)
Can you clone that repo though, with that commit included?
GitLab has [permission level](https://docs.gitlab.com/ee/user/permissions.html) which will restrict access, so make sure your git clone commands are executed with the right user, and with the ssh ... |
2213235 | Undoing a git pull --rebase | 75 | 2010-02-06 13:28:54 | <p>Hey I'm new to git and I need to undo a pull, can anyone help?!? So what I've done is...</p>
<ol>
<li>git commit</li>
<li>git stash</li>
<li>git pull --rebase</li>
<li>git stash pop</li>
</ol>
<p>this created a bunch of conflicts and went a bit wrong. Now doing 'git stash list' reveals that my stash is still there... | 66,363 | 267,730 | 2024-05-25 22:08:00 | 2,213,281 | 54 | 2010-02-06 13:43:12 | 112,968 | 2010-02-06 13:43:12 | https://stackoverflow.com/q/2213235 | https://stackoverflow.com/a/2213281 | <p>using <code>git reflog</code> you will see a list of commits HEAD pointed to in the past</p>
<p>using</p>
<pre><code>git checkout -b after-commit HEAD@{1} # or the commit you want to recover
</code></pre>
<p>you create a new branch at that precise position and check it out</p>
| <p>using <code>git reflog</code> you will see a list of commits HEAD pointed to in the past</p> <p>using</p> <pre><code>git checkout -b after-commit HEAD@{1} # or the commit you want to recover </code></pre> <p>you create a new branch at that precise position and check it out</p> | 119, 13091, 28896, 29934, 34403 | git, git-pull, git-rebase, git-revert, git-stash | <h1>Undoing a git pull --rebase</h1>
<p>Hey I'm new to git and I need to undo a pull, can anyone help?!? So what I've done is...</p>
<ol>
<li>git commit</li>
<li>git stash</li>
<li>git pull --rebase</li>
<li>git stash pop</li>
</ol>
<p>this created a bunch of conflicts and went a bit wrong. Now doing 'git stash list'... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,222 | git | # Undoing a git pull --rebase
Hey I'm new to git and I need to undo a pull, can anyone help?!? So what I've done is...
1. git commit
2. git stash
3. git pull --rebase
4. git stash pop
this created a bunch of conflicts and went a bit wrong. Now doing 'git stash list' reveals that my stash is still there. Is it possib... | using `git reflog` you will see a list of commits HEAD pointed to in the past
using
```
git checkout -b after-commit HEAD@{1} # or the commit you want to recover
```
you create a new branch at that precise position and check it out |
1624705 | How can I merge many commits, but leave one out? | 75 | 2009-10-26 13:13:43 | <p>Suppose I have this feature branch "foo". Now I want to merge it back into master, but I've added some debugging code that I don't want in master. </p>
<p>The debug code is in it's own commit, so I could use <code>git cherry-pick</code> on each commit and leave out this commit. But that's gonna be quite tiresome. <... | 39,460 | 35,189 | 2017-05-09 11:19:46 | 1,624,723 | 54 | 2009-10-26 13:16:39 | 196,279 | 2009-10-26 13:16:39 | https://stackoverflow.com/q/1624705 | https://stackoverflow.com/a/1624723 | <p>Use interactive rebase:</p>
<pre><code>git rebase -i SHA-OF-FIRST-COMMIT-IN-BRANCH
</code></pre>
<p>That will open something like this in your $EDITOR:</p>
<pre><code> pick 8ac4783 folders and folders
pick cf8b1f5 minor refactor
pick 762b37a Lots of improvement. Folders adn shit.
pick 3fae6e1 Be re... | <p>Use interactive rebase:</p> <pre><code>git rebase -i SHA-OF-FIRST-COMMIT-IN-BRANCH </code></pre> <p>That will open something like this in your $EDITOR:</p> <pre><code> pick 8ac4783 folders and folders pick cf8b1f5 minor refactor pick 762b37a Lots of improvement. Folders adn shit. pick 3fae6e1 Be re... | 119, 717 | git, merge | <h1>How can I merge many commits, but leave one out?</h1>
<p>Suppose I have this feature branch "foo". Now I want to merge it back into master, but I've added some debugging code that I don't want in master. </p>
<p>The debug code is in it's own commit, so I could use <code>git cherry-pick</code> on each commit and le... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,223 | git | # How can I merge many commits, but leave one out?
Suppose I have this feature branch "foo". Now I want to merge it back into master, but I've added some debugging code that I don't want in master.
The debug code is in it's own commit, so I could use `git cherry-pick` on each commit and leave out this commit. But tha... | Use interactive rebase:
```
git rebase -i SHA-OF-FIRST-COMMIT-IN-BRANCH
```
That will open something like this in your $EDITOR:
```
pick 8ac4783 folders and folders
pick cf8b1f5 minor refactor
pick 762b37a Lots of improvement. Folders adn shit.
pick 3fae6e1 Be ready to tableview
pick b174dc0 repl... |
8470360 | How to work simultaneously on a few branches | 71 | 2011-12-12 05:41:46 | <p>This is a follow-up on <a href="https://stackoverflow.com/questions/8453039/cleaning-my-git-branch-of-features-in-development">this question</a> on creating branches.</p>
<p>It strikes me as odd that I would still work on one repository because the files on my local machine will be a weird mix of different experime... | 91,549 | 341,583 | 2019-04-03 17:02:52 | 8,470,617 | 54 | 2011-12-12 06:21:42 | 19,818 | 2018-02-22 10:34:32 | https://stackoverflow.com/q/8470360 | https://stackoverflow.com/a/8470617 | <p>As of Git 2.5, <code>git-worktree</code> directly supports this workflow. See <a href="https://stackoverflow.com/a/30186607/19818">VonC's answer to this question</a> for details.</p>
<p>My answer below may suffice if you don't like <code>git-worktree</code> for whatever reason.</p>
<hr>
<p>Git is designed to allo... | <p>As of Git 2.5, <code>git-worktree</code> directly supports this workflow. See <a href="https://stackoverflow.com/a/30186607/19818">VonC's answer to this question</a> for details.</p> <p>My answer below may suffice if you don't like <code>git-worktree</code> for whatever reason.</p> <hr> <p>Git is designed to allo... | 119, 76220 | git, git-branch | <h1>How to work simultaneously on a few branches</h1>
<p>This is a follow-up on <a href="https://stackoverflow.com/questions/8453039/cleaning-my-git-branch-of-features-in-development">this question</a> on creating branches.</p>
<p>It strikes me as odd that I would still work on one repository because the files on my l... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,224 | git | # How to work simultaneously on a few branches
This is a follow-up on [this question](https://stackoverflow.com/questions/8453039/cleaning-my-git-branch-of-features-in-development) on creating branches.
It strikes me as odd that I would still work on one repository because the files on my local machine will be a weir... | As of Git 2.5, `git-worktree` directly supports this workflow. See [VonC's answer to this question](https://stackoverflow.com/a/30186607/19818) for details.
My answer below may suffice if you don't like `git-worktree` for whatever reason.
---
Git is designed to allow you to work within a single folder on disk. This ... |
5862233 | Commit changes only in one directory in Git | 66 | 2011-05-02 20:41:04 | <p>I'm using Git 1.7.4.1 on Mac 10.6.6. From the command line, how do I commit changes in only a single directory? I added the directory by doing:</p>
<pre><code>git add my-dir
</code></pre>
<p>but doing</p>
<pre><code>git commit -a
</code></pre>
<p>brings up a list of all changes in my repo, and I only want to c... | 110,374 | 623,658 | 2016-03-27 12:05:09 | 5,862,269 | 54 | 2011-05-02 20:45:28 | 33,732 | 2011-05-02 20:45:28 | https://stackoverflow.com/q/5862233 | https://stackoverflow.com/a/5862269 | <p>Omit the <code>-a</code> option. Then <code>git</code> will commit only the files that you staged with <code>git add</code>.</p>
<p>You can also try committing the directory without staging with <code>git commit my-dir</code>.</p>
| <p>Omit the <code>-a</code> option. Then <code>git</code> will commit only the files that you staged with <code>git add</code>.</p> <p>You can also try committing the directory without staging with <code>git commit my-dir</code>.</p> | 119 | git | <h1>Commit changes only in one directory in Git</h1>
<p>I'm using Git 1.7.4.1 on Mac 10.6.6. From the command line, how do I commit changes in only a single directory? I added the directory by doing:</p>
<pre><code>git add my-dir
</code></pre>
<p>but doing</p>
<pre><code>git commit -a
</code></pre>
<p>brings up a... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,227 | git | # Commit changes only in one directory in Git
I'm using Git 1.7.4.1 on Mac 10.6.6. From the command line, how do I commit changes in only a single directory? I added the directory by doing:
```
git add my-dir
```
but doing
```
git commit -a
```
brings up a list of all changes in my repo, and I only want to commit ... | Omit the `-a` option. Then `git` will commit only the files that you staged with `git add`.
You can also try committing the directory without staging with `git commit my-dir`. |
4830344 | How to do a rebase with git gui? | 64 | 2011-01-28 16:05:00 | <p>I know how to do a git rebase from the command line, but how do you do it with the official <a href="http://www.kernel.org/pub/software/scm/git/docs/git-gui.html" rel="noreferrer">git-gui</a>?</p>
| 59,629 | 52,176 | 2016-10-02 02:54:20 | 9,200,135 | 54 | 2012-02-08 19:32:36 | 954 | 2014-07-16 16:20:14 | https://stackoverflow.com/q/4830344 | https://stackoverflow.com/a/9200135 | <p>Add this to the <code>.gitconfig</code> file in your home directory to add rebase commands to the Tools menu:</p>
<pre><code>[guitool "Rebase onto..."]
cmd = git rebase $REVISION
revprompt = yes
[guitool "Rebase/Continue"]
cmd = git rebase --continue
[guitool "Rebase/Skip"]
cmd = git rebase --skip
[... | <p>Add this to the <code>.gitconfig</code> file in your home directory to add rebase commands to the Tools menu:</p> <pre><code>[guitool "Rebase onto..."] cmd = git rebase $REVISION revprompt = yes [guitool "Rebase/Continue"] cmd = git rebase --continue [guitool "Rebase/Skip"] cmd = git rebase --skip [... | 119, 29934, 33729 | git, git-gui, git-rebase | <h1>How to do a rebase with git gui?</h1>
<p>I know how to do a git rebase from the command line, but how do you do it with the official <a href="http://www.kernel.org/pub/software/scm/git/docs/git-gui.html" rel="noreferrer">git-gui</a>?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,229 | git | # How to do a rebase with git gui?
I know how to do a git rebase from the command line, but how do you do it with the official [git-gui](http://www.kernel.org/pub/software/scm/git/docs/git-gui.html)? | Add this to the `.gitconfig` file in your home directory to add rebase commands to the Tools menu:
```
[guitool "Rebase onto..."]
cmd = git rebase $REVISION
revprompt = yes
[guitool "Rebase/Continue"]
cmd = git rebase --continue
[guitool "Rebase/Skip"]
cmd = git rebase --skip
[guitool "Rebase/Abort"]
... |
31747072 | Will remote URL for fetch and push be different? | 58 | 2015-07-31 13:13:47 | <p>git remote --v show remote info</p>
<pre><code>origin https://github.com/test/testing-iOS.git (fetch)
origin https://github.com/test/testing-iOS.git (push)
</code></pre>
<p>It shows that both fetch and push are using the same remote URL.</p>
<p>Question:</p>
<p>When will (if ever) remote URL for fetch and push... | 17,117 | 66,814 | 2022-09-24 09:16:22 | 31,747,275 | 54 | 2015-07-31 13:23:19 | 6,309 | 2015-07-31 14:05:02 | https://stackoverflow.com/q/31747072 | https://stackoverflow.com/a/31747275 | <p>Yes (using different remote), and that is why Git 2.5 introduces a new ref shorthand <code>@{push}</code>.<br>
See "<a href="https://stackoverflow.com/a/30720302/6309">Viewing Unpushed Git Commits</a>"</p>
<blockquote>
<p>What commands can you use to change remote URL for fetch or push separately?</p>
</blockquot... | <p>Yes (using different remote), and that is why Git 2.5 introduces a new ref shorthand <code>@{push}</code>.<br> See "<a href="https://stackoverflow.com/a/30720302/6309">Viewing Unpushed Git Commits</a>"</p> <blockquote> <p>What commands can you use to change remote URL for fetch or push separately?</p> </blockquot... | 119, 41346 | git, git-remote | <h1>Will remote URL for fetch and push be different?</h1>
<p>git remote --v show remote info</p>
<pre><code>origin https://github.com/test/testing-iOS.git (fetch)
origin https://github.com/test/testing-iOS.git (push)
</code></pre>
<p>It shows that both fetch and push are using the same remote URL.</p>
<p>Question:... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,230 | git | # Will remote URL for fetch and push be different?
git remote --v show remote info
```
origin https://github.com/test/testing-iOS.git (fetch)
origin https://github.com/test/testing-iOS.git (push)
```
It shows that both fetch and push are using the same remote URL.
Question:
When will (if ever) remote URL for fet... | Yes (using different remote), and that is why Git 2.5 introduces a new ref shorthand `@{push}`.
See "[Viewing Unpushed Git Commits](https://stackoverflow.com/a/30720302/6309)"
> What commands can you use to change remote URL for fetch or push separately?
You need a separate remote:
```
git remote add myfork /url/f... |
9038616 | git post-push hook? | 58 | 2012-01-27 19:00:45 | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="https://stackoverflow.com/questions/1797074/local-executing-hook-after-a-git-push">Local executing hook after a git push?</a> </p>
</blockquote>
<p>git has a number of hooks that can call scripts near certain events.</p>
<p>Is it possible to set... | 41,731 | 1,131,467 | 2012-01-27 19:04:38 | 9,038,644 | 54 | 2012-01-27 19:04:38 | 119,963 | 2012-01-27 19:04:38 | https://stackoverflow.com/q/9038616 | https://stackoverflow.com/a/9038644 | <p>The list of hooks in <code>man githooks</code> is complete. There is no post-push hook. There are hooks which run in a repository after someone's pushed into it (i.e. for putting in the central repository), but nothing is triggered in the repository that you pushed from.</p>
<p>If there's a common task you need to ... | <p>The list of hooks in <code>man githooks</code> is complete. There is no post-push hook. There are hooks which run in a repository after someone's pushed into it (i.e. for putting in the central repository), but nothing is triggered in the repository that you pushed from.</p> <p>If there's a common task you need to ... | 119 | git | <h1>git post-push hook?</h1>
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="https://stackoverflow.com/questions/1797074/local-executing-hook-after-a-git-push">Local executing hook after a git push?</a> </p>
</blockquote>
<p>git has a number of hooks that can call scripts near certain events.<... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,231 | git | # git post-push hook?
> **Possible Duplicate:**
> [Local executing hook after a git push?](https://stackoverflow.com/questions/1797074/local-executing-hook-after-a-git-push)
git has a number of hooks that can call scripts near certain events.
Is it possible to setup a git hook in my working repository that execute... | The list of hooks in `man githooks` is complete. There is no post-push hook. There are hooks which run in a repository after someone's pushed into it (i.e. for putting in the central repository), but nothing is triggered in the repository that you pushed from.
If there's a common task you need to do after pushing, you... |
30195143 | gitk: command not found | 54 | 2015-05-12 15:20:32 | <p>Environment: Mac OSX 10.10. When I was trying to use <code>gitk</code>, it shows:</p>
<pre><code>Coda-2:~ Coda$ gitk
-bash: gitk: command not found
</code></pre>
<p>I think the reason is the old version of <code>git</code>. Here is some information, and I have already typed <code>brew update</code>.</p>
<pre><cod... | 59,375 | 3,732,906 | 2020-10-28 07:51:16 | 30,221,762 | 54 | 2015-05-13 17:38:27 | 3,732,906 | 2020-10-28 07:51:16 | https://stackoverflow.com/q/30195143 | https://stackoverflow.com/a/30221762 | <p>Follow these steps to fix the issue:</p>
<ol>
<li><p>Check <code>git</code> version with <code>git --version</code>, and it may show old version.</p>
</li>
<li><p>Update Homebrew with <code>brew update</code>.</p>
</li>
<li><p>Install the latest version of Git from Homebrew with <code>brew install git</code>.</p>
<p... | <p>Follow these steps to fix the issue:</p> <ol> <li><p>Check <code>git</code> version with <code>git --version</code>, and it may show old version.</p> </li> <li><p>Update Homebrew with <code>brew update</code>.</p> </li> <li><p>Install the latest version of Git from Homebrew with <code>brew install git</code>.</p> <p... | 119, 30785 | git, gitk | <h1>gitk: command not found</h1>
<p>Environment: Mac OSX 10.10. When I was trying to use <code>gitk</code>, it shows:</p>
<pre><code>Coda-2:~ Coda$ gitk
-bash: gitk: command not found
</code></pre>
<p>I think the reason is the old version of <code>git</code>. Here is some information, and I have already typed <code>b... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,233 | git | # gitk: command not found
Environment: Mac OSX 10.10. When I was trying to use `gitk`, it shows:
```
Coda-2:~ Coda$ gitk
-bash: gitk: command not found
```
I think the reason is the old version of `git`. Here is some information, and I have already typed `brew update`.
```
Coda-2:~ Coda$ git --version
git version 1... | Follow these steps to fix the issue:
1. Check `git` version with `git --version`, and it may show old version.
2. Update Homebrew with `brew update`.
3. Install the latest version of Git from Homebrew with `brew install git`.
(Note that if anything went wrong with the installation, the `brew doctor` command can be... |
36975986 | Cherry pick shows "commit is a merge but no -m option was given" error | 52 | 2016-05-02 06:12:32 | <p>I have two branches, master and development.</p>
<p>I need to get some commit from the development branch into the master branch. I do it by cherry-pick but it shows me some error:</p>
<pre><code>$> git cherry-pick cf0d52b
error: Commit cf0d52b900f990300c3aa17936ddbae1476d461a is a merge but no -m option was giv... | 104,704 | 3,047,113 | 2024-08-29 07:20:35 | 36,976,874 | 54 | 2016-05-02 07:12:13 | 1,755,598 | 2016-05-02 07:26:52 | https://stackoverflow.com/q/36975986 | https://stackoverflow.com/a/36976874 | <p>You are trying to <code>cherry-pick</code> a merge. A merge is build up from at several parents. You have to supply the parent id to the merge.</p>
<p>You have to supply any of the followings:</p>
<blockquote>
<p><em><strong><code>-m parent-number</code></strong></em> / <em><strong><code>--mainline parent-number</co... | <p>You are trying to <code>cherry-pick</code> a merge. A merge is build up from at several parents. You have to supply the parent id to the merge.</p> <p>You have to supply any of the followings:</p> <blockquote> <p><em><strong><code>-m parent-number</code></strong></em> / <em><strong><code>--mainline parent-number</co... | 119, 36489 | cherry-pick, git | <h1>Cherry pick shows "commit is a merge but no -m option was given" error</h1>
<p>I have two branches, master and development.</p>
<p>I need to get some commit from the development branch into the master branch. I do it by cherry-pick but it shows me some error:</p>
<pre><code>$> git cherry-pick cf0d52b
error: Com... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,234 | git | # Cherry pick shows "commit is a merge but no -m option was given" error
I have two branches, master and development.
I need to get some commit from the development branch into the master branch. I do it by cherry-pick but it shows me some error:
```
$> git cherry-pick cf0d52b
error: Commit cf0d52b900f990300c3aa179... | You are trying to `cherry-pick` a merge. A merge is build up from at several parents. You have to supply the parent id to the merge.
You have to supply any of the followings:
> ***`-m parent-number`*** / ***`--mainline parent-number`***
>
> Usually you cannot cherry-pick a merge because **you do not know which side o... |
22146026 | XCode source control: view changes for one file | 49 | 2014-03-03 11:50:32 | <p>Is it possible to view a "timeline" (history) for a selected file for like 50 commits? I mean changes made to this particular file and and view commits when they were made and users who changed them? I know Xcode got some powerful version control features, I just can not find this one.</p>
| 58,562 | 1,113,938 | 2023-09-01 01:45:48 | 22,147,183 | 54 | 2014-03-03 12:45:22 | 1,672,804 | 2014-03-03 12:45:22 | https://stackoverflow.com/q/22146026 | https://stackoverflow.com/a/22147183 | <p>What it sounds like you want is the "Blame View", if we were on the terminal you could write <code>git blame <file-name></code> to see the commit/time/and user for every single line of a particular file. In Xcode you can accomplish the same thing by activating the blame view. I've posted a picture to show you ... | <p>What it sounds like you want is the "Blame View", if we were on the terminal you could write <code>git blame <file-name></code> to see the commit/time/and user for every single line of a particular file. In Xcode you can accomplish the same thing by activating the blame view. I've posted a picture to show you ... | 119, 456, 908, 92815 | git, version-control, xcode, xcode5 | <h1>XCode source control: view changes for one file</h1>
<p>Is it possible to view a "timeline" (history) for a selected file for like 50 commits? I mean changes made to this particular file and and view commits when they were made and users who changed them? I know Xcode got some powerful version control features, I j... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,235 | git | # XCode source control: view changes for one file
Is it possible to view a "timeline" (history) for a selected file for like 50 commits? I mean changes made to this particular file and and view commits when they were made and users who changed them? I know Xcode got some powerful version control features, I just can n... | What it sounds like you want is the "Blame View", if we were on the terminal you could write `git blame <file-name>` to see the commit/time/and user for every single line of a particular file. In Xcode you can accomplish the same thing by activating the blame view. I've posted a picture to show you where the Blame View... |
23952575 | Is git stash stack pushed to the remote repo? | 48 | 2014-05-30 10:38:29 | <p>Is my <code>stash</code> stack pushed to the <code>remote repo</code>? Or is it completely ignored? </p>
<p>I'm just curious if I should tend to it every once in a while to drop some of it to save space on the server.</p>
| 22,807 | 2,266,261 | 2019-05-30 13:36:44 | 23,952,704 | 54 | 2014-05-30 10:45:14 | 149,998 | 2014-05-30 10:45:14 | https://stackoverflow.com/q/23952575 | https://stackoverflow.com/a/23952704 | <p>No. Stashes are local. </p>
<p><code>$ man git stash</code>:</p>
<blockquote>
<p>Use git stash when you want to record the current state of the working directory and the index, but want to go back to a clean working directory. The command saves your local modifications away reverts the working directory to matc... | <p>No. Stashes are local. </p> <p><code>$ man git stash</code>:</p> <blockquote> <p>Use git stash when you want to record the current state of the working directory and the index, but want to go back to a clean working directory. The command saves your local modifications away reverts the working directory to matc... | 119, 13091 | git, git-stash | <h1>Is git stash stack pushed to the remote repo?</h1>
<p>Is my <code>stash</code> stack pushed to the <code>remote repo</code>? Or is it completely ignored? </p>
<p>I'm just curious if I should tend to it every once in a while to drop some of it to save space on the server.</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,236 | git | # Is git stash stack pushed to the remote repo?
Is my `stash` stack pushed to the `remote repo`? Or is it completely ignored?
I'm just curious if I should tend to it every once in a while to drop some of it to save space on the server. | No. Stashes are local.
`$ man git stash`:
> Use git stash when you want to record the current state of the working directory and the index, but want to go back to a clean working directory. The command saves your local modifications away reverts the working directory to match the HEAD commit.
I wouldn't keep too man... |
50452866 | How to show date and time of a commit by hash | 42 | 2018-05-21 16:19:28 | <p>I used <code>git reflog</code> to identify a hash for when I created a particular branch. I got the hash of <code>fe1ddcdef</code>. I haven't pushed this branch to the remote yet. I'm now trying to find the date and time for when <code>fe1ddcdef</code> took place. <code>git reflog</code> only shows me:</p>
<p><code... | 43,645 | 370,407 | 2021-05-09 02:42:13 | 50,453,196 | 54 | 2018-05-21 16:42:49 | 7,426,932 | 2018-05-21 16:42:49 | https://stackoverflow.com/q/50452866 | https://stackoverflow.com/a/50453196 | <p>Simply use :</p>
<pre><code>git show fe1ddcdef
</code></pre>
<p>… to display the content of the commit. Actually, once you have any expression that identifies a commit object, you can use it in all places that require a revision. These expressions can be an hexadecimal hash (even partial), a branch name or a tag n... | <p>Simply use :</p> <pre><code>git show fe1ddcdef </code></pre> <p>… to display the content of the commit. Actually, once you have any expression that identifies a commit object, you can use it in all places that require a revision. These expressions can be an hexadecimal hash (even partial), a branch name or a tag n... | 119 | git | <h1>How to show date and time of a commit by hash</h1>
<p>I used <code>git reflog</code> to identify a hash for when I created a particular branch. I got the hash of <code>fe1ddcdef</code>. I haven't pushed this branch to the remote yet. I'm now trying to find the date and time for when <code>fe1ddcdef</code> took plac... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,237 | git | # How to show date and time of a commit by hash
I used `git reflog` to identify a hash for when I created a particular branch. I got the hash of `fe1ddcdef`. I haven't pushed this branch to the remote yet. I'm now trying to find the date and time for when `fe1ddcdef` took place. `git reflog` only shows me:
`fe1ddcdef... | Simply use :
```
git show fe1ddcdef
```
… to display the content of the commit. Actually, once you have any expression that identifies a commit object, you can use it in all places that require a revision. These expressions can be an hexadecimal hash (even partial), a branch name or a tag name. It can also be one of ... |
1334027 | Git and working on multiple branches | 42 | 2009-08-26 11:22:19 | <p>I have a couple of Git branches: 'experimental', 'something' and 'master'.</p>
<p>I switched to the 'experimental' branch. I noticed a bug which is unrelated to 'experimental' and belongs to changes which have been made in 'something'. How should I fix it?</p>
<p>I'm thinking I should switch to 'something', fix th... | 21,954 | 135,722 | 2023-11-16 07:13:21 | 1,340,143 | 54 | 2009-08-27 10:21:40 | 46,058 | 2009-08-27 10:21:40 | https://stackoverflow.com/q/1334027 | https://stackoverflow.com/a/1340143 | <p>There are two solutions not mentioned already that you can use: use a <strong>topic branch</strong> or use <strong>cherry-picking</strong>.</p>
<hr>
<h3>Topic branch solution</h3>
<p>In the <strong>topic branch solution</strong>, you switch to branch 'something', <em>create a branch to fix a bug</em> e.g. 'someth... | <p>There are two solutions not mentioned already that you can use: use a <strong>topic branch</strong> or use <strong>cherry-picking</strong>.</p> <hr> <h3>Topic branch solution</h3> <p>In the <strong>topic branch solution</strong>, you switch to branch 'something', <em>create a branch to fix a bug</em> e.g. 'someth... | 119, 456, 1879 | branch, git, version-control | <h1>Git and working on multiple branches</h1>
<p>I have a couple of Git branches: 'experimental', 'something' and 'master'.</p>
<p>I switched to the 'experimental' branch. I noticed a bug which is unrelated to 'experimental' and belongs to changes which have been made in 'something'. How should I fix it?</p>
<p>I'm t... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,238 | git | # Git and working on multiple branches
I have a couple of Git branches: 'experimental', 'something' and 'master'.
I switched to the 'experimental' branch. I noticed a bug which is unrelated to 'experimental' and belongs to changes which have been made in 'something'. How should I fix it?
I'm thinking I should switch... | There are two solutions not mentioned already that you can use: use a **topic branch** or use **cherry-picking**.
---
### Topic branch solution
In the **topic branch solution**, you switch to branch 'something', *create a branch to fix a bug* e.g. 'something-bugfix', merge this branch into 'something' (fixing the bu... |
55659241 | How to install git on a docker ubuntu image? | 41 | 2019-04-12 20:49:43 | <p>I have a simple docker file of</p>
<pre><code>FROM ubuntu:18.04
COPY . /usr/src/app/
COPY docker_files/.bash_aliases /root/
$ docker build -t dock .
Sending build context to Docker daemon 146.9kB
Step 1/3 : FROM ubuntu:18.04
---> 94e814e2efa8
Step 2/3 : COPY . /usr/src/app/
---> bf79eb6c42c1
Step 3/3 : CO... | 64,515 | 631,619 | 2024-07-05 10:52:31 | 55,659,307 | 54 | 2019-04-12 20:55:36 | 1,354,978 | 2019-09-30 18:43:06 | https://stackoverflow.com/q/55659241 | https://stackoverflow.com/a/55659307 | <p>This Dockerfile works for me </p>
<pre><code>FROM ubuntu:18.04
RUN apt update
RUN apt install -y git
</code></pre>
<p>Inside the container</p>
<pre><code>$ which git
/usr/bin/git
</code></pre>
| <p>This Dockerfile works for me </p> <pre><code>FROM ubuntu:18.04 RUN apt update RUN apt install -y git </code></pre> <p>Inside the container</p> <pre><code>$ which git /usr/bin/git </code></pre> | 119, 549, 1364, 90304, 108477 | containers, docker, dockerfile, git, ubuntu | <h1>How to install git on a docker ubuntu image?</h1>
<p>I have a simple docker file of</p>
<pre><code>FROM ubuntu:18.04
COPY . /usr/src/app/
COPY docker_files/.bash_aliases /root/
$ docker build -t dock .
Sending build context to Docker daemon 146.9kB
Step 1/3 : FROM ubuntu:18.04
---> 94e814e2efa8
Step 2/3 : CO... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,239 | git | # How to install git on a docker ubuntu image?
I have a simple docker file of
```
FROM ubuntu:18.04
COPY . /usr/src/app/
COPY docker_files/.bash_aliases /root/
$ docker build -t dock .
Sending build context to Docker daemon 146.9kB
Step 1/3 : FROM ubuntu:18.04
---> 94e814e2efa8
Step 2/3 : COPY . /usr/src/app/
---... | This Dockerfile works for me
```
FROM ubuntu:18.04
RUN apt update
RUN apt install -y git
```
Inside the container
```
$ which git
/usr/bin/git
``` |
28313664 | Remove empty commits in git | 41 | 2015-02-04 04:43:37 | <p>I just migrated a project from Mercurial to Git. Mercurial adds empty commits when you add tags, so I ended up with empty commits in Git that I would like to remove.</p>
<p>How do I remove empty commits (commits that do not have any files in them) from Git?</p>
<p>Thanks.</p>
| 28,465 | 1,795,917 | 2017-06-01 16:55:57 | 28,313,729 | 54 | 2015-02-04 04:51:19 | 1,256,452 | 2015-02-04 05:06:00 | https://stackoverflow.com/q/28313664 | https://stackoverflow.com/a/28313729 | <p>One simple (but slow) way to do this is with <code>git filter-branch</code> and <code>--prune-empty</code>. With no other filters, no other commits will be altered, but any empty ones will be discarded (which will cause all subsequent commits to have new parent-IDs and is therefore still "rewrites history": not a b... | <p>One simple (but slow) way to do this is with <code>git filter-branch</code> and <code>--prune-empty</code>. With no other filters, no other commits will be altered, but any empty ones will be discarded (which will cause all subsequent commits to have new parent-IDs and is therefore still "rewrites history": not a b... | 119, 456, 53850 | git, git-commit, version-control | <h1>Remove empty commits in git</h1>
<p>I just migrated a project from Mercurial to Git. Mercurial adds empty commits when you add tags, so I ended up with empty commits in Git that I would like to remove.</p>
<p>How do I remove empty commits (commits that do not have any files in them) from Git?</p>
<p>Thanks.</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,240 | git | # Remove empty commits in git
I just migrated a project from Mercurial to Git. Mercurial adds empty commits when you add tags, so I ended up with empty commits in Git that I would like to remove.
How do I remove empty commits (commits that do not have any files in them) from Git?
Thanks. | One simple (but slow) way to do this is with `git filter-branch` and `--prune-empty`. With no other filters, no other commits will be altered, but any empty ones will be discarded (which will cause all subsequent commits to have new parent-IDs and is therefore still "rewrites history": not a big deal if this is your in... |
39071360 | What's a `WIP` on a stash commit? | 39 | 2016-08-22 04:19:58 | <p>What's a <code>WIP</code> means on a stash commit?</p>
<pre><code>$ git stash list
stash@{0}: WIP on master: 049d078 added the index file
stash@{1}: WIP on master: c264051 Revert "added file_size"
stash@{2}: WIP on master: 21d80a5 added number to log
</code></pre>
<p>I'm just curious.</p>
| 16,276 | 4,015,856 | 2016-08-22 04:22:34 | 39,071,379 | 54 | 2016-08-22 04:22:34 | 1,633,783 | 2016-08-22 04:22:34 | https://stackoverflow.com/q/39071360 | https://stackoverflow.com/a/39071379 | <p>From the <a href="https://git-scm.com/docs/git-stash"><code>git-stash</code> documentation</a>:</p>
<blockquote>
<p>A stash is by default listed as "WIP on branchname …", but you can
give a more descriptive message on the command line when you create
one.</p>
</blockquote>
<p>WIP stands for <em><strong>w</s... | <p>From the <a href="https://git-scm.com/docs/git-stash"><code>git-stash</code> documentation</a>:</p> <blockquote> <p>A stash is by default listed as "WIP on branchname …", but you can give a more descriptive message on the command line when you create one.</p> </blockquote> <p>WIP stands for <em><strong>w</s... | 119, 13091, 53850 | git, git-commit, git-stash | <h1>What's a `WIP` on a stash commit?</h1>
<p>What's a <code>WIP</code> means on a stash commit?</p>
<pre><code>$ git stash list
stash@{0}: WIP on master: 049d078 added the index file
stash@{1}: WIP on master: c264051 Revert "added file_size"
stash@{2}: WIP on master: 21d80a5 added number to log
</code></pre>
<p>I'm ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,242 | git | # What's a `WIP` on a stash commit?
What's a `WIP` means on a stash commit?
```
$ git stash list
stash@{0}: WIP on master: 049d078 added the index file
stash@{1}: WIP on master: c264051 Revert "added file_size"
stash@{2}: WIP on master: 21d80a5 added number to log
```
I'm just curious. | From the [`git-stash` documentation](https://git-scm.com/docs/git-stash):
> A stash is by default listed as "WIP on branchname …", but you can
> give a more descriptive message on the command line when you create
> one.
WIP stands for ***w**ork **i**n **p**rogress*. |
51422637 | git diff for a single file in stash | 38 | 2018-07-19 12:24:22 | <p>I know from <a href="https://stackoverflow.com/questions/7677736/git-diff-against-a-stash">this answer</a> how to show the diff against a stash.</p>
<pre><code>git stash show -p stash@{1}
</code></pre>
<p>But how can I show the diff to a specific file from a stash?</p>
| 16,869 | 4,684,797 | 2019-12-26 10:06:35 | 51,422,829 | 54 | 2018-07-19 12:33:48 | 2,020,827 | 2018-07-19 12:45:26 | https://stackoverflow.com/q/51422637 | https://stackoverflow.com/a/51422829 | <p>You can use the diff command with a path:</p>
<pre><code>git diff stash@{1} -- <path>
</code></pre>
| <p>You can use the diff command with a path:</p> <pre><code>git diff stash@{1} -- <path> </code></pre> | 119, 13091 | git, git-stash | <h1>git diff for a single file in stash</h1>
<p>I know from <a href="https://stackoverflow.com/questions/7677736/git-diff-against-a-stash">this answer</a> how to show the diff against a stash.</p>
<pre><code>git stash show -p stash@{1}
</code></pre>
<p>But how can I show the diff to a specific file from a stash?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,243 | git | # git diff for a single file in stash
I know from [this answer](https://stackoverflow.com/questions/7677736/git-diff-against-a-stash) how to show the diff against a stash.
```
git stash show -p stash@{1}
```
But how can I show the diff to a specific file from a stash? | You can use the diff command with a path:
```
git diff stash@{1} -- <path>
``` |
25912441 | Can I add a .gitignore file just for me that overrides the project .gitignore? | 38 | 2014-09-18 12:19:39 | <p>I am using Git in Android Studio on a OS X machine, and I would like to have a personal <code>.gitignore</code> file that overrides the <code>.gitignore</code> that are in the project (I want mine to ignore <code>.iml</code> files). Can this be done and how?</p>
<p>I have tried to create a <code>.gitignore</code> f... | 10,887 | 190,803 | 2025-10-07 05:15:09 | 25,914,385 | 54 | 2014-09-18 13:41:53 | 1,860,929 | 2017-05-16 18:14:36 | https://stackoverflow.com/q/25912441 | https://stackoverflow.com/a/25914385 | <p>Instead of creating a new <code>.gitignore</code> file, you <a href="https://stackoverflow.com/a/22906964/1860929">should use</a> the <code>.git/info/exclude</code> file to setup ignore rules specific to your clone of the repo.</p>
<p>So, basically, go to your project root, and run</p>
<pre><code>cd $PROJECT_ROOT
... | <p>Instead of creating a new <code>.gitignore</code> file, you <a href="https://stackoverflow.com/a/22906964/1860929">should use</a> the <code>.git/info/exclude</code> file to setup ignore rules specific to your clone of the repo.</p> <p>So, basically, go to your project root, and run</p> <pre><code>cd $PROJECT_ROOT ... | 119, 25056 | git, gitignore | <h1>Can I add a .gitignore file just for me that overrides the project .gitignore?</h1>
<p>I am using Git in Android Studio on a OS X machine, and I would like to have a personal <code>.gitignore</code> file that overrides the <code>.gitignore</code> that are in the project (I want mine to ignore <code>.iml</code> file... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,244 | git | # Can I add a .gitignore file just for me that overrides the project .gitignore?
I am using Git in Android Studio on a OS X machine, and I would like to have a personal `.gitignore` file that overrides the `.gitignore` that are in the project (I want mine to ignore `.iml` files). Can this be done and how?
I have trie... | Instead of creating a new `.gitignore` file, you [should use](https://stackoverflow.com/a/22906964/1860929) the `.git/info/exclude` file to setup ignore rules specific to your clone of the repo.
So, basically, go to your project root, and run
```
cd $PROJECT_ROOT
echo "*.iml" >> .git/info/exclude
```
Note that the t... |
18879104 | How to commit only a message to GIT? | 38 | 2013-09-18 17:57:29 | <p>Suppose that I have been working on a branch and have committed my work but want to
add a message in the logs of what is next on the todo list for the branch. Times
I might want to do this include:</p>
<ul>
<li>Switching branches to work on something else - need to remind myself of what to do next</li>
<li>Weeke... | 17,110 | 251,589 | 2022-01-11 17:06:14 | 18,879,118 | 54 | 2013-09-18 17:57:55 | 251,589 | 2022-01-11 17:06:14 | https://stackoverflow.com/q/18879104 | https://stackoverflow.com/a/18879118 | <p>Yes. It is possible. I can never remember how to do this and always need to Google (so I am writting a Q/A in hope that this will help me to remember).</p>
<p>The command is:</p>
<pre><code>git commit --allow-empty --only
</code></pre>
<p>The doc for <code>--allow-empty</code> reads:</p>
<blockquote>
<p>Usually re... | <p>Yes. It is possible. I can never remember how to do this and always need to Google (so I am writting a Q/A in hope that this will help me to remember).</p> <p>The command is:</p> <pre><code>git commit --allow-empty --only </code></pre> <p>The doc for <code>--allow-empty</code> reads:</p> <blockquote> <p>Usually re... | 119 | git | <h1>How to commit only a message to GIT?</h1>
<p>Suppose that I have been working on a branch and have committed my work but want to
add a message in the logs of what is next on the todo list for the branch. Times
I might want to do this include:</p>
<ul>
<li>Switching branches to work on something else - need to r... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,245 | git | # How to commit only a message to GIT?
Suppose that I have been working on a branch and have committed my work but want to
add a message in the logs of what is next on the todo list for the branch. Times
I might want to do this include:
- Switching branches to work on something else - need to remind myself of what to... | Yes. It is possible. I can never remember how to do this and always need to Google (so I am writting a Q/A in hope that this will help me to remember).
The command is:
```
git commit --allow-empty --only
```
The doc for `--allow-empty` reads:
> Usually recording a commit that has the exact same tree as its sole
> p... |
18729510 | What is the difference between "py[cod]" and "pyc" in .gitignore notation? | 36 | 2013-09-10 22:03:34 | <p>What is the difference (if any) between ".pyc" and ".py[cod]" notation in ignoring files. I am noticing I have both on my git ignore file. Thanks</p>
| 13,862 | 2,272,034 | 2013-09-11 01:50:29 | 18,729,541 | 54 | 2013-09-10 22:06:49 | 954 | 2013-09-10 22:06:49 | https://stackoverflow.com/q/18729510 | https://stackoverflow.com/a/18729541 | <p>You are safe to remove the <code>.pyc</code> entry from your <code>.gitignore</code>, since <code>.py[cod]</code> will cover it. The square brackets are for matching any one of the characters, so it matches <code>.pyc</code>, <code>.pyo</code> and <code>.pyd</code>.</p>
<p>Since they are all generated from the <cod... | <p>You are safe to remove the <code>.pyc</code> entry from your <code>.gitignore</code>, since <code>.py[cod]</code> will cover it. The square brackets are for matching any one of the characters, so it matches <code>.pyc</code>, <code>.pyo</code> and <code>.pyd</code>.</p> <p>Since they are all generated from the <cod... | 16, 119 | git, python | <h1>What is the difference between "py[cod]" and "pyc" in .gitignore notation?</h1>
<p>What is the difference (if any) between ".pyc" and ".py[cod]" notation in ignoring files. I am noticing I have both on my git ignore file. Thanks</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,246 | git | # What is the difference between "py[cod]" and "pyc" in .gitignore notation?
What is the difference (if any) between ".pyc" and ".py[cod]" notation in ignoring files. I am noticing I have both on my git ignore file. Thanks | You are safe to remove the `.pyc` entry from your `.gitignore`, since `.py[cod]` will cover it. The square brackets are for matching any one of the characters, so it matches `.pyc`, `.pyo` and `.pyd`.
Since they are all generated from the `.py` source, they should not be stored in source control. |
17007277 | point gem branch path in gemfile | 35 | 2013-06-09 07:06:35 | <p>How to point gem branch path in gemfile.</p>
<p>This is what i am doing :</p>
<pre><code>gem 'rails', path: '/home/ubuntu/workspace/Fork/rails', :branch => 'any_of'
</code></pre>
<p>but when i run <code>bundle update</code>, it's not show any branch like sprockets-rails.</p>
<pre><code>Using sprockets-rai... | 23,699 | 1,008,837 | 2016-04-15 06:02:58 | 17,011,622 | 54 | 2013-06-09 16:20:14 | 634,513 | 2013-06-09 17:16:26 | https://stackoverflow.com/q/17007277 | https://stackoverflow.com/a/17011622 | <p>In your app run this command.</p>
<pre><code>bundle config local.rails /home/ubuntu/workspace/Fork/rails
</code></pre>
<p>Then in your Gemfile you specify the github source which will be overridden. </p>
<pre><code>gem 'rails', :github => 'rails/rails', :branch => 'any_of'
</code></pre>
<p>Source: <a href... | <p>In your app run this command.</p> <pre><code>bundle config local.rails /home/ubuntu/workspace/Fork/rails </code></pre> <p>Then in your Gemfile you specify the github source which will be overridden. </p> <pre><code>gem 'rails', :github => 'rails/rails', :branch => 'any_of' </code></pre> <p>Source: <a href... | 12, 119, 4984 | git, ruby, ruby-on-rails | <h1>point gem branch path in gemfile</h1>
<p>How to point gem branch path in gemfile.</p>
<p>This is what i am doing :</p>
<pre><code>gem 'rails', path: '/home/ubuntu/workspace/Fork/rails', :branch => 'any_of'
</code></pre>
<p>but when i run <code>bundle update</code>, it's not show any branch like sprockets-... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,247 | git | # point gem branch path in gemfile
How to point gem branch path in gemfile.
This is what i am doing :
```
gem 'rails', path: '/home/ubuntu/workspace/Fork/rails', :branch => 'any_of'
```
but when i run `bundle update`, it's not show any branch like sprockets-rails.
```
Using sprockets-rails (2.0.0.rc4) from git... | In your app run this command.
```
bundle config local.rails /home/ubuntu/workspace/Fork/rails
```
Then in your Gemfile you specify the github source which will be overridden.
```
gem 'rails', :github => 'rails/rails', :branch => 'any_of'
```
Source: <http://gembundler.com/v1.3/git.html> |
9186496 | Determining UTM zone (to convert) from longitude/latitude | 35 | 2012-02-08 01:09:04 | <p>I'm writing a program which expects a number of lat/long points, and I convert them internally to UTM in order to do some calculations in metres.</p>
<p>The range of the lat/long points themselves is quite small -- about 200m x 200m. They can be relied on almost always to be within a single UTM zone (unless you get... | 35,851 | 913,184 | 2022-03-08 16:04:57 | 9,188,972 | 54 | 2012-02-08 06:55:06 | 980,833 | 2013-03-18 02:20:39 | https://stackoverflow.com/q/9186496 | https://stackoverflow.com/a/9188972 | <p><strong>Edit:</strong> For (non-R) code that works for <em>all</em> non-polar areas on earth, see <a href="https://gis.stackexchange.com/questions/13291/is-there-a-simple-way-to-compute-the-utm-zone-from-a-lat-long-point">here</a> or <a href="http://www.igorexchange.com/node/927" rel="noreferrer">here</a>.</p>
<hr>... | <p><strong>Edit:</strong> For (non-R) code that works for <em>all</em> non-polar areas on earth, see <a href="https://gis.stackexchange.com/questions/13291/is-there-a-simple-way-to-compute-the-utm-zone-from-a-lat-long-point">here</a> or <a href="http://www.igorexchange.com/node/927" rel="noreferrer">here</a>.</p> <hr>... | 4452, 11114, 20301, 56442 | coordinate-transformation, latitude-longitude, r, utm | <h1>Determining UTM zone (to convert) from longitude/latitude</h1>
<p>I'm writing a program which expects a number of lat/long points, and I convert them internally to UTM in order to do some calculations in metres.</p>
<p>The range of the lat/long points themselves is quite small -- about 200m x 200m. They can be rel... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,248 | git | # Determining UTM zone (to convert) from longitude/latitude
I'm writing a program which expects a number of lat/long points, and I convert them internally to UTM in order to do some calculations in metres.
The range of the lat/long points themselves is quite small -- about 200m x 200m. They can be relied on almost al... | **Edit:** For (non-R) code that works for *all* non-polar areas on earth, see [here](https://gis.stackexchange.com/questions/13291/is-there-a-simple-way-to-compute-the-utm-zone-from-a-lat-long-point) or [here](http://www.igorexchange.com/node/927).
---
Unless you are dealing with data from a couple of exceptional are... |
54922704 | Git cloning error: 'fatal: multiple updates for ... ref not allowed' | 34 | 2019-02-28 09:49:05 | <p>I'm getting an error when trying to <code>git clone</code> a repository:</p>
<pre><code>git clone https://github.com/laradock/laradock.git
Cloning into 'laradock'...
remote: Enumerating object... | 19,289 | 10,541,736 | 2022-07-05 21:56:22 | 54,925,834 | 54 | 2019-02-28 12:32:53 | 10,541,736 | 2019-02-28 12:53:49 | https://stackoverflow.com/q/54922704 | https://stackoverflow.com/a/54925834 | <p>Well, I seem to have fixed the issue. Removing the following from my .gitconfig seemed to do the trick, but I am not sure why:</p>
<pre><code>[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
</code></pre>
<p>I know that <code>git v2.21.0</code> was just released a few days ago, so maybe something ... | <p>Well, I seem to have fixed the issue. Removing the following from my .gitconfig seemed to do the trick, but I am not sure why:</p> <pre><code>[remote "origin"] fetch = +refs/heads/*:refs/remotes/origin/* </code></pre> <p>I know that <code>git v2.21.0</code> was just released a few days ago, so maybe something ... | 119, 369, 1067 | git, homebrew, macos | <h1>Git cloning error: 'fatal: multiple updates for ... ref not allowed'</h1>
<p>I'm getting an error when trying to <code>git clone</code> a repository:</p>
<pre><code>git clone https://github.com/laradock/laradock.git
Cloning into 'laradock'... ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,250 | git | # Git cloning error: 'fatal: multiple updates for ... ref not allowed'
I'm getting an error when trying to `git clone` a repository:
```
git clone https://github.com/laradock/laradock.git
Cloning into 'laradock'... ... | Well, I seem to have fixed the issue. Removing the following from my .gitconfig seemed to do the trick, but I am not sure why:
```
[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
```
I know that `git v2.21.0` was just released a few days ago, so maybe something changed under the hood. I need to chec... |
37739797 | git fatal: failed to read object xxx: Invalid argument | 33 | 2016-06-10 04:15:46 | <p>I am getting the following error if I pull for fetch from remote</p>
<pre><code>$ git pull
remote: Counting objects: 85, done.
remote: Compressing objects: 100% (37/37), done.
remote: Total 85 (delta 63), reused 69 (delta 48)
Unpacking objects: 100% (85/85), done.
error: inflate: data stream error (unknown compress... | 46,353 | 415,865 | 2019-10-15 12:54:29 | 37,740,711 | 54 | 2016-06-10 05:44:27 | 415,865 | 2016-06-10 05:44:27 | https://stackoverflow.com/q/37739797 | https://stackoverflow.com/a/37740711 | <p>Finally I was able to fix this issue.
I think issue happened when my computer shutdown due to power cut.</p>
<p>I was able to commit any changes in any of my local branch. This means my pack file is no corrupted but some refs are invalid.</p>
<p>Back up your <code>.git</code> first. Then I use <code>git fsck</code... | <p>Finally I was able to fix this issue. I think issue happened when my computer shutdown due to power cut.</p> <p>I was able to commit any changes in any of my local branch. This means my pack file is no corrupted but some refs are invalid.</p> <p>Back up your <code>.git</code> first. Then I use <code>git fsck</code... | 119 | git | <h1>git fatal: failed to read object xxx: Invalid argument</h1>
<p>I am getting the following error if I pull for fetch from remote</p>
<pre><code>$ git pull
remote: Counting objects: 85, done.
remote: Compressing objects: 100% (37/37), done.
remote: Total 85 (delta 63), reused 69 (delta 48)
Unpacking objects: 100% (8... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,252 | git | # git fatal: failed to read object xxx: Invalid argument
I am getting the following error if I pull for fetch from remote
```
$ git pull
remote: Counting objects: 85, done.
remote: Compressing objects: 100% (37/37), done.
remote: Total 85 (delta 63), reused 69 (delta 48)
Unpacking objects: 100% (85/85), done.
error: ... | Finally I was able to fix this issue.
I think issue happened when my computer shutdown due to power cut.
I was able to commit any changes in any of my local branch. This means my pack file is no corrupted but some refs are invalid.
Back up your `.git` first. Then I use `git fsck` command
```
$ git fsck --full
error:... |
15373928 | Cleaning up after a conflicted git merge? | 30 | 2013-03-12 23:01:15 | <p>I had a small conflict in a <code>.h</code> header file in a project I'm working on. This project is tracked in Git.</p>
<p>Fortunately, the conflict was very simple to solve. I used</p>
<p><code>git mergetool</code></p>
<p>And chose the default (<code>opendiff</code>) which seemed to be FileMerge on my Mac. I ma... | 20,908 | 88,111 | 2013-03-12 23:12:13 | 15,374,033 | 54 | 2013-03-12 23:09:03 | 1,385,860 | 2013-03-12 23:09:03 | https://stackoverflow.com/q/15373928 | https://stackoverflow.com/a/15374033 | <p>You can simply delete them like you would any other file. For example:</p>
<pre><code>rm MyHeader.h.orig
</code></pre>
<p>Alternatively, if there are no other untracked files, then after you commit with</p>
<pre><code>git commit -a
</code></pre>
<p>you may clean your repository with</p>
<pre><code>git clean -n
... | <p>You can simply delete them like you would any other file. For example:</p> <pre><code>rm MyHeader.h.orig </code></pre> <p>Alternatively, if there are no other untracked files, then after you commit with</p> <pre><code>git commit -a </code></pre> <p>you may clean your repository with</p> <pre><code>git clean -n ... | 119, 456, 717, 17349, 62599 | filemerge, git, merge, merge-conflict-resolution, version-control | <h1>Cleaning up after a conflicted git merge?</h1>
<p>I had a small conflict in a <code>.h</code> header file in a project I'm working on. This project is tracked in Git.</p>
<p>Fortunately, the conflict was very simple to solve. I used</p>
<p><code>git mergetool</code></p>
<p>And chose the default (<code>opendiff</... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,255 | git | # Cleaning up after a conflicted git merge?
I had a small conflict in a `.h` header file in a project I'm working on. This project is tracked in Git.
Fortunately, the conflict was very simple to solve. I used
`git mergetool`
And chose the default (`opendiff`) which seemed to be FileMerge on my Mac. I made the appro... | You can simply delete them like you would any other file. For example:
```
rm MyHeader.h.orig
```
Alternatively, if there are no other untracked files, then after you commit with
```
git commit -a
```
you may clean your repository with
```
git clean -n
git clean -f
```
`git clean -n` will tell you what `git clean... |
58378352 | How to tell git to accept all current changes | 29 | 2019-10-14 13:57:14 | <p>So I was just trying to upload my code to git, I don't know what I did but somehow i'm in a bit of pickle. </p>
<p>Because there are so many conflicts in almost all of my files. </p>
<p>I don't want to resolve each conflict manually by going through each file because there are hundreds of files and there are mul... | 60,344 | 10,606,250 | 2024-08-22 22:01:25 | 65,959,377 | 54 | 2021-01-29 17:49:15 | 1,032,370 | 2024-08-22 22:01:25 | https://stackoverflow.com/q/58378352 | https://stackoverflow.com/a/65959377 | <p><strong>Incoming Change:</strong></p>
<pre class="lang-bash prettyprint-override"><code>git checkout --theirs .
git add .
</code></pre>
<p>or</p>
<p><strong>Current Change:</strong></p>
<pre class="lang-bash prettyprint-override"><code>git checkout --ours .
git add .
</code></pre>
| <p><strong>Incoming Change:</strong></p> <pre class="lang-bash prettyprint-override"><code>git checkout --theirs . git add . </code></pre> <p>or</p> <p><strong>Current Change:</strong></p> <pre class="lang-bash prettyprint-override"><code>git checkout --ours . git add . </code></pre> | 119 | git | <h1>How to tell git to accept all current changes</h1>
<p>So I was just trying to upload my code to git, I don't know what I did but somehow i'm in a bit of pickle. </p>
<p>Because there are so many conflicts in almost all of my files. </p>
<p>I don't want to resolve each conflict manually by going through each fil... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,256 | git | # How to tell git to accept all current changes
So I was just trying to upload my code to git, I don't know what I did but somehow i'm in a bit of pickle.
Because there are so many conflicts in almost all of my files.
I don't want to resolve each conflict manually by going through each file because there are hundred... | **Incoming Change:**
```
git checkout --theirs .
git add .
```
or
**Current Change:**
```
git checkout --ours .
git add .
``` |
18116198 | Merge local master branch with remote master branch in Git | 29 | 2013-08-08 00:51:58 | <p>I'm in a strange situation: I have copied a directory (local repository) from a former developer on to my machine. There have been several commits to the remote master that are NOT in his local repository.</p>
<p><strong>How do I merge the local copy of master with the most up-to-date changes of the remote master?<... | 50,004 | 2,317,381 | 2014-08-05 14:50:06 | 18,116,319 | 54 | 2013-08-08 01:04:33 | null | 2014-08-05 14:50:06 | https://stackoverflow.com/q/18116198 | https://stackoverflow.com/a/18116319 | <h2>Case 1: remote/master has everything that local master has</h2>
<p>If <code>remote/master</code> contains all of the commits that the local <code>master</code> contains, simply do a <code>git pull</code>:</p>
<pre><code>git checkout master
git pull remote master
</code></pre>
<p>You can check if the local <code>... | <h2>Case 1: remote/master has everything that local master has</h2> <p>If <code>remote/master</code> contains all of the commits that the local <code>master</code> contains, simply do a <code>git pull</code>:</p> <pre><code>git checkout master git pull remote master </code></pre> <p>You can check if the local <code>... | 119, 28897 | git, git-merge | <h1>Merge local master branch with remote master branch in Git</h1>
<p>I'm in a strange situation: I have copied a directory (local repository) from a former developer on to my machine. There have been several commits to the remote master that are NOT in his local repository.</p>
<p><strong>How do I merge the local co... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,259 | git | # Merge local master branch with remote master branch in Git
I'm in a strange situation: I have copied a directory (local repository) from a former developer on to my machine. There have been several commits to the remote master that are NOT in his local repository.
**How do I merge the local copy of master with the ... | ## Case 1: remote/master has everything that local master has
If `remote/master` contains all of the commits that the local `master` contains, simply do a `git pull`:
```
git checkout master
git pull remote master
```
You can check if the local `master` has commits that `remote/master` doesn't by using the following... |
11018411 | How do I export a specific commit with git-archive? | 29 | 2012-06-13 15:34:31 | <p>I asked a similar question before, but it was answered inadequately so I thought I would ask again here but providing more information. I need to get different and older versions of a git repository and I'm having trouble with that. What I've tried is</p>
<pre><code>git checkout master~X
git archive --format zip ... | 51,837 | 1,442,534 | 2018-05-02 14:48:47 | 11,019,214 | 54 | 2012-06-13 16:23:59 | 1,301,972 | 2018-05-02 14:48:47 | https://stackoverflow.com/q/11018411 | https://stackoverflow.com/a/11019214 | <h3>The Problem</h3>
<p>In both your examples, you are exporting the tip of <em>master</em>. Take out your flags and arguments, and you have:</p>
<pre><code>git archive master
</code></pre>
<p>In other words, you're explicitly doing this to yourself by specifying whatever is stored in <strong>.git/refs/heads/master<... | <h3>The Problem</h3> <p>In both your examples, you are exporting the tip of <em>master</em>. Take out your flags and arguments, and you have:</p> <pre><code>git archive master </code></pre> <p>In other words, you're explicitly doing this to yourself by specifying whatever is stored in <strong>.git/refs/heads/master<... | 119, 4167, 7330 | export, git, repository | <h1>How do I export a specific commit with git-archive?</h1>
<p>I asked a similar question before, but it was answered inadequately so I thought I would ask again here but providing more information. I need to get different and older versions of a git repository and I'm having trouble with that. What I've tried is</p>
... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,260 | git | # How do I export a specific commit with git-archive?
I asked a similar question before, but it was answered inadequately so I thought I would ask again here but providing more information. I need to get different and older versions of a git repository and I'm having trouble with that. What I've tried is
```
git chec... | ### The Problem
In both your examples, you are exporting the tip of *master*. Take out your flags and arguments, and you have:
```
git archive master
```
In other words, you're explicitly doing this to yourself by specifying whatever is stored in **.git/refs/heads/master** as your tree-ish.
### The Solution
You ne... |
1597508 | git merge: keep one side for some files, manual merge the rest | 28 | 2009-10-20 21:42:49 | <p>In a merge with conflicts, is there a way to tell git to keep one version for a set of files?</p>
<pre><code>$ git checkout some_branch
$ git merge origin/master
$ ?
</code></pre>
| 13,471 | 16,957 | 2009-10-20 22:30:18 | 1,597,544 | 54 | 2009-10-20 21:52:46 | 119,963 | 2009-10-20 22:30:18 | https://stackoverflow.com/q/1597508 | https://stackoverflow.com/a/1597544 | <p>If you've already attempted the merge and are looking at the unmerged files, you can use git checkout:</p>
<pre><code>git checkout some_branch
git merge origin/master
<conflicts!>
git checkout --theirs -- <dir>|<file>
</code></pre>
<p>(and of course, <code>--ours</code> keeps the version from the... | <p>If you've already attempted the merge and are looking at the unmerged files, you can use git checkout:</p> <pre><code>git checkout some_branch git merge origin/master <conflicts!> git checkout --theirs -- <dir>|<file> </code></pre> <p>(and of course, <code>--ours</code> keeps the version from the... | 119, 717 | git, merge | <h1>git merge: keep one side for some files, manual merge the rest</h1>
<p>In a merge with conflicts, is there a way to tell git to keep one version for a set of files?</p>
<pre><code>$ git checkout some_branch
$ git merge origin/master
$ ?
</code></pre>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,261 | git | # git merge: keep one side for some files, manual merge the rest
In a merge with conflicts, is there a way to tell git to keep one version for a set of files?
```
$ git checkout some_branch
$ git merge origin/master
$ ?
``` | If you've already attempted the merge and are looking at the unmerged files, you can use git checkout:
```
git checkout some_branch
git merge origin/master
<conflicts!>
git checkout --theirs -- <dir>|<file>
```
(and of course, `--ours` keeps the version from the current branch) |
25931684 | Git Push Error - Could not resolve host name | 27 | 2014-09-19 10:21:37 | <pre><code>nshastri@N-SHASTRI ~/datasciencecoursera (master)
$ git push origin master
</code></pre>
<blockquote>
<p>ssh: Could not resolve hostname https: no address associated with name</p>
<p>fatal: Could not read from remote repository.</p>
<p>Please make sure you have the correct access rights
and th... | 85,860 | 4,057,986 | 2021-05-08 13:15:00 | 25,932,311 | 54 | 2014-09-19 10:55:26 | 6,309 | 2014-09-26 07:11:13 | https://stackoverflow.com/q/25931684 | https://stackoverflow.com/a/25932311 | <p>Simply type:</p>
<pre><code>git remote -v
</code></pre>
<p>and double-check the url associated with <code>origin</code> for your <a href="https://stackoverflow.com/a/2749166/6309">upstream repo</a>.</p>
<p>Once you have the right url, update your remote origin with another <a href="http://git-scm.com/docs/git-rem... | <p>Simply type:</p> <pre><code>git remote -v </code></pre> <p>and double-check the url associated with <code>origin</code> for your <a href="https://stackoverflow.com/a/2749166/6309">upstream repo</a>.</p> <p>Once you have the right url, update your remote origin with another <a href="http://git-scm.com/docs/git-rem... | 119, 4236 | git, push | <h1>Git Push Error - Could not resolve host name</h1>
<pre><code>nshastri@N-SHASTRI ~/datasciencecoursera (master)
$ git push origin master
</code></pre>
<blockquote>
<p>ssh: Could not resolve hostname https: no address associated with name</p>
<p>fatal: Could not read from remote repository.</p>
<p>Please... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,263 | git | # Git Push Error - Could not resolve host name
```
nshastri@N-SHASTRI ~/datasciencecoursera (master)
$ git push origin master
```
> ssh: Could not resolve hostname https: no address associated with name
>
> fatal: Could not read from remote repository.
>
> Please make sure you have the correct access rights
> and the... | Simply type:
```
git remote -v
```
and double-check the url associated with `origin` for your [upstream repo](https://stackoverflow.com/a/2749166/6309).
Once you have the right url, update your remote origin with another [`git remote` command](http://git-scm.com/docs/git-remote):
```
git remote set-url origin /the/... |
12644855 | How do I reset a Heroku git repository to its initial state? | 21 | 2012-09-28 17:43:06 | <p>I have got a web application within a git repository. Due to historic reasons the web application is not at the root of the repository, it is within a folder called <code>website</code>. Beside that there are some other folders, so that I have got the following structure:</p>
<pre><code>myApp
+- .git
+- otherFolder... | 9,730 | 1,333,873 | 2014-09-10 19:22:11 | 13,403,588 | 54 | 2012-11-15 18:10:58 | 1,827,511 | 2012-11-15 18:10:58 | https://stackoverflow.com/q/12644855 | https://stackoverflow.com/a/13403588 | <p>You can nest git commands to execute force push.</p>
<p>For your case the command will be:</p>
<pre><code>git push heroku `git subtree split --prefix website master`:master --force
</code></pre>
| <p>You can nest git commands to execute force push.</p> <p>For your case the command will be:</p> <pre><code>git push heroku `git subtree split --prefix website master`:master --force </code></pre> | 119, 8279 | git, heroku | <h1>How do I reset a Heroku git repository to its initial state?</h1>
<p>I have got a web application within a git repository. Due to historic reasons the web application is not at the root of the repository, it is within a folder called <code>website</code>. Beside that there are some other folders, so that I have got... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,264 | git | # How do I reset a Heroku git repository to its initial state?
I have got a web application within a git repository. Due to historic reasons the web application is not at the root of the repository, it is within a folder called `website`. Beside that there are some other folders, so that I have got the following struc... | You can nest git commands to execute force push.
For your case the command will be:
```
git push heroku `git subtree split --prefix website master`:master --force
``` |
13840516 | How to find my distance to a known location in JavaScript | 19 | 2012-12-12 13:07:05 | <p>Using JavaScript in the browser, how can I determine the distance from my current location to another location for which I have the latitude and longitude?</p>
| 37,475 | 1,557,121 | 2022-02-08 14:39:04 | 13,841,047 | 54 | 2012-12-12 13:37:48 | 209,103 | 2015-05-06 17:51:05 | https://stackoverflow.com/q/13840516 | https://stackoverflow.com/a/13841047 | <p>If your code runs in a browser, you can use the HTML5 geolocation API:</p>
<pre><code>window.navigator.geolocation.getCurrentPosition(function(pos) {
console.log(pos);
var lat = pos.coords.latitude;
var lon = pos.coords.longitude;
})
</code></pre>
<p>Once you know the current position and the position of y... | <p>If your code runs in a browser, you can use the HTML5 geolocation API:</p> <pre><code>window.navigator.geolocation.getCurrentPosition(function(pos) { console.log(pos); var lat = pos.coords.latitude; var lon = pos.coords.longitude; }) </code></pre> <p>Once you know the current position and the position of y... | 3, 1372, 6238, 10580, 20301 | distance, geolocation, gps, javascript, latitude-longitude | <h1>How to find my distance to a known location in JavaScript</h1>
<p>Using JavaScript in the browser, how can I determine the distance from my current location to another location for which I have the latitude and longitude?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,265 | git | # How to find my distance to a known location in JavaScript
Using JavaScript in the browser, how can I determine the distance from my current location to another location for which I have the latitude and longitude? | If your code runs in a browser, you can use the HTML5 geolocation API:
```
window.navigator.geolocation.getCurrentPosition(function(pos) {
console.log(pos);
var lat = pos.coords.latitude;
var lon = pos.coords.longitude;
})
```
Once you know the current position and the position of your "target", you can calcu... |
10124223 | Pulling just one directory out of a git repo | 17 | 2012-04-12 13:08:04 | <p>I have a git repo that I want to do a pull from. I do a normal <code>git pull</code> with no problems. The issue is that I want just one certain directory out of the repo. My thinking was that I could use a <code>.gitignore</code> file with a rule like this:</p>
<pre><code>#Ignore all files
/
#Except the one I want... | 63,979 | 81,415 | 2012-08-04 12:19:00 | 10,124,421 | 54 | 2012-04-12 13:18:43 | 329,407 | 2012-08-04 12:19:00 | https://stackoverflow.com/q/10124223 | https://stackoverflow.com/a/10124421 | <p><code>git pull</code> fetches and merges the remote branch. </p>
<p><code>.gitignore</code> works only locally, and will hide matching entries from showing up on <code>git status</code> and being added to the index with <code>git add</code>. It's not what you want. </p>
<p>What you want to do, is <code>fetch</code... | <p><code>git pull</code> fetches and merges the remote branch. </p> <p><code>.gitignore</code> works only locally, and will hide matching entries from showing up on <code>git status</code> and being added to the index with <code>git add</code>. It's not what you want. </p> <p>What you want to do, is <code>fetch</code... | 119, 28896, 33720, 37230 | git, git-checkout, git-fetch, git-pull | <h1>Pulling just one directory out of a git repo</h1>
<p>I have a git repo that I want to do a pull from. I do a normal <code>git pull</code> with no problems. The issue is that I want just one certain directory out of the repo. My thinking was that I could use a <code>.gitignore</code> file with a rule like this:</p>
... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,266 | git | # Pulling just one directory out of a git repo
I have a git repo that I want to do a pull from. I do a normal `git pull` with no problems. The issue is that I want just one certain directory out of the repo. My thinking was that I could use a `.gitignore` file with a rule like this:
```
#Ignore all files
/
#Except th... | `git pull` fetches and merges the remote branch.
`.gitignore` works only locally, and will hide matching entries from showing up on `git status` and being added to the index with `git add`. It's not what you want.
What you want to do, is `fetch` the remote branch, and from that, extract the dir/file you need.
```
$ ... |
24491065 | Dart package dependency to subdirectory of git repo | 16 | 2014-06-30 13:18:17 | <p>I have a couple of small dart demo projects together in one git repository. Thus each project is in a subfolder of the repository and the yaml files of each of these projects is in the corresponding folder, not under the root of the repo. Is there a way to specify a git dependency to such a subfolder within a git re... | 5,737 | 2,166,690 | 2023-08-22 17:39:45 | 53,760,890 | 54 | 2018-12-13 11:31:35 | 25,124 | 2023-08-22 17:39:45 | https://stackoverflow.com/q/24491065 | https://stackoverflow.com/a/53760890 | <p>Several years on, support for this has been added:</p>
<p><a href="https://github.com/dart-lang/pub/pull/1650" rel="noreferrer">https://github.com/dart-lang/pub/pull/1650</a></p>
<p>You can now split the <code>git</code> dependency into a <code>url</code> and <code>path</code>:</p>
<pre><code>dependencies:
protobu... | <p>Several years on, support for this has been added:</p> <p><a href="https://github.com/dart-lang/pub/pull/1650" rel="noreferrer">https://github.com/dart-lang/pub/pull/1650</a></p> <p>You can now split the <code>git</code> dependency into a <code>url</code> and <code>path</code>:</p> <pre><code>dependencies: protobu... | 119, 73780, 85041 | dart, dart-pub, git | <h1>Dart package dependency to subdirectory of git repo</h1>
<p>I have a couple of small dart demo projects together in one git repository. Thus each project is in a subfolder of the repository and the yaml files of each of these projects is in the corresponding folder, not under the root of the repo. Is there a way to... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,267 | git | # Dart package dependency to subdirectory of git repo
I have a couple of small dart demo projects together in one git repository. Thus each project is in a subfolder of the repository and the yaml files of each of these projects is in the corresponding folder, not under the root of the repo. Is there a way to specify ... | Several years on, support for this has been added:
<https://github.com/dart-lang/pub/pull/1650>
You can now split the `git` dependency into a `url` and `path`:
```
dependencies:
protobuf:
git:
url: https://github.com/dart-lang/protobuf.git
path: protobuf
```
Further reading: <https://dart.dev/tool... |
40650366 | Move the annotation on Map like Uber iOS application | 16 | 2016-11-17 08:53:03 | <p>I am working on a project where I need to create a similar iOS application to UBER and OLA where the car is moving based on the location. I'm looking for some kind of Library which can make Cars move and take turns smoothly just like OLA. For now, I was able to move the car from one latitude-longitude to another. Bu... | 10,294 | 5,989,921 | 2022-04-26 07:02:40 | 40,651,099 | 54 | 2016-11-17 09:28:09 | 2,427,479 | 2022-04-26 07:02:40 | https://stackoverflow.com/q/40650366 | https://stackoverflow.com/a/40651099 | <p>Actually I had also one requirement in my previous iOS application, so please find the below URL for download the code and review it.</p>
<blockquote>
<p>Environment: Xcode 11 and Swift 5</p>
</blockquote>
<p>Link: <a href="https://github.com/ram2386/Track-Car" rel="nofollow noreferrer">https://github.com/ram2386/Tr... | <p>Actually I had also one requirement in my previous iOS application, so please find the below URL for download the code and review it.</p> <blockquote> <p>Environment: Xcode 11 and Swift 5</p> </blockquote> <p>Link: <a href="https://github.com/ram2386/Track-Car" rel="nofollow noreferrer">https://github.com/ram2386/Tr... | 7003, 20301, 38948, 47563, 104797 | latitude-longitude, mkannotation, mkmapview, objective-c, swift | <h1>Move the annotation on Map like Uber iOS application</h1>
<p>I am working on a project where I need to create a similar iOS application to UBER and OLA where the car is moving based on the location. I'm looking for some kind of Library which can make Cars move and take turns smoothly just like OLA. For now, I was a... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,268 | git | # Move the annotation on Map like Uber iOS application
I am working on a project where I need to create a similar iOS application to UBER and OLA where the car is moving based on the location. I'm looking for some kind of Library which can make Cars move and take turns smoothly just like OLA. For now, I was able to mo... | Actually I had also one requirement in my previous iOS application, so please find the below URL for download the code and review it.
> Environment: Xcode 11 and Swift 5
Link: <https://github.com/ram2386/Track-Car>
**Highlight of the code in which I had done it.**
For accomplished the functionality for moving the c... |
2236743 | git refusing to fetch into current branch | 111 | 2010-02-10 12:33:19 | <p>I set up a remote repository and I can push new changes to it, but I cannot fetch from it, I always get the (rather cryptic) error message:</p>
<pre><code>fatal: Refusing to fetch into current branch refs/heads/master of non-bare repository
fatal: The remote end hung up unexpectedly
</code></pre>
<p>What does it m... | 92,264 | 262,667 | 2025-09-03 09:17:39 | 2,236,805 | 53 | 2010-02-10 12:45:16 | 95,382 | 2010-02-10 12:45:16 | https://stackoverflow.com/q/2236743 | https://stackoverflow.com/a/2236805 | <p>What you're trying to do is to fetch the branch you're workin on. That is, you <em>are</em> on the master branch and you try to update it. That's not possible. It's more common to update the <code>remotes/*</code> branches and then pull it into your local ones. What you want is, perhaps,</p>
<pre><code>git remote a... | <p>What you're trying to do is to fetch the branch you're workin on. That is, you <em>are</em> on the master branch and you try to update it. That's not possible. It's more common to update the <code>remotes/*</code> branches and then pull it into your local ones. What you want is, perhaps,</p> <pre><code>git remote a... | 119, 33720 | git, git-fetch | <h1>git refusing to fetch into current branch</h1>
<p>I set up a remote repository and I can push new changes to it, but I cannot fetch from it, I always get the (rather cryptic) error message:</p>
<pre><code>fatal: Refusing to fetch into current branch refs/heads/master of non-bare repository
fatal: The remote end hu... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,269 | git | # git refusing to fetch into current branch
I set up a remote repository and I can push new changes to it, but I cannot fetch from it, I always get the (rather cryptic) error message:
```
fatal: Refusing to fetch into current branch refs/heads/master of non-bare repository
fatal: The remote end hung up unexpectedly
`... | What you're trying to do is to fetch the branch you're workin on. That is, you *are* on the master branch and you try to update it. That's not possible. It's more common to update the `remotes/*` branches and then pull it into your local ones. What you want is, perhaps,
```
git remote add otherrepo thehost:/the/path.g... |
25388499 | How can I run git push/pull commands with SSH verbose mode? | 106 | 2014-08-19 16:28:33 | <p>If I run "git push" with the GIT_TRACE=2 environment variable, I get the following:</p>
<pre><code>09:25:28.098743 git.c:349 trace: built-in: git 'push' 'origin' 'master'
09:25:28.100261 run-command.c:341 trace: run_command: 'ssh' 'git@bitbucket.org' 'git-receive-pack '\''kevinburke/letter.git'\... | 78,664 | 329,700 | 2019-10-22 19:25:42 | 25,390,120 | 53 | 2014-08-19 18:06:51 | 2,262,894 | 2017-01-16 17:42:36 | https://stackoverflow.com/q/25388499 | https://stackoverflow.com/a/25390120 | <p>Put this in your ~/.ssh/config file:</p>
<pre><code>Host <git-server-FQDN> LogLevel (QUIET|FATAL|ERROR|INFO|VERBOSE|DEBUG|DEBUG1|DEBUG2|DEBUG3)
</code></pre>
<p>Subsequent git commands that interact with the server should produce desired debug output.</p>
| <p>Put this in your ~/.ssh/config file:</p> <pre><code>Host <git-server-FQDN> LogLevel (QUIET|FATAL|ERROR|INFO|VERBOSE|DEBUG|DEBUG1|DEBUG2|DEBUG3) </code></pre> <p>Subsequent git commands that interact with the server should produce desired debug output.</p> | 119, 386 | git, ssh | <h1>How can I run git push/pull commands with SSH verbose mode?</h1>
<p>If I run "git push" with the GIT_TRACE=2 environment variable, I get the following:</p>
<pre><code>09:25:28.098743 git.c:349 trace: built-in: git 'push' 'origin' 'master'
09:25:28.100261 run-command.c:341 trace: run_command: 's... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,270 | git | # How can I run git push/pull commands with SSH verbose mode?
If I run "git push" with the GIT_TRACE=2 environment variable, I get the following:
```
09:25:28.098743 git.c:349 trace: built-in: git 'push' 'origin' 'master'
09:25:28.100261 run-command.c:341 trace: run_command: 'ssh' 'git@bitbucket.o... | Put this in your ~/.ssh/config file:
```
Host <git-server-FQDN> LogLevel (QUIET|FATAL|ERROR|INFO|VERBOSE|DEBUG|DEBUG1|DEBUG2|DEBUG3)
```
Subsequent git commands that interact with the server should produce desired debug output. |
41882919 | Is there a way to gpg sign all previous commits? | 74 | 2017-01-26 21:01:03 | <p>As the title says, I'm looking for a way to gpg sign all my previous commits in a repository (preferably without typing in my passcode for every commit).</p>
| 39,685 | 3,457,620 | 2026-01-20 16:00:39 | 41,883,164 | 53 | 2017-01-26 21:19:50 | 14,660 | 2017-01-26 21:25:18 | https://stackoverflow.com/q/41882919 | https://stackoverflow.com/a/41883164 | <p>You can, but it will have to rewrite your entire history to do so.</p>
<p>Signing a commit changes the commit which changes its commit ID. Since the commit ID depends on the previous commit ID, all commits after that have to be changed. And you're signing them all anyway.</p>
<p>If it's a personal repository that ... | <p>You can, but it will have to rewrite your entire history to do so.</p> <p>Signing a commit changes the commit which changes its commit ID. Since the commit ID depends on the previous commit ID, all commits after that have to be changed. And you're signing them all anyway.</p> <p>If it's a personal repository that ... | 119, 6735 | git, gnupg | <h1>Is there a way to gpg sign all previous commits?</h1>
<p>As the title says, I'm looking for a way to gpg sign all my previous commits in a repository (preferably without typing in my passcode for every commit).</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,273 | git | # Is there a way to gpg sign all previous commits?
As the title says, I'm looking for a way to gpg sign all my previous commits in a repository (preferably without typing in my passcode for every commit). | You can, but it will have to rewrite your entire history to do so.
Signing a commit changes the commit which changes its commit ID. Since the commit ID depends on the previous commit ID, all commits after that have to be changed. And you're signing them all anyway.
If it's a personal repository that nobody else is wo... |
49018053 | How large does a "large file" have to be to benefit from Git LFS? | 70 | 2018-02-27 21:14:45 | <p>I'm reading about <a href="https://git-lfs.github.com/" rel="noreferrer">Git LFS</a> and see time and again that it works great for "large files"</p>
<blockquote>
<p>Git Large File Storage (LFS) replaces large files such as audio samples, videos[...]</p>
</blockquote>
<h1></h1>
<blockquote>
<p>Version larg... | 32,827 | 531,762 | 2022-09-13 17:34:49 | 49,110,802 | 53 | 2018-03-05 12:43:45 | 6,603,816 | 2018-03-05 12:50:39 | https://stackoverflow.com/q/49018053 | https://stackoverflow.com/a/49110802 | <p>There is no exact threshold to define what is a large file. This is up to the user. To see if you need to store some files using Git LFS you need to understand how git works.</p>
<p>The most fundamental difference between Git and other source control tools (perforce, svn), is that Git stores a full snapshot of the ... | <p>There is no exact threshold to define what is a large file. This is up to the user. To see if you need to store some files using Git LFS you need to understand how git works.</p> <p>The most fundamental difference between Git and other source control tools (perforce, svn), is that Git stores a full snapshot of the ... | 119, 115244 | git, git-lfs | <h1>How large does a "large file" have to be to benefit from Git LFS?</h1>
<p>I'm reading about <a href="https://git-lfs.github.com/" rel="noreferrer">Git LFS</a> and see time and again that it works great for "large files"</p>
<blockquote>
<p>Git Large File Storage (LFS) replaces large files such as audio sa... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,274 | git | # How large does a "large file" have to be to benefit from Git LFS?
I'm reading about [Git LFS](https://git-lfs.github.com/) and see time and again that it works great for "large files"
> Git Large File Storage (LFS) replaces large files such as audio samples, videos[...]
#
> Version large files—even those as larg... | There is no exact threshold to define what is a large file. This is up to the user. To see if you need to store some files using Git LFS you need to understand how git works.
The most fundamental difference between Git and other source control tools (perforce, svn), is that Git stores a full snapshot of the repository... |
34120504 | How can I make docker-compose build an image from a remote git repository? | 68 | 2015-12-06 17:37:33 | <p>Docker-compose allows you to utilize either preëxisting docker images or build from source. For the build option, the <a href="https://docs.docker.com/compose/compose-file/" rel="noreferrer">official reference</a> requires</p>
<blockquote>
<p>Either a path to a directory containing a Dockerfile, <strong>or a url ... | 76,898 | 684,619 | 2022-02-08 17:18:45 | 34,120,804 | 53 | 2015-12-06 18:06:55 | 684,908 | 2017-04-03 16:25:19 | https://stackoverflow.com/q/34120504 | https://stackoverflow.com/a/34120804 | <p>Are you running version 1.5.2? It looks like this was actually recently added in <a href="https://github.com/docker/compose/pull/2430" rel="noreferrer">https://github.com/docker/compose/pull/2430</a>. Try upgrading.</p>
<p>Example:</p>
<pre><code>---
version: '2'
services:
redis:
image: "redis:3.2.3"
h... | <p>Are you running version 1.5.2? It looks like this was actually recently added in <a href="https://github.com/docker/compose/pull/2430" rel="noreferrer">https://github.com/docker/compose/pull/2430</a>. Try upgrading.</p> <p>Example:</p> <pre><code>--- version: '2' services: redis: image: "redis:3.2.3" h... | 119, 90304, 110604 | docker, docker-compose, git | <h1>How can I make docker-compose build an image from a remote git repository?</h1>
<p>Docker-compose allows you to utilize either preëxisting docker images or build from source. For the build option, the <a href="https://docs.docker.com/compose/compose-file/" rel="noreferrer">official reference</a> requires</p>
<bloc... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,275 | git | # How can I make docker-compose build an image from a remote git repository?
Docker-compose allows you to utilize either preëxisting docker images or build from source. For the build option, the [official reference](https://docs.docker.com/compose/compose-file/) requires
> Either a path to a directory containing a Do... | Are you running version 1.5.2? It looks like this was actually recently added in <https://github.com/docker/compose/pull/2430>. Try upgrading.
Example:
```
---
version: '2'
services:
redis:
image: "redis:3.2.3"
hostname: redis
redis-commander:
build: https://github.com/joeferner/redis-commander.git... |
28166547 | What are the differences between 'revert', 'amend,' 'rollback', and 'undo' a commit? | 63 | 2015-01-27 08:59:36 | <p>To help in my knowledge of git so I can use it day to day, what is the difference between:</p>
<ul>
<li>revert</li>
<li>amend</li>
<li>rollback</li>
<li>undo</li>
</ul>
<p>What are they and what do they do?</p>
| 53,738 | 3,602,256 | 2023-10-05 05:33:10 | 28,166,763 | 53 | 2015-01-27 09:13:07 | 2,541,573 | 2023-10-05 05:33:10 | https://stackoverflow.com/q/28166547 | https://stackoverflow.com/a/28166763 | <p>The terms <em>revert</em> and <em>amend</em> have a well-defined meaning in Git. In contrast, <em>rollback</em> and <em>undo</em> do not have such a well-defined meaning, and are open to interpretation.</p>
<h2>Reverting a commit...</h2>
<p>...means creating (on the current branch) a new commit that applies the inv... | <p>The terms <em>revert</em> and <em>amend</em> have a well-defined meaning in Git. In contrast, <em>rollback</em> and <em>undo</em> do not have such a well-defined meaning, and are open to interpretation.</p> <h2>Reverting a commit...</h2> <p>...means creating (on the current branch) a new commit that applies the inv... | 119, 5766, 12196, 30968, 34403 | git, git-amend, git-revert, rollback, undo | <h1>What are the differences between 'revert', 'amend,' 'rollback', and 'undo' a commit?</h1>
<p>To help in my knowledge of git so I can use it day to day, what is the difference between:</p>
<ul>
<li>revert</li>
<li>amend</li>
<li>rollback</li>
<li>undo</li>
</ul>
<p>What are they and what do they do?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,276 | git | # What are the differences between 'revert', 'amend,' 'rollback', and 'undo' a commit?
To help in my knowledge of git so I can use it day to day, what is the difference between:
- revert
- amend
- rollback
- undo
What are they and what do they do? | The terms *revert* and *amend* have a well-defined meaning in Git. In contrast, *rollback* and *undo* do not have such a well-defined meaning, and are open to interpretation.
## Reverting a commit...
...means creating (on the current branch) a new commit that applies the inverse changes that another commit introduced... |
298314 | Find files in git repo over x megabytes, that don't exist in HEAD | 58 | 2008-11-18 10:00:44 | <p>I have a Git repository I store random things in. Mostly random scripts, text files, websites I've designed and so on.</p>
<p>There are some large binary files I have deleted over time (generally 1-5MB), which are sitting around increasing the size of the repository, which I don't need in the revision history.</p>
... | 19,458 | 745 | 2023-09-28 09:55:02 | 298,888 | 53 | 2008-11-18 14:32:14 | 9,410 | 2013-03-06 12:14:24 | https://stackoverflow.com/q/298314 | https://stackoverflow.com/a/298888 | <p>This is an adaptation of <a href="https://stackoverflow.com/questions/223678/git-which-commit-has-this-blob#223890">the <code>git-find-blob</code> script I posted previously</a>:</p>
<pre class="lang-perl prettyprint-override"><code>#!/usr/bin/perl
use 5.008;
use strict;
use Memoize;
sub usage { die "usage: git-la... | <p>This is an adaptation of <a href="https://stackoverflow.com/questions/223678/git-which-commit-has-this-blob#223890">the <code>git-find-blob</code> script I posted previously</a>:</p> <pre class="lang-perl prettyprint-override"><code>#!/usr/bin/perl use 5.008; use strict; use Memoize; sub usage { die "usage: git-la... | 119 | git | <h1>Find files in git repo over x megabytes, that don't exist in HEAD</h1>
<p>I have a Git repository I store random things in. Mostly random scripts, text files, websites I've designed and so on.</p>
<p>There are some large binary files I have deleted over time (generally 1-5MB), which are sitting around increasing t... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,279 | git | # Find files in git repo over x megabytes, that don't exist in HEAD
I have a Git repository I store random things in. Mostly random scripts, text files, websites I've designed and so on.
There are some large binary files I have deleted over time (generally 1-5MB), which are sitting around increasing the size of the r... | This is an adaptation of [the `git-find-blob` script I posted previously](https://stackoverflow.com/questions/223678/git-which-commit-has-this-blob#223890):
```
#!/usr/bin/perl
use 5.008;
use strict;
use Memoize;
sub usage { die "usage: git-large-blob <size[b|k|m]> [<git-log arguments ...>]\n" }
@ARGV or usage();
my... |
25169440 | Remove/hide git branches without deleting commit histories | 54 | 2014-08-06 20:18:58 | <p><strong>Situation:</strong></p>
<p>I have a main repo with a main dev branch and lots of "experiment" branches sprouting off from it (e.g., <code>exp1</code> and <code>exp2</code>). The purpose of these experiment branches is to serve as placeholders for experiments that generate numerical results. I record the b... | 25,084 | 1,325,279 | 2022-07-22 19:09:07 | 25,173,231 | 53 | 2014-08-07 02:24:40 | 1,256,452 | 2022-07-22 19:09:07 | https://stackoverflow.com/q/25169440 | https://stackoverflow.com/a/25173231 | <p>Here's one alternative: use non-branch references to save the branch-tips before deleting the branch names.</p>
<p>Since these are non-branch references, they won't show up in <code>git branch</code> output, nor in stuff shown by <code>git log --branches</code> and <code>gitk --branches</code>, for instance. Howeve... | <p>Here's one alternative: use non-branch references to save the branch-tips before deleting the branch names.</p> <p>Since these are non-branch references, they won't show up in <code>git branch</code> output, nor in stuff shown by <code>git log --branches</code> and <code>gitk --branches</code>, for instance. Howeve... | 119, 76220, 106108 | git, git-branch, git-branch-sculpting | <h1>Remove/hide git branches without deleting commit histories</h1>
<p><strong>Situation:</strong></p>
<p>I have a main repo with a main dev branch and lots of "experiment" branches sprouting off from it (e.g., <code>exp1</code> and <code>exp2</code>). The purpose of these experiment branches is to serve as placehold... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,280 | git | # Remove/hide git branches without deleting commit histories
**Situation:**
I have a main repo with a main dev branch and lots of "experiment" branches sprouting off from it (e.g., `exp1` and `exp2`). The purpose of these experiment branches is to serve as placeholders for experiments that generate numerical results.... | Here's one alternative: use non-branch references to save the branch-tips before deleting the branch names.
Since these are non-branch references, they won't show up in `git branch` output, nor in stuff shown by `git log --branches` and `gitk --branches`, for instance. However, they will show up in `--all` listings, a... |
5427414 | Editing a git submodule | 54 | 2011-03-25 00:57:26 | <p>Is this possible? Imagine I have projects Parent & Child. Both are git respositories. Child is a submodule of Parent.</p>
<p>Can I make edits to the version of Child that is inside Parent & commit & push them just like a regular repository?</p>
<p>Or do I need a separate clone of Child somewhere that I... | 45,106 | 134,595 | 2011-03-25 09:43:19 | 5,427,432 | 53 | 2011-03-25 01:01:09 | 16,271 | 2011-03-25 09:43:19 | https://stackoverflow.com/q/5427414 | https://stackoverflow.com/a/5427432 | <p>You don't need a seperate clone. The sub-module folder is a world of its own. Just edit, commit, branch, and push to your heart's delight.</p>
<p>Git is great that way. :-)</p>
<p>BTW, the parent repository will even detect when changes happen inside the sub-module folder and offer you to commit the current state ... | <p>You don't need a seperate clone. The sub-module folder is a world of its own. Just edit, commit, branch, and push to your heart's delight.</p> <p>Git is great that way. :-)</p> <p>BTW, the parent repository will even detect when changes happen inside the sub-module folder and offer you to commit the current state ... | 119, 41612 | git, git-submodules | <h1>Editing a git submodule</h1>
<p>Is this possible? Imagine I have projects Parent & Child. Both are git respositories. Child is a submodule of Parent.</p>
<p>Can I make edits to the version of Child that is inside Parent & commit & push them just like a regular repository?</p>
<p>Or do I need a separat... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,281 | git | # Editing a git submodule
Is this possible? Imagine I have projects Parent & Child. Both are git respositories. Child is a submodule of Parent.
Can I make edits to the version of Child that is inside Parent & commit & push them just like a regular repository?
Or do I need a separate clone of Child somewhere that I m... | You don't need a seperate clone. The sub-module folder is a world of its own. Just edit, commit, branch, and push to your heart's delight.
Git is great that way. :-)
BTW, the parent repository will even detect when changes happen inside the sub-module folder and offer you to commit the current state of the sub-module... |
923956 | How to back up private branches in git | 54 | 2009-05-29 01:01:06 | <p>I have a local branch for day-to-day dev work in git. My workflow is:</p>
<ol>
<li>Do stuff on local_branch, commit</li>
<li>Fetch origin/master </li>
<li>Rebase local_branch to catch up with new stuff from origin/master</li>
</ol>
<p>It all works fine, however most of the recommendations I encountered say that on... | 23,309 | 62,194 | 2014-07-30 01:38:32 | 930,160 | 53 | 2009-05-30 17:26:12 | 825 | 2011-11-11 02:41:54 | https://stackoverflow.com/q/923956 | https://stackoverflow.com/a/930160 | <p>I use the --mirror option and push to a personal backup repository:</p>
<p>Add it as a remote:</p>
<pre><code>git remote add bak server:/path/to/backup/repo
</code></pre>
<p>Do the backup:</p>
<pre><code>git push --mirror bak
</code></pre>
<p>This will automatically make your backup repository look like your ac... | <p>I use the --mirror option and push to a personal backup repository:</p> <p>Add it as a remote:</p> <pre><code>git remote add bak server:/path/to/backup/repo </code></pre> <p>Do the backup:</p> <pre><code>git push --mirror bak </code></pre> <p>This will automatically make your backup repository look like your ac... | 119, 717, 758, 8974, 17650 | dropbox, git, merge, rebase, workflow | <h1>How to back up private branches in git</h1>
<p>I have a local branch for day-to-day dev work in git. My workflow is:</p>
<ol>
<li>Do stuff on local_branch, commit</li>
<li>Fetch origin/master </li>
<li>Rebase local_branch to catch up with new stuff from origin/master</li>
</ol>
<p>It all works fine, however most ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,282 | git | # How to back up private branches in git
I have a local branch for day-to-day dev work in git. My workflow is:
1. Do stuff on local_branch, commit
2. Fetch origin/master
3. Rebase local_branch to catch up with new stuff from origin/master
It all works fine, however most of the recommendations I encountered say that ... | I use the --mirror option and push to a personal backup repository:
Add it as a remote:
```
git remote add bak server:/path/to/backup/repo
```
Do the backup:
```
git push --mirror bak
```
This will automatically make your backup repository look like your active one -- branches will be created, deleted, updated (ev... |
22081209 | Find the root of the git repository where the file lives | 52 | 2014-02-27 21:47:41 | <p>When working in Python (e.g. running a script), how can I find the path of the root of the git repository where the script lives?</p>
<p>So far I know I can get the current path with:</p>
<pre><code>path_to_containing_folder = os.path.dirname(os.path.realpath(__file__))
</code></pre>
<p>How can I then find out wh... | 68,288 | 283,296 | 2021-05-13 08:23:34 | 41,920,796 | 53 | 2017-01-29 12:17:59 | 4,705,274 | 2017-01-29 12:17:59 | https://stackoverflow.com/q/22081209 | https://stackoverflow.com/a/41920796 | <p>Use the GitPython module <a href="http://gitpython.readthedocs.io/en/stable/" rel="noreferrer">http://gitpython.readthedocs.io/en/stable/</a>.</p>
<pre><code>pip install gitpython
</code></pre>
<p>Assume you have a local Git repo at <code>/path/to/.git</code>. The below example receives <code>/path/to/your/file</c... | <p>Use the GitPython module <a href="http://gitpython.readthedocs.io/en/stable/" rel="noreferrer">http://gitpython.readthedocs.io/en/stable/</a>.</p> <pre><code>pip install gitpython </code></pre> <p>Assume you have a local Git repo at <code>/path/to/.git</code>. The below example receives <code>/path/to/your/file</c... | 16, 119 | git, python | <h1>Find the root of the git repository where the file lives</h1>
<p>When working in Python (e.g. running a script), how can I find the path of the root of the git repository where the script lives?</p>
<p>So far I know I can get the current path with:</p>
<pre><code>path_to_containing_folder = os.path.dirname(os.pat... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,283 | git | # Find the root of the git repository where the file lives
When working in Python (e.g. running a script), how can I find the path of the root of the git repository where the script lives?
So far I know I can get the current path with:
```
path_to_containing_folder = os.path.dirname(os.path.realpath(__file__))
```
... | Use the GitPython module <http://gitpython.readthedocs.io/en/stable/>.
```
pip install gitpython
```
Assume you have a local Git repo at `/path/to/.git`. The below example receives `/path/to/your/file` as input, it correctly returns the Git root as `/path/to/`.
```
import git
def get_git_root(path):
git_re... |
41403456 | What is the format of <pattern> in git-branch --list | 51 | 2016-12-30 22:26:58 | <p>As title, I have read <a href="http://www.kernel.org/pub/software/scm/git/docs/git-branch.html" rel="noreferrer">the manual</a> but in vain.</p>
<p>What I found is that a <code>*</code> can be wildcard pattern matching.</p>
<pre><code>git branch --list 'issues*6'
issues/586
issues/616
</code></pre>
<p>However, ... | 36,481 | 1,009,442 | 2022-02-14 20:02:16 | 41,403,591 | 53 | 2016-12-30 22:39:56 | 1,256,452 | 2019-07-11 18:05:52 | https://stackoverflow.com/q/41403456 | https://stackoverflow.com/a/41403591 | <p>Quoting from that same <a href="https://www.kernel.org/pub/software/scm/git/docs/git-branch.html" rel="noreferrer">manual page you linked</a>:</p>
<blockquote>
<p>If <code>--list</code> is given, or if there are no non-option arguments, existing branches are listed; the current branch will be highlighted with an ... | <p>Quoting from that same <a href="https://www.kernel.org/pub/software/scm/git/docs/git-branch.html" rel="noreferrer">manual page you linked</a>:</p> <blockquote> <p>If <code>--list</code> is given, or if there are no non-option arguments, existing branches are listed; the current branch will be highlighted with an ... | 119 | git | <h1>What is the format of <pattern> in git-branch --list</h1>
<p>As title, I have read <a href="http://www.kernel.org/pub/software/scm/git/docs/git-branch.html" rel="noreferrer">the manual</a> but in vain.</p>
<p>What I found is that a <code>*</code> can be wildcard pattern matching.</p>
<pre><code>git branch --list ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,284 | git | # What is the format of in git-branch --list
As title, I have read [the manual](http://www.kernel.org/pub/software/scm/git/docs/git-branch.html) but in vain.
What I found is that a `*` can be wildcard pattern matching.
```
git branch --list 'issues*6'
issues/586
issues/616
```
However, it's found by myself instea... | Quoting from that same [manual page you linked](https://www.kernel.org/pub/software/scm/git/docs/git-branch.html):
> If `--list` is given, or if there are no non-option arguments, existing branches are listed; the current branch will be highlighted with an asterisk. Option `-r` causes the remote-tracking branches to b... |
1754491 | Is there a way to configure git repository to reject 'git push --force'? | 51 | 2009-11-18 08:38:51 | <p>I was wondering is there a way to prevent '<code>git push --force</code>' on a repository (only on master branch)?</p>
<p>Assume I have remote git repository and do:</p>
<ul>
<li>'<code>git push</code>' to 'master'. It works.</li>
<li>'<code>git push --force</code>' to 'branch-1'. It works.</li>
<li>'<code>git push ... | 23,330 | 86,249 | 2023-09-19 13:19:46 | 1,754,553 | 53 | 2009-11-18 08:51:31 | 19,563 | 2009-11-18 08:51:31 | https://stackoverflow.com/q/1754491 | https://stackoverflow.com/a/1754553 | <p>Setting the configuration variables:</p>
<pre><code>receive.denyNonFastForwards
receive.denyDeletes
</code></pre>
<p>will prevent any 'forced' pushes from working across all branches.</p>
<p>If you want finer pre-branch control then you will have to use a 'hook' on the remote repository, probably the 'update' hoo... | <p>Setting the configuration variables:</p> <pre><code>receive.denyNonFastForwards receive.denyDeletes </code></pre> <p>will prevent any 'forced' pushes from working across all branches.</p> <p>If you want finer pre-branch control then you will have to use a 'hook' on the remote repository, probably the 'update' hoo... | 119 | git | <h1>Is there a way to configure git repository to reject 'git push --force'?</h1>
<p>I was wondering is there a way to prevent '<code>git push --force</code>' on a repository (only on master branch)?</p>
<p>Assume I have remote git repository and do:</p>
<ul>
<li>'<code>git push</code>' to 'master'. It works.</li>
<li>... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,285 | git | # Is there a way to configure git repository to reject 'git push --force'?
I was wondering is there a way to prevent '`git push --force`' on a repository (only on master branch)?
Assume I have remote git repository and do:
- '`git push`' to 'master'. It works.
- '`git push --force`' to 'branch-1'. It works.
- '`git ... | Setting the configuration variables:
```
receive.denyNonFastForwards
receive.denyDeletes
```
will prevent any 'forced' pushes from working across all branches.
If you want finer pre-branch control then you will have to use a 'hook' on the remote repository, probably the 'update' hook.
There is a sample update hook ... |
8495103 | git stash and pop shows file no longer marked as moved? | 41 | 2011-12-13 19:38:13 | <pre><code>git mv file1 file2
git status
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# renamed: file1 -> file2
git stash
git stash pop
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# new file: ... | 7,885 | 743,464 | 2015-10-23 19:03:21 | 8,496,145 | 53 | 2011-12-13 21:04:05 | 526,535 | 2015-10-23 19:03:21 | https://stackoverflow.com/q/8495103 | https://stackoverflow.com/a/8496145 | <p>If you <strong>haven't already popped</strong> your stash, do:</p>
<pre><code>git stash pop --index
</code></pre>
<p>This correctly preserves moved (but not committed) file relationships in a stash. According to <code>git help stash</code>:</p>
<blockquote>
<p>If the --index option is used, then tries to reinst... | <p>If you <strong>haven't already popped</strong> your stash, do:</p> <pre><code>git stash pop --index </code></pre> <p>This correctly preserves moved (but not committed) file relationships in a stash. According to <code>git help stash</code>:</p> <blockquote> <p>If the --index option is used, then tries to reinst... | 119, 13091 | git, git-stash | <h1>git stash and pop shows file no longer marked as moved?</h1>
<pre><code>git mv file1 file2
git status
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# renamed: file1 -> file2
git stash
git stash pop
# On branch master
# Changes to be committed:
# (... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,288 | git | # git stash and pop shows file no longer marked as moved?
```
git mv file1 file2
git status
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# renamed: file1 -> file2
git stash
git stash pop
# On branch master
# Changes to be committed:
# (use "git reset HEAD <f... | If you **haven't already popped** your stash, do:
```
git stash pop --index
```
This correctly preserves moved (but not committed) file relationships in a stash. According to `git help stash`:
> If the --index option is used, then tries to reinstate not only the working tree's changes, but also the index's ones. How... |
39332407 | Git hooks : applying `git config core.hooksPath` | 40 | 2016-09-05 14:08:01 | <p>I have a git repository with a pre-commit hook set up :</p>
<pre><code>my-repo
|- .git
|- hooks
|- pre-commit # I made this file executable
</code></pre>
<p>Until there, everything works. The hook is running when I commit.</p>
<p>=================================</p>
<p>I now run <code>git config co... | 64,891 | 1,621,232 | 2023-12-13 07:22:18 | 39,338,979 | 53 | 2016-09-06 00:08:08 | 1,256,452 | 2016-09-06 00:08:08 | https://stackoverflow.com/q/39332407 | https://stackoverflow.com/a/39338979 | <p>The <code>core.hooksPath</code> support is <a href="https://github.com/git/git/blob/master/Documentation/RelNotes/2.9.0.txt#L127-L128" rel="noreferrer">new in Git version 2.9</a>, having been put in with <a href="https://github.com/git/git/commit/867ad08a2610526edb5723804723d371136fc643" rel="noreferrer">commit <cod... | <p>The <code>core.hooksPath</code> support is <a href="https://github.com/git/git/blob/master/Documentation/RelNotes/2.9.0.txt#L127-L128" rel="noreferrer">new in Git version 2.9</a>, having been put in with <a href="https://github.com/git/git/commit/867ad08a2610526edb5723804723d371136fc643" rel="noreferrer">commit <cod... | 119, 43087 | git, githooks | <h1>Git hooks : applying `git config core.hooksPath`</h1>
<p>I have a git repository with a pre-commit hook set up :</p>
<pre><code>my-repo
|- .git
|- hooks
|- pre-commit # I made this file executable
</code></pre>
<p>Until there, everything works. The hook is running when I commit.</p>
<p>=============... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,290 | git | # Git hooks : applying `git config core.hooksPath`
I have a git repository with a pre-commit hook set up :
```
my-repo
|- .git
|- hooks
|- pre-commit # I made this file executable
```
Until there, everything works. The hook is running when I commit.
=================================
I now run `git con... | The `core.hooksPath` support is [new in Git version 2.9](https://github.com/git/git/blob/master/Documentation/RelNotes/2.9.0.txt#L127-L128), having been put in with [commit `867ad08a2610526edb5723804723d371136fc643`](https://github.com/git/git/commit/867ad08a2610526edb5723804723d371136fc643). If your Git version is not... |
3629545 | Is git commit -am redundant, if I do git add before? | 40 | 2010-09-02 17:21:52 | <p>Is it redundant to run <code>git add .</code> and then <code>git commit -am "commit message"</code>?</p>
<p>Can I just run <code>git add .</code> and then <code>git commit -m "commit message"</code> or, alternatively, just <code>git commit -am "commit message"</code>?</p>
| 28,033 | 168,286 | 2018-07-02 11:54:56 | 3,629,580 | 53 | 2010-09-02 17:26:18 | 40,657 | 2010-09-02 17:26:18 | https://stackoverflow.com/q/3629545 | https://stackoverflow.com/a/3629580 | <p><code>Git add</code> + <code>git commit -m</code> will just commit those files you've added (new and previously tracked), but <code>git commit -am</code> will commit all changes on tracked files, but it doesn't add new files.</p>
| <p><code>Git add</code> + <code>git commit -m</code> will just commit those files you've added (new and previously tracked), but <code>git commit -am</code> will commit all changes on tracked files, but it doesn't add new files.</p> | 119 | git | <h1>Is git commit -am redundant, if I do git add before?</h1>
<p>Is it redundant to run <code>git add .</code> and then <code>git commit -am "commit message"</code>?</p>
<p>Can I just run <code>git add .</code> and then <code>git commit -m "commit message"</code> or, alternatively, just <code>git commit -am "commit me... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,291 | git | # Is git commit -am redundant, if I do git add before?
Is it redundant to run `git add .` and then `git commit -am "commit message"`?
Can I just run `git add .` and then `git commit -m "commit message"` or, alternatively, just `git commit -am "commit message"`? | `Git add` + `git commit -m` will just commit those files you've added (new and previously tracked), but `git commit -am` will commit all changes on tracked files, but it doesn't add new files. |
46706821 | Create new branch based on current branch to work on a new feature | 39 | 2017-10-12 10:04:45 | <p>How do I create a new branch in <code>git</code> to begin work on a new feature?</p>
<p>I want the new branch to be a duplicate of the current branch (ie, the new branch's HEAD should be the same as the current HEAD).</p>
<hr />
<p>Question differentiation:</p>
<ul>
<li><a href="https://stackoverflow.com/q/4470523/5... | 109,904 | 5,353,461 | 2020-09-24 19:55:07 | 46,706,822 | 53 | 2017-10-12 10:04:45 | 5,353,461 | 2018-09-01 10:12:51 | https://stackoverflow.com/q/46706821 | https://stackoverflow.com/a/46706822 | <p><strong>TL;DR:</strong></p>
<p>To create and start work on a new branch called <code>FEATURE</code>, you do:</p>
<pre><code>git checkout -b FEATURE
</code></pre>
<p><strong>Detailed explanation</strong></p>
<p>To create a branch called <code>FEATURE</code>:</p>
<pre><code>git branch FEATURE
</code></pre>
<p>Ho... | <p><strong>TL;DR:</strong></p> <p>To create and start work on a new branch called <code>FEATURE</code>, you do:</p> <pre><code>git checkout -b FEATURE </code></pre> <p><strong>Detailed explanation</strong></p> <p>To create a branch called <code>FEATURE</code>:</p> <pre><code>git branch FEATURE </code></pre> <p>Ho... | 119, 37230, 76220 | git, git-branch, git-checkout | <h1>Create new branch based on current branch to work on a new feature</h1>
<p>How do I create a new branch in <code>git</code> to begin work on a new feature?</p>
<p>I want the new branch to be a duplicate of the current branch (ie, the new branch's HEAD should be the same as the current HEAD).</p>
<hr />
<p>Question ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,292 | git | # Create new branch based on current branch to work on a new feature
How do I create a new branch in `git` to begin work on a new feature?
I want the new branch to be a duplicate of the current branch (ie, the new branch's HEAD should be the same as the current HEAD).
---
Question differentiation:
- [Create a bran... | **TL;DR:**
To create and start work on a new branch called `FEATURE`, you do:
```
git checkout -b FEATURE
```
**Detailed explanation**
To create a branch called `FEATURE`:
```
git branch FEATURE
```
However, this does not change your current branch.
You can then `checkout` the newly created branch (which means m... |
23898093 | Stash the changes made with atlassian sourcetree | 36 | 2014-05-27 20:13:43 | <p>I have a lot of files changed in my project. I want to stash 2 files but i'm a bit afraid to make a mistake since i never did this.</p>
<p>If i would stash now, will it only stash the 2 staged files?
<img src="https://i.sstatic.net/fb9Jc.png" alt="enter image description here"></p>
<p>And if I don't mark the "Keep... | 60,477 | 1,022,707 | 2020-09-02 04:36:58 | 23,898,314 | 53 | 2014-05-27 20:27:34 | null | 2014-05-27 20:27:34 | https://stackoverflow.com/q/23898093 | https://stackoverflow.com/a/23898314 | <p>This applies to Git in general, not just with SourceTree. When you stash changes, the items that will be stashed are the changes to <strong>tracked files</strong> in your working copy and in the staging area. <strong>Those changes will be saved in the stash</strong>, and reverted in the working copy and index.</p>
... | <p>This applies to Git in general, not just with SourceTree. When you stash changes, the items that will be stashed are the changes to <strong>tracked files</strong> in your working copy and in the staging area. <strong>Those changes will be saved in the stash</strong>, and reverted in the working copy and index.</p> ... | 119, 13091, 90056 | atlassian-sourcetree, git, git-stash | <h1>Stash the changes made with atlassian sourcetree</h1>
<p>I have a lot of files changed in my project. I want to stash 2 files but i'm a bit afraid to make a mistake since i never did this.</p>
<p>If i would stash now, will it only stash the 2 staged files?
<img src="https://i.sstatic.net/fb9Jc.png" alt="enter imag... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,294 | git | # Stash the changes made with atlassian sourcetree
I have a lot of files changed in my project. I want to stash 2 files but i'm a bit afraid to make a mistake since i never did this.
If i would stash now, will it only stash the 2 staged files?

And if I... | This applies to Git in general, not just with SourceTree. When you stash changes, the items that will be stashed are the changes to **tracked files** in your working copy and in the staging area. **Those changes will be saved in the stash**, and reverted in the working copy and index.
**When you choose to keep changes... |
25807094 | List modified file names in a git stash | 34 | 2014-09-12 11:19:16 | <p>Can I list the names of the modified files in a stash, without their contents?</p>
<p>While searching, I only found people printing the whole diff, couldn't manage to view the filenames only.</p>
| 19,198 | 207,655 | 2015-05-08 10:53:45 | 25,813,763 | 53 | 2014-09-12 17:33:32 | 1,256,452 | 2014-09-12 17:33:32 | https://stackoverflow.com/q/25807094 | https://stackoverflow.com/a/25813763 | <p>The <code>show</code> sub-command, in the end, invokes <code>git diff</code> with whatever flags you have set, or <code>--stat</code> if you did not set any, so simply <code>git stash show --name-only</code>, which runs <code>git diff --name-only</code> between the base commit and the work-tree commit.</p>
<p>(See ... | <p>The <code>show</code> sub-command, in the end, invokes <code>git diff</code> with whatever flags you have set, or <code>--stat</code> if you did not set any, so simply <code>git stash show --name-only</code>, which runs <code>git diff --name-only</code> between the base commit and the work-tree commit.</p> <p>(See ... | 119, 13091 | git, git-stash | <h1>List modified file names in a git stash</h1>
<p>Can I list the names of the modified files in a stash, without their contents?</p>
<p>While searching, I only found people printing the whole diff, couldn't manage to view the filenames only.</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,297 | git | # List modified file names in a git stash
Can I list the names of the modified files in a stash, without their contents?
While searching, I only found people printing the whole diff, couldn't manage to view the filenames only. | The `show` sub-command, in the end, invokes `git diff` with whatever flags you have set, or `--stat` if you did not set any, so simply `git stash show --name-only`, which runs `git diff --name-only` between the base commit and the work-tree commit.
(See [here](https://stackoverflow.com/a/20412685/1256452) and [here](h... |
14201443 | How to rename last N commits messages in git? | 34 | 2013-01-07 18:01:17 | <p>I have 30 commits and I want to add "Bug XXXXXXX" at the beginning of all the messages, can I do this in a single action/command?</p>
<p>I'm trying to avoid squashing them.</p>
| 20,823 | 982,921 | 2025-04-29 23:38:39 | 14,201,492 | 53 | 2013-01-07 18:05:17 | 1,020,470 | 2025-04-29 23:38:39 | https://stackoverflow.com/q/14201443 | https://stackoverflow.com/a/14201492 | <p>Use <code>git rebase -i HEAD~<N></code> where N is the number of commits to go back, and <code>-i</code> will make it interactive, ie it will open in vim or whatever your default editor is. See <a href="https://git-scm.com/book/en/v2/Git-Tools-Rewriting-History" rel="nofollow noreferrer">Scott Chacon's Book</a... | <p>Use <code>git rebase -i HEAD~<N></code> where N is the number of commits to go back, and <code>-i</code> will make it interactive, ie it will open in vim or whatever your default editor is. See <a href="https://git-scm.com/book/en/v2/Git-Tools-Rewriting-History" rel="nofollow noreferrer">Scott Chacon's Book</a... | 119 | git | <h1>How to rename last N commits messages in git?</h1>
<p>I have 30 commits and I want to add "Bug XXXXXXX" at the beginning of all the messages, can I do this in a single action/command?</p>
<p>I'm trying to avoid squashing them.</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,298 | git | # How to rename last N commits messages in git?
I have 30 commits and I want to add "Bug XXXXXXX" at the beginning of all the messages, can I do this in a single action/command?
I'm trying to avoid squashing them. | Use `git rebase -i HEAD~<N>` where N is the number of commits to go back, and `-i` will make it interactive, ie it will open in vim or whatever your default editor is. See [Scott Chacon's Book](https://git-scm.com/book/en/v2/Git-Tools-Rewriting-History). Then you can change the commit message.
If you need it automated... |
56125354 | Git push after rebase | 33 | 2019-05-14 07:46:23 | <p>I'm doing this:</p>
<pre><code>git checkout master
git pull
git checkout feature
git rebase origin/master
</code></pre>
<p>then resolve all the problems...
Try to push - not gonna happen...</p>
<p>Git is telling me that after doing a rebase,
I have two options:</p>
<ul>
<li><p>use <code>--force</code>, which seems r... | 41,733 | 8,905,843 | 2024-05-19 21:07:00 | 56,125,603 | 53 | 2019-05-14 08:00:30 | 3,866,623 | 2019-05-14 08:00:30 | https://stackoverflow.com/q/56125354 | https://stackoverflow.com/a/56125603 | <p>There is nothing wrong with <code>git push --force</code> on principle.</p>
<p>What it does is to replace the remote head of your branch with your local.</p>
<p>There are two cases, one where it is fine to push force, and one where it is not fine at all:</p>
<p>If you rebased (and therefore created a new chain of... | <p>There is nothing wrong with <code>git push --force</code> on principle.</p> <p>What it does is to replace the remote head of your branch with your local.</p> <p>There are two cases, one where it is fine to push force, and one where it is not fine at all:</p> <p>If you rebased (and therefore created a new chain of... | 119, 4236, 8974 | git, push, rebase | <h1>Git push after rebase</h1>
<p>I'm doing this:</p>
<pre><code>git checkout master
git pull
git checkout feature
git rebase origin/master
</code></pre>
<p>then resolve all the problems...
Try to push - not gonna happen...</p>
<p>Git is telling me that after doing a rebase,
I have two options:</p>
<ul>
<li><p>use <cod... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,299 | git | # Git push after rebase
I'm doing this:
```
git checkout master
git pull
git checkout feature
git rebase origin/master
```
then resolve all the problems...
Try to push - not gonna happen...
Git is telling me that after doing a rebase,
I have two options:
- use `--force`, which seems risky and stupid
- or `pull` ag... | There is nothing wrong with `git push --force` on principle.
What it does is to replace the remote head of your branch with your local.
There are two cases, one where it is fine to push force, and one where it is not fine at all:
If you rebased (and therefore created a new chain of commits for your branch), your bra... |
20757601 | git splitting repository by subfolder and retain all old branches | 32 | 2013-12-24 08:40:15 | <p>I have a git repo with 2 directories and multiple branches, I want to split them and create all branches</p>
<pre><code>`-- Big-repo
|-- dir1
`-- dir2
Branches : branch1, branch2, branch3 ...
</code></pre>
<p><strong>What I want</strong></p>
<p>I want to split dir1 and dir2 as two separate repos and reta... | 9,240 | 1,520,502 | 2018-06-18 20:45:44 | 20,793,890 | 53 | 2013-12-27 02:23:08 | 214,373 | 2015-04-12 14:01:59 | https://stackoverflow.com/q/20757601 | https://stackoverflow.com/a/20793890 | <h2>Short answer</h2>
<p><a href="http://git-scm.com/docs/git-filter-branch" rel="noreferrer"><code>git filter-branch</code></a> offers exactly the functionality you want. With the <code>--subdirectory-filter</code> option you can create a new set of commits where the contents of <code>subDirectory</code> are at the r... | <h2>Short answer</h2> <p><a href="http://git-scm.com/docs/git-filter-branch" rel="noreferrer"><code>git filter-branch</code></a> offers exactly the functionality you want. With the <code>--subdirectory-filter</code> option you can create a new set of commits where the contents of <code>subDirectory</code> are at the r... | 119, 41612, 46509, 68200 | git, git-filter-branch, git-submodules, git-subtree | <h1>git splitting repository by subfolder and retain all old branches</h1>
<p>I have a git repo with 2 directories and multiple branches, I want to split them and create all branches</p>
<pre><code>`-- Big-repo
|-- dir1
`-- dir2
Branches : branch1, branch2, branch3 ...
</code></pre>
<p><strong>What I want</s... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,302 | git | # git splitting repository by subfolder and retain all old branches
I have a git repo with 2 directories and multiple branches, I want to split them and create all branches
```
`-- Big-repo
|-- dir1
`-- dir2
Branches : branch1, branch2, branch3 ...
```
**What I want**
I want to split dir1 and dir2 as two s... | ## Short answer
[`git filter-branch`](http://git-scm.com/docs/git-filter-branch) offers exactly the functionality you want. With the `--subdirectory-filter` option you can create a new set of commits where the contents of `subDirectory` are at the root of the directory.
```
git filter-branch --prune-empty --subdirect... |
12427779 | How do you make Git ignore spaces and tabs? | 32 | 2012-09-14 15:40:38 | <p>I have a small scripting project that consists of five different source files in one directory called "Droid XX-XX-XX". Each time I created a new backup copy of the source directory, I put the date in the X's. So there are about 15 different versions from different dates. I want to add each of these to my bare new G... | 50,224 | 811,519 | 2016-03-09 01:54:55 | 12,428,451 | 53 | 2012-09-14 16:26:43 | 498,594 | 2015-06-29 19:37:07 | https://stackoverflow.com/q/12427779 | https://stackoverflow.com/a/12428451 | <p>It's sounding like you need more control and standardization of the development process. The one who commits changes should be the same person who modifies the files. Or at least the committer should know exactly what changed.</p>
<p>Examine carefully the output of <code>git diff</code>, and use the <code>-w</code>... | <p>It's sounding like you need more control and standardization of the development process. The one who commits changes should be the same person who modifies the files. Or at least the committer should know exactly what changed.</p> <p>Examine carefully the output of <code>git diff</code>, and use the <code>-w</code>... | 119, 606, 8194 | diff, git, indentation | <h1>How do you make Git ignore spaces and tabs?</h1>
<p>I have a small scripting project that consists of five different source files in one directory called "Droid XX-XX-XX". Each time I created a new backup copy of the source directory, I put the date in the X's. So there are about 15 different versions from differen... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,303 | git | # How do you make Git ignore spaces and tabs?
I have a small scripting project that consists of five different source files in one directory called "Droid XX-XX-XX". Each time I created a new backup copy of the source directory, I put the date in the X's. So there are about 15 different versions from different dates. ... | It's sounding like you need more control and standardization of the development process. The one who commits changes should be the same person who modifies the files. Or at least the committer should know exactly what changed.
Examine carefully the output of `git diff`, and use the `-w` flag to ignore spaces. There's ... |
11491880 | How to install git bash on ubuntu? | 32 | 2012-07-15 12:26:05 | <p>I am new to Ubuntu. Previously I was on Windows and was using <code>git bash</code> for <code>git</code> commands.
But I have decided to use Ubuntu and I installed <code>git</code> but I am not sure whether it is necessary to install <code>git bash</code> on Ubuntu? And, if it is necessary, how should I install it?<... | 135,322 | 1,436,641 | 2012-07-16 05:43:24 | 11,491,897 | 53 | 2012-07-15 12:28:48 | 1,090,166 | 2012-07-15 12:28:48 | https://stackoverflow.com/q/11491880 | https://stackoverflow.com/a/11491897 | <p>If it's not installed yet:</p>
<pre><code>sudo apt-get install git-core
</code></pre>
<p>Check installation:</p>
<pre><code>git --version
</code></pre>
<p>When it's installed, you can use it inside your existing bash in ubuntu.</p>
| <p>If it's not installed yet:</p> <pre><code>sudo apt-get install git-core </code></pre> <p>Check installation:</p> <pre><code>git --version </code></pre> <p>When it's installed, you can use it inside your existing bash in ubuntu.</p> | 119, 549 | git, ubuntu | <h1>How to install git bash on ubuntu?</h1>
<p>I am new to Ubuntu. Previously I was on Windows and was using <code>git bash</code> for <code>git</code> commands.
But I have decided to use Ubuntu and I installed <code>git</code> but I am not sure whether it is necessary to install <code>git bash</code> on Ubuntu? And, i... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,304 | git | # How to install git bash on ubuntu?
I am new to Ubuntu. Previously I was on Windows and was using `git bash` for `git` commands.
But I have decided to use Ubuntu and I installed `git` but I am not sure whether it is necessary to install `git bash` on Ubuntu? And, if it is necessary, how should I install it? | If it's not installed yet:
```
sudo apt-get install git-core
```
Check installation:
```
git --version
```
When it's installed, you can use it inside your existing bash in ubuntu. |
16793637 | Recover deleted branch in Git | 31 | 2013-05-28 13:42:21 | <p>I have deleted my branch by mistake like this:</p>
<pre><code>git branch -D demo
</code></pre>
<p>But I want to recover it… I get this after <code>git reflog</code></p>
<pre><code>541b2f5 HEAD@{23}: checkout: moving from demo to master
06fa6d5 HEAD@{24}: commit (merge): remove ajax call for deleting variables and... | 34,858 | 1,656,267 | 2017-07-18 14:10:13 | 16,813,291 | 53 | 2013-05-29 11:59:13 | 1,427,604 | 2013-05-29 12:04:58 | https://stackoverflow.com/q/16793637 | https://stackoverflow.com/a/16813291 | <p>Create a list of all dangling or unreachable commits.</p>
<pre><code>git fsck --full --no-reflogs --unreachable --lost-found
</code></pre>
<p>Print a list of commit messages for all commits in the lost and found.</p>
<pre><code>ls -1 .git/lost-found/commit/ | xargs -n 1 git log -n 1 --pretty=oneline
</code></pre>... | <p>Create a list of all dangling or unreachable commits.</p> <pre><code>git fsck --full --no-reflogs --unreachable --lost-found </code></pre> <p>Print a list of commit messages for all commits in the lost and found.</p> <pre><code>ls -1 .git/lost-found/commit/ | xargs -n 1 git log -n 1 --pretty=oneline </code></pre>... | 119, 76220 | git, git-branch | <h1>Recover deleted branch in Git</h1>
<p>I have deleted my branch by mistake like this:</p>
<pre><code>git branch -D demo
</code></pre>
<p>But I want to recover it… I get this after <code>git reflog</code></p>
<pre><code>541b2f5 HEAD@{23}: checkout: moving from demo to master
06fa6d5 HEAD@{24}: commit (merge): remo... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,305 | git | # Recover deleted branch in Git
I have deleted my branch by mistake like this:
```
git branch -D demo
```
But I want to recover it… I get this after `git reflog`
```
541b2f5 HEAD@{23}: checkout: moving from demo to master
06fa6d5 HEAD@{24}: commit (merge): remove ajax call for deleting variables and transfomers
b84... | Create a list of all dangling or unreachable commits.
```
git fsck --full --no-reflogs --unreachable --lost-found
```
Print a list of commit messages for all commits in the lost and found.
```
ls -1 .git/lost-found/commit/ | xargs -n 1 git log -n 1 --pretty=oneline
```
Find your missing commit through the process o... |
34195002 | How to ask Spring Cloud Config server to checkout configuration from specific branch? | 28 | 2015-12-10 06:18:36 | <p>I have following Spring cloud config application.yml: </p>
<pre><code>spring:
application:
name: configserver
cloud:
config:
server:
git:
uri: https://xyz@bitbucket.org/xyz/microservices-configs.git
username: xyz
password: xyz
basedir: target/... | 53,716 | 1,660,192 | 2021-11-11 13:22:52 | 34,208,724 | 53 | 2015-12-10 18:02:15 | 2,730,527 | 2015-12-10 18:02:15 | https://stackoverflow.com/q/34195002 | https://stackoverflow.com/a/34208724 | <p>According to the <a href="http://projects.spring.io/spring-cloud/docs/1.0.3/spring-cloud.html#_locating_remote_configuration_resources" rel="noreferrer">documentation</a>, the configuration you want to set in your config client is:</p>
<pre><code>spring.cloud.config.label=mybranch
</code></pre>
<p>Where <code>mybr... | <p>According to the <a href="http://projects.spring.io/spring-cloud/docs/1.0.3/spring-cloud.html#_locating_remote_configuration_resources" rel="noreferrer">documentation</a>, the configuration you want to set in your config client is:</p> <pre><code>spring.cloud.config.label=mybranch </code></pre> <p>Where <code>mybr... | 119, 1211, 7027, 95875, 107291 | git, spring, spring-boot, spring-cloud, spring-mvc | <h1>How to ask Spring Cloud Config server to checkout configuration from specific branch?</h1>
<p>I have following Spring cloud config application.yml: </p>
<pre><code>spring:
application:
name: configserver
cloud:
config:
server:
git:
uri: https://xyz@bitbucket.org/xyz/micro... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,307 | git | # How to ask Spring Cloud Config server to checkout configuration from specific branch?
I have following Spring cloud config application.yml:
```
spring:
application:
name: configserver
cloud:
config:
server:
git:
uri: https://xyz@bitbucket.org/xyz/microservices-configs.git
... | According to the [documentation](http://projects.spring.io/spring-cloud/docs/1.0.3/spring-cloud.html#_locating_remote_configuration_resources), the configuration you want to set in your config client is:
```
spring.cloud.config.label=mybranch
```
Where `mybranch` is an existing branch in your git repo. |
25670173 | Why does Git tell me "Not currently on any branch" after I run "git checkout origin/<branch>"? | 24 | 2014-09-04 16:05:43 | <p>I was trying to follow the instructions from <a href="https://stackoverflow.com/questions/4735556/git-not-currently-on-any-branch-is-there-an-easy-way-to-get-back-on-a-branch">Git: "Not currently on any branch." Is there an easy way to get back on a branch, while keeping the changes?</a> but <code>git chec... | 44,336 | 2,528,472 | 2022-04-06 23:19:26 | 25,670,296 | 53 | 2014-09-04 16:11:41 | 2,541,573 | 2019-10-22 13:49:07 | https://stackoverflow.com/q/25670173 | https://stackoverflow.com/a/25670296 | <p>The output of <code>git status</code> indicates that your working directory is clean; good.</p>
<p>Now, by running</p>
<pre><code>git checkout origin/web-zach
</code></pre>
<p>you are attempting to check out a <em>remote-tracking</em> branch, called <code>origin/web-zach</code>; it's a special type of branch, loc... | <p>The output of <code>git status</code> indicates that your working directory is clean; good.</p> <p>Now, by running</p> <pre><code>git checkout origin/web-zach </code></pre> <p>you are attempting to check out a <em>remote-tracking</em> branch, called <code>origin/web-zach</code>; it's a special type of branch, loc... | 119, 31678, 37230 | git, git-checkout, remote-branch | <h1>Why does Git tell me "Not currently on any branch" after I run "git checkout origin/<branch>"?</h1>
<p>I was trying to follow the instructions from <a href="https://stackoverflow.com/questions/4735556/git-not-currently-on-any-branch-is-there-an-easy-way-to-get-back-on-a-branch">Git: "Not currently on any branc... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,308 | git | # Why does Git tell me "Not currently on any branch" after I run "git checkout origin/"?
I was trying to follow the instructions from [Git: "Not currently on any branch." Is there an easy way to get back on a branch, while keeping the changes?](https://stackoverflow.com/questions/4735556/git-not-currently-on-any-branc... | The output of `git status` indicates that your working directory is clean; good.
Now, by running
```
git checkout origin/web-zach
```
you are attempting to check out a *remote-tracking* branch, called `origin/web-zach`; it's a special type of branch, local to your repo, that keeps track of the corresponding branch, ... |
34890313 | Deleting all Git cached submodules from repository | 21 | 2016-01-20 02:06:05 | <p>Our team is not using submodules anymore for a long time and we would like to free some repository space by deleting all cached submodules.</p>
<p>Do we simply need to delete the following?</p>
<pre><code>rm -rf .git/modules
</code></pre>
<p><strong>Or is there a more recommended way to do it? Also, we would like... | 42,729 | 1,033,581 | 2016-01-21 02:40:26 | 34,914,461 | 53 | 2016-01-21 02:40:26 | 1,033,581 | 2016-01-21 02:40:26 | https://stackoverflow.com/q/34890313 | https://stackoverflow.com/a/34914461 | <p>I figured out a possible small confusion in my question regarding "not using submodules": are there unused submodule folders left, or were those folders deleted already and only cache is left?</p>
<p>Well, I think we can address both situations by first following a clean removal process, and then assume something w... | <p>I figured out a possible small confusion in my question regarding "not using submodules": are there unused submodule folders left, or were those folders deleted already and only cache is left?</p> <p>Well, I think we can address both situations by first following a clean removal process, and then assume something w... | 119, 41612 | git, git-submodules | <h1>Deleting all Git cached submodules from repository</h1>
<p>Our team is not using submodules anymore for a long time and we would like to free some repository space by deleting all cached submodules.</p>
<p>Do we simply need to delete the following?</p>
<pre><code>rm -rf .git/modules
</code></pre>
<p><strong>Or i... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,310 | git | # Deleting all Git cached submodules from repository
Our team is not using submodules anymore for a long time and we would like to free some repository space by deleting all cached submodules.
Do we simply need to delete the following?
```
rm -rf .git/modules
```
**Or is there a more recommended way to do it? Also,... | I figured out a possible small confusion in my question regarding "not using submodules": are there unused submodule folders left, or were those folders deleted already and only cache is left?
Well, I think we can address both situations by first following a clean removal process, and then assume something was not don... |
26914909 | Undo a git reset --hard origin/master | 19 | 2014-11-13 17:33:24 | <p>Working on local master branch:</p>
<pre><code>git commit -m "Lots of important commits"
git reset --hard origin/master
</code></pre>
<p>How can I retrieve the commits that have been lost as a result of the git reset (from the remote)?</p>
<p>EDIT: note this is not about retrieving uncommitted changes.</p>
| 26,758 | 196,533 | 2018-04-21 16:31:23 | 26,914,992 | 53 | 2014-11-13 17:37:38 | 846,273 | 2014-11-13 17:43:36 | https://stackoverflow.com/q/26914909 | https://stackoverflow.com/a/26914992 | <p>If you committed it, nothing is lost.</p>
<p>If you have the reference of the commit, you can just <code>git reset --hard <sha></code> to that precise commit.</p>
<p>In case you don't you can always use <code>git reflog</code> to retrieve the sha before performing the hard reset.</p>
<p>For instance if <cod... | <p>If you committed it, nothing is lost.</p> <p>If you have the reference of the commit, you can just <code>git reset --hard <sha></code> to that precise commit.</p> <p>In case you don't you can always use <code>git reflog</code> to retrieve the sha before performing the hard reset.</p> <p>For instance if <cod... | 119, 51381 | git, git-reset | <h1>Undo a git reset --hard origin/master</h1>
<p>Working on local master branch:</p>
<pre><code>git commit -m "Lots of important commits"
git reset --hard origin/master
</code></pre>
<p>How can I retrieve the commits that have been lost as a result of the git reset (from the remote)?</p>
<p>EDIT: note this is not a... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,311 | git | # Undo a git reset --hard origin/master
Working on local master branch:
```
git commit -m "Lots of important commits"
git reset --hard origin/master
```
How can I retrieve the commits that have been lost as a result of the git reset (from the remote)?
EDIT: note this is not about retrieving uncommitted changes. | If you committed it, nothing is lost.
If you have the reference of the commit, you can just `git reset --hard <sha>` to that precise commit.
In case you don't you can always use `git reflog` to retrieve the sha before performing the hard reset.
For instance if `git reset --hard origin/master` is the last command you... |
12373733 | How to stage deleted files? | 659 | 2012-09-11 16:01:03 | <p>Say I have a file in my git repository called <code>foo</code>.</p>
<p>Suppose it has been deleted with <code>rm</code> (not <code>git rm</code>). Then git status will show:</p>
<pre><code>Changes not staged for commit:
deleted: foo
</code></pre>
<p>How do I stage this individual file deletion?</p>
<p>If I try... | 434,203 | 1,131,467 | 2025-01-14 14:02:04 | 43,056,286 | 52 | 2017-03-27 20:52:11 | 712,598 | 2020-07-15 16:33:12 | https://stackoverflow.com/q/12373733 | https://stackoverflow.com/a/43056286 | <p>Since Git 2.0.0, <code>git add</code> will also stage file deletions.</p>
<p><a href="https://git-scm.com/docs/git-add/2.0.0" rel="noreferrer">Git 2.0.0 Docs - git-add</a></p>
<blockquote>
<p>< pathspec >…</p>
<p>Files to add content from. Fileglobs (e.g. *.c) can be given to add all
matching files. Also a lea... | <p>Since Git 2.0.0, <code>git add</code> will also stage file deletions.</p> <p><a href="https://git-scm.com/docs/git-add/2.0.0" rel="noreferrer">Git 2.0.0 Docs - git-add</a></p> <blockquote> <p>< pathspec >…</p> <p>Files to add content from. Fileglobs (e.g. *.c) can be given to add all matching files. Also a lea... | 119, 34792, 74978, 112901 | git, git-add, git-rm, git-stage | <h1>How to stage deleted files?</h1>
<p>Say I have a file in my git repository called <code>foo</code>.</p>
<p>Suppose it has been deleted with <code>rm</code> (not <code>git rm</code>). Then git status will show:</p>
<pre><code>Changes not staged for commit:
deleted: foo
</code></pre>
<p>How do I stage this indi... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,312 | git | # How to stage deleted files?
Say I have a file in my git repository called `foo`.
Suppose it has been deleted with `rm` (not `git rm`). Then git status will show:
```
Changes not staged for commit:
deleted: foo
```
How do I stage this individual file deletion?
If I try:
```
git add foo
```
It says:
```
'f... | Since Git 2.0.0, `git add` will also stage file deletions.
[Git 2.0.0 Docs - git-add](https://git-scm.com/docs/git-add/2.0.0)
> < pathspec >…
>
> Files to add content from. Fileglobs (e.g. *.c) can be given to add all
> matching files. Also a leading directory name (e.g. dir to add dir/file1 and dir/file2) can be giv... |
4545370 | How to list all tags pointing to a specific commit in git | 114 | 2010-12-28 10:32:55 | <p>I have seen the commands <code>git describe</code> and <code>git-name-rev</code> but I have not managed to get them to list more than one tag.</p>
<p>Example: I have the sha1 48eb354 and I know the tags A and B point to it. So I want a git command <code>git {something} 48eb354</code> that produce output similar to ... | 54,515 | 11,722 | 2022-09-19 07:42:06 | 4,546,826 | 52 | 2010-12-28 14:40:40 | 356,716 | 2010-12-28 14:47:37 | https://stackoverflow.com/q/4545370 | https://stackoverflow.com/a/4546826 | <p><code>git show-ref --tags -d | grep ^48eb354 | sed -e 's,.* refs/tags/,,' -e 's/\^{}//'</code></p>
<p>should work for both lightweight and annotated tags.</p>
| <p><code>git show-ref --tags -d | grep ^48eb354 | sed -e 's,.* refs/tags/,,' -e 's/\^{}//'</code></p> <p>should work for both lightweight and annotated tags.</p> | 115, 119 | git, tags | <h1>How to list all tags pointing to a specific commit in git</h1>
<p>I have seen the commands <code>git describe</code> and <code>git-name-rev</code> but I have not managed to get them to list more than one tag.</p>
<p>Example: I have the sha1 48eb354 and I know the tags A and B point to it. So I want a git command <... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,314 | git | # How to list all tags pointing to a specific commit in git
I have seen the commands `git describe` and `git-name-rev` but I have not managed to get them to list more than one tag.
Example: I have the sha1 48eb354 and I know the tags A and B point to it. So I want a git command `git {something} 48eb354` that produce ... | `git show-ref --tags -d | grep ^48eb354 | sed -e 's,.* refs/tags/,,' -e 's/\^{}//'`
should work for both lightweight and annotated tags. |
56191415 | Why is `git push --force-with-lease` failing with "rejected ... stale info" even when my local repo is up to date with remote? | 92 | 2019-05-17 17:57:36 | <p>I'm trying to force push a rebase of a feature branch to a remote repository. To be a bit safer, I'm trying to use <code>--force-with-lease</code> to make sure no other changes have happened in the branch since I last fetched it.</p>
<p>This is failing for reasons I don't understand:</p>
<pre><code>$ git branch
* ... | 53,558 | 90,848 | 2023-07-15 23:56:16 | 56,191,884 | 52 | 2019-05-17 18:35:36 | 90,848 | 2019-05-17 18:35:36 | https://stackoverflow.com/q/56191415 | https://stackoverflow.com/a/56191884 | <p>In this case it turned out that the problem was that the remote branch had been deleted, but there was still a copy of it in my local repo. Fetch doesn't delete local copies by default, which is why it had no effect.</p>
<p>Adding the <code>--prune</code> option to my initial <code>git pull</code> (before doing my ... | <p>In this case it turned out that the problem was that the remote branch had been deleted, but there was still a copy of it in my local repo. Fetch doesn't delete local copies by default, which is why it had no effect.</p> <p>Adding the <code>--prune</code> option to my initial <code>git pull</code> (before doing my ... | 119, 28898 | git, git-push | <h1>Why is `git push --force-with-lease` failing with "rejected ... stale info" even when my local repo is up to date with remote?</h1>
<p>I'm trying to force push a rebase of a feature branch to a remote repository. To be a bit safer, I'm trying to use <code>--force-with-lease</code> to make sure no other changes have... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,315 | git | # Why is `git push --force-with-lease` failing with "rejected ... stale info" even when my local repo is up to date with remote?
I'm trying to force push a rebase of a feature branch to a remote repository. To be a bit safer, I'm trying to use `--force-with-lease` to make sure no other changes have happened in the bra... | In this case it turned out that the problem was that the remote branch had been deleted, but there was still a copy of it in my local repo. Fetch doesn't delete local copies by default, which is why it had no effect.
Adding the `--prune` option to my initial `git pull` (before doing my rebase) corrects this problem. |
5667476 | Git non-fast-forward rejected | 90 | 2011-04-14 17:58:47 | <p>I feel like this question has been asked many times, but the solution is typically "I deleted the directory and re-did my work with a fresh checkout." I did a commit and push but realized that I referred to the wrong ticket number in the commit message. So I looked on SO for a quick <a href="https://stackoverflow.co... | 104,531 | 203,583 | 2016-06-24 14:35:32 | 5,667,848 | 52 | 2011-04-14 18:29:24 | 66,353 | 2011-04-14 18:29:24 | https://stackoverflow.com/q/5667476 | https://stackoverflow.com/a/5667848 | <p>Force <code>git push</code>:</p>
<pre><code>git push origin +develop
</code></pre>
| <p>Force <code>git push</code>:</p> <pre><code>git push origin +develop </code></pre> | 119, 456 | git, version-control | <h1>Git non-fast-forward rejected</h1>
<p>I feel like this question has been asked many times, but the solution is typically "I deleted the directory and re-did my work with a fresh checkout." I did a commit and push but realized that I referred to the wrong ticket number in the commit message. So I looked on SO for a ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,316 | git | # Git non-fast-forward rejected
I feel like this question has been asked many times, but the solution is typically "I deleted the directory and re-did my work with a fresh checkout." I did a commit and push but realized that I referred to the wrong ticket number in the commit message. So I looked on SO for a quick [so... | Force `git push`:
```
git push origin +develop
``` |
6191138 | How to see commits that were merged in to a merge commit? | 77 | 2011-05-31 17:19:54 | <p>If <code>my-feature-branch</code> was merged into <code>my-main-branch</code>, how can I see what commits were merged in from <code>my-feature-branch</code>?</p>
| 40,754 | 85,616 | 2021-10-31 02:11:14 | 6,191,836 | 52 | 2011-05-31 18:26:16 | 422,597 | 2021-10-31 02:11:14 | https://stackoverflow.com/q/6191138 | https://stackoverflow.com/a/6191836 | <p>If you want to see every commits merged in the last merge you can try that :</p>
<pre><code>git log $(git merge-base --octopus \
$(git log -1 --merges --pretty=format:%P)).. --boundary
</code></pre>
<p>Here is an example of my current log :</p>
<pre><code>$ git log --graph --pretty=oneline --abbrev-commit
* 44899b9 ... | <p>If you want to see every commits merged in the last merge you can try that :</p> <pre><code>git log $(git merge-base --octopus \ $(git log -1 --merges --pretty=format:%P)).. --boundary </code></pre> <p>Here is an example of my current log :</p> <pre><code>$ git log --graph --pretty=oneline --abbrev-commit * 44899b9 ... | 119, 1879, 28897, 47913, 53850 | branch, git, git-commit, git-log, git-merge | <h1>How to see commits that were merged in to a merge commit?</h1>
<p>If <code>my-feature-branch</code> was merged into <code>my-main-branch</code>, how can I see what commits were merged in from <code>my-feature-branch</code>?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,317 | git | # How to see commits that were merged in to a merge commit?
If `my-feature-branch` was merged into `my-main-branch`, how can I see what commits were merged in from `my-feature-branch`? | If you want to see every commits merged in the last merge you can try that :
```
git log $(git merge-base --octopus \
$(git log -1 --merges --pretty=format:%P)).. --boundary
```
Here is an example of my current log :
```
$ git log --graph --pretty=oneline --abbrev-commit
* 44899b9 pouf
* 8f49f9c Merge branch 'test... |
64787301 | 'git init -b <branch name>' command in terminal is throwing an 'unknown switch' error | 65 | 2020-11-11 13:24:00 | <p>I am trying to add an existing project to GitHub using the command line. I am in the relevant working directory in the terminal and am trying to use the <code>git init -b main</code> command.</p>
<p>Initially, I was getting an error relating to xcode:</p>
<pre><code>xcrun: error: invalid active developer path (/Libr... | 78,955 | 11,807,509 | 2021-09-15 01:37:14 | 64,787,736 | 52 | 2020-11-11 13:50:57 | 7,976,758 | 2020-11-11 13:50:57 | https://stackoverflow.com/q/64787301 | https://stackoverflow.com/a/64787736 | <p><a href="https://git-scm.com/docs/git-init/2.24.3" rel="noreferrer"><code>git</code> 2.24</a> doesn't have option <code>-b</code>/<code>--initial-branch</code>. It was added in <a href="https://git-scm.com/docs/git-init/2.28.0" rel="noreferrer"><code>git</code> 2.28</a>. You need to upgrade to use the option.</p>
<p... | <p><a href="https://git-scm.com/docs/git-init/2.24.3" rel="noreferrer"><code>git</code> 2.24</a> doesn't have option <code>-b</code>/<code>--initial-branch</code>. It was added in <a href="https://git-scm.com/docs/git-init/2.28.0" rel="noreferrer"><code>git</code> 2.28</a>. You need to upgrade to use the option.</p> <p... | 119, 908, 138656 | git, macos-catalina, xcode | <h1>'git init -b <branch name>' command in terminal is throwing an 'unknown switch' error</h1>
<p>I am trying to add an existing project to GitHub using the command line. I am in the relevant working directory in the terminal and am trying to use the <code>git init -b main</code> command.</p>
<p>Initially, I was gettin... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,318 | git | # 'git init -b ' command in terminal is throwing an 'unknown switch' error
I am trying to add an existing project to GitHub using the command line. I am in the relevant working directory in the terminal and am trying to use the `git init -b main` command.
Initially, I was getting an error relating to xcode:
```
xcru... | [`git` 2.24](https://git-scm.com/docs/git-init/2.24.3) doesn't have option `-b`/`--initial-branch`. It was added in [`git` 2.28](https://git-scm.com/docs/git-init/2.28.0). You need to upgrade to use the option.
Or, as @matt said, create a repo and then rename the branch:
```
git init repo
cd repo
git branch -m master... |
36878344 | What does git sync do in VSCode | 54 | 2016-04-27 00:47:41 | <p>What commands are actually run when you <em>Synchronise Changes</em> in Visual Studio Code?</p>
<p><a href="https://i.sstatic.net/P5VKm.png" rel="noreferrer"><img src="https://i.sstatic.net/P5VKm.png" alt="git sync in vscode"></a></p>
| 61,673 | 80,428 | 2020-01-18 17:26:04 | 36,878,418 | 52 | 2016-04-27 00:54:47 | 1,863,229 | 2019-05-28 12:41:04 | https://stackoverflow.com/q/36878344 | https://stackoverflow.com/a/36878418 | <p>From the <a href="https://code.visualstudio.com/Docs/editor/versioncontrol" rel="noreferrer">VSCode online help</a>:</p>
<blockquote>
<p>Given that your repository is connected to some remote and that your checked out branch has an upstream link to a branch in that remote, VS Code offers you useful actions to pus... | <p>From the <a href="https://code.visualstudio.com/Docs/editor/versioncontrol" rel="noreferrer">VSCode online help</a>:</p> <blockquote> <p>Given that your repository is connected to some remote and that your checked out branch has an upstream link to a branch in that remote, VS Code offers you useful actions to pus... | 119, 111608 | git, visual-studio-code | <h1>What does git sync do in VSCode</h1>
<p>What commands are actually run when you <em>Synchronise Changes</em> in Visual Studio Code?</p>
<p><a href="https://i.sstatic.net/P5VKm.png" rel="noreferrer"><img src="https://i.sstatic.net/P5VKm.png" alt="git sync in vscode"></a></p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,322 | git | # What does git sync do in VSCode
What commands are actually run when you *Synchronise Changes* in Visual Studio Code?
[](https://i.sstatic.net/P5VKm.png) | From the [VSCode online help](https://code.visualstudio.com/Docs/editor/versioncontrol):
> Given that your repository is connected to some remote and that your checked out branch has an upstream link to a branch in that remote, VS Code offers you useful actions to push, pull and sync that branch (**the latter will run... |
16524225 | How can I populate the Git commit ID into a file when I commit? | 54 | 2013-05-13 14:13:45 | <p>I would like to create Git hook(s) that will populate the commit id of the commit I am about to make into a file (basically variable substitution) in my source code. Is this possible with Git? Or is the fact that by resolving the variable to the git id, I am going to be changing the sha 1, thereby winding up with a ... | 46,974 | 203,802 | 2017-01-31 15:31:35 | 16,529,140 | 52 | 2013-05-13 18:54:53 | 1,253,222 | 2013-05-13 18:54:53 | https://stackoverflow.com/q/16524225 | https://stackoverflow.com/a/16529140 | <p>The solution I have used for a similar situation is this:</p>
<ol>
<li>Put the string <code>$Id$</code> somewhere in the file you want to have identified (e.g. <code>test.html</code>), probably within a comment or other non-functional section of the file where it won't cause issues.</li>
<li>In your <code>.gitattri... | <p>The solution I have used for a similar situation is this:</p> <ol> <li>Put the string <code>$Id$</code> somewhere in the file you want to have identified (e.g. <code>test.html</code>), probably within a comment or other non-functional section of the file where it won't cause issues.</li> <li>In your <code>.gitattri... | 119 | git | <h1>How can I populate the Git commit ID into a file when I commit?</h1>
<p>I would like to create Git hook(s) that will populate the commit id of the commit I am about to make into a file (basically variable substitution) in my source code. Is this possible with Git? Or is the fact that by resolving the variable to th... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,323 | git | # How can I populate the Git commit ID into a file when I commit?
I would like to create Git hook(s) that will populate the commit id of the commit I am about to make into a file (basically variable substitution) in my source code. Is this possible with Git? Or is the fact that by resolving the variable to the git id,... | The solution I have used for a similar situation is this:
1. Put the string `$Id$` somewhere in the file you want to have identified (e.g. `test.html`), probably within a comment or other non-functional section of the file where it won't cause issues.
2. In your `.gitattributes`, flag the file in question with the `id... |
8581609 | git flow - how do I pause development on one feature to work on another | 54 | 2011-12-20 20:33:36 | <p>I'm new to git and git flow. I've read all the various pages, blogs, and stackoverflow questions on it,and have been using it in my daily development.</p>
<p>But one issue has been bothering me, I just can't wrap my head around it. I know feature branches are supposed to be small, you start a feature, code a part o... | 17,844 | 1,108,614 | 2016-08-13 08:16:23 | 8,594,335 | 52 | 2011-12-21 18:07:40 | 649,852 | 2011-12-21 18:17:43 | https://stackoverflow.com/q/8581609 | https://stackoverflow.com/a/8594335 | <p>You do not need the <code>git flow feature pause yak-Speedup</code> command (<code>feature pause</code> doesn't exist anyway). The command you want to use in place of <code>git flow feature resume yak-Speedup</code> is <code>git flow feature checkout yak-Speedup</code>; that will get you back on the <code>yak-Speedu... | <p>You do not need the <code>git flow feature pause yak-Speedup</code> command (<code>feature pause</code> doesn't exist anyway). The command you want to use in place of <code>git flow feature resume yak-Speedup</code> is <code>git flow feature checkout yak-Speedup</code>; that will get you back on the <code>yak-Speedu... | 119, 64339 | git, git-flow | <h1>git flow - how do I pause development on one feature to work on another</h1>
<p>I'm new to git and git flow. I've read all the various pages, blogs, and stackoverflow questions on it,and have been using it in my daily development.</p>
<p>But one issue has been bothering me, I just can't wrap my head around it. I k... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,324 | git | # git flow - how do I pause development on one feature to work on another
I'm new to git and git flow. I've read all the various pages, blogs, and stackoverflow questions on it,and have been using it in my daily development.
But one issue has been bothering me, I just can't wrap my head around it. I know feature bran... | You do not need the `git flow feature pause yak-Speedup` command (`feature pause` doesn't exist anyway). The command you want to use in place of `git flow feature resume yak-Speedup` is `git flow feature checkout yak-Speedup`; that will get you back on the `yak-Speedup` feature branch to continue development.
Executin... |
6104258 | How to reset Heroku app and re-commit everything? | 54 | 2011-05-23 23:38:18 | <p>I'm building an application which I'm also testing in Heroku. I ran into some problem today and had to rollback one commit in my local git repo, but Heroku now won't recognize my changes saying that "everything is up to date".</p>
<p>So, running</p>
<pre><code>git push heroku master
</code></pre>
<p>heroku respon... | 49,221 | 351,901 | 2017-05-25 06:10:04 | 6,110,610 | 52 | 2011-05-24 12:44:37 | 252,799 | 2015-01-09 04:06:41 | https://stackoverflow.com/q/6104258 | https://stackoverflow.com/a/6110610 | <p>Sounds weird. Maybe try pushing a different branch would do?</p>
<pre><code>git branch production
git checkout production
#do some code changes
git commit -am "some desperate code changes to try fix heroku"
git push heroku production:master
</code></pre>
<p>Creating a new production branch is what I want you to te... | <p>Sounds weird. Maybe try pushing a different branch would do?</p> <pre><code>git branch production git checkout production #do some code changes git commit -am "some desperate code changes to try fix heroku" git push heroku production:master </code></pre> <p>Creating a new production branch is what I want you to te... | 119, 8279, 64108 | git, heroku, ruby-on-rails-3 | <h1>How to reset Heroku app and re-commit everything?</h1>
<p>I'm building an application which I'm also testing in Heroku. I ran into some problem today and had to rollback one commit in my local git repo, but Heroku now won't recognize my changes saying that "everything is up to date".</p>
<p>So, running</p>
<pre><... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,325 | git | # How to reset Heroku app and re-commit everything?
I'm building an application which I'm also testing in Heroku. I ran into some problem today and had to rollback one commit in my local git repo, but Heroku now won't recognize my changes saying that "everything is up to date".
So, running
```
git push heroku master... | Sounds weird. Maybe try pushing a different branch would do?
```
git branch production
git checkout production
#do some code changes
git commit -am "some desperate code changes to try fix heroku"
git push heroku production:master
```
Creating a new production branch is what I want you to test. Besides, it's nice to h... |
482309 | How do you get git to ignore all contents of a directory? | 53 | 2009-01-27 04:28:34 | <p>I have a git directory which contains the a whole bunch of files and then has a directory called 'sessions'. 'sessions' contains cookie information for my web.py program. </p>
<p>I need the folder 'sessions' to remain in the git repository because without the folder the program does not function correctly. I don't ... | 14,208 | 59,210 | 2013-04-12 21:48:48 | 482,331 | 52 | 2009-01-27 04:45:48 | 1,902,010 | 2013-04-12 21:48:48 | https://stackoverflow.com/q/482309 | https://stackoverflow.com/a/482331 | <p>If I'm remembering correctly, you can do this by creating a <code>.gitignore</code> file in the <code>sessions</code> folder with <code>[^.]*</code> as its contents.</p>
| <p>If I'm remembering correctly, you can do this by creating a <code>.gitignore</code> file in the <code>sessions</code> folder with <code>[^.]*</code> as its contents.</p> | 119 | git | <h1>How do you get git to ignore all contents of a directory?</h1>
<p>I have a git directory which contains the a whole bunch of files and then has a directory called 'sessions'. 'sessions' contains cookie information for my web.py program. </p>
<p>I need the folder 'sessions' to remain in the git repository because w... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,326 | git | # How do you get git to ignore all contents of a directory?
I have a git directory which contains the a whole bunch of files and then has a directory called 'sessions'. 'sessions' contains cookie information for my web.py program.
I need the folder 'sessions' to remain in the git repository because without the folder... | If I'm remembering correctly, you can do this by creating a `.gitignore` file in the `sessions` folder with `[^.]*` as its contents. |
21901443 | Git diff: Write output and exit instead of interactive mode | 49 | 2014-02-20 07:50:31 | <p>When I run <code>git diff</code> on my OSX command line, the output is displayed inside a <code>less</code> or <code>vim</code> interface. The interface lets me to scroll up and down, and quit using the <kbd>q</kbd> key.</p>
<p>This is very annoying, especially when there is no diff and git opens a blank screen.</p... | 13,828 | 51,197 | 2018-05-02 01:34:26 | 50,126,020 | 52 | 2018-05-02 01:34:26 | 2,221,472 | 2018-05-02 01:34:26 | https://stackoverflow.com/q/21901443 | https://stackoverflow.com/a/50126020 | <p>Disable the interactive pager with the <code>--no-pager</code> option.</p>
<p>Usage: <code>git --no-pager diff</code> (note how it's not specific to git-diff, so it's usable with any git command!)</p>
<p>Documentation: <a href="https://git-scm.com/docs/git" rel="noreferrer">https://git-scm.com/docs/git</a></p>
<p... | <p>Disable the interactive pager with the <code>--no-pager</code> option.</p> <p>Usage: <code>git --no-pager diff</code> (note how it's not specific to git-diff, so it's usable with any git command!)</p> <p>Documentation: <a href="https://git-scm.com/docs/git" rel="noreferrer">https://git-scm.com/docs/git</a></p> <p... | 119, 369, 606, 30669 | diff, git, interactive-mode, macos | <h1>Git diff: Write output and exit instead of interactive mode</h1>
<p>When I run <code>git diff</code> on my OSX command line, the output is displayed inside a <code>less</code> or <code>vim</code> interface. The interface lets me to scroll up and down, and quit using the <kbd>q</kbd> key.</p>
<p>This is very annoyi... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,327 | git | # Git diff: Write output and exit instead of interactive mode
When I run `git diff` on my OSX command line, the output is displayed inside a `less` or `vim` interface. The interface lets me to scroll up and down, and quit using the `q` key.
This is very annoying, especially when there is no diff and git opens a blank... | Disable the interactive pager with the `--no-pager` option.
Usage: `git --no-pager diff` (note how it's not specific to git-diff, so it's usable with any git command!)
Documentation: <https://git-scm.com/docs/git>
Copied from <https://stackoverflow.com/a/2183920/2221472> |
39082651 | What does "Keep Index" option of Git stash dialog in Intellij IDEA do? | 48 | 2016-08-22 14:51:35 | <p>It is said in <a href="https://www.jetbrains.com/help/idea/2016.2/stash-dialog.html" rel="noreferrer">IDEA documentation</a></p>
<blockquote>
<p>Select this check box to have IntelliJ IDEA bring the changes staged in the index to your working tree for examination and testing.</p>
</blockquote>
<p>Can somebody pl... | 25,967 | 1,902,296 | 2016-08-22 19:06:43 | 39,086,970 | 52 | 2016-08-22 19:04:38 | 1,140,085 | 2016-08-22 19:04:38 | https://stackoverflow.com/q/39082651 | https://stackoverflow.com/a/39086970 | <p>This determines if the stash is created with the git <code>--keep-index</code> flag.</p>
<p>From <a href="https://git-scm.com/docs/git-stash#_options" rel="noreferrer">GIT docs</a>:</p>
<blockquote>
<p>If the <code>--keep-index</code> option is used, all changes already added to the index are left intact.</p>
</... | <p>This determines if the stash is created with the git <code>--keep-index</code> flag.</p> <p>From <a href="https://git-scm.com/docs/git-stash#_options" rel="noreferrer">GIT docs</a>:</p> <blockquote> <p>If the <code>--keep-index</code> option is used, all changes already added to the index are left intact.</p> </... | 119, 8945 | git, intellij-idea | <h1>What does "Keep Index" option of Git stash dialog in Intellij IDEA do?</h1>
<p>It is said in <a href="https://www.jetbrains.com/help/idea/2016.2/stash-dialog.html" rel="noreferrer">IDEA documentation</a></p>
<blockquote>
<p>Select this check box to have IntelliJ IDEA bring the changes staged in the index to your... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,329 | git | # What does "Keep Index" option of Git stash dialog in Intellij IDEA do?
It is said in [IDEA documentation](https://www.jetbrains.com/help/idea/2016.2/stash-dialog.html)
> Select this check box to have IntelliJ IDEA bring the changes staged in the index to your working tree for examination and testing.
Can somebody ... | This determines if the stash is created with the git `--keep-index` flag.
From [GIT docs](https://git-scm.com/docs/git-stash#_options):
> If the `--keep-index` option is used, all changes already added to the index are left intact.
So in other words, any files you've added to git will also remain outside of the stas... |
1869885 | Why is the Python calculated "hashlib.sha1" different from "git hash-object" for a file? | 46 | 2009-12-08 21:13:58 | <p>I'm trying to calculate the SHA-1 value of a file. </p>
<p>I've fabricated this script:</p>
<pre><code>def hashfile(filepath):
sha1 = hashlib.sha1()
f = open(filepath, 'rb')
try:
sha1.update(f.read())
finally:
f.close()
return sha1.hexdigest()
</code></pre>
<p>For a specific fi... | 31,502 | 20,261 | 2016-05-17 10:17:06 | 1,869,911 | 52 | 2009-12-08 21:17:52 | 3,153 | 2009-12-08 21:17:52 | https://stackoverflow.com/q/1869885 | https://stackoverflow.com/a/1869911 | <p>git calculates hashes like this: </p>
<pre><code>sha1("blob " + filesize + "\0" + data)
</code></pre>
<p><a href="https://stackoverflow.com/questions/552659/assigning-git-sha1s-without-git">Reference</a></p>
| <p>git calculates hashes like this: </p> <pre><code>sha1("blob " + filesize + "\0" + data) </code></pre> <p><a href="https://stackoverflow.com/questions/552659/assigning-git-sha1s-without-git">Reference</a></p> | 16, 119, 581 | git, hash, python | <h1>Why is the Python calculated "hashlib.sha1" different from "git hash-object" for a file?</h1>
<p>I'm trying to calculate the SHA-1 value of a file. </p>
<p>I've fabricated this script:</p>
<pre><code>def hashfile(filepath):
sha1 = hashlib.sha1()
f = open(filepath, 'rb')
try:
sha1.update(f.read... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,330 | git | # Why is the Python calculated "hashlib.sha1" different from "git hash-object" for a file?
I'm trying to calculate the SHA-1 value of a file.
I've fabricated this script:
```
def hashfile(filepath):
sha1 = hashlib.sha1()
f = open(filepath, 'rb')
try:
sha1.update(f.read())
finally:
f.c... | git calculates hashes like this:
```
sha1("blob " + filesize + "\0" + data)
```
[Reference](https://stackoverflow.com/questions/552659/assigning-git-sha1s-without-git) |
36630490 | Git fetch origin vs git fetch --all | 44 | 2016-04-14 17:52:59 | <p>What is the difference between the following git commands?</p>
<pre><code>git fetch origin
</code></pre>
<p>and</p>
<pre><code>git fetch --all
</code></pre>
<p>Running them from the command line looks like they do the same thing.</p>
| 24,444 | 4,912,604 | 2024-02-09 17:38:52 | 36,630,525 | 52 | 2016-04-14 17:55:02 | 1,742,973 | 2016-04-14 17:55:02 | https://stackoverflow.com/q/36630490 | https://stackoverflow.com/a/36630525 | <p><code>git fetch origin</code> fetch data only from <code>origin</code>, and <code>git fetch --all</code> fetch data from all remotes (<code>origin</code> is one of them)</p>
| <p><code>git fetch origin</code> fetch data only from <code>origin</code>, and <code>git fetch --all</code> fetch data from all remotes (<code>origin</code> is one of them)</p> | 119, 33720 | git, git-fetch | <h1>Git fetch origin vs git fetch --all</h1>
<p>What is the difference between the following git commands?</p>
<pre><code>git fetch origin
</code></pre>
<p>and</p>
<pre><code>git fetch --all
</code></pre>
<p>Running them from the command line looks like they do the same thing.</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,332 | git | # Git fetch origin vs git fetch --all
What is the difference between the following git commands?
```
git fetch origin
```
and
```
git fetch --all
```
Running them from the command line looks like they do the same thing. | `git fetch origin` fetch data only from `origin`, and `git fetch --all` fetch data from all remotes (`origin` is one of them) |
10075184 | Git list of branch names of specific remote | 44 | 2012-04-09 15:02:24 | <p>How can it possible to get all names of some remote origin branches?</p>
<p>I started from <code>--remote --list</code> options, but got redundant <code>origin/HEAD -> origin/master</code> message and branches from the another origin.</p>
<pre><code>$> git branch --remote --list
origin/HEAD -> origin/ma... | 26,131 | 570,689 | 2023-08-25 12:06:24 | 10,076,537 | 52 | 2012-04-09 16:43:53 | 6,309 | 2019-07-11 13:47:11 | https://stackoverflow.com/q/10075184 | https://stackoverflow.com/a/10076537 | <blockquote>
<p>It's important that it should be done without <code>grep</code>, <code>sed</code>, <code>tail</code> or even <code>ghc -e</code> wrappers, only with true git power, because of their unsafeness and variation.</p>
</blockquote>
<p>That is only true for git porcelain commands (see "<a href="https://stac... | <blockquote> <p>It's important that it should be done without <code>grep</code>, <code>sed</code>, <code>tail</code> or even <code>ghc -e</code> wrappers, only with true git power, because of their unsafeness and variation.</p> </blockquote> <p>That is only true for git porcelain commands (see "<a href="https://stac... | 119, 76220 | git, git-branch | <h1>Git list of branch names of specific remote</h1>
<p>How can it possible to get all names of some remote origin branches?</p>
<p>I started from <code>--remote --list</code> options, but got redundant <code>origin/HEAD -> origin/master</code> message and branches from the another origin.</p>
<pre><code>$> git... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,333 | git | # Git list of branch names of specific remote
How can it possible to get all names of some remote origin branches?
I started from `--remote --list` options, but got redundant `origin/HEAD -> origin/master` message and branches from the another origin.
```
$> git branch --remote --list
origin/HEAD -> origin/master
... | > It's important that it should be done without `grep`, `sed`, `tail` or even `ghc -e` wrappers, only with true git power, because of their unsafeness and variation.
That is only true for git porcelain commands (see "[What does the term porcelain mean in Git?](https://stackoverflow.com/questions/6976473/what-does-the-... |
17704119 | How to prefer files from one branch during a merge? | 43 | 2013-07-17 15:34:48 | <p>Some time ago I created a branch from my <code>master</code> branch. Let's call it <code>new_feature</code>. While I was working on <code>new_feature</code>, the <code>master</code> branch followed its normal evolution. Now that <code>new_feature</code> is ready to be merged into <code>master</code> I see some confl... | 20,964 | 1,075,374 | 2015-03-26 09:52:27 | 17,704,449 | 52 | 2013-07-17 15:48:30 | 498,699 | 2013-07-17 15:48:30 | https://stackoverflow.com/q/17704119 | https://stackoverflow.com/a/17704449 | <p>As mention in the comment there are several strategies in the documentation. You can also find them here: <a href="http://git-scm.com/docs/git-merge">http://git-scm.com/docs/git-merge</a></p>
<p>You are looking for either <code>git merge -s recursive -X ours</code> or <code>git merge -s recursive -X theirs</code> ... | <p>As mention in the comment there are several strategies in the documentation. You can also find them here: <a href="http://git-scm.com/docs/git-merge">http://git-scm.com/docs/git-merge</a></p> <p>You are looking for either <code>git merge -s recursive -X ours</code> or <code>git merge -s recursive -X theirs</code> ... | 119 | git | <h1>How to prefer files from one branch during a merge?</h1>
<p>Some time ago I created a branch from my <code>master</code> branch. Let's call it <code>new_feature</code>. While I was working on <code>new_feature</code>, the <code>master</code> branch followed its normal evolution. Now that <code>new_feature</code> is... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,334 | git | # How to prefer files from one branch during a merge?
Some time ago I created a branch from my `master` branch. Let's call it `new_feature`. While I was working on `new_feature`, the `master` branch followed its normal evolution. Now that `new_feature` is ready to be merged into `master` I see some conflicts, all of t... | As mention in the comment there are several strategies in the documentation. You can also find them here: <http://git-scm.com/docs/git-merge>
You are looking for either `git merge -s recursive -X ours` or `git merge -s recursive -X theirs` depending on the branch that you are on. Be careful with these as you can accid... |
10482773 | Also use comma as a word separator in diff | 42 | 2012-05-07 13:13:25 | <p>How can I add <code>,</code> as a word separator for git diff --word-diff?</p>
<p>For instance I would like the diff to recognize that</p>
<pre><code>function(A,B,C) -> function(A, B, C)
</code></pre>
<p>only has added the spaces instead of replacing the whole line.</p>
| 10,669 | 317,273 | 2025-08-12 04:21:34 | 10,483,000 | 52 | 2012-05-07 13:32:09 | 236,871 | 2012-05-07 13:32:09 | https://stackoverflow.com/q/10482773 | https://stackoverflow.com/a/10483000 | <p>Use <code>--word-diff-regex</code>:</p>
<pre><code> --word-diff-regex=<regex>
Use <regex> to decide what a word is, instead of considering runs
of non-whitespace to be a word. Also implies --word-diff unless it
was already enabled.
Every non-overlapping match of the <re... | <p>Use <code>--word-diff-regex</code>:</p> <pre><code> --word-diff-regex=<regex> Use <regex> to decide what a word is, instead of considering runs of non-whitespace to be a word. Also implies --word-diff unless it was already enabled. Every non-overlapping match of the <re... | 119, 606 | diff, git | <h1>Also use comma as a word separator in diff</h1>
<p>How can I add <code>,</code> as a word separator for git diff --word-diff?</p>
<p>For instance I would like the diff to recognize that</p>
<pre><code>function(A,B,C) -> function(A, B, C)
</code></pre>
<p>only has added the spaces instead of replacing the whol... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,335 | git | # Also use comma as a word separator in diff
How can I add `,` as a word separator for git diff --word-diff?
For instance I would like the diff to recognize that
```
function(A,B,C) -> function(A, B, C)
```
only has added the spaces instead of replacing the whole line. | Use `--word-diff-regex`:
```
--word-diff-regex=<regex>
Use <regex> to decide what a word is, instead of considering runs
of non-whitespace to be a word. Also implies --word-diff unless it
was already enabled.
Every non-overlapping match of the <regex> is considered a word.
Anythi... |
17901588 | New repo with copied history of only currently tracked files | 40 | 2013-07-27 19:22:23 | <p>Our current repo has tens of thousands of commits and a fresh clone transfers nearly a gig of data (there are lots of jar files that have since been deleted in the history). We'd like to cut this size down by making a new repo that keeps the full history for just the files that are currently active in the repo, or ... | 6,545 | 1,010,025 | 2021-09-22 07:48:57 | 17,909,526 | 52 | 2013-07-28 14:59:27 | 761,202 | 2021-09-22 07:48:57 | https://stackoverflow.com/q/17901588 | https://stackoverflow.com/a/17909526 | <h2>Delete everything and restore what you want</h2>
<p>Rather than delete this-list-of-files one at a time, do the almost-opposite: delete everything and just restore the files you want to keep.</p>
<p>Like so:</p>
<pre><code># for unix
$ git checkout master
$ git ls-files > keep-these.txt
$ git filter-branch --fo... | <h2>Delete everything and restore what you want</h2> <p>Rather than delete this-list-of-files one at a time, do the almost-opposite: delete everything and just restore the files you want to keep.</p> <p>Like so:</p> <pre><code># for unix $ git checkout master $ git ls-files > keep-these.txt $ git filter-branch --fo... | 119 | git | <h1>New repo with copied history of only currently tracked files</h1>
<p>Our current repo has tens of thousands of commits and a fresh clone transfers nearly a gig of data (there are lots of jar files that have since been deleted in the history). We'd like to cut this size down by making a new repo that keeps the full... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,336 | git | # New repo with copied history of only currently tracked files
Our current repo has tens of thousands of commits and a fresh clone transfers nearly a gig of data (there are lots of jar files that have since been deleted in the history). We'd like to cut this size down by making a new repo that keeps the full history f... | ## Delete everything and restore what you want
Rather than delete this-list-of-files one at a time, do the almost-opposite: delete everything and just restore the files you want to keep.
Like so:
```
# for unix
$ git checkout master
$ git ls-files > keep-these.txt
$ git filter-branch --force --index-filter \
"git... |
14607636 | Is it advisable to include the contents of vendor/cache in Git in a Rails 3.2 application? | 39 | 2013-01-30 15:31:39 | <p>I frequently need to create branches in my application for new development. This often means that I have changes to my Gemfile in my branch that are not present in Master, and as such I end up with differences in the cached gems in vendor/cache.</p>
<p>I find that it bothers me that I am committing cached gems, but... | 8,078 | 465,986 | 2013-02-13 20:35:55 | 14,862,588 | 52 | 2013-02-13 20:34:52 | 563,041 | 2013-02-13 20:34:52 | https://stackoverflow.com/q/14607636 | https://stackoverflow.com/a/14862588 | <p>TL;DR: This is up to you, but I recommend keeping them in git.</p>
<p>What <code>vendor/cache</code> does is allow bundling, especially deployment bundling to skip downloading the gems from rubygems. This significantly reduces reliance on rubygems.</p>
<p>In deployment, you can specify <code>--local</code> to bund... | <p>TL;DR: This is up to you, but I recommend keeping them in git.</p> <p>What <code>vendor/cache</code> does is allow bundling, especially deployment bundling to skip downloading the gems from rubygems. This significantly reduces reliance on rubygems.</p> <p>In deployment, you can specify <code>--local</code> to bund... | 12, 119, 2847, 64108, 76120 | git, ruby, rubygems, ruby-on-rails-3, ruby-on-rails-3.2 | <h1>Is it advisable to include the contents of vendor/cache in Git in a Rails 3.2 application?</h1>
<p>I frequently need to create branches in my application for new development. This often means that I have changes to my Gemfile in my branch that are not present in Master, and as such I end up with differences in the ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,337 | git | # Is it advisable to include the contents of vendor/cache in Git in a Rails 3.2 application?
I frequently need to create branches in my application for new development. This often means that I have changes to my Gemfile in my branch that are not present in Master, and as such I end up with differences in the cached ge... | TL;DR: This is up to you, but I recommend keeping them in git.
What `vendor/cache` does is allow bundling, especially deployment bundling to skip downloading the gems from rubygems. This significantly reduces reliance on rubygems.
In deployment, you can specify `--local` to bundler to completely remove all dependence... |
5298972 | Relationship between n git branches | 39 | 2011-03-14 13:08:19 | <p><strong>If I have n git branches, how do I easily show the relationship between these branches?</strong></p>
<p>Basically I am interested in seeing a tree of a subset of all the branches in my repository. I am however not interested in all the intermediate commits.</p>
<p>E.g.: My repository looks like this:</p>
... | 16,589 | 81,398 | 2019-08-09 11:33:06 | 5,299,045 | 52 | 2011-03-14 13:15:34 | 490,930 | 2011-03-14 13:15:34 | https://stackoverflow.com/q/5298972 | https://stackoverflow.com/a/5299045 | <p>You can give this a try:</p>
<pre><code>git log --graph --all --decorate --simplify-by-decoration
</code></pre>
<p>It will only show commits that are branch heads or tagged.</p>
| <p>You can give this a try:</p> <pre><code>git log --graph --all --decorate --simplify-by-decoration </code></pre> <p>It will only show commits that are branch heads or tagged.</p> | 119, 1879, 76220 | branch, git, git-branch | <h1>Relationship between n git branches</h1>
<p><strong>If I have n git branches, how do I easily show the relationship between these branches?</strong></p>
<p>Basically I am interested in seeing a tree of a subset of all the branches in my repository. I am however not interested in all the intermediate commits.</p>
... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,338 | git | # Relationship between n git branches
**If I have n git branches, how do I easily show the relationship between these branches?**
Basically I am interested in seeing a tree of a subset of all the branches in my repository. I am however not interested in all the intermediate commits.
E.g.: My repository looks like th... | You can give this a try:
```
git log --graph --all --decorate --simplify-by-decoration
```
It will only show commits that are branch heads or tagged. |
36251746 | How to use gitignore in Pycharm? | 37 | 2016-03-27 19:37:31 | <p>Similar questions <a href="https://stackoverflow.com/questions/936249/stop-tracking-and-ignore-changes-to-a-file-in-git">like this one</a> about how to ignore files in a git repo are typically answered by showing which git command to execute on the command line. <a href="https://stackoverflow.com/questions/9237345/h... | 94,695 | 1,318,479 | 2022-05-20 18:17:55 | 47,823,842 | 52 | 2017-12-14 23:48:01 | 9,101,313 | 2017-12-15 00:03:49 | https://stackoverflow.com/q/36251746 | https://stackoverflow.com/a/47823842 | <p>Try:</p>
<ol>
<li>Go to Settings</li>
<li>Go to Plugins</li>
<li>Search for: .ignore</li>
<li>Install</li>
<li>Restart PyCharm</li>
</ol>
<p><code>.gitignore</code> should now be included in <code>.ignore</code> along with <code>.hgignore</code> etc.</p>
| <p>Try:</p> <ol> <li>Go to Settings</li> <li>Go to Plugins</li> <li>Search for: .ignore</li> <li>Install</li> <li>Restart PyCharm</li> </ol> <p><code>.gitignore</code> should now be included in <code>.ignore</code> along with <code>.hgignore</code> etc.</p> | 119, 25056, 51298 | git, gitignore, pycharm | <h1>How to use gitignore in Pycharm?</h1>
<p>Similar questions <a href="https://stackoverflow.com/questions/936249/stop-tracking-and-ignore-changes-to-a-file-in-git">like this one</a> about how to ignore files in a git repo are typically answered by showing which git command to execute on the command line. <a href="htt... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,339 | git | # How to use gitignore in Pycharm?
Similar questions [like this one](https://stackoverflow.com/questions/936249/stop-tracking-and-ignore-changes-to-a-file-in-git) about how to ignore files in a git repo are typically answered by showing which git command to execute on the command line. [Even this one](https://stackove... | Try:
1. Go to Settings
2. Go to Plugins
3. Search for: .ignore
4. Install
5. Restart PyCharm
`.gitignore` should now be included in `.ignore` along with `.hgignore` etc. |
8170558 | Git push: set target for branch | 36 | 2011-11-17 16:19:33 | <p>I'd like to push my current branch (hp1) with</p>
<pre><code>git push
</code></pre>
<p>and not</p>
<pre><code>git push origin hp1:team/hp1
</code></pre>
<p>The remote branch already exists.</p>
<p>My local branches:</p>
<pre><code>develop
master
* hp1
</code></pre>
<p>git remote show origin tells me:</p>
<pr... | 50,467 | 1,050,687 | 2015-11-24 07:40:08 | 8,172,215 | 52 | 2011-11-17 18:17:59 | 526,535 | 2011-11-17 18:23:28 | https://stackoverflow.com/q/8170558 | https://stackoverflow.com/a/8172215 | <p>First of all, when pushing for the first time, do:</p>
<pre><code>git push -u origin hp1:team/hp1
</code></pre>
<p>About -u option:</p>
<blockquote>
<p>-u<br>
--set-upstream </p>
<p>For every branch that is up to date or successfully pushed, add
upstream (tracking) reference, used by argument-less git-... | <p>First of all, when pushing for the first time, do:</p> <pre><code>git push -u origin hp1:team/hp1 </code></pre> <p>About -u option:</p> <blockquote> <p>-u<br> --set-upstream </p> <p>For every branch that is up to date or successfully pushed, add upstream (tracking) reference, used by argument-less git-... | 119 | git | <h1>Git push: set target for branch</h1>
<p>I'd like to push my current branch (hp1) with</p>
<pre><code>git push
</code></pre>
<p>and not</p>
<pre><code>git push origin hp1:team/hp1
</code></pre>
<p>The remote branch already exists.</p>
<p>My local branches:</p>
<pre><code>develop
master
* hp1
</code></pre>
<p>... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,341 | git | # Git push: set target for branch
I'd like to push my current branch (hp1) with
```
git push
```
and not
```
git push origin hp1:team/hp1
```
The remote branch already exists.
My local branches:
```
develop
master
* hp1
```
git remote show origin tells me:
```
Remote branches:
develop tracked
master tra... | First of all, when pushing for the first time, do:
```
git push -u origin hp1:team/hp1
```
About -u option:
> -u
> --set-upstream
>
> For every branch that is up to date or successfully pushed, add
> upstream (tracking) reference, used by argument-less git-pull(1) and
> other commands. For more information, see br... |
34060557 | git and vimdiff - close all files at once | 35 | 2015-12-03 07:57:02 | <p>When using vimdiff with git and lots of changed files, vimdiff will open each file sequentially. It opens up the next file once you have closed the current file.</p>
<p>But what if I just want to break out of the whole diff process and also do not want to have coming diffs open?</p>
<p>How can I stop all diffs whe... | 10,987 | 1,616,329 | 2016-02-01 23:27:15 | 34,065,448 | 52 | 2015-12-03 11:55:19 | 1,616,329 | 2015-12-03 11:55:19 | https://stackoverflow.com/q/34060557 | https://stackoverflow.com/a/34065448 | <p>OK, I found it.</p>
<p>in .gitconfig:</p>
<pre><code>[difftool]
# Be able to abort all diffs with `:cq` or `:cquit`
trustExitCode = true
</code></pre>
<p>Then inside vim just enter <code>:cq</code> or <code>:cquit</code>. This will exit vim with error codes and git has been told to rely on the error codes... | <p>OK, I found it.</p> <p>in .gitconfig:</p> <pre><code>[difftool] # Be able to abort all diffs with `:cq` or `:cquit` trustExitCode = true </code></pre> <p>Then inside vim just enter <code>:cq</code> or <code>:cquit</code>. This will exit vim with error codes and git has been told to rely on the error codes... | 119, 2605 | git, vimdiff | <h1>git and vimdiff - close all files at once</h1>
<p>When using vimdiff with git and lots of changed files, vimdiff will open each file sequentially. It opens up the next file once you have closed the current file.</p>
<p>But what if I just want to break out of the whole diff process and also do not want to have comi... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,342 | git | # git and vimdiff - close all files at once
When using vimdiff with git and lots of changed files, vimdiff will open each file sequentially. It opens up the next file once you have closed the current file.
But what if I just want to break out of the whole diff process and also do not want to have coming diffs open?
... | OK, I found it.
in .gitconfig:
```
[difftool]
# Be able to abort all diffs with `:cq` or `:cquit`
trustExitCode = true
```
Then inside vim just enter `:cq` or `:cquit`. This will exit vim with error codes and git has been told to rely on the error codes with `trustExitCode`. |
15862598 | how to add all currently untracked files/folders to git ignore? | 35 | 2013-04-07 12:54:04 | <p>I initialized the <code>git</code> repository and made a first commit.
Now, in this directory I run <code>./configure</code> and <code>./make all</code> so that it populates a lot of extra files/folders don't want to track.</p>
<p>What I would like to do, is to add all those untracked files once and for all to my g... | 17,212 | 888,478 | 2022-03-29 03:04:06 | 15,862,643 | 52 | 2013-04-07 12:58:27 | 2,204,581 | 2013-04-07 12:58:27 | https://stackoverflow.com/q/15862598 | https://stackoverflow.com/a/15862643 | <p>Try this:</p>
<pre><code>git status -s | grep -e "^\?\?" | cut -c 4- >> .gitignore
</code></pre>
<p>Explanation: <code>git status -s</code> gives you a short version of the status, without headers. The <code>grep</code> takes only lines that start with <code>??</code>, i.e. untracked files, the <code>cut</co... | <p>Try this:</p> <pre><code>git status -s | grep -e "^\?\?" | cut -c 4- >> .gitignore </code></pre> <p>Explanation: <code>git status -s</code> gives you a short version of the status, without headers. The <code>grep</code> takes only lines that start with <code>??</code>, i.e. untracked files, the <code>cut</co... | 119, 25056 | git, gitignore | <h1>how to add all currently untracked files/folders to git ignore?</h1>
<p>I initialized the <code>git</code> repository and made a first commit.
Now, in this directory I run <code>./configure</code> and <code>./make all</code> so that it populates a lot of extra files/folders don't want to track.</p>
<p>What I would... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,343 | git | # how to add all currently untracked files/folders to git ignore?
I initialized the `git` repository and made a first commit.
Now, in this directory I run `./configure` and `./make all` so that it populates a lot of extra files/folders don't want to track.
What I would like to do, is to add all those untracked files ... | Try this:
```
git status -s | grep -e "^\?\?" | cut -c 4- >> .gitignore
```
Explanation: `git status -s` gives you a short version of the status, without headers. The `grep` takes only lines that start with `??`, i.e. untracked files, the `cut` removes the `??`, and the rest adds it to the `.gitignore` file. |
15612003 | How to push a new folder (containing other folders and files) to an existing git repo? | 35 | 2013-03-25 09:54:45 | <p>I cloned a repository to my desktop machine using <code>git clone sshurl</code>. As expected, this created a folder in my desktop.</p>
<p>Now, instead of a single file, I want to push a whole folder into git. For example, the folder that I cloned is named <code>project_iphone</code>. Now I add another folder called... | 234,153 | 1,089,434 | 2022-09-03 21:51:29 | 15,612,144 | 52 | 2013-03-25 10:01:54 | 752,411 | 2013-03-25 10:01:54 | https://stackoverflow.com/q/15612003 | https://stackoverflow.com/a/15612144 | <p>You need to <code>git add my_project</code> to stage your new folder. Then <code>git add my_project/*</code> to stage its contents. Then commit what you've staged using <code>git commit</code> and finally push your changes back to the source using <code>git push origin master</code> (I'm assuming you wish to push ... | <p>You need to <code>git add my_project</code> to stage your new folder. Then <code>git add my_project/*</code> to stage its contents. Then commit what you've staged using <code>git commit</code> and finally push your changes back to the source using <code>git push origin master</code> (I'm assuming you wish to push ... | 119, 218, 4236 | directory, git, push | <h1>How to push a new folder (containing other folders and files) to an existing git repo?</h1>
<p>I cloned a repository to my desktop machine using <code>git clone sshurl</code>. As expected, this created a folder in my desktop.</p>
<p>Now, instead of a single file, I want to push a whole folder into git. For example... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,344 | git | # How to push a new folder (containing other folders and files) to an existing git repo?
I cloned a repository to my desktop machine using `git clone sshurl`. As expected, this created a folder in my desktop.
Now, instead of a single file, I want to push a whole folder into git. For example, the folder that I cloned ... | You need to `git add my_project` to stage your new folder. Then `git add my_project/*` to stage its contents. Then commit what you've staged using `git commit` and finally push your changes back to the source using `git push origin master` (I'm assuming you wish to push to the master branch). |
96615 | Git - is it pull or rebase when working on branches with other people | 33 | 2008-09-18 20:33:27 | <p>So if I'm using branches that are remote (tracked) branches, and I want to get the lastest, I'm still unclear if I should be doing <code>git pull</code> or <code>git rebase</code>. I thought I had read that doing <code>git rebase</code> when working on a branch with other users, it can screw them up when they pull o... | 15,323 | 14,873 | 2012-07-10 19:27:19 | 96,924 | 52 | 2008-09-18 21:01:49 | 6,349 | 2011-06-08 02:39:21 | https://stackoverflow.com/q/96615 | https://stackoverflow.com/a/96924 | <p>Git pull is a combination of 2 commands</p>
<ul>
<li>git fetch (syncs your local repo with the newest stuff on the remote)</li>
<li>git merge (merges the changes from the distant branch, if any, into your local tracking branch)</li>
</ul>
<p>git rebase is only a rough equivalent to git merge. It doesn't fetch anyt... | <p>Git pull is a combination of 2 commands</p> <ul> <li>git fetch (syncs your local repo with the newest stuff on the remote)</li> <li>git merge (merges the changes from the distant branch, if any, into your local tracking branch)</li> </ul> <p>git rebase is only a rough equivalent to git merge. It doesn't fetch anyt... | 119, 456 | git, version-control | <h1>Git - is it pull or rebase when working on branches with other people</h1>
<p>So if I'm using branches that are remote (tracked) branches, and I want to get the lastest, I'm still unclear if I should be doing <code>git pull</code> or <code>git rebase</code>. I thought I had read that doing <code>git rebase</code> w... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,345 | git | # Git - is it pull or rebase when working on branches with other people
So if I'm using branches that are remote (tracked) branches, and I want to get the lastest, I'm still unclear if I should be doing `git pull` or `git rebase`. I thought I had read that doing `git rebase` when working on a branch with other users, ... | Git pull is a combination of 2 commands
- git fetch (syncs your local repo with the newest stuff on the remote)
- git merge (merges the changes from the distant branch, if any, into your local tracking branch)
git rebase is only a rough equivalent to git merge. It doesn't fetch anything remotely. In fact it doesn't d... |
20338500 | Git repository lost its remote branches? | 32 | 2013-12-02 21:45:04 | <p>I have a git repository that <em>has</em> a remote set up ("git fetch" works), but it <em>doesn't</em> have any remote branches: the ".git/refs/remotes" folder doesn't exist, and </p>
<pre><code>git branch -r
</code></pre>
<p>returns nothing (empty list, no branches). Yet the actual remote repository does have a... | 36,542 | 407,588 | 2017-04-25 16:17:24 | 20,338,558 | 52 | 2013-12-02 21:47:19 | 1,256,452 | 2017-04-25 16:17:24 | https://stackoverflow.com/q/20338500 | https://stackoverflow.com/a/20338558 | <p>[Edit, April 2017] If you made your original clone with <code>--single-branch</code>, your <code>remote.origin.fetch</code> setting will be the problem. If you used a <code>--depth</code> limit, that too implies <code>--single-branch</code>. Restore the normal <code>remote.origin.fetch</code> value described below... | <p>[Edit, April 2017] If you made your original clone with <code>--single-branch</code>, your <code>remote.origin.fetch</code> setting will be the problem. If you used a <code>--depth</code> limit, that too implies <code>--single-branch</code>. Restore the normal <code>remote.origin.fetch</code> value described below... | 119, 456 | git, version-control | <h1>Git repository lost its remote branches?</h1>
<p>I have a git repository that <em>has</em> a remote set up ("git fetch" works), but it <em>doesn't</em> have any remote branches: the ".git/refs/remotes" folder doesn't exist, and </p>
<pre><code>git branch -r
</code></pre>
<p>returns nothing (empty list, no branch... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,346 | git | # Git repository lost its remote branches?
I have a git repository that *has* a remote set up ("git fetch" works), but it *doesn't* have any remote branches: the ".git/refs/remotes" folder doesn't exist, and
```
git branch -r
```
returns nothing (empty list, no branches). Yet the actual remote repository does have a... | [Edit, April 2017] If you made your original clone with `--single-branch`, your `remote.origin.fetch` setting will be the problem. If you used a `--depth` limit, that too implies `--single-branch`. Restore the normal `remote.origin.fetch` value described below and you will get a fuller clone.
---
Normally, just runni... |
7066734 | sqlite3 file add in .gitignore but still in the modified list? | 32 | 2011-08-15 15:17:18 | <p>I ignore <code>*.sqlite3</code> file both in the project directory and the global gitignore config, but after that the sqlite3 file show in the git modified log every time.
How can I fix that?</p>
| 26,565 | 658,269 | 2023-08-03 10:50:45 | 7,066,782 | 52 | 2011-08-15 15:20:03 | 526,535 | 2011-08-15 15:20:03 | https://stackoverflow.com/q/7066734 | https://stackoverflow.com/a/7066782 | <p>If the file(s) is already in the repo ( ie. it is versioned ) it will continue to show as modified if you make changes to it. To make git start ignore them, first unversion the files ( using <code>git rm --cached</code> and <code>git commit</code> )</p>
| <p>If the file(s) is already in the repo ( ie. it is versioned ) it will continue to show as modified if you make changes to it. To make git start ignore them, first unversion the files ( using <code>git rm --cached</code> and <code>git commit</code> )</p> | 119, 4984 | git, ruby-on-rails | <h1>sqlite3 file add in .gitignore but still in the modified list?</h1>
<p>I ignore <code>*.sqlite3</code> file both in the project directory and the global gitignore config, but after that the sqlite3 file show in the git modified log every time.
How can I fix that?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,347 | git | # sqlite3 file add in .gitignore but still in the modified list?
I ignore `*.sqlite3` file both in the project directory and the global gitignore config, but after that the sqlite3 file show in the git modified log every time.
How can I fix that? | If the file(s) is already in the repo ( ie. it is versioned ) it will continue to show as modified if you make changes to it. To make git start ignore them, first unversion the files ( using `git rm --cached` and `git commit` ) |
714589 | Can git-svn correctly populate svn:mergeinfo properties? | 32 | 2009-04-03 16:03:02 | <p>I am evaluating git-svn and trying to determine how well it will play with a particular svn repository. I am mostly concerned with getting git-svn to perform merges in such a way that the svn:mergeinfo property is correctly set in the subversion repo. Is this possible?</p>
<p>Here is what I have done so far:</p>
<... | 6,766 | 65,778 | 2012-09-10 20:37:17 | 5,983,620 | 52 | 2011-05-12 19:48:26 | 97,627 | 2011-12-25 01:04:07 | https://stackoverflow.com/q/714589 | https://stackoverflow.com/a/5983620 | <p>Even though this is an old question, the current state of affairs with git-svn has changed since it was asked. Specifically, in git 1.7.5, there is some limited support for setting the svn:mergeinfo when dcommitting back to svn.</p>
<p><code>git svn dcommit</code> now accepts the <code>-mergeinfo=<mergeinfo><... | <p>Even though this is an old question, the current state of affairs with git-svn has changed since it was asked. Specifically, in git 1.7.5, there is some limited support for setting the svn:mergeinfo when dcommitting back to svn.</p> <p><code>git svn dcommit</code> now accepts the <code>-mergeinfo=<mergeinfo><... | 63, 119, 717, 6452 | git, git-svn, merge, svn | <h1>Can git-svn correctly populate svn:mergeinfo properties?</h1>
<p>I am evaluating git-svn and trying to determine how well it will play with a particular svn repository. I am mostly concerned with getting git-svn to perform merges in such a way that the svn:mergeinfo property is correctly set in the subversion repo.... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,348 | git | # Can git-svn correctly populate svn:mergeinfo properties?
I am evaluating git-svn and trying to determine how well it will play with a particular svn repository. I am mostly concerned with getting git-svn to perform merges in such a way that the svn:mergeinfo property is correctly set in the subversion repo. Is this ... | Even though this is an old question, the current state of affairs with git-svn has changed since it was asked. Specifically, in git 1.7.5, there is some limited support for setting the svn:mergeinfo when dcommitting back to svn.
`git svn dcommit` now accepts the `-mergeinfo=<mergeinfo>` flag. To quote from the [1.7.5+... |
16857063 | Git-SVN: Update Git repo from centralized SVN server | 31 | 2013-05-31 12:16:49 | <p>I'm working on a project for which everyone uses <code>SVN</code> as a centralized server and everybody pushes the changes they do on that server. I want to use <code>Git</code> locally and I'm pretty new to <code>git svn</code>. I did a <code>git svn clone</code> of the repository with <code>git svn clone -r HEAD h... | 30,577 | 1,007,758 | 2014-03-31 15:22:26 | 16,858,275 | 52 | 2013-05-31 13:18:51 | 1,237,653 | 2014-03-31 15:22:26 | https://stackoverflow.com/q/16857063 | https://stackoverflow.com/a/16858275 | <p>Best way to work on a Subversion Repository via Git:</p>
<ol>
<li><code>git svn init -s https://svn.repo/app/ myrepo</code> assuming that under <a href="https://svn.repo/app/">https://svn.repo/app/</a> the repo contains the standard <code>/trunk</code>, <code>branches</code> and <code>tags</code> subdirectories</li... | <p>Best way to work on a Subversion Repository via Git:</p> <ol> <li><code>git svn init -s https://svn.repo/app/ myrepo</code> assuming that under <a href="https://svn.repo/app/">https://svn.repo/app/</a> the repo contains the standard <code>/trunk</code>, <code>branches</code> and <code>tags</code> subdirectories</li... | 119, 6452, 28896, 33720 | git, git-fetch, git-pull, git-svn | <h1>Git-SVN: Update Git repo from centralized SVN server</h1>
<p>I'm working on a project for which everyone uses <code>SVN</code> as a centralized server and everybody pushes the changes they do on that server. I want to use <code>Git</code> locally and I'm pretty new to <code>git svn</code>. I did a <code>git svn clo... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%git%'; a.Body LIKE '%<code>%git%'; q.Score > 5; a.Score > 10 | 17,349 | git | # Git-SVN: Update Git repo from centralized SVN server
I'm working on a project for which everyone uses `SVN` as a centralized server and everybody pushes the changes they do on that server. I want to use `Git` locally and I'm pretty new to `git svn`. I did a `git svn clone` of the repository with `git svn clone -r HE... | Best way to work on a Subversion Repository via Git:
1. `git svn init -s https://svn.repo/app/ myrepo` assuming that under <https://svn.repo/app/> the repo contains the standard `/trunk`, `branches` and `tags` subdirectories
2. Do a `git svn fetch` in myrepo until no more commits are fetched (may take quite some time ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.