messages listlengths 3 3 |
|---|
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git submodule update vs git submodule sync\nThe git documentation doesn't make it at all clear what the difference is between a git submodule update and a git submodule sync is. I'm also not finding any help out on the web. Can someone help me out with what the difference is here?\n update\n Update the registered submodules to match what the superproject expects\n by cloning missing submodules and updating the working tree of the\n submodules. The \"updating\" can be done in several ways depending on\n command line options and the value of submodule.<name>.update\n configuration variable.\n\n-\n sync\n Synchronizes submodules' remote URL configuration setting to the value\n specified in .gitmodules. It will only affect those submodules which\n already have a URL entry in .git/config (that is the case when they are\n initialized or freshly added). This is useful when submodule URLs\n change upstream and you need to update your local repositories\n accordingly.\n\nFor reference, I'm using the git client version 2.11.0"
},
{
"role": "assistant",
"content": "update is basically doing git pull in each submodule (except without a branch, since the main repo specifies a commit directly).\nThe tricky one is sync. Imagine you clone a project with submodules, then later the upstream project changes one of the submodules to point to a different URL.\nYour local copy of the submodule will still point to the old URL, since git never allows remote repositories to force a change to local configuration. You need to run git submodule sync to apply the remote repo's configuration to your local submodule repos.\nNote also that, if you are making changes to the submodules, you might want the URLs to mismatch even if the upstream never changed them ... but using multiple remote URLs is probably a better idea for that case."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-send-email - Send a collection of patches as emails sendemail.signedOffCc (deprecated)"
},
{
"role": "assistant",
"content": "Deprecated alias for sendemail.signedOffByCc ."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to Merge when you get error \"Hint: You have divergent branches and need to specify how to reconcile them.\"\nI'm working with 1 other developer who has created a branch that needs to be merged with master.\nI get this error when attempting to Pull in Git in Visual Studio Community (not Visual Studio Code) to a Bitbucket repo\nIf I attempt to Push it says \"unable to push because your local branch is behind the remote branch\".\nThis is the error:\nHint: You have divergent branches and need to specify how to reconcile them.\nHint: You can do so by running one of the following commands sometime before\nHint: your next pull:\nHint: \nHint: git config pull.rebase false # merge\nHint: git config pull.rebase true # rebase\nHint: git config pull.ff only # fast-forward only\nHint: \nHint: You can replace \"git config\" with \"git config --global\" to set a default\nHint: preference for all repositories. You can also pass --rebase, --no-rebase,\nHint: or --ff-only on the command line to override the configured default per\nHint: invocation.\nGit failed with a fatal error.\nGit failed with a fatal error.\nNeed to specify how to reconcile divergent branches.\n\nI've found various things that discuss this, eg\nhttps://laracasts.com/discuss/channels/code-review/git-pull-error-pulling-without-specifying-how-to-reconcile-divergent-branches-is-discouraged?page=1&replyId=773818\nand\nHow can I deal with this Git warning? \"Pulling without specifying how to reconcile divergent branches is discouraged\"\nBut none of them explain WHY this is happening and what the actions actually do.\nHow can I merge in what's in the other branch into master, why is this message coming up and what effect do all the suggestions in the hints have?\nThanks"
},
{
"role": "assistant",
"content": "As is often the case with confusing stuff in Git, there's some history involved.\nThe first thing to know is that git pull does too much stuff. Well, for some people (me), it does too much; others like that it does this much; but in fact, it does two jobs, each of which has its own separate Git command:\n\ngit pull runs git fetch. Most, but not all, of the arguments you give to git pull are passed directly to git fetch. So git pull means run git fetch and git pull origin somebranch means run git fetch origin somebranch.\n\nAssuming the first step succeeds, git pull runs a second Git command.\n\n\nThe reason to have a step 2 at all is simple enough: git fetch obtains new commits from some other Git repository, stuffing those new commits into your own repository where you now have access to them. But then it stops. You have access to the new commits, but nothing is actually using the new commits yet. To use the new commits, you need a second step.\nInitially, that second step was always git merge. The git merge command is pretty big and complicated but it has a meaning that's pretty simple to describe: Merge means combine work. Git will attempt to take work you have done, if you have done any, and work they have done, if they have done any, and combine the work, using simple and stupid automated rules. These rules have no clue as to how or why you did the work, or what anything you changed means. They just work based on \"lines\" in diffs.\nThere are, however, four possibilities here:\n\nPerhaps you did no work and they did no work. You got no new commits. There's literally nothing to do, and git merge does nothing.\n\nPerhaps you did some work and they did nothing; you got no new commits; there's nothing to do and git merge does nothing again.\n\nPerhaps you did no work and they did do some work. You got some new commits. Combining your lack-of-work with their actual work is easy and git merge will take a shortcut if you allow it.\n\nPerhaps you and they both did work. You have new commits and you got new commits from them, and git merge has to use its simple-and-stupid rules to combine the work. Git cannot take any shortcuts here and you will get a full-blown merge.\n\n\nThe shortcut that Git may be able to take is to simply check out their latest commit while dragging your branch name forward. The git merge command calls this a fast-forward merge, although there's no actual merging involved. This kind of not-really-a-merge is trivial, and normally extremely safe: the only thing that can go wrong is if their latest commit doesn't actually function properly. (In that case, you can go back to the older version that does.) So a \"fast forward\" merge is particularly friendly: there's no complicated line-by-line merging rules that can go awry. Many people like this kind of \"merge\".\nSometimes the shortcut is not possible, and sometimes some people don't want Git to take the shortcut (for reasons we won't cover here to keep this answer short, or short for me anyway). There is a way to tell git merge do not take the shortcut, even if you can.\nSo, for git merge alone, that gives us three possibilities:\n\nnothing to do (and git merge is always willing to do nothing);\nfast-forward is possible, but maybe Git shouldn't do it; and\nfast-forward is not possible, which means this merge isn't trivial.\n\nThe git merge command has options to tell it what to do in all but the \"nothing to do\" case:\n\n(no flags): do a fast-forward if possible, and if not, attempt a real merge.\n--ff-only: do a fast-forward if that's possible. If not, give an error stating that fast-forward is not possible; do not attempt a merge.\n--no-ff: even if a fast-forward is possible, don't use the shortcut: attempt a full merge in every case (except of course the \"nothing to do\" case).\n\nThe git pull command accepts all of these flags and will pass them on to git merge, should you choose to have git pull run git merge as its step 2.\nBut wait, there's more\nNot everyone wants Git to do merges. Suppose you have made one or two new commits, which we'll call I and J, and your git fetch from origin brings in two new commits that they made since you started, which we will call K and L. That gives you a set of commits that, if you were to draw them, might look like this:\n I--J <-- your-branch\n /\n...--G--H <-- main\n \\\n K--L <-- origin/main\n\nYou can fast-forward your main to match their origin/main:\n I--J <-- your-branch\n /\n...--G--H\n \\\n K--L <-- main, origin/main\n\nAnd, whether or not you do that, you can merge your commit J with their commit L to produce a new merge commit M:\n I--J\n / \\\n...--G--H M <-- your-branch (HEAD)\n \\ /\n K--L <-- origin/main\n\nBut some people prefer to rebase their commits—in this case I and J—so that they come after commit L, so that the picture now looks like this:\n I--J [abandoned]\n /\n...--G--H--K--L <-- origin/main\n \\\n I'-J' <-- your-branch\n\nHere, we have copied commits I and J to new-and-improved commits I' and J'. These commits make the same changes to L that I-J made to H, but these commits have different big-ugly-hash-IDs and look like you made them after the origin guys made their K-L commits.\nThe git pull command can do this kind of rebasing:\ngit switch your-branch\ngit pull --rebase origin main\n\ndoes this all in one shot, by running git fetch to get their commits, then running git rebase with the right arguments to make Git copy I-J to I'-J' as shown above. Once the rebase is done—remember that, like git merge, it may have merge conflicts that you have to solve first—Git will move the branch name your-branch to select the last copied commit: J' in this example.\nNot very long after git pull was written, this --rebase was added to it. And since many people want this sort of thing to happen automatically, git pull gained the ability to default to using --rebase. You configured your branch to do this (by setting branch.branch.rebase to true) and git pull would do a rebase for you. (Note that the commit on which your rebase occurs now depends on two things: the upstream setting of the branch, and some of the arguments you can pass to git pull. I've kept things explicit in this example so that we do not have to worry about smaller details, but in practice, you do.)\nThis brings us to 2006 or 2008 or so\nAt this point in Git's development, we have:\n\ngit fetch: obtains new commits from somewhere else (an \"upstream\" or origin repository for instance), often updating origin/* style remote-tracking names;\ngit merge: does nothing, or a fast-forward, or a true merge, of some specified commit or the branch's upstream;\ngit rebase: copies some set of existing commits to new-and-improved commits, using a specified commit or the branch's upstream, then abandons the original commits in favor of the copies; and\ngit pull: using the branch's upstream or explicit arguments, run git fetch and then run either git merge or git rebase.\n\nBecause git merge can take --ff-only or --no-ff arguments, git pull must be able to pass these to git merge if we're using git merge.\nAs time goes on, more options start appearing, such as auto-stashing, rebase's \"fork point\", and so on. Also, it turns out that many people want rebasing to be their default for git pull, so Git acquires a new configuration option, branch.autoSetupRebase. When set to remote or always, this does what many of these folks want (though there are actually four settings today; I don't remember if it had four back then and have not bothered to check).\nTime continues marching on and we reach the 2020s\nBy now—some time between 2020 and 2022—it has become clear that git pull does the wrong thing for many, maybe even most, people who are new to Git. My personal recommendation has been to avoid git pull. Just don't use it: run git fetch first, then look at what git fetch said. Then, if git fetch did a lot, maybe use git log next. And then, once you're sure whether you want git merge with whatever options, or git rebase also with whatever options, run that command. If you use this option, you are in full control. You dictate what happens, rather than getting some surprise from Git. I like this option: it's simple! You do need to run at least two commands, of course. But you get to run additional commands between those two, and that can be useful.\nStill, if a git pull brings in new commits that can be merged under git merge --ff-only, that often turns out to be what I want: do that fast-forward, or else stop and let me look around and decide whether I want a rebase, a merge, or whatever else I might want.1 And that often turns out to be what others want as well, and now git pull, run with no arguments at all, can be told to do that directly:\ngit config --global pull.ff only\n\nachieves this.\nMeanwhile, the other two git config --global commands in the hint you show in your question make the second command be merge or rebase. So now, in 2022, it's easy to tell git pull to do what I would want it to do. Furthermore, it seems that the Git maintainers have come around to my point of view: that git pull without some forethought is bad, and newbies should not use it. So they've set up git pull so that it now requires that you pick one of these three options, if you want to run it with no arguments.2\nSo, you need to pick one. The old default was git config pull.rebase false, but that was a bad default. I do not recommend it. I do recommend git config pull.ff only (though I still don't actually use it due to 15+ years of habits).\n\n1One real-world example: I encounter some bug that's a problem for me. I make a change to the code that I know is wrong, but lets me get my work done. I commit this horrible hack. I then wait for the upstream to make changes. They do and I bring in the new commits. If they've fixed the bug, I want to drop my fix, not merge or rebase it. If they have not fixed the bug, I want to rebase my hack (which may or may not need some tweaking). The \"have they fixed the bug\" test requires something git pull cannot test on its own.\n2Note that running git pull with arguments is not supposed to generate this kind of complaint. I still don't run it much, so I'm not quite sure what the bug was, but in the first round or two of implementation of the new feature, there was a bug where git pull would complain inappropriately. I believe it is fixed in 2.35 and am almost positive it's fixed in 2.36, which should be out any time now."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Xcode 11 SPM authentication failed because no credentials provided\nI started using Swift package manager and when I add repository with https (https://github.com/Alamofire/Alamofire.git) address authentication always fails when I try to login with my github account\nXcode authentication fail\nBut if I'm using [email protected]:Alamofire/Alamofire.git it will get added successfully. I tried regenerating new key, deleted .ssh directory but nothing makes https work and I still get xcode authentication failed because no credentials were provided error. I could use locally ssh url but in CI I need one with https."
},
{
"role": "assistant",
"content": "It was a problem with git config. In .gitconfig file it was set to\n[url \"[email protected]:\"]\n insteadOf = https://github.com/\n\nAfter removing this section https worked correctly\nEDIT: as mentioned in comments you can easily access your gitconfig in terminal with command: git config --global --edit"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "GitHub: Reopening a merged pull request\n\nI made some changes\nI submitted a pull request\nThe pull request was accepted and merged.\nWe found a bug\nThe changes were removed again (force push to 1 commit before) whilst I fixed the bug.\n\nI've now fixed the bug and want to resubmit the pull request with 1 extra commit. Is there any way to reopen the pull request or update it, or do I have to create a new pull request, type out the description etc again? Gitorious has this feature and we've recently moved to GitHub."
},
{
"role": "assistant",
"content": "The answer seems to be: You can't. \nOnce a pull request is merged and closed, it is locked forever and cannot be reopened. If your pull request is merged, closed, then your changes are pulled out (via force pushing backwards to before the merge), you will need to add commits to the branch and create a new pull request, copying all the details over and probably providing a link to the original pull request to manually save the history.\nMight be a nice feature request for future GitHub."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Can you change code in a GitLab pipeline?\n\nIs it possible for a GitLab CI/CD pipeline to commit code changes?\nI would like to run a stage that uses black to format my code automatically whenever I push my work.\ngitlab-ci.yml\nimage: python:3.6\n\nstages:\n - test\n\nbefore_script:\n - python3 -m pip install -r requirements.txt\n\ntest:linting:\n script:\n - black ./\n\n\nI made sure to include a file that needs reformatting to test if this works. \nJob output\n $ black ./\n reformatted test.py\n All done! ✨ 🍰 ✨\n 1 file reformatted.\n\nThe file in my repository remains unchanged which leads me to believe that this might not be possible."
},
{
"role": "assistant",
"content": "Black won't automatically commit corrected python code unless you use pre-commit hook.\nBest way to run black in CI is to include something like :\nblack . --check --verbose --diff --color\n\nThis will fail the test if python code fail to adhere to code format and force user to fix formatting.\nplease checkout black --help for all tags.\nThis is a good reference on Black : https://www.mattlayman.com/blog/2018/python-code-black/\nRepo : https://github.com/psf/black"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-show - Show various types of objects --dirstat-by-file[=<param1,param2>…]"
},
{
"role": "assistant",
"content": "Synonym for --dirstat=files,<param1>,<param2>…"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Have sshd forward logins of git user to a (GitLab) Docker container\n\nI would like to configure sshd on my host machine to forward public key logins of a certain user to a Docker container that runs its own sshd service.\nTo give some context, I have GitLab running in a Docker container and I dislike opening another port on the host machine for the SSH GitLab communication but instead have sshd on the host machine redirect user and key directly to the port the GitLab exposes on the local machine.\nMy idea is to do something like this:\nMatch User git\n ForceCommand ssh -p <GitLab port> <some arguments that forward to> git@localhost\n ...\n\nHelp is greatly appreciated!"
},
{
"role": "assistant",
"content": "I found a simple workaround to this. Just create a Git user on the host machine and provide a proxy script that executes the given Git commands in the GitLab container using the host's SSH daemon and the .ssh/authorized_keys from the container volume.\n\nOn the host machine, add the user git using the same UID & GID as in the GitLab docker container (998) and set your GitLab data directory as the user's home:\nuseradd -u 998 -s /bin/bash -d /your/gitlab/path/data git\n\nAdd the git user to the docker group\nusermod -G docker git\n\nAdd a proxy script /opt/gitlab/embedded/service/gitlab-shell/bin/gitlab-shell on the host machine with the following contents:\n#!/bin/bash\ndocker exec -i -u git <your_gitlab_container_id> sh -c \"SSH_CONNECTION='$SSH_CONNECTION' SSH_ORIGINAL_COMMAND='$SSH_ORIGINAL_COMMAND' $0 $1\""
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "With Git, how do I turn off the \"LF will be replaced by CRLF\" warning\nWith Git, when using the autocrlf = true flag, a warning is still given when line-endings are changed.\nI understand what the warning is for, and how to turn off the line-ending flag, but how do I turn off the warning itself?"
},
{
"role": "assistant",
"content": "You can turn off the warning with\ngit config --global core.safecrlf false\n\n(This will only turn off the warning, not the function itself.)"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Github unable to access SSL connect error\n\nI have been using git lots for the last few months. git push worked 12 hours ago now all attempts generate errors, with verbose it produces this:\nGIT_CURL_VERBOSE=1 git push\n* Couldn't find host github.com in the .netrc file; using defaults\n* About to connect() to github.com port 443 (#0)\n* Trying 192.30.253.112... * Connected to github.com (192.30.253.112) port 443 (#0)\n* Initializing NSS with certpath: sql:/etc/pki/nssdb\n* CAfile: /etc/pki/tls/certs/ca-bundle.crt\n CApath: none\n* NSS error -12190\n* Expire cleared\n* Closing connection #0\nfatal: unable to access 'https://github.com/waveney/wmff/': SSL connect error\n\nAny bright ideas? No changes to server from when it worked to now, restart made no difference"
},
{
"role": "assistant",
"content": "I was having the same problem on various CentOS 6 VM's and it turned out to be an issue with stale curl and nss libraries (thanks to this thread for pointing me in the right direction: cURL SSL connect error 35 with NSS error -5961).\nThe fix that worked for me is just:\nyum update -y nss curl libcurl"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How do I get the output of a specific step in GitHub Actions?\n\nI have this GitHub Actions workflow which runs tests, but now I am integrating slack notification in it. I want to get the output of the Run tests step and send it as a message in the slack step.\n - name: Run tests\n run: |\n mix compile --warnings-as-errors\n mix format --check-formatted\n mix ecto.create\n mix ecto.migrate\n mix test\n env:\n MIX_ENV: test\n PGHOST: localhost\n PGUSER: postgres\n\n - name: Slack Notification\n uses: rtCamp/action-slack-notify@master\n env:\n SLACK_MESSAGE: Run tests output\n SLACK_TITLE: CI Test Suite\n SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}"
},
{
"role": "assistant",
"content": "You need to do 3 things:\n\nAdd an id to the step you want the output from\nCreate the outputs using the GITHUB_OUTPUT environment variable\nUse the id and the output name in another step to get the outputs and then join them into one message for slack\n\n- name: Run tests\n run: |\n echo \"mix-compile--warnings-as-errors=$(mix compile --warnings-as-errors)\\n\" >> $GITHUB_OUTPUT\n echo \"mix-format--check-formatted=$(mix format --check-formatted)\\n\" >> $GITHUB_OUTPUT\n echo \"mix-ecto_create=$(mix ecto.create)\\n\" >> $GITHUB_OUTPUT\n echo \"mix-ecto_migrate=$(mix ecto.migrate)\\n\" >> $GITHUB_OUTPUT\n echo \"mix-test=$(mix test)\\n\" >> $GITHUB_OUTPUT\n id: run_tests\n env:\n MIX_ENV: test\n PGHOST: localhost\n PGUSER: postgres\n\n- name: Slack Notification\n uses: rtCamp/action-slack-notify@v2\n env:\n SLACK_MESSAGE: ${{join(steps.run_tests.outputs.*, '\\n')}}\n SLACK_TITLE: CI Test Suite\n SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}\n\nSee Metadata Syntax for outputs name description"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git - the stupid content tracker git-ls-tree"
},
{
"role": "assistant",
"content": "List the contents of a tree object"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-diff-index - Compare a tree to the working tree or index -a --text"
},
{
"role": "assistant",
"content": "Treat all files as text."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-pull - Fetch from and integrate with another repository or a local branch --ff-only"
},
{
"role": "assistant",
"content": "Only update to the new history if there is no divergent local\nhistory. This is the default when no method for reconciling\ndivergent histories is provided (via the --rebase=* flags)."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-diff - Show changes between commits, commit and working tree, etc <limit>"
},
{
"role": "assistant",
"content": "An integer parameter specifies a cut-off percent (3% by default).\nDirectories contributing less than this percentage of the changes\nare not shown in the output."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git merge: apply changes to code that moved to a different file\nI am attempting a pretty beefy git merge maneuver right now. One problem that I am coming across is that I made some changes to some code in my branch, but my colleague moved that code to a new file in his branch. So when I did git merge my_branch his_branch, git did not notice that the code in the new file was the same as the old, and so none of my changes are there. \nWhat's the easiest way to go about applying my changes again to the code in the new files. I won't have too many problems finding out which commits need to be reapplied (I can just use git log --stat). But as far as I can tell, there is no way to get git to reapply the changes into the new files. The easiest thing I am seeing right now is to manually reapply the changes, which is not looking like a good idea. \nI know that git recognizes blobs, not files, so surely there must be a way to tell it, \"apply this exact code change from this commit, except not where it was but where it now is in this new file\"."
},
{
"role": "assistant",
"content": "I had a similar issue, and I resolved it by rebasing my work to match the target file organization. This works because git keep tracks of files content, so by rebasing on top of a rename, the changes are applied as necessary.\nMore precisely, let's say that you modified original.txt on your branch (the local branch), but on the master branch, original.txt has been copied to another one, say copy.txt.\nThis copy has been done in a commit that we name commit CP.\nYou want to apply all your local changes, commits A and B below, that were made on original.txt, to the new file copy.txt.\n ---- X -----CP------ (master)\n \\ \n `--A---B--- (local)\n \n\nCreate a throwaway branch move at the starting point of your changes with git branch move X. That is to say, put the move branch at commit X, the one before the commits you want to merge; most likely, this is the commit from which you branched out to implement your changes. As user @digory doo wrote below, you can do git merge-base master local to find X.\n ---- X (move)-----CP----- (master)\n \\ \n `--A---B--- (local)\n \n\nOn this branch, issue the following renaming command:\ngit mv original.txt copy.txt\n\nThis renames the file. Note that copy.txt did not yet exist in your tree at this point.\nCommit your change (we name this commit MV).\n ,--MV (move)\n /\n ---- X -----CP----- (master)\n \\ \n `--A---B--- (local)\n \n\nYou can now rebase your work on top of move:\ngit rebase move local\n\nThis should work without problem, and your changes are applied to copy.txt in your local branch.\n ,--MV (move)---A'---B'--- (local)\n /\n ---- X -----CP----- (master)\n \n\nNow, you do not necessarily want or need to have commit MV in your main branch's history, because the move operation may lead to a conflict with the copy operation at commit CP in the main branch.\nYou only have to rebase your work again, discarding the move operation, as follows:\ngit rebase move local --onto CP\n\n... where CP is the commit where copy.txt was introduced in the other branch.\nThis rebases all the changes on copy.txt on top of the CP commit.\nNow, your local branch is exactly as if you always modified copy.txt and not original.txt, and you can continue merging with others.\n ,--A''---B''-- (local)\n /\n -----X-------CP----- (master)\n \n\nIt is important that the changes are applied on CP or otherwise copy.txt would not exist and the changes would be applied back on original.txt.\nHope this is clear.\nThis answer comes late, but this may be useful to someone else."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to store releases/binaries in GitLab?\nI am building a workflow with Gitlab, Jenkins and - probably - Nexus (I need an artifact storage). I would like to have GitLab to store releases/binaries - is it possible in a convenient way?\nI would not like to have another service from which a release (and documentation) could be downloaded but to have it somehow integrated with repository manager, just like releases are handled in e.g. GitHub. Any clues?"
},
{
"role": "assistant",
"content": "Update Oct. 2020:\nGitLab 13.5 now offers:\n\nAttach binary assets to Releases\nIf you aren’t currently using GitLab for your releases because you can’t attach binaries to releases, your workflow just got a lot simpler.\nYou now have the ability to attach binaries to a release tag from the gitlab.ci-yml. This extends support of Release Assets to include binaries, rather than just asset links or source code. This makes it even easier for your development teams to adopt GitLab and use it to automate your release process.\n\nSee Documentation and Issue.\n\n\nUpdate Nov. 2015: GitLab 8.2 now supports releases.\nWith its API, you now can create and update a relase associated to a tag.\nFor now, it is only the ability to add release notes (markdown text and attachments) to git tags (aka Releases).\n\nfirst upload the release binary\ncreate a new release and place a link to the uploaded binary in the description\n\nUpdate May 2019: GitLab 1.11 introduces an interesting \"Guest access to Releases\":\n\nIt is now possible for guest users of your projects to view releases that you have published on the Releases page.\nThey will be able to download your published artifacts, but are not allowed to download the source code nor see repository information such as tags and commits.\n\n\nOriginal answer March 2015\nThis is in progress, and suggested in suggestions 4156755:\n\nWe’re accepting merge requests for the minimal proposal by Ciro:\n\n\n\nFor each repository tag under https://github.com/cirosantilli/test/releases/tag/3.0, allow to upload and download a list of files.\n2. The upload and download can be done directly from the tag list view.\n3. If a tag gets removed, the uploads are destroyed.\n(we’re not accepting the tag message edit mentioned in recent comments)\n\n\n\nThe comments to that suggestion include:\n\nWhat makes it more interesting is the next step.\nI would really like a way to let public download artifacts from \"releases\" without being able to access source code (i.e. make sources private for project team only except anything else like wiki, \"releases\", issue tracker).\n\n\nHowever, such additional feature looks more generic and I submitted a separate feature request for that.\n\n\nNevertheless, I repeat my point here:\nWhile the simplistic version of \"releases\" is still nice to have, many people can easily set up external file server and point URLs in release/tag description to this server outside GitLab.\nIn other words, \"releases\" may not look attractive now without some future picture of integration."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Does Git Add have a verbose switch\nI am in the process of moving all my private an public repo's over to github. One of the decisions I have made is to only use the console as it means a smaller tooling footprint if I ever need to change PCs, etc.\nI would be a huge user of console applications and being new to git I decided to purchase Tekpub's Mastering Git series since it shows you how to intergrate git bash as a toolbar.\nEverything is working fine except for the add all command which is:\ngit add .\n\nIt seems to be working but I don't get any indication of it working or not. Is there a verbose switch (I think that is what it would be called) that would say what files were tracked after the command is launched?\nI am using Visual Studio 2010 with the standard install of git (Not Git extensions)"
},
{
"role": "assistant",
"content": "For some git-commands you can specify --verbose,\ngit 'command' --verbose\n\nor\ngit 'command' -v\n\nMake sure the switch is after the actual git command. Otherwise - it won't work!\nAlso useful:\ngit 'command' --dry-run"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-rev-list - Lists commit objects in reverse chronological order --objects"
},
{
"role": "assistant",
"content": "Print the object IDs of any object referenced by the listed\ncommits. --objects foo ^bar thus means “send me\nall object IDs which I need to download if I have the commit\nobject bar but not foo ”. See also --object-names below."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "New lines inside paragraph in README.md\n\nWhen editing an issue and clicking Preview the following markdown source:\na\nb\nc\n\nshows every letter on a new line.\nHowever, it seems to me that pushing similar markdown source structure in README.md joins all the letters on one line.\nI'd like the new lines preserved in the README.md in this project: https://github.com/zoran119/simple-read-only-test\nAny idea how?"
},
{
"role": "assistant",
"content": "Interpreting newlines as <br /> used to be a feature of Github-flavored markdown, but the most recent help document no longer lists this feature.\nFortunately, you can do it manually. The easiest way is to ensure that each line ends with two spaces. So, change\na\nb\nc\n\ninto\na__\nb__\nc\n\n(where _ is a blank space).\nOr, you can add explicit <br /> tags.\na <br />\nb <br />\nc"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Can clang-format tell me if formatting changes are necessary?\nIs there an way that you can run clang-format in a mode where it reports if the file meets the specified format? A kind of dry-run mode where it reports if a change is needed, but doesn't make the change. Ideally I'd like clang-format to just return a non-zero exit code if the file needs changes. Or, even more ideally, a non-zero exit code and a list of the files that need changes on standard output.\nI'm trying to keep the question generic, so that more people can answer, but what I am trying to do is write a git pre-commit hook that will reject any commits that don't match the expected .clang-format . It's easy to run clang-format on the list of files in the index. But it's hard to know if clang-format actually changed anything. \nI have one potential solution based on -output-replacements-xml (that I will post as an answer), but it's a hack and I feel like this should be more straightforward. Comments/suggestions, edits, different answers/approaches are all welcome."
},
{
"role": "assistant",
"content": "Starting with clang-format-10, you can use the --dry-run and -Werror command line options. They will cause ClangFormat to output any formatting violations to stdout and return a non-zero exit status if any input file was not correctly formatted.\n$ clang-format --dry-run --Werror foo.cpp\nfoo.cpp:129:23: error: code should be clang-formatted [-Wclang-format-violations]\n if (rc <= 0) {\n$ echo $?\n1\n\nOriginally from my website here: https://rigtorp.se/notes/clang-format/"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-shortlog - Summarize git log output <paths>"
},
{
"role": "assistant",
"content": "Commits modifying the given <paths> are selected."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Gitlab CI - find the pipeline variables used\n\nWhen you run a pipeline from the Gitlab UI, you are open to add variables to the run:\n\n\n\nFrom the overview of finished pipelines, is there a way to find the set variables and values of specific runs?"
},
{
"role": "assistant",
"content": "As far as I know, these are one time variables you set by running a pipeline manually. You cannot view the the variables in the UI. Instead, like @Origin said you can echo the variable in the job.\nexample:\nscript:\n - '& echo \"$MY_VARIABLE\"'\n\nI would recommend you to save your variables in the default CI/CD Settings. (Settings -> CI/CD -> Variables). There you can set, save, protect (from other user roles) and view them for sure. These variables will be used in any pipeline run you do."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-config - Get and set repository or global options gitcvs.dbName"
},
{
"role": "assistant",
"content": "Database used by git-cvsserver to cache revision information\nderived from the Git repository. The exact meaning depends on the\nused database driver, for SQLite (which is the default driver) this\nis a filename. Supports variable substitution (see git-cvsserver for details). May not contain semicolons ( ; ).\nDefault: %Ggitcvs.%m.sqlite"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git - the stupid content tracker git-sh-setup"
},
{
"role": "assistant",
"content": "Common Git shell script setup code"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How can I switch a public repo to private and vice versa on GitHub?\nI can't seem to find a way to do this. Is it possible at all? Since this is kind of important in my case, is there a code management platform where this is possible?"
},
{
"role": "assistant",
"content": "Instead of switching back and forth between GitHub repository visibility status (which is possible through the repository settings, section \"danger zone\"), I would rather establish 2 repositories:\n\none public, with only public content\none private, with a mix of public and private content\n\nThat way, you don't have to wonder, when pushing to a repository, if it is today public or private: you would push to one specific repository (of the two), knowing full well its visibility status.\nAnd you would never expose private content, which, is set to public even a few minutes, ... is no longer ever truly private (because it can be cloned, replicated and pushed elsewhere)\n\nThat being said, since June 2020, you have an \"Updated UI for Changing Repository Visibility \":\n\nYou can now set your repository to any available visibility option – public, private, or internal – from a single dialog in the repository's settings.\nPreviously, you had to navigate separate sections, buttons, and dialog boxes for changing between public and private, and between private and internal.\n\nSee \"Setting repository visibility\"\n\n(*) \"destructuve action\" because of the consequences of the visibility change:\n\npublic to private: some features won't be available in the repository after you change the visibility to private. Any published GitHub Pages site will be automatically unpublished.\nGitHub Advanced Security features, such as code scanning, will stop working\n\nprivate to public: GitHub will detach private forks and turn them into a standalone private repository\n\n\n\nNote that, since July 10th 2020, the default visibility is private:\n\nDefault visibility for new repositories\n\n\nWhen you create a repository, you can choose whether it should be private or public.\nNow, when you're signed into GitHub through an organization's single sign on service and create a new repository through the website navigation, the default selection is Private.\nThis helps prevent sensitive company data from unintentionally being pushed to public repositories. See the about repository visibility article for more information about this choice."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-ls-files - Show information about files in the index and the working tree path"
},
{
"role": "assistant",
"content": "The pathname of the file which is recorded in the index."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "What are the differences between git branch, fork, fetch, merge, rebase and clone?\nI want to understand the difference between a branch, a fork and a clone in Git?\nSimilarly, what does it mean when I do a git fetch as opposed to a git pull? \nAlso, what does rebase mean in comparison to merge? \nHow can I squash individual commits themselves together?\nHow are they used, why are they used and what do they represent?\nHow does GitHub figure in?"
},
{
"role": "assistant",
"content": "Git\nThis answer includes GitHub as many folks have asked about that too.\nLocal repositories\nGit (locally) has a directory (.git) which you commit your files to and this is your 'local repository'. This is different from systems like SVN where you add and commit to the remote repository immediately.\nGit stores each version of a file that changes by saving the entire file. It is also different from SVN in this respect as you could go to any individual version without 'recreating' it through delta changes.\nGit doesn't 'lock' files at all and thus avoids the 'exclusive lock' functionality for an edit (older systems like pvcs come to mind), so all files can always be edited, even when off-line. It actually does an amazing job of merging file changes (within the same file!) together during pulls or fetches/pushes to a remote repository such as GitHub. The only time you need to do manual changes (actually editing a file) is if two changes involve the same line(s) of code.\n\nBranches\nBranches allow you to preserve the main code (the 'master' branch), make a copy (a new branch) and then work within that new branch. If the work takes a while or master gets a lot of updates since the branch was made then merging or rebasing (often preferred for better history and easier to resolve conflicts) against the master branch should be done. When you've finished, you merge the changes made in the branch back in to the master repository. Many organizations use branches for each piece of work whether it is a feature, bug or chore item. Other organizations only use branches for major changes such as version upgrades.\nFork: With a branch you control and manage the branch, whereas with a fork someone else controls accepting the code back in.\nBroadly speaking, there are two main approaches to doing branches. The first is to keep most changes on the master branch, only using branches for larger and longer-running things like version changes where you want to have two branches available for different needs. The second is whereby you basically make a branch for every feature request, bug fix or chore and then manually decide when to actually merge those branches into the main master branch. Though this sounds tedious, this is a common approach and is the one that I currently use and recommend because this keeps the master branch cleaner and it's the master that we promote to production, so we only want completed, tested code, via the rebasing and merging of branches.\nThe standard way to bring a branch 'in' to master is to do a merge. Branches can also be \"rebased\" to 'clean up' history. It doesn't affect the current state and is done to give a 'cleaner' history.\nBasically, the idea is that you branched from a certain point (usually from master). Since you branched, 'master' itself has since moved forward from that branching point. It will be 'cleaner' (easier to resolve issues and the history will be easier to understand) if all the changes you have done in a branch are played against the current state of master with all of its latest changes. So, the process is: save the changes; get the 'new' master, and then reapply (this is the rebase part) the changes again against that. Be aware that rebase, just like merge, can result in conflicts that you have to manually resolve (i.e. edit and fix).\nOne guideline to note:\nOnly rebase if the branch is local and you haven't pushed it to remote yet!\nThis is mainly because rebasing can alter the history that other people see which may include their own commits.\nTracking branches\nThese are the branches that are named origin/branch_name (as opposed to just branch_name). When you are pushing and pulling the code to/from remote repositories this is actually the mechanism through which that happens. For example, when you git push a branch called building_groups, your branch goes first to origin/building_groups and then that goes to the remote repository. Similarly, if you do a git fetch building_groups, the file that is retrieved is placed in your origin/building_groups branch. You can then choose to merge this branch into your local copy. Our practice is to always do a git fetch and a manual merge rather than just a git pull (which does both of the above in one step).\nFetching new branches.\nGetting new branches: At the initial point of a clone you will have all the branches. However, if other developers add branches and push them to the remote there needs to be a way to 'know' about those branches and their names in order to be able to pull them down locally. This is done via a git fetch which will get all new and changed branches into the locally repository using the tracking branches (e.g., origin/). Once fetched, one can git branch --remote to list the tracking branches and git checkout [branch] to actually switch to any given one.\nMerging\nMerging is the process of combining code changes from different branches, or from different versions of the same branch (for example when a local branch and remote are out of sync). If one has developed work in a branch and the work is complete, ready and tested, then it can be merged into the master branch. This is done by git checkout master to switch to the master branch, then git merge your_branch. The merge will bring all the different files and even different changes to the same files together. This means that it will actually change the code inside files to merge all the changes.\nWhen doing the checkout of master it's also recommended to do a git pull origin master to get the very latest version of the remote master merged into your local master. If the remote master changed, i.e., moved forward, you will see information that reflects that during that git pull. If that is the case (master changed) you are advised to git checkout your_branch and then rebase it to master so that your changes actually get 'replayed' on top of the 'new' master. Then you would continue with getting master up-to-date as shown in the next paragraph.\nIf there are no conflicts, then master will have the new changes added in. If there are conflicts, this means that the same files have changes around similar lines of code that it cannot automatically merge. In this case git merge new_branch will report that there's conflict(s) to resolve. You 'resolve' them by editing the files (which will have both changes in them), selecting the changes you want, literally deleting the lines of the changes you don't want and then saving the file. The changes are marked with separators such as ======== and <<<<<<<<.\nOnce you have resolved any conflicts you will once again git add and git commit those changes to continue the merge (you'll get feedback from git during this process to guide you).\nWhen the process doesn't work well you will find that git merge --abort is very handy to reset things.\nInteractive rebasing and squashing / reordering / removing commits\nIf you have done work in a lot of small steps, e.g., you commit code as 'work-in-progress' every day, you may want to 'squash' those many small commits into a few larger commits. This can be particularly useful when you want to do code reviews with colleagues. You don't want to replay all the 'steps' you took (via commits), you want to just say here is the end effect (diff) of all of my changes for this work in one commit.\nThe key factor to evaluate when considering whether to do this is whether the multiple commits are against the same file or files more than one (better to squash commits in that case). This is done with the interactive rebasing tool. This tool lets you squash commits, delete commits, reword messages, etc. For example, git rebase -i HEAD~10 (note: that's a ~, not a -) brings up the following:\n\nBe careful though and use this tool 'gingerly'. Do one squash/delete/reorder at a time, exit and save that commit, then reenter the tool. If commits are not contiguous you can reorder them (and then squash as needed). You can actually delete commits here too, but you really need to be sure of what you are doing when you do that!\nForks\nThere are two main approaches to collaboration in Git repositories. The first, detailed above, is directly via branches that people pull and push from/to. These collaborators have their SSH keys registered with the remote repository. This will let them push directly to that repository. The downside is that you have to maintain the list of users.\nThe other approach - forking - allows anybody to 'fork' the repository, basically making a local copy in their own Git repository account. They can then make changes and when finished send a 'pull request' (really it's more of a 'push' from them and a 'pull' request for the actual repository maintainer) to get the code accepted.\nThis second method, using forks, does not require someone to maintain a list of users for the repository.\n\nGitHub\nGitHub (a remote repository) is a remote source that you normally push and pull those committed changes to if you have (or are added to) such a repository, so local and remote are actually quite distinct. Another way to think of a remote repository is that it is a .git directory structure that lives on a remote server.\nWhen you 'fork' - in the GitHub web browser GUI you can click on this button - you create a copy ('clone') of the code in your GitHub account. It can be a little subtle first time you do it, so keep making sure you look at whose repository a code base is listed under - either the original owner or 'forked from' and you, e.g., like this:\n\nOnce you have the local copy, you can make changes as you wish (by pulling and pushing them to a local machine). When you are done then you submit a 'pull request' to the original repository owner/admin (sounds fancy but actually you just click on this: ) and they 'pull' it in.\nMore common for a team working on code together is to 'clone' the repository (click on the 'copy' icon on the repository's main screen). Then, locally type git clone and paste. This will set you up locally and you can also push and pull to the (shared) GitHub location.\nClones\nAs indicated in the section on GitHub, a clone is a copy of a repository. When you have a remote repository you issue the git clone command against its URL and you then end up with a local copy, or clone, of the repository. This clone has everything, the files, the master branch, the other branches, all the existing commits, the whole shebang. It is this clone that you do your adds and commits against and then the remote repository itself is what you push those commits to. It's this local/remote concept that makes Git (and systems similar to it such as Mercurial) a DVCS (Distributed Version Control System) as opposed to the more traditional CVSs (Code Versioning Systems) such as SVN, PVCS, CVS, etc. where you commit directly to the remote repository.\nVisualization\nVisualization of the core concepts can be seen at\nhttp://marklodato.github.com/visual-git-guide/index-en.html and\nhttp://ndpsoftware.com/git-cheatsheet.html#loc=index\nIf you want a visual display of how the changes are working, you can't beat the visual tool gitg (gitx for macOS) with a GUI that I call 'the subway map' (esp. London Underground), great for showing who did what, how things changes, diverged and merged, etc.\nYou can also use it to add, commit and manage your changes!\n\nAlthough gitg/gitx is fairly minimal, the number of GUI tools continues to expand. Many Mac users use brotherbard's fork of gitx and for Linux, a great option is smart-git with an intuitive yet powerful interface:\n\nNote that even with a GUI tool, you will probably do a lot of commands at the command line.\nFor this, I have the following aliases in my ~/.bash_aliases file (which is called from my ~/.bashrc file for each terminal session):\n# git\nalias g='git status'\nalias gcob='git checkout -b '\nalias gcom='git checkout master'\nalias gd='git diff'\nalias gf='git fetch'\nalias gfrm='git fetch; git reset --hard origin/master'\nalias gg='git grep '\nalias gits='alias | grep \"^alias g.*git.*$\"'\nalias gl='git log'\nalias gl1='git log --oneline'\nalias glf='git log --name-status'\nalias glp='git log -p'\nalias gpull='git pull '\nalias gpush='git push '\n\nAND I have the following \"git aliases\" in my ~/.gitconfig file - why have these ?\nSo that branch completion (with the TAB key) works !\nSo these are:\n[alias]\n co = checkout\n cob = checkout -b\n\nExample usage: git co [branch] <- tab completion for branches will work.\nGUI Learning Tool\nYou may find https://learngitbranching.js.org/ useful in learning some of the base concepts. Screen shot: \nVideo: https://youtu.be/23JqqcLPss0\nFinally, 7 key lifesavers!\n\nYou make changes, add and commit them (but don't push) and then oh! you realize you are in master!\n git reset [filename(s)]\n git checkout -b [name_for_a_new_branch]\n git add [file(s)]\n git commit -m \"A useful message\"\n\n Voila! You've moved that 'master' commit to its own branch !\n\n\nYou mess up some files while working in a local branch and simply want to go back to what you had the last time you did a git pull:\n git reset --hard origin/master # You will need to be comfortable doing this!\n\n\nYou start making changes locally, you edit half a dozen files and then, oh crap, you're still in the master (or another) branch:\n git checkout -b new_branch_name # just create a new branch\n git add . # add the changes files\n git commit -m\"your message\" # and commit them\n\n\nYou mess up one particular file in your current branch and want to basically 'reset' that file (lose changes) to how it was the the last time you pulled it from the remote repository:\n git checkout your/directories/filename\n\nThis actually resets the file (like many Git commands it is not well named for what it is doing here).\n\nYou make some changes locally, you want to make sure you don't lose them while you do a git reset or rebase: I often make a manual copy of the entire project (cp -r ../my_project ~/) when I am not sure if I might mess up in Git or lose important changes.\n\nYou are rebasing but things gets messed up:\n git rebase --abort # To abandon interactive rebase and merge issues\n\n\nAdd your Git branch to your PS1 prompt (see https://unix.stackexchange.com/a/127800/10043), e.g.\n\nThe branch is selenium_rspec_conversion."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to let Jenkins git commit only if there are changes?\nI have a Jenkins job that builds from a github.com repository's master branch with Maven (mvn clean install), then checks for license headers in Java files and missing NOTICE files, and adds them if necessary (mvn license:format notice:generate). Sometimes this will result in changed or added files, sometimes not.\nWhenever there have any changes been made (by the license plugin) I want to push the changes to the github repo.\nNow I'm having trouble figuring out how best to achieve that. I've added a shell build step after the Maven license plugin where I execute git commands:\ngit add . # Just in case any NOTICE files have been added\ngit commit -m \"Added license headers\"\n\ngit add . alone works, i.e., doesn't break the build, even if no files have been added. However, git commit breaks the build, if there aren't any changes at all.\nI'm not concerned about pushing back to github, as I believe the Git Publisher post-build action can do this for me. Can someone please point me in the right direction for the git commit?"
},
{
"role": "assistant",
"content": "git diff --quiet && git diff --staged --quiet || git commit -am 'Added license headers'\n\nThis command do exactly what is required, 'git commit only if there are changes', while the commands in the other answers do not: they only ignore any error of git commit."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Does deleting a branch in git remove it from the history?\nComing from svn, just starting to become familiar with git.\nWhen a branch is deleted in git, is it removed from the history? \nIn svn, you can easily recover a branch by reverting the delete operation (reverse merge). Like all deletes in svn, the branch is never really deleted, it's just removed from the current tree.\nIf the branch is actually deleted from the history in git, what happens to the changes that were merged from that branch? Are they retained?"
},
{
"role": "assistant",
"content": "Branches are just pointers to commits in git. In git each commit has a complete source tree, it is a very different structure from svn where all branches and tags (by convention) live in separate 'folders' of the repository alongside the special 'trunk'.\nIf the branch was merged into another branch before it was deleted then all of the commits will still be reachable from the other branch when the first branch is deleted. They remain exactly as they were.\nIf the branch is deleted without being merged into another branch then the commits in that branch (up until the point where the forked from a commit that is still reachable) will cease to be visible.\nThe commits will still be retained in the repository and it is possible to recover them immediately after the delete, but eventually they will be garbage collected."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Multiple GitHub Pages and custom domains via DNS\n\nI want to have one user page and multiple project pages hosted by GitHub Pages but available under ONE custom domain (with subdomains for each GitHub Pages repository, of course). So my goals are as follows:\n\nOne user page (http://florianwolters.github.com) available under http://blog.florianwolters.de, http://www.florianwolters.de and http://florianwolters.de.\nAs many project pages as I wish (e.g. http://florianwolters.github.com/pear available under http://pear.florianwolters.de.\n\nAs of my current understanding, GitHub Pages do only allow ONE CNAME resource record for a page (both user pages and project pages) defined in the CNAME file in the root of a Git repository.\nI already tried out many things (playing around with DNS records and header redirects at my domain provider EUserv, but I can only access my GitHub user pages under one URL (http://blog.florianwolters.de). I am aware that DNS changes can take up until two days.\nCan somebody explain to me, how I can achieve the goals described above? I can not believe that this is not possible but I am also no expert for DNS, etc.\nIf the above is not possible: What is your suggested workaround? I do want to access all my GitHub pages under one domain (and the subdomains of that domain).\nResources\n\nhttp://help.github.com/pages/\nCustom domain for GitHub project pages\nhttps://groups.google.com/forum/?fromgroups#!topic/github/AaAuoDK44Ag\nhttps://github.com/blog/315-cname-support-for-github-pages\nhttp://code.lancepollard.com/custom-domain-github-pages"
},
{
"role": "assistant",
"content": "You can do it. Notice that all DNS CNAME entries point to the same host.\n1:\ngithub.com/florianwolters/florianwolters.github.com\nCNAME file content: blog.florianwolters.de\nDNS CNAME: blog > florianwolters.github.com\n2:\ngithub.com/florianwolters/pear/tree/gh-pages\nCNAME file content: pear.florianwolters.de\nDNS CNAME: pear > florianwolters.github.com"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-config - Get and set repository or global options receive.denyCurrentBranch"
},
{
"role": "assistant",
"content": "If set to true or \"refuse\", git-receive-pack will deny a ref update\nto the currently checked out branch of a non-bare repository.\nSuch a push is potentially dangerous because it brings the HEAD\nout of sync with the index and working tree. If set to \"warn\",\nprint a warning of such a push to stderr, but allow the push to\nproceed. If set to false or \"ignore\", allow such pushes with no\nmessage. Defaults to \"refuse\". Another option is \"updateInstead\" which will update the working\ntree if pushing into the current branch. This option is\nintended for synchronizing working directories when one side is not easily\naccessible via interactive ssh (e.g. a live web site, hence the requirement\nthat the working directory be clean). This mode also comes in handy when\ndeveloping inside a VM to test and fix code on different Operating Systems. By default, \"updateInstead\" will refuse the push if the working tree or\nthe index have any difference from the HEAD, but the push-to-checkout hook can be used to customize this. See githooks ."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Can I use a scripted commit template for git?\nWe are working on tickets, and when we use the ticket number in the git commit message on the first line, then the ticket is updated with the commit message.\nTo make things simple we always work on a branch with the commit number.\nNow I'd like to be presented with a commit message where the ticket number would already be filled in. \nIt must be possible, because the branch is already in the commit template, but in comments which are removed by git. I have scoured the docs and the 'net a couple of times, but I must be looking for the wrong words, because I cannot find it.\nCan anyone help?"
},
{
"role": "assistant",
"content": "You probably want to set up a prepare-commit-msg hook on your local repository. It might look like this (say the branches are named 'work-on-ticket-XXXX':\n#!/bin/sh\nORIG_MSG_FILE=\"$1\"\nTEMP=`mktemp /tmp/git-XXXXX`\n\nTICKETNO=`git branch | grep '^\\*' | cut -b3-`\n\n(echo \"Work on ticket #$TICKETNO\"; cat \"$ORIG_MSG_FILE\") > \"$TEMP\"\ncat \"$TEMP\" > \"$ORIG_MSG_FILE\"\n\nPut something like that (marked executable) in .git/hooks/prepare-commit-msg. You may have to adjust and elaborate on it of course."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How can I see what I am about to push with git?\nIs there a way to see what would be pushed if I did a git push command?\nWhat I'm picturing is something like the \"Files Changed\" tab of Github's \"pull request\" feature. When I issue a pull request, I can look and see what will be pulled in if they accept my pull request: \nCommand line is OK, but I'd prefer some sort of GUI (like the screenshot above)."
},
{
"role": "assistant",
"content": "For a list of files to be pushed, run:\ngit diff --stat --cached [remote/branch]\n\nexample: \ngit diff --stat --cached origin/master\n\nFor the code diff of the files to be pushed, run:\ngit diff [remote repo/branch]\n\nTo see full file paths of the files that will change, run:\ngit diff --numstat [remote repo/branch]\n\nIf you want to see these diffs in a GUI, you will need to configure git for that. See How do I view 'git diff' output with a visual diff program?."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-log - Show commit logs --dd"
},
{
"role": "assistant",
"content": "Produce diff with respect to first parent for both merge and\nregular commits.\nShortcut for --diff-merges=first-parent -p ."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Is there a way to revert to a previous commit in VS code?\nIs there a way to revert to a previous git commit in VS code?\nI know I can see the changes between commits and the differences in the working tree but I want to know how to reset to the previous commit in visual studio code."
},
{
"role": "assistant",
"content": "With the source control icon selected, if you then click the ellipsis ... at the top right.\nWith v1.48 you will see a list of options for submenus: under Commit is Undo Last Commit. Under Changes is Discard All Changes."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git - the stupid content tracker git-symbolic-ref"
},
{
"role": "assistant",
"content": "Read, modify and delete symbolic refs"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-format-patch - Prepare patches for e-mail submission --binary"
},
{
"role": "assistant",
"content": "In addition to --full-index , output a binary diff that\ncan be applied with git-apply ."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-status - Show the working tree status"
},
{
"role": "assistant",
"content": "DESCRIPTION Displays paths that have differences between the index file and the\ncurrent HEAD commit, paths that have differences between the working\ntree and the index file, and paths in the working tree that are not\ntracked by Git (and are not ignored by gitignore ). The first\nare what you would commit by running git commit ; the second and\nthird are what you could commit by running git add before running git commit ."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-config - Get and set repository or global options format.headers"
},
{
"role": "assistant",
"content": "Additional email headers to include in a patch to be submitted\nby mail. See git-format-patch ."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-pull - Fetch from and integrate with another repository or a local branch --negotiate-only"
},
{
"role": "assistant",
"content": "Do not fetch anything from the server, and instead print the\nancestors of the provided --negotiation-tip=* arguments,\nwhich we have in common with the server. This is incompatible with --recurse-submodules=[yes|on-demand] .\nInternally this is used to implement the push.negotiate option, see git-config ."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-reset - Reset current HEAD to the specified state <pathspec>…"
},
{
"role": "assistant",
"content": "Limits the paths affected by the operation. For more details, see the pathspec entry in gitglossary ."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How do I make a branch point at a specific commit? [duplicate]\nThis question already has answers here:\n \n \n\n\n\n\nMove branch pointer to different commit without checkout\n\n (11 answers)\n \n\nClosed 4 years ago.\n\n\n\nIn Git, I understand that a branch is a pointer to a commit.\nHow do I make a specific branch point to a specific commit? Say I want to make master point at 1258f0d0aae..., how do I do that?"
},
{
"role": "assistant",
"content": "You can make master point at 1258f0d0aae this way:\ngit checkout master\ngit reset --hard 1258f0d0aae\n\nBut you have to be careful about doing this. It may well rewrite the history of that branch. That would create problems if you have published it and other people are working on the branch.\nAlso, the git reset --hard command will throw away any uncommitted changes (i.e. those just in your working tree or the index).\nYou can also force an update to a branch with:\ngit branch -f master 1258f0d0aae\n\n... but git won't let you do that if you're on master at the time."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to cherry-pick a range of commits and merge them into another branch?\nI have the following repository layout:\n\nmaster branch (production)\nintegration\nworking\n\nWhat I want to achieve is to cherry-pick a range of commits from the working branch and merge it into the integration branch. I'm pretty new to git and I can't figure out how to exactly do this (the cherry-picking of commit ranges in one operation, not the merging) without messing the repository up. Any pointers or thoughts on this? Thanks!"
},
{
"role": "assistant",
"content": "When it comes to a range of commits, cherry-picking is was impractical.\nAs mentioned below by Keith Kim, Git 1.7.2+ introduced the ability to cherry-pick a range of commits (but you still need to be aware of the consequence of cherry-picking for future merge)\n\ngit cherry-pick\" learned to pick a range of commits\n(e.g. \"cherry-pick A..B\" and \"cherry-pick --stdin\"), so did \"git revert\"; these do not support the nicer sequencing control \"rebase [-i]\" has, though.\n\ndamian comments and warns us:\n\nIn the \"cherry-pick A..B\" form, A should be older than B.\nIf they're the wrong order, the command will silently fail.\n\nIf you want to pick the range B through D (including B) that would be B~..D (instead of B..D).\nSee \"Git create branch from range of previous commits?\" for an illustration.\nAs Jubobs mentions in the comments:\n\nThis assumes that B is not a root commit; you'll get an \"unknown revision\" error otherwise.\n\nNote: as of Git 2.9.x/2.10 (Q3 2016), you can cherry-pick a range of commits directly on an orphan branch (empty head): see \"How to make an existing branch an orphan in Git\".\n\nOriginal answer (January 2010)\nA rebase --onto would be better, where you replay the given range of commits on top of your integration branch, as Charles Bailey described here.\n(also, look for \"Here is how you would transplant a topic branch based on one branch to another\" in the git rebase man page, to see a practical example of git rebase --onto)\nIf your current branch is integration:\n# Checkout a new temporary branch at the current location\ngit checkout -b tmp\n\n# Move the integration branch to the head of the new patchset\ngit branch -f integration last_SHA-1_of_working_branch_range\n\n# Rebase the patchset onto tmp, the old location of integration\ngit rebase --onto tmp first_SHA-1_of_working_branch_range~1 integration\n\nThat will replay everything between:\n\nafter the parent of first_SHA-1_of_working_branch_range (hence the ~1): the first commit you want to replay\nup to \"integration\" (which points to the last commit you intend to replay, from the working branch)\n\nto \"tmp\" (which points to where integration was pointing before)\nIf there is any conflict when one of those commits is replayed:\n\neither solve it and run \"git rebase --continue\".\nor skip this patch, and instead run \"git rebase --skip\"\nor cancel the all thing with a \"git rebase --abort\" (and put back the integration branch on the tmp branch)\n\nAfter that rebase --onto, integration will be back at the last commit of the integration branch (that is \"tmp\" branch + all the replayed commits)\nWith cherry-picking or rebase --onto, do not forget it has consequences on subsequent merges, as described here.\n\nA pure \"cherry-pick\" solution is discussed here, and would involve something like:\n\nIf you want to use a patch approach then \"git format-patch|git am\" and \"git cherry\" are your options.\nCurrently, git cherry-pick accepts only a single commit, but if you want to pick the range B through D that would be B^..D (actually B~..D, see below) in Git lingo, so:\n\ngit rev-list --reverse --topo-order B~..D | while read rev \ndo \n git cherry-pick $rev || break \ndone \n\nBut anyway, when you need to \"replay\" a range of commits, the word \"replay\" should push you to use the \"rebase\" feature of Git.\n\npridmorej objects in the comments:\n\nWARNING: don't be fooled by the above suggestion of using carat (^) to make the range inclusive!\nThis does not include CommitId1 if, for instance, the parent of CommitId1 is a merge commit:git cherry-pick CommitId1^..CommitId99.\nIn that case, cherry-pick still starts from CommitId2 - no idea why, but that's the behavior I've experienced.\nI did, however, discover that using tilde (~) works as expected, even when the parent of CommitId1 is a merge commit: git cherry-pick CommitId1~..CommitId99.\n\nTrue: that highlights an important nuance in using Git's cherry-picking command with commit ranges, particularly when dealing with merge commits.\nIn Git, ^ and ~ have specific meanings when used with commit references:\n\n^ refers to the parent of a commit, and when used in a range, it can lead to unexpected results, especially with merge commits.\n~, on the other hand, is used to denote the first parent of a commit in a linear history, which makes it more predictable in the context of cherry-picking a range.\n\nWhen cherry-picking a range of commits, especially in scenarios involving merge commits, prefer using ~ to make sure the range includes the intended commits.\nSo regarding git cherry-pick CommitId1^..CommitId99: When specifying a range CommitId1^..CommitId99, Git interprets this as \"start from the parent of CommitId1 and include commits up to CommitId99\".\n\nIf CommitId1 is a regular commit, its only parent (say CommitId0) becomes the start of the range, effectively excluding CommitId1 itself.\nIf CommitId1 is a merge commit, CommitId1^ still points to its first parent. That can be particularly confusing because merge commits by their nature merge two lines of development, and the first parent might not be intuitively the \"previous\" commit in a linear sense.\n\nIn non-linear histories involving merge commits, the first parent of a merge commit might not be the direct predecessor in the same branch.\nThe tilde (~) notation, when used as in CommitId1~..CommitId99, effectively means \"include CommitId1 and go back one commit from there\", which in most cases will include CommitId1 in the range, as intended.\nConsider the following commit history, where M represents a merge commit, and each letter represents a different commit:\nA---B---C-------D---E--CommitId99 <- master\n \\ /\n X---Y---M <- feature (CommitId1 is M)\n\n\nA, B, C, D, E are commits on the master branch.\nX, Y are commits on a feature branch.\nM is a merge commit on the feature branch, merging changes from master into feature. Here, M is CommitId1.\n\nWhen you run the command:\ngit cherry-pick CommitId1^..CommitId99\n\n\nCommitId1 is M.\nCommitId1^ refers to the first parent of M.\nIn this case, the first parent of M is D because merge commits list their parents in the order they were merged.\n\nSo, the range CommitId1^..CommitId99 translates to D..CommitId99. M (CommitId1) is excluded!\nBut if you use git cherry-pick CommitId1~..CommitId99, when used in the context of a range, like CommitId1~..CommitId99, the interpretation is \"start from the commit right before CommitId1 and include up to CommitId99.\"\nSo CommitId1~ refers to the commit right before M in the feature branch, which is Y (since M was created on the feature branch, by a merge from master to feature).\nThe range CommitId1~..CommitId99 translates to Y..CommitId99.\nUsing ~ in the range with git cherry-pick effectively shifts the start of the range to the commit right before CommitId1, thereby including CommitId1 in the cherry-picked range. That behavior is particularly useful when you want to include merge commits in your cherry-picking operation."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-rebase - Reapply commits on top of another base tip rebase.stat"
},
{
"role": "assistant",
"content": "Whether to show a diffstat of what changed upstream since the last\nrebase. False by default."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git - the stupid content tracker GIT_DIFF_PATH_COUNTER"
},
{
"role": "assistant",
"content": "A 1-based counter incremented by one for every path."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git submodule init not pulling latest commit\nI have a git repo with a git submodule inside of it. The submodule is hosted on bitbucket. I want to update my local copy of the submodule to its latest commit. I tired \"git submodule update\" however that is not doing anything. So I tried deleting the submodule folder and then doing \"git submodule init\" However it simply pulls the initial submodule commit, not the latest.\nHow can I get my local submodule to update to the latest commit?"
},
{
"role": "assistant",
"content": "Git is doing exactly what it's supposed to be doing. git submodule update will set your submodule to what the current commit in the parent repo specifies the submodule should be at. This way you can checkout another branch, older commit or tag, then run git submodule update and the submodule will be set to what that reference expects so your entire solution will have it's dependencies satisfied.\nWhat you need to do is:\ncd mysubmoduledir\ngit fetch\ngit checkout master # or any other branch that you need the latest of\ngit merge origin/master\ncd - # go back to the top repo\ngit status # should show that your submodule changed\ngit add mysubmoduledir\ngit commit -m \"Updated my solution to use latest sub project.\"\n\na shorter version is:\ncd mysubmoduledir\ngit pull # assumes you are already on the branch you need to be on\ncd -\ngit commit -am \"Updated submodule\" # assumes you had no other modified files\n\nThe word \"update\" is not the best for this submodule command. It really means \"point the submodule to the commit that the parent repo's commit expects\".\nUpdating a submodule to a different commit (doesn't have to be the latest) requires you to cd into that directory, manipulate it like a regular git repo so the current commit is what you want, then go back out and commit this change on the top level repo."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Why is gitlab asking me to enter my user credentials?\n\ngit is asking me to enter my gitlab user credentials when pushing or pulling code. I am using gitlab.com, I'm not self-hosting gitlab.\nI followed the instructions to set up my ssh key. I created a key, I copied the contents from ~/.ssh/id_rsa.pub, added the key to gitlab using gitlab's user interface, and git still asks me for my user and password.\ngit remote -v\norigin https://gitlab.com/<my_user>/<my_repo> (fetch)\norigin https://gitlab.com/<my_user>/<my_repo> (push)"
},
{
"role": "assistant",
"content": "You are using HTTPS authentication. Switch to an SSH-based URL (in this case, probably ssh://[email protected]/path/to/repo.git or [email protected]:path/to/repo.git). For instance:\ngit remote set-url origin ssh://[email protected]/<user>/<repo>\n\n(Alternatively, if you're comfortable with using your configured editor, you can run git config --edit and edit the URL directly in the configuration file. Make sure whatever editor you choose stores files in plain-text format, not any enhanced rich-text or UTF-16 encoding.)\nBackground\nIn order to connect one Git to another, you may need to authenticate yourself. There are several ways to do that. (Whether you need to do that depends on the kind of connection you are making, and whether the repository is public.)\nIf you are authenticating over https://, your Git may ask for a user name and password. It can use various credential helpers, which may also store user names and/or passwords. You can configure which credential helper to use, including the \"cache\" and \"store\" helpers, which use different additional data. Note that the available set of credential helpers varies based on your underlying operating system as well.\nIf you are authenticating over ssh://, you will use an ssh key (SSH authentication).\nIf you use a URL that begins with user@host:, you are using SSH authentication."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to identify conflicting commits by hash during git rebase?\nWhen I encounter a merge conflict using git rebase, how can I identify the source of the conflict in terms of commits, rather than just file differences?\nI already know how to make (basic) use of git mergetool or git add before git rebase --continue, but sometimes the differences between files just isn't enough: I want to see the commit log and diff of the commit that just failed to be applied to the working tree.\nI've read in other questions that git log --merge would show the parent commits if I were using git merge. I tried it anyways when I encountered a conflict and got told fatal: --merge without MERGE_HEAD?.\nHow can I identify the problematic commit?"
},
{
"role": "assistant",
"content": "Short Answer\nIf it says \nPatch failed at 0001 commit message for F\n\nThen run\n$ head -1 .git/rebase-apply/0001\nFrom ad1c7739c1152502229e3f2ab759ec5323988326 Mon Sep 17 00:00:00 2001\n\nTo get the SHA ad1c77 of the failing commit, and then use git show ad1c77 to have a look at it.\nLong Answer\nLet's start with this tree:\nA---B---C---D\n \\\n E---F---G\n\n$ git checkout G\n$ git rebase D\n\nWhen a rebase conflict occurs, it is a conflict between \n\nthe upstream changes (C--D) from the the common ancestor (B) PLUS the already rebased changes and already resolved conflict (E') versus\nthe patch of the next commit (F)\n\nLet's see what happens:\n1) A---B---C---D---E' <- E patched and committed successfully as E'\n2) A---B---C---D---E'--- <- failed to patch F onto E'\n\nHere's the error message:\nFirst, rewinding head to replay your work on top of it...\nApplying: commit message for F\nUsing index info to reconstruct a base tree...\nFalling back to patching base and 3-way merge...\nAuto-merging 1.txt\nCONFLICT (content): Merge conflict in 1.txt\nFailed to merge in the changes.\nPatch failed at 0001 commit message for F\n\nFirst, you can see that it was F, because the commit message appears. However, if your commit messages all look like \"foo\", \"documentation\" or \"some fixes\", then this won't help, and you really want the SHA id ad1c77 or the contents of the patch.\nHere's how to find out the real identity of F:\nWhen it lists the rebase conflict, it will say something like:\nPatch failed at 0001 commit message for F\n\nNow look in .git/rebase-apply/, where you will find the patch file 0001:\n$ ls .git/rebase-apply\n0001 head-name msg orig-head sign\n0002 info msg-clean patch threeway\napply-opt keep next quiet utf8\nfinal-commit last onto rebasing\n\nThe patch file includes the original commit-id\n$ head -1 .git/rebase-apply/0001\nFrom ad1c7739c1152502229e3f2ab759ec5323988326 Mon Sep 17 00:00:00 2001\n\nYou can then look at that.\nThere must be an easier way, but this works.\nNote that the fact that the patch failed may be due to a different commit (if you are rebasing onto a common ancestor of HEAD and the rebase target). Finding that commit is rather more complicated, although you could try doing the rebase in reverse to find it:\n$ git checkout D\n$ git rebase G"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-config - Get and set repository or global options --unset"
},
{
"role": "assistant",
"content": "Remove the line matching the key from config file."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-init - Create an empty Git repository or reinitialize an existing one --template= <template-directory>"
},
{
"role": "assistant",
"content": "Specify the directory from which templates will be used. (See the \"TEMPLATE\nDIRECTORY\" section below.)"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-rev-list - Lists commit objects in reverse chronological order %ah"
},
{
"role": "assistant",
"content": "author date, human style (like the --date=human option of git-rev-list )"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Should you include or ignore gradle-wrapper.properties\nWhen working on a team of android developers using gradle as your build system. Should you include gradle/wrapper/gradle-wrapper.properties in git, or should it be part of your .gitignore?"
},
{
"role": "assistant",
"content": "It should be included in your git repo.\nBy using it with gradlew, this will ensure all your developers (and your build servers!) always use the same version of Gradle. This way you know that every one is building the same exact way."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-diff - Show changes between commits, commit and working tree, etc --abbrev[=<n>]"
},
{
"role": "assistant",
"content": "Instead of showing the full 40-byte hexadecimal object\nname in diff-raw format output and diff-tree header\nlines, show the shortest prefix that is at least <n> hexdigits long that uniquely refers the object.\nIn diff-patch output format, --full-index takes higher\nprecedence, i.e. if --full-index is specified, full blob\nnames will be shown regardless of --abbrev .\nNon default number of digits can be specified with --abbrev=<n> ."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git - the stupid content tracker gitprotocol-common"
},
{
"role": "assistant",
"content": "Things common to various protocols"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git - the stupid content tracker --attr-source=<tree-ish>"
},
{
"role": "assistant",
"content": "Read gitattributes from <tree-ish> instead of the worktree. See gitattributes . This is equivalent to setting the GIT_ATTR_SOURCE environment variable."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Git Copy a folder from master branch to another branch\nI have folder name utils I want to copy this folder from master branch to work branch. How do I do that ?"
},
{
"role": "assistant",
"content": "To copy the folder over:\n$ git checkout work\nSwitched to branch 'work'\n$ git checkout master -- utils\n$ git add utils\n$ git commit -m \"Adding 'utils' directory from 'master' branch.\"\n[work 9fcd968] Adding 'utils' directory from 'master' branch.\n 1 file changed, 0 insertions(+), 0 deletions(-)\n create mode 100644 utils/file\n\nIf you want to delete it on master after that:\n$ git checkout master\nSwitched to branch 'master'\n$ git rm -r utils\nrm 'utils/file'\n$ git commit -m \"Removing 'utils' directory.\"\n[master c786f95] Removing 'utils' directory.\n 1 file changed, 0 insertions(+), 0 deletions(-)\n delete mode 100644 utils/file\n\nThen you can just git push as necessary. Git's output in your project may be different; I just made a simple test repo here with only one file in the utils directory."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Using .gitignore file to hide appsettings.json does not actually hide it\nI have a C# MVC .Net Core application I'm building, the connection string is in a file called appsettings.json so what I want to do is simply exclude this from my git repository. I have added the following line to the git ignore file:\nappsettings.json\nI have also tried:\n**/appsettings.json\nBut neither seem to work, the change I've made to the appsettings.json file still appears, am I missing something fundamental here?"
},
{
"role": "assistant",
"content": "This is a common misunderstanding about the way .gitignore works we all met at some point when working with Git: .gitignore will ignore all files that are not being tracked yet; indeed, files that are already being tracked in your Git repository are not ignored by your .gitignore setup.\nTo fulfil your need, it would be sufficient to untrack the files that you desire to ignore, i.e. in your case the appsettings.json file.\nAs reported in your question's comments, this has been answered already here. Then, your .gitignore setup will work as you would expect."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git stash and apply\nI'm new to git and not quite clear on how stashing works.\nLet's say I'm working on branch master and try to git pull and receive the error that my local changes would be overwritten and need to be stashed or committed. If I haven't staged any of my changes and run git stash, then do a git pull and and update successfully, what happens when I git stash apply?\nIn general, If someone else modifies files and I run git pull, what happens when I run git stash apply? does it overwrite the files that were just updated, regardless of whether or not they were staged when I stashed them? Does it overwrite every file that I just updated with git pull, with the files that were stashed?"
},
{
"role": "assistant",
"content": "Quick \"TL;DR\" take-away version, so one can come back later and study more\ngit stash hangs a stash-bag—this is a peculiar form of a merge commit that is not on any branch—on the current HEAD commit. A later git stash apply, when you're at any commit—probably a different commit—then tries to restore the changes git computes by looking at both the hanging stash-bag and the commit it hangs from.\nWhen you're done with the changes, you should use git stash drop to let go of the stash-bag from the commit it was \"stashed on\". (And, git stash pop is just shorthand for \"apply, then automatically drop\". I recommend keeping the two steps separate, though, in case you don't like the result of \"apply\" and you want to try again later.)\nThe long version\ngit stash is actually fairly complex.\nIt's been said that \"git makes much more sense once you understand X\", for many different values of \"X\", which generalizes to \"git makes much more sense once you understand git\". :-)\nIn this case, to really understand stash, you need to understand how commits, branches, the index/staging-area, git's reference name space, and merges all work, because git stash creates a very peculiar merge commit that is referred-to by a name outside the usual name-spaces—a weird kind of merge that is not \"on a branch\" at all—and git stash apply uses git's merge machinery to attempt to \"re-apply\" the changes saved when the peculiar merge commit was made, optionally preserving the distinction between staged and unstaged changes.\nFortunately, you don't actually need to understand all of that to use git stash.\nHere, you're working on some branch (master) and you have some changes that aren't ready yet, so you don't want to commit them on the branch.1 Meanwhile someone else put something good—or at least, you hope it's good—into the origin/master over on the remote repo, so you want to pick those up.\nLet's say that you and they both started with commits that end in - A - B - C, i.e., C is the final commit that you had in your repo when you started working on branch master. The new \"something good\" commits, we'll call D and E.\nIn your case you're running git pull and it fails with the \"working directory not clean\" problem. So, you run git stash. This commits your stuff for you, in its special weird stash-y fashion, so that your working directory is now clean. Now you can git pull.\nIn terms of drawing of commits (a graph like you get with gitk or git log --graph), you now have something like this. The stash is the little bag-of-i-w dangling off the commit you were \"on\", in your master branch, when you ran git stash. (The reason for the names i and w is that these are the \"i\"ndex / staging-area and \"w\"ork-tree parts of the stash.)\n- A - B - C - D - E <-- HEAD=master, origin/master\n |\\\n i-w <-- the \"stash\"\n\nThis drawing is what you get if you started working on master and never did any commits. The most recent commit you had was thus C. After making the stash, git pull was able to add commits D and E to your local branch master. The stashed bag of work is still hanging off C.\nIf you made a few commits of your own—we'll call them Y, for your commit, and Z just to have two commits—the result of the \"stash then pull\" looks like this:\n .-------- origin/master\n- A - B - C - D - E - M <-- HEAD=master\n \\ /\n Y - Z\n |\\\n i-w <-- the \"stash\"\n\nThis time, after stash hung its stash-bag off Z, the pull—which is just fetch then merge—had to do a real merge, instead of just a \"fast forward\". So it makes commit M, the merge commit. The origin/master label still refers to commit E, not M. You're now on master at commit M, which is a merge of E and Z. You're \"one ahead\" of origin/master.\nIn either case, if you now run git stash apply, the stash script (it's a shell script that uses a lot of low level git \"plumbing\" commands) effectively2 does this:\ngit diff stash^ stash > /tmp/patch\ngit apply /tmp/patch\n\nThis diffs stash, which names w—the \"work tree\" part of the stash—against the correct3 parent. In other words, it finds out \"what you changed\" between the proper parent commit (C or Z, as appropriate) and the stashed work-tree. It then applies the changes to the currently-checked-out version, which is either E or M, again depending on where you started.\nIncidentally, git stash show -p really just runs that same git diff command (with no > /tmp/patch part of course). Without -p, it runs the diff with --stat. So if you want to see in detail what git stash apply will merge in, use git stash show -p. (This won't show you what git stash apply can attempt to apply from the index part of the stash, though; this is a minor gripe I have with the stash script.)\n\nIn any case, once the stash applies cleanly, you can use git stash drop to remove the reference to the stash-bag, so that it can be garbage-collected. Until you drop it, it has a name (refs/stash, aka stash@{0}) so it sticks around \"forever\" ... except for the fact that if you make a new stash, the stash script \"pushes\" the current stash into the stash reflog (so that its name becomes stash@{1}) and makes the new stash use the refs/stash name. Most reflog entries stick around for 90 days (you can configure this to be different) and then expire. Stashes don't expire by default, but if you configure this otherwise, a \"pushed\" stash can get lost, so be careful about depending on \"save forever\" if you start configuring git to your liking.\nNote that git stash drop \"pops\" the stash stack here, renumbering stash@{2} to stash@{1} and making stash@{1} become plain stash. Use git stash list to see the stash-stack.\n\n1It's not bad to go ahead and commit them anyway, and then do a later git rebase -i to squash or fixup further second, third, fourth, ..., nth commits, and/or rewrite the temporary \"checkpoint\" commit. But that's independent of this.\n2It's a fair bit more complex because you can use --index to try to keep staged changes staged, but in fact, if you look in the script, you'll see the actual command sequence git diff ... | git apply --index. It really does just apply a diff, in this case! Eventually it invokes git merge-recursive directly, though, to merge in the work tree, allowing the same changes to have been brought in from elsewhere. A plain git apply would fail if your patch does something the \"good stuff\" commits D and E also does.\n3This uses git's parent-naming magic syntax, with a little advance planning inside the stash script. Because the stash is this funky merge commit, w has two or even three parents, but the stash script sets it up so that the \"first parent\" is the original commit, C or Z, as appropriate. The \"second parent\" stash^2 is the index state at the time of the commit, shown as i in the little hanging stash-bag, and the \"third parent\", if it exists, is unstaged-and-maybe-ignored files, from git stash save -u or git stash save -a.\nNote that I assume, in this answer, that you have not carefully staged part of your work-tree and that you are not using git stash apply --index to restore the staged index. By not doing any of this, you render the i commit pretty much redundant, so that we need not worry about it during the apply step. If you are using apply --index or equivalent, and have staged items, you can get into a lot more corner cases, where the stash won't apply cleanly.\nThese same caveats apply, with yet more corner cases, to stashes saved with -u or -a, that have that third commit.\nFor these extra-hard cases, git stash provides a way to turn a stash into a full-fledged branch—but I'll leave all that to another answer."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-svn - Bidirectional operation between a Subversion repository and Git -A --after"
},
{
"role": "assistant",
"content": "Don’t require an exact match if given an SVN revision; if there is\nnot an exact match return the closest match searching forward in the\nhistory."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-diff-index - Compare a tree to the working tree or index --no-prefix"
},
{
"role": "assistant",
"content": "Do not show any source or destination prefix."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-bisect - Use binary search to find the commit that introduced a bug"
},
{
"role": "assistant",
"content": "NAME git-bisect - Use binary search to find the commit that introduced a bug"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-rev-list - Lists commit objects in reverse chronological order --do-walk"
},
{
"role": "assistant",
"content": "Overrides a previous --no-walk ."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-log - Show commit logs --color-moved-ws=<modes>"
},
{
"role": "assistant",
"content": "This configures how whitespace is ignored when performing the\nmove detection for --color-moved .\nThese modes can be given as a comma separated list: no Do not ignore whitespace when performing move detection. ignore-space-at-eol Ignore changes in whitespace at EOL. ignore-space-change Ignore changes in amount of whitespace. This ignores whitespace\nat line end, and considers all other sequences of one or\nmore whitespace characters to be equivalent. ignore-all-space Ignore whitespace when comparing lines. This ignores differences\neven if one line has whitespace where the other line has none. allow-indentation-change Initially ignore any whitespace in the move detection, then\ngroup the moved code blocks only into a block if the change in\nwhitespace is the same per line. This is incompatible with the\nother modes."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-cat-file - Provide contents or details of repository objects --batch-command --batch-command=<format>"
},
{
"role": "assistant",
"content": "Enter a command mode that reads commands and arguments from stdin. May\nonly be combined with --buffer , --textconv , --use-mailmap or --filters . When used with --textconv or --filters , the input lines must\nspecify the path, separated by whitespace. See the section BATCH OUTPUT below for details. When used with --use-mailmap , for commit and tag objects, the contents command shows the identities replaced using the\nmailmap mechanism, while the info command shows the size\nof the object as if it actually recorded the replacement\nidentities. --batch-command recognizes the following commands: contents <object> Print object contents for object reference <object> . This corresponds to\nthe output of --batch . info <object> Print object info for object reference <object> . This corresponds to the\noutput of --batch-check . flush Used with --buffer to execute all preceding commands that were issued\nsince the beginning or since the last flush was issued. When --buffer is used, no output will come until a flush is issued. When --buffer is not used, commands are flushed each time without issuing flush ."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Force LF eol in git repo and working copy\nI have a git repository hosted on github. Many of the files were initially developed on Windows, and I wasn't too careful about line endings. When I performed the initial commit, I also didn't have any git configuration in place to enforce correct line endings. The upshot is that I have a number of files with CRLF line endings in my github repository.\nI'm now developing partially on Linux, and I'd like to clean up the line endings. How can I ensure the files are stored correctly with LF on github, and have LF in my working copy?\nI've set up a .gitattributes file containing text eol=LF; is that correct? With that committed and pushed, can I just rm my local repo and re-clone from github to get the desired effect?"
},
{
"role": "assistant",
"content": "Without a bit of information about what files are in your repository (pure source code, images, executables, ...), it's a bit hard to answer the question :)\nBeside this, I'll consider that you're willing to default to LF as line endings in your working directory because you're willing to make sure that text files have LF line endings in your .git repository wether you work on Windows or Linux. Indeed better safe than sorry....\nHowever, there's a better alternative: Benefit from LF line endings in your Linux workdir, CRLF line endings in your Windows workdir AND LF line endings in your repository.\nAs you're partially working on Linux and Windows, make sure core.eol is set to native and core.autocrlf is set to true.\nThen, replace the content of your .gitattributes file with the following\n* text=auto\n\nThis will let Git handle the automagic line endings conversion for you, on commits and checkouts. Binary files won't be altered, files detected as being text files will see the line endings converted on the fly.\nHowever, as you know the content of your repository, you may give Git a hand and help him detect text files from binary files.\nProvided you work on a C based image processing project, replace the content of your .gitattributes file with the following\n* text=auto\n*.txt text\n*.c text\n*.h text\n*.jpg binary\n\nThis will make sure files which extension is c, h, or txt will be stored with LF line endings in your repo and will have native line endings in the working directory. Jpeg files won't be touched. All of the others will be benefit from the same automagic filtering as seen above.\nIn order to get a get a deeper understanding of the inner details of all this, I'd suggest you to dive into this very good post \"Mind the end of your line\" from Tim Clem, a Githubber.\nAs a real world example, you can also peek at this commit where those changes to a .gitattributes file are demonstrated.\nUPDATE to the answer considering the following comment\n\nI actually don't want CRLF in my Windows directories, because my Linux environment is actually a VirtualBox sharing the Windows directory\n\nMakes sense. Thanks for the clarification. In this specific context, the .gitattributes file by itself won't be enough.\nRun the following commands against your repository\n$ git config core.eol lf\n$ git config core.autocrlf input\n\nAs your repository is shared between your Linux and Windows environment, this will update the local config file for both environment. core.eol will make sure text files bear LF line endings on checkouts. core.autocrlf will ensure potential CRLF in text files (resulting from a copy/paste operation for instance) will be converted to LF in your repository.\nOptionally, you can help Git distinguish what is a text file by creating a .gitattributes file containing something similar to the following:\n# Autodetect text files\n* text=auto\n\n# ...Unless the name matches the following\n# overriding patterns\n\n# Definitively text files \n*.txt text\n*.c text\n*.h text\n\n# Ensure those won't be messed up with\n*.jpg binary\n*.data binary\n\nIf you decided to create a .gitattributes file, commit it.\nLastly, ensure git status mentions \"nothing to commit (working directory clean)\", then perform the following operation\n$ git checkout-index --force --all\n\nThis will recreate your files in your working directory, taking into account your config changes and the .gitattributes file and replacing any potential overlooked CRLF in your text files.\nOnce this is done, every text file in your working directory WILL bear LF line endings and git status should still consider the workdir as clean."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-for-each-ref - Output information on each ref --no-contains[=<object>]"
},
{
"role": "assistant",
"content": "Only list refs which don’t contain the specified commit (HEAD\nif not specified)."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Git rebase --continue complains even when all merge conflicts have been resolved\nI am using version 1.7.1 of Git. I tried using git rebase master to rebase against master from my branch. I got an error because there was a merge conflict:\nFirst, rewinding head to replay your work on top of it...\nApplying: checkstyled.\nUsing index info to reconstruct a base tree...\nFalling back to patching base and 3-way merge...\nAuto-merging AssetsLoader.java\nCONFLICT (content): Merge conflict in AssetsLoader.java\nFailed to merge in the changes.\nPatch failed at 0001 checkstyled.\n\nAfter manually editing the file to resolve the conflict, I got this result from git status:\n# Not currently on any branch.\n# Changes to be committed:\n# (use \"git reset HEAD <file>...\" to unstage)\n#\n# modified: PassengerContactHandler.java\n#\n# Unmerged paths:\n# (use \"git reset HEAD <file>...\" to unstage)\n# (use \"git add/rm <file>...\" as appropriate to mark resolution)\n#\n# both modified: AssetsLoader.java\n#\n\nThen, after git add AssetsLoader.java, I tried again, getting:\n# Not currently on any branch.\n# Changes to be committed:\n# (use \"git reset HEAD <file>...\" to unstage)\n#\n# modified: AssetsLoader.java\n# modified: PassengerContactHandler.java\n#\n\nBut then git rebase --continue resulted in:\ngit rebase --continue\nYou must edit all merge conflicts and then\nmark them as resolved using git add\n\nI know I can skip the patch and continue the rebase; but will the changes in PassengerContactHandler.java will be rebased into my branch? How should I proceed?\nCould it be that the file with the resolved conflict is exactly like the original version?"
},
{
"role": "assistant",
"content": "When fixing a conflict, you removed all code in the patch being applied to the branch you are rebasing on. If you are sure you have added all your changes using git add: Use git rebase --skip to continue.\nAs Youness Marhrani mentioned in their comment, be careful when using the command git rebase --skip as you may lose your work (edited files).\nWhen in doubt\nTo make sure you dont lose any work:\n\nAbort your rebase git rebase --abort\nThen create a new branch git checkout -b my-rebasebranch\nRebase your new branch instead: git rebase origin/main (or whatever)\n\nMore details:\nNormally, when fixing a conflict during rebasing, you will edit the conflicting file, keeping some or all of the code in the patch currently being applied to the branch you rebase on. After fixing the patch and doing\ngit add your/conflicted/file\ngit status\n\nyou will get a (usually green) line showing the modified file\n\nmodified: your/conflicted/file\n\ngit rebase --continue will work fine in this situation.\nSometimes, however, when resolving the conflict, you remove everything in your new patch, keeping only code from the branch you rebased on. Now when you add the file, it will be exactly like the one you tried to rebase on. git status will show no green line displaying the modified files. Now, if you do\ngit rebase --continue\n\ngit will complain with\n\nNo changes - did you forget to use 'git add'?\n\nIf you are sure you have added all your changes, what git actually wants you to do in this situation is to use\ngit rebase --skip\n\nto skip the patch. Previously I never did this, as I was always unsure what would actually be skipped if I did, it was not obvious to me what \"skip this patch\" really meant. But if you get no green line with\n\nmodified: your/conflicted/file\n\nafter editing the conflicted file, adding it, and doing git status, then you can be pretty sure you removed the whole patch, and you can instead use\ngit rebase --skip\n\nto continue.\n\nThe original post said this sometimes works:\ngit add -A\ngit rebase --continue\n# works magically?\n\n\n... but don't rely on this (and be sure not to add leftover files in your repository folders)"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Android Studio git check in author name\nI use Android Studio with Bitbucket(over Git) for my repositories. I generally get the author name on the revision history as my name (not my Bitbucket username). When I installed Android Studio in a new computer and pushed for the first time, it showed a dialog asking for Git Username and email.\nNow all my check ins have author as the username. I am not sure how to change the setting, how can I configure the VCS author settings in Android Studio?"
},
{
"role": "assistant",
"content": "I don't think there is any UI for changing this in Android Studio, but you can change this from the command line:\ngit config user.name <your user name>\ngit config user.email <your email>\n\nAdd --global if you want this to apply to all Git repositories on your machine."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-cherry-pick - Apply the changes introduced by some existing commits git cherry-pick maint next ^master git cherry-pick maint master..next"
},
{
"role": "assistant",
"content": "Apply the changes introduced by all commits that are\nancestors of maint or next, but not master or any of its\nancestors. Note that the latter does not mean maint and\neverything between master and next ; specifically, maint will not be used if it is included in master ."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-ls-tree - List the contents of a tree object objectsize[:padded]"
},
{
"role": "assistant",
"content": "The size of a blob object (\"-\" if it’s a commit or tree ).\nIt also supports a padded format of size with \"%(objectsize:padded)\"."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Fatal Error when updating submodule using GIT\n\nI am trying to update the submodules of this git repositary but I keep getting a fatal errors:\n[root@iptlock ProdigyView]# git submodule update --recursive\nCloning into core...\nPermission denied (publickey).\nfatal: The remote end hung up unexpectedly\nClone of '[email protected]:ProdigyView/ProdigyView-Core.git' into submodule path 'core' failed\n\nOr this way\n[root@iptlock root]# git clone --recursive https://github.com/ProdigyView/ProdigyView.git\nCloning into ProdigyView...\nremote: Counting objects: 438, done.\nremote: Compressing objects: 100% (275/275), done.\nremote: Total 438 (delta 172), reused 394 (delta 128)\nReceiving objects: 100% (438/438), 8.03 MiB | 5.19 MiB/s, done.\nResolving deltas: 100% (172/172), done.\nSubmodule 'core' ([email protected]:ProdigyView/ProdigyView-Core.git) registered for path 'core'\nCloning into core...\nPermission denied (publickey).\nfatal: The remote end hung up unexpectedly\nClone of '[email protected]:ProdigyView/ProdigyView-Core.git' into submodule path 'core' failed\n\nAny ideas of why this is happening withthe submodule? The repo is this one: \nhttps://github.com/ProdigyView/ProdigyView\n(The submodule is able to be cloned if I do not try to clone it as a submodule.)"
},
{
"role": "assistant",
"content": "The issue is that git can't find the public key needed to download the repo from your server, the solution is to use the public url.\nIn the file .gitmodule you will find the following entry:\n[submodule \"example\"]\n path = example\n url = [email protected]:webhat/example.git\n\nThe URL need to be changed to the public URL for the module:\n[submodule \"example\"]\n path = example\n url = https://github.com/webhat/example.git\n\nAs you can see the prefix git@ has been changed to https:// and the infix : becomes /\nEDIT:\nIn your own repository you might need to use git:// rather than https://\nThe previous answer was unclear to me, so I added this.\nEDIT 2:\nIf you find you need to run git submodule sync or need to edit .git/config to get this to work, you have likely set up remotes for the submodules."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-tag - Create, list, delete or verify a tag object signed with GPG -a --annotate"
},
{
"role": "assistant",
"content": "Make an unsigned, annotated tag object"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "\"did you run git update-server-info\" error on a Github repository\n\nI'm using the github Gui from their website to manage my repos, and I'm getting the following error:\nfatal: https://github.com/TeaCodie/TeaCodie-Website.git/info/refs not found: \ndid you run git update-server-info on the server?\n\nHow can I fix this?"
},
{
"role": "assistant",
"content": "You might have changed your repository name\nIn your local repository edit the file:\n.git/config\n\nThen check:\n[remote \"origin\"]\n url = \n\nthat the URL matches your remote repository"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-rev-list - Lists commit objects in reverse chronological order %gs"
},
{
"role": "assistant",
"content": "reflog subject"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-gc - Cleanup unnecessary files and optimize the local repository --auto"
},
{
"role": "assistant",
"content": "With this option, git gc checks whether any housekeeping is\nrequired; if not, it exits without performing any work. See the gc.auto option in the \"CONFIGURATION\" section below for how\nthis heuristic works. Once housekeeping is triggered by exceeding the limits of\nconfiguration options such as gc.auto and gc.autoPackLimit , all\nother housekeeping tasks (e.g. rerere, working trees, reflog…) will\nbe performed as well."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "No submodule mapping found in .gitmodule for a path that's not a submodule\nI have a project that has a submodule at lib/three20\nMy .gitmodule file looks like this:\n[submodule \"lib/three20\"]\n path = lib/three20\n url = git://github.com/facebook/three20.git\n\nI have cloned this in the past without errors, (git submodule init followed by a git submodule update) and it's been working for a while.\nI tried to clone this to a new machine, and now I'm getting this error on git submodule init:\nNo submodule mapping found in .gitmodules for path 'Classes/Support/Three20'\n\nThat path is just an empty folder in Xcode that I use to house the projects from the other directory. It's not part of the .gitmodules file, so I don't see where it's getting this path from.\nAny ideas?"
},
{
"role": "assistant",
"content": "No submodule mapping found in .gitmodules for path 'OtherLibrary/MKStore'\nwhen\n$ git submodule update --init\n\nI didn't know why the error occur. After spending a minute and found the answer in stackoverflow.\n$ git rm --cached OtherLibrary/MKStore\n\nand then update the submodule again. It's working fine.\nhttp://en.saturngod.net/no-submodule-mapping-found-in-gitmodules"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-format-patch - Prepare patches for e-mail submission --ignore-blank-lines"
},
{
"role": "assistant",
"content": "Ignore changes whose lines are all blank."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Is there an alternative to .htaccess for GitHub Pages?\n\nI understand that .htaccess is not supported by GitHub Pages. Is there an alternative for password-protecting particular directories for websites hosted by GitHub Pages?"
},
{
"role": "assistant",
"content": "Although you can't use .htaccess or .conf, Github has instructions on how to use the Jekyll Redirect From plugin.\nhttps://help.github.com/articles/redirects-on-github-pages/\nThe page above no longer has any mention of the plugin. The direct link to the jekyll-redirect-from plugin GitHub repo is https://github.com/jekyll/jekyll-redirect-from"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Meaning of the GitHub message: push declined due to email privacy restrictions\nI have accepted and merged a pull request on GitHub, and now I cannot pull my commits any more.\nThe message is:\n! [remote rejected] master -> master (push declined due to email privacy restrictions)\nerror: failed to push some refs to '[email protected]:FranckFreiburger/vue-resize-sensor.git'\n\n\ngit did not exit cleanly (exit code 1) (3838 ms @ 12/04/2017 21:23:11)\n\nWhat should I do now?"
},
{
"role": "assistant",
"content": "The remote repository has been configured to disallow you pushing a commit that would reveal your personal e-mail address. For example in GitHub you have checked the Block command line pushes that expose my email checkbox to enable this.\n\nWhile you can of course uncheck that setting, it will expose your private e-mail address to everyone in the world, as author information is readable by anyone with access to your repository.\nInstead, do this:\n\nYou can see your personal e-mail address, which is used by default for your commits in Git:\ngit config --global user.email\n\nFind your GitHub noreply address in your GitHub's Personal Settings → Emails. It's mentioned in the description of the Keep my email address private checkbox. Usually, it starts with a unique identifier, plus your username:\n{ID}+{username}@users.noreply.github.com\n\n\nChange the global user e-mail address setting to be your GitHub noreply address:\ngit config --global user.email {ID}+{username}@users.noreply.github.com\n\nReset the author information on your last commit:\ngit commit --amend --reset-author\n\nIf you have multiple commits with your private e-mail address, see this answer.\nNow you can push the commit with the noreply e-mail address, and future commits will have the noreply e-mail address as well.\ngit push"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-fast-import - Backend for fast Git data importers fastimport.unpackLimit"
},
{
"role": "assistant",
"content": "If the number of objects imported by git-fast-import is below this limit, then the objects will be unpacked into\nloose object files. However, if the number of imported objects\nequals or exceeds this limit, then the pack will be stored as a\npack. Storing the pack from a fast-import can make the import\noperation complete faster, especially on slow filesystems. If\nnot set, the value of transfer.unpackLimit is used instead."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to undo a git commit --amend [duplicate]\nThis question already has answers here:\n \n \n\n\n\n\nHow to undo \"git commit --amend\" done instead of \"git commit\"\n\n (14 answers)\n \n\nClosed 6 years ago.\n\n\n\nI accidentally typed in a git commit --amend. This is a mistake because I realized that the commit is actually entirely new and it should be committed with a new message. I want to make a new commit. How do I undo this?"
},
{
"role": "assistant",
"content": "PetSerAl's comment is the key. Here's the two command sequence to do just what you want:\ngit reset --soft @{1}\ngit commit -C @{1}\n\nand an explanation of how this works.\nDescription\nWhen you make a new commit, Git usually1 uses this sequence of events:\n\nRead the ID (SHA-1 hash, like a123456...) of the current commit (via HEAD, which gives us the current branch). Let's call this ID C (for Current). Note that this current commit has a parent commit; let's call its ID P (for Parent).\nTurn the index (aka staging-area) into a tree. This produces another ID; let's call this ID T (for Tree).\nWrite a new commit with parent = C and tree = T. This new commit gets another ID. Let's call this N (for New).\nUpdate the branch with the new commit ID N.\n\nWhen using --amend Git changes the process a bit. It still writes a new commit as before, but in step 3, instead of writing the new commit with parent = C, it writes it with parent = P.\nPicture\nPictorially, we can draw what happened this way. We start with a commit graph that ends in P--C, pointed-to by branch:\n...--P--C <-- branch\n\nWhen we make the new commit N we get:\n...--P--C--N <-- branch\n\nWhen we use --amend, we get this instead:\n C\n /\n...--P--N <-- branch\n\nNote that commit C is still in the repository; it's just been shoved aside, up out of the way, so that new commit N can point back to old parent P.\nGoal\nWhat you realized you want, after the git commit --amend, is to have the chain look instead like:\n...--P--C--N <-- branch\n\nWe can't quite do this—we can't change N; Git can never change any commit (or any other object) once it's stored in the repo—but note that the ...--P--C chain is still in there, fully intact. You can find commit C through the reflogs, and this is what the @{1} syntax does. (Specifically, this is short for currentbranch@{1},2 which means \"where currentbranch pointed one step ago\", which was \"to commit C\".)\nSo, we now run git reset --soft @{1}, which does this:\n C <-- branch\n /\n...--P--N\n\nNow branch points to C, which points back to P.\nWhat happens to N? The same thing that happened to C before: it's saved for a while through the reflog.\nWe don't really need it (although it may come in handy), because the --soft flag to git reset keeps the index / staging-area untouched (along with the work-tree). This means we can make a new commit again now, by just running another git commit. It will go through the same four steps (read the ID from HEAD, create the tree, create a new commit, and update the branch):\n C--N2 <-- branch\n /\n...--P--N\n\nwhere N2 will be our new new (second new?) commit.\nWe can even make git commit re-use the commit message from commit N. The git commit command has a --reuse-message argument, also spelled -C; all we have to do is give it something that lets it find the original new commit N from which to copy the message, to make N2 with. How do we do that? The answer is: it's in the reflog, just as C was when we needed to do the git reset.\nIn fact, it's the same @{1}!\nRemember, @{1} means \"where it was just a moment ago\", and git reset just updated it, moving it from C to N. We haven't yet made new commit N2. (Once we do that, N will be @{2}, but we haven't yet.)\nSo, putting it all together, we get:\ngit reset --soft @{1}\ngit commit -C @{1}\n\n\n1The places this description breaks down include when you're amending a merge, when you're on a detached HEAD, and when you use an alternative index. Even then, though, it's pretty obvious how to modify the description.\n2If HEAD is detached, so that there is no current branch, the meaning becomes HEAD@{1}. Note that @ by itself is short for HEAD, so the fact that @{n} refers to the current branch, rather than to HEAD itself, is a bit inconsistent.\nTo see how they differ, consider git checkout develop followed by git checkout master (assuming both branches exist). The first checkout changes HEAD to point to develop, and the second changes HEAD to point to master. This means that master@{1} is whatever commit master pointed to, before the last update to master; but HEAD@{1} is the commit develop points to now—probably some other commit.\n(Recap: after these two git checkout commands, @{1} means master@{1} now, HEAD@{1} means the same commit as develop now, and @ means HEAD. If you're confused, well, so was I, and apparently I am not alone: see the comments.)"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "What are the differences between msys/git and git-for-windows/mingw-w64-x86_64-git?\nTo be able to run the test scripts for my cross-platform application also on Windows, I installed MSYS2 and used pacman to install any packages my test scripts rely on.\nSince MSYS2 provides a port of git (msys/git), I think there is no need to install Git for Windows as well. But what are the differences between the git version provided in the MSYS2 repository and the one provided by Git for Windows?\nI noticed these differences so far:\n\nmsys/git will fail when running pip freeze on a virtualenv where a Python package from a git clone is installed in develop mode:\nFileNotFoundError: [WinError 3] The system cannot find the path specified: '/c/users/user/documents/project/.git\\\\..'\n\ngit-for-windows/mingw-w64-x86_64-git doesn't fail, so there are at least some differences with respect to path handling.\nGit for Windows's gitk and git gui work out of the box. There's no need to set the GIT_GUI_LIB_DIR environment variable as described here.\n\nIt seems git from the Git for Windows repository offers the best experience at this point.\nP.S. You can install Git for Windows's git in MSYS2 by adding the following to /etc/pacman.conf, above the [mingw32], [mingw64] and [msys] entries. But it might be a better idea to install the Git for Windows SDK instead, which is basically a special edition of MSYS2 including Git for Windows. Otherwise, the procedure below (and more) is also described here.\n[git-for-windows]\nServer = https://dl.bintray.com/$repo/pacman/$arch\n\n[git-for-windows-mingw32]\nServer = https://dl.bintray.com/git-for-windows/pacman/i686\n\nAfter this (and perhaps a pacman -Sy), you can install the Git for Windows's git:\npacman -S mingw-w64-x86_64-git\n\nI suppose there's no reason not to install Git for Windows's git in MSYS2?\nEDIT The Git for Windows (un)installer left behind C:\\ProgramData\\Git\\config. This points git at the wrong location for the SSL certificates. You can remove C:\\ProgramData\\Git\\config to fix this."
},
{
"role": "assistant",
"content": "msys/git is linked against a dynamic library provided by MSYS2 to provide POSIX-to-Windows compatibility (POSIX emulation) in a manner similar to how cygwin does (MSYS2 is forked from cygwin), thus it requires the MSYS2 environment to be present to run.\ngit-for-windows/mingw-w64-x86_64-git on the other hand, is compiled using the MinGW compiler, which performs the translation to native Windows calls at compile time, which results in a much faster binary compared to the emulation approach, and does only require native Windows libraries to run.\nFrom The difference between MSYS2 and MinGW:\n\nThe POSIX emulation layer of MSYS2 binaries is convenient, but comes at a cost: Typically, MSYS2 programs are noticably slower than their MinGW counterparts (if there are such counterparts). As a consequence, the Git for Windows project tries to provide as many components as possible as MinGW binaries.\n\nSee also: How does MSYS2 differ from Cygwin?"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "gitattributes - Defining attributes per path binary"
},
{
"role": "assistant",
"content": "Keep the version from your branch in the work tree, but\nleave the path in the conflicted state for the user to\nsort out."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to create a commit and push into repo with GitHub API v3?\n\nI want to create a repository and Commit a few files to it via any Python package. How do I do?\nI do not understand how to add files for commit."
},
{
"role": "assistant",
"content": "Solution using the requests library:\nNOTES: I use the requests library to do the calls to GitHub REST API v3.\n1. Get the last commit SHA of a specific branch\n# GET /repos/:owner/:repo/branches/:branch_name\nlast_commit_sha = response.json()['commit']['sha']\n\n2. Create the blobs with the file's content (encoding base64 or utf-8)\n# POST /repos/:owner/:repo/git/blobs\n# {\n# \"content\": \"aGVsbG8gd29ybGQK\",\n# \"encoding\": \"base64\"\n#}\nbase64_blob_sha = response.json()['sha']\n\n# POST /repos/:owner/:repo/git/blobs\n# {\n# \"content\": \"hello world\",\n# \"encoding\": \"utf-8\"\n#}\nutf8_blob_sha = response.json()['sha']\n\n3. Create a tree which defines the folder structure\n# POST repos/:owner/:repo/git/trees/\n# {\n# \"base_tree\": last_commit_sha,\n# \"tree\": [\n# {\n# \"path\": \"myfolder/base64file.txt\",\n# \"mode\": \"100644\",\n# \"type\": \"blob\",\n# \"sha\": base64_blob_sha\n# },\n# {\n# \"path\": \"file-utf8.txt\",\n# \"mode\": \"100644\",\n# \"type\": \"blob\",\n# \"sha\": utf8_blob_sha\n# }\n# ]\n# }\ntree_sha = response.json()['sha']\n\n4. Create the commit\n# POST /repos/:owner/:repo/git/commits\n# {\n# \"message\": \"Add new files at once programatically\",\n# \"author\": {\n# \"name\": \"Jan-Michael Vincent\",\n# \"email\": \"[email protected]\"\n# },\n# \"parents\": [\n# last_commit_sha\n# ],\n# \"tree\": tree_sha\n# }\nnew_commit_sha = response.json()['sha']\n\n5. Update the reference of your branch to point to the new commit SHA (on master branch example)\n# PATCH /repos/:owner/:repo/git/refs/heads/:branch\n# {\n# \"sha\": new_commit_sha\n# }\n\nFinally, for a more advanced setup read the docs."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Clone a github repo into a private gitlab repo\n\nI am trying to pull a repo from github and push it up to a private repo on a gitlab server that I am running.\nI cloned the github repo to my local machine\ngit clone https://github.com/somepage/someproject\n\nat that point I added a new remote (my gitlab)\ngit remote add gitlab https://mygitlabserver/mypage/myproject\n\nthen I pushed (in this case only branch on githab was develop)\ngit push gitlab develop\n\nNow I am running into problems when I try to clone from my gitlab repo:\ngit clone https://mygitlabserver/mypage/myproject\nCloning into 'myproject'...\nremote: Counting objects: 140, done.\nremote: Compressing objects: 100% (85/85), done.\nremote: Total 140 (delta 40), reused 140 (delta 40)\nReceiving objects: 100% (140/140), 2.75 MiB | 1.85 MiB/s, done.\nResolving deltas: 100% (40/40), done.\nChecking connectivity... done.\nwarning: remote HEAD refers to nonexistent ref, unable to checkout.\n\nNot 100% what that warning is about, but I am sure its not good. If I list the contents of that cloned dir its empty.\nWhat did I do wrong?"
},
{
"role": "assistant",
"content": "I suspect you are getting that error because the default configuration of a repository in gitlab is to have a default branch name of master. You have only pushed a branch named develop, and when you clone the repository git is attempting to checkout the nonexistent master branch.\nYou can:\n\ngo into the repository settings in gitlab and set the default branch to develop, \nor you can just name the branch master, \nor you can provide -b develop to the git clone command, \nor after cloning you can simply git checkout develop."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How do I \"commit\" changes in a git submodule? [duplicate]\nThis question already has answers here:\n \n \n\n\n\n\nGit commit to common submodule (master branch)\n\n (7 answers)\n \n\nClosed 11 years ago.\n\n\n\nI have, in my naivety, set up a git submodule and treated it like a Subversion external - i.e. it's now full of changes that I've just realized haven't been committed or pushed anywhere.\nIs there some easy way to commit/push the submodule changes back to the upstream repo? And what's the recommended technique in Git for doing simultaneous development on separate (but linked) repositories in this way?"
},
{
"role": "assistant",
"content": "A submodule is its own repo/work-area, with its own .git directory.\nSo, first commit/push your submodule's changes:\n$ cd path/to/submodule\n$ git add <stuff>\n$ git commit -m \"comment\"\n$ git push\n\nThen, update your main project to track the updated version of the submodule:\n$ cd /main/project\n$ git add path/to/submodule\n$ git commit -m \"updated my submodule\"\n$ git push"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to view the committed files you have not pushed yet?\nFor example I commit some files, the next day some more files, and so on. After some days I want to view all my committed files and view their difference with the remote repo. Note that I have not pushed anything. I just want to verify that if I push some thing then it will go to the remote repo as I expect."
},
{
"role": "assistant",
"content": "Assuming you're on local branch master, which is tracking origin/master:\ngit diff --stat origin/master.."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Visual Studio: How to create project from existing GitHub repository?\n\nI came from Eclipse background and I am apparently missing something. \nThere is an existing GitHub project with JS code in it and I would like to start adding TypeScript nature to it, one type at a time.\nI have followed this tutorial to clone project from GitHub to my \"local git repository\". Now the Team Explorer window displays it as local repository and I can commit changes etc but it's not a project and I don't know how to open it as a project (I want to open it as TypeScript project).\nThe workflow I was used to from Eclipse would simply be New -> Other -> SVN -> Checkout Projects from SVN that is automatically followed by New Project Wizard.\nHow do I clone existing JS project from GitHub and make it a TypeScrip project while keeping the existing folder structure?\nEDIT: I am using Visual Studio Express and I am limited to the native Git extension."
},
{
"role": "assistant",
"content": "What I typically do in this situation;\n\nClone repository using Git in Visual Studio; or use GitHub for Windows and Clone in Desktop from the Git project's web page. This will create a directory (repository) with the project files where you specify. \nIn visual studio, File->New->create a new project from existing code. From the wizard, select C# or C++ (whatever your choice it does not really matter) \nThe wizard requires a project file location: give the location of the Git folder that contains the project files (where you cloned the project's repository). \nThe Wizard requires a unique project name, for example you can use the name of the Git project with VisualStudio (or VS) appended to the end. \nGit will now be in sync and you will be able to see all the git files. Making changes will check them out and allow you to push them to the project etc... \n\n***** By default Git will want to check in the newly created .csproj file that Visual Studio creates to allow you to open the project in Visual Studio. You will just want to drag this into the excluded changes section because most likely the project in question will not be using Visual Studio.**"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-log - Show commit logs %%"
},
{
"role": "assistant",
"content": "a raw %"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Git: set branch to current ref\nDue to the use of submodules in my projects I'm finding myself often on \"(no branch)\". As I'm also adding code to those submodules I'm committing in there. When I then want to push those submodules I need to be on a branch of course. Hence my question:\nIs there a way/shortcut in git (command line) to set a local branch to the current commit/HEAD without the detour of \ngit checkout the_branch\ngit reset --hard <previous commit-ish>\n\nTo be more precise, my real problem with the above \"detour\" is that I'm temporarily leaving the original HEAD with the checkout-command. That can be avoid with the git branch -f command (thanks to CharlesB)."
},
{
"role": "assistant",
"content": "Checkout the branch with -B: this will reset the branch to HEAD, which is the current ref.\ngit checkout -B <branch> \n\nFrom the docs:\n\nIf -B is given, is created if it doesn’t exist;\n otherwise, it is reset. This is the transactional equivalent of\n$ git branch -f <branch> [<start point>]\n$ git checkout <branch>\n\nthat is to say, the branch is not reset/created unless \"git\n checkout\" is successful."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git - the stupid content tracker git-mktag"
},
{
"role": "assistant",
"content": "Creates a tag object with extra validation"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git - the stupid content tracker GIT_TRACE_FSMONITOR"
},
{
"role": "assistant",
"content": "Enables trace messages for the filesystem monitor extension.\nSee GIT_TRACE for available trace output options."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-format-patch - Prepare patches for e-mail submission --textconv --no-textconv"
},
{
"role": "assistant",
"content": "Allow (or disallow) external text conversion filters to be run\nwhen comparing binary files. See gitattributes for\ndetails. Because textconv filters are typically a one-way\nconversion, the resulting diff is suitable for human\nconsumption, but cannot be applied. For this reason, textconv\nfilters are enabled by default only for git-diff and git-log , but not for git-format-patch or\ndiff plumbing commands."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Can I copy a Git working copy onto another machine?\nI am in the process of creating a Git working copy from our SVN server with 'git svn clone'. But this takes quite some time (we have > 20.000 revs and almost 10.000 files). I have some other machines (for other developers) that I would like to setup the same way. Will it be possible to copy the resulting files from the first machine onto others, so as to spend less time?\nIn other words, is there anything in a Git working copy that ties it to the machine it was created on?\nThanks."
},
{
"role": "assistant",
"content": "You can copy it, everything is inside the .git folder and is not dependant on anything else."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git - the stupid content tracker git-merge-one-file"
},
{
"role": "assistant",
"content": "The standard helper program to use with git-merge-index"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-diff - Show changes between commits, commit and working tree, etc plain"
},
{
"role": "assistant",
"content": "Show words as [-removed-] and {+added+} . Makes no\nattempts to escape the delimiters if they appear in the input,\nso the output may be ambiguous."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How can I undo discard changes in GitHub Desktop?\nIs there any way to undo discard changes in GitHub Desktop, after the Undo button has disappeared?\n\nI am talking about GitHub Desktop's undo feature, not git in general."
},
{
"role": "assistant",
"content": "As of 5/8/18, and if you're using the latest version of github desktop or github desktop beta, uncommitted discarded changes are now copied over as new files and put into your trash/recycling bin. \nThis is what the current prompt looks like:"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Git on the server(windows server 2012) [closed]\n\nClosed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.\n \n \n\n\n\n\n\n\n\n\n\n\n\n Questions asking us to recommend or find a book, tool, software library, tutorial or other off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.\n\n\nClosed 9 years ago.\n\n\n\n\n\n\n\n Improve this question\n \n\n\n\nWe want to install Git in our dedicated server to mange our code version and code revision. Our dedicated server has Windows server 2012. We thought about GitLab, but it is not supported in windows. Suggest me which one should I use, there is Gitprep for windows."
},
{
"role": "assistant",
"content": "You could use Bonobo Git Server, it is designed to run on Windows in IIS."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "pull using git including submodule\n\nIn one of my iOS project I have add a sub-module added, lets say a friend of my wants to pull it including the submodule, how can he do this? Whenever I tried to download the zip file from github it doesn't pull the submodule along with it"
},
{
"role": "assistant",
"content": "That's by design. Get the submodules as a second step.\ngit clone git://url...\ncd repo\ngit submodule update --init\n\nThen afterwards, add another step after the git pull.\ngit pull ...\ngit submodule update --recursive\n\nOf course, this only works if the submodules are set up correctly in the first place..."
}
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.