{"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "fetch in git doesn't get all branches\nI have cloned a repository, after which somebody else has created a new branch, which I'd like to start working on. I read the manual, and it seems dead straight easy. Strangely it's not working, and all the posts I've found suggest I'm doing the right thing. So I'll subject myself to the lambasting, because there must be something obviously wrong with this:\nThe correct action seems to be \ngit fetch\ngit branch -a\n* master\n remotes/origin/HEAD --> origin/master\n remotes/origin/master\ngit checkout -b dev-gml origin/dev-gml\n\nAt this point there is a problem, for some reason after git fetch I can't see the dev-gml remote branch. Why not? If I clone the repository freshly, it's there, so certainly the remote branch exists:\n$ mkdir ../gitest\n$ cd ../gitest\n$ git clone https://github.com/example/proj.git\nCloning into proj...\nremote: Counting objects: 1155, done.\nremote: Compressing objects: 100% (383/383), done.\nremote: Total 1155 (delta 741), reused 1155 (delta 741)\nReceiving objects: 100% (1155/1155), 477.22 KiB | 877 KiB/s, done.\nResolving deltas: 100% (741/741), done.\n$ cd projdir\n$ git branch -a\n* master\n remotes/origin/HEAD -> origin/master\n remotes/origin/dev-gml\n remotes/origin/master\n\nI've tried git update, git pull, git fetch --all, git pretty-please in all possible permutations..."}, {"role": "assistant", "content": "The problem can be seen when checking the remote.origin.fetch setting\n(The lines starting with $ are bash prompts with the commands I typed. The other lines are the resulting output)\n$ git config --get remote.origin.fetch\n+refs/heads/master:refs/remotes/origin/master\n\nAs you can see, in my case, the remote was set to fetch the master branch specifically and only. I fixed it as per below, including the second command to check the results.\n$ git config remote.origin.fetch \"+refs/heads/*:refs/remotes/origin/*\"\n$ git config --get remote.origin.fetch\n+refs/heads/*:refs/remotes/origin/*\n\nThe wildcard * of course means everything under that path.\nUnfortunately I saw this comment after I had already dug through and found the answer by trial and error."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "My pull request has been merged, what to do next?\n\nI recently participated in a project from GitHub. I did the following:\nForked the original repository, cloned it to my local machine, made a branch to fix existing bug, fixed bug being in that branch, pushed that branch to my repo, send a pull request to the author of the repository to merge my fix branch to its master branch.\nIt was my first time I commited on another's code so I don't know what to do. Now my pull request has been merged to original repo/project by the author. \nWhat should I do next? Should I delete the branch? Should I merge the branch? Anything else?\n\nAdditional info:\nThe original project has a single branch.\nI also have a upstream set to get latest updates form the original repo. (I did it like this):\ngit remote add upstream https://path/to/original/repo.git\n\nAnd I get updates like this:\ngit fetch upstream"}, {"role": "assistant", "content": "What to do next is: going on contributing new features or fixing other bugs in their own dedicated branches (pushed only to your fork). \nMeaning your fork stays, but the branches within your fork can come and go. \nYou can also remove the fork if you are not planning to contribute further, but it will remove the corresponding entry in 'Repositories you contribute to'.\nIt is easier to:\n\ndelete your fix branch (actually, it is now deleted for you) on your fork (and in your local cloned repo: see \"Delete a Git branch both locally and remotely\")\ngit pull upstream master (if master was the branch in which your fix has been integrated: the merge will be a fast-forward one): no rebase needed at this point.\nrecreate a fix branch on top of your updated local master (now with the latest from upstream master).\n\n\nHowever, never forget one step before submitting any future pull request:\nrebase first your current branch (fix) from upstream destination branch\n(upstream being the original repo you have forked: see \"What is the difference between origin and upstream in github\")\nBefore submitting anything back to the original repo (\"upstream\"), you need to make sure your work is based on top of the latest from said original repo (or the pull-request won't result in a fast-forward merge once applied back on upstream repo).\nSee, for instance, \"Workflow for managing pull requests on shared repos in github\".\nIn other words, upstream can evolve (have new commits pushed on it) while you are busy fixing stuff. You need to replay your fixes on top of that latest work from upstream to make sure your commits are still compatible with the latest of upstream.\n\nThe OP Santosh Kumar asks in the comments:\n\nI have pulled and merged from upstream to master, now what? \n\nIf you haven't made any new fixes since your recent pull request, see above (delete and recreate an new branch fix on top of your updated master).\nIf you have done any more work since your pull request, I wouldn't merge from upstream if I want to make a new pull request: I would pull and rebase:\ngit pull --rebase upstream master\n\nThat way, all my new local work is replayed on top of the most recent upstream master commits (fetched in my local repo), supposing that master is the target branch that will integrate my future pull request.\nThen I can push my local work to 'origin', which is my fork on GitHub of upstream.\nAnd from my fork on GitHub, I can safely make a pull request, knowing that it will only add new commits to upstream without needing any merge resolution: merging those new commits in upstream repo will mean a simple fast-forward merge.\n\nA git pull --rebase without specifying the branch on top of which you want to rebase your (currently checked out) fix branch wouldn't work:\n\nThat (git pull --rebase) says: \n\nYou asked to pull from the remote '`upstream`', but did not specify a branch. \n\n\nShould I append master at last? And what will this do?, will it delete my fix branch?\n\nYes, you can specify the branch which will be the target of the pull request, for instance 'master'.\nThat will not delete your fix branch, but will replay it on top of upstream master fetched in your repo."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-config - Get and set repository or global options push.useBitmaps"}, {"role": "assistant", "content": "If set to \"false\", disable use of bitmaps for \"git push\" even if pack.useBitmaps is \"true\", without preventing other git operations\nfrom using bitmaps. Default is true."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How can I completely remove a file from a git repository?\nI noticed recently that the project files my text editors use (along with some other junk) got added the git repository for the project. Since they aren't actually part of the project, I'd like to remove them, but git rm doesnt remove the old versions from the repository, and I couldnt find anything else that looks promising."}, {"role": "assistant", "content": "The tool you want is git filter-branch. Its usage is described here, but basically:\n$ git filter-branch --tree-filter 'rm -f my_file' HEAD\n\nwill remove \"my_file\" from every commit.\nNotice that this rewrites every commit, so if you push into a remote repository, you have to (a) force the update, and (b) everyone else who pulled from you will now have duplicate commits (since you rewrote the history), as described on the git rebase man page."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How to merge all files manually in Git?\nI want to merge all files manually with meld or any other diff tool, how can I do this with Git? \nWhen I run git mergetool \nit says no files need merging. So I suppose I can do it only if I have conflicts."}, {"role": "assistant", "content": "There is much simpler way:\ngit merge --no-commit merge_branch\nAs man says:\n\nWith --no-commit perform the merge but pretend the merge failed and do\n not autocommit, to give the user a chance to inspect and further tweak\n the merge result before\n committing."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Trigger Github Actions only when PR is merged\n\nI have a github actions yaml file as follows:\nname: Test deployment\non:\n pull_request:\n branches:\n - master\n\njobs:\n deploy:\n runs-on: ubuntu-18.04\n steps:\n - name: Random name\n run: date\n\n\nWhen I raise a PR from a branch to master branch, Github Action gets triggered. So, I updated my YAML to:\nname: Test deployment\non:\n pull_request:\n types:\n - closed\n branches:\n - master\n\n\nNow it is triggered when I merge the PR rather than while raising it. But it also gets triggered when I close the PR without merging it.\nI found nothing like merged type in docs\nEven the following syntax i tried does not work as expected:\njobs:\n ...\n if: github.event_name == 'pull_request' && github.event.action == 'closed'\n\nCan anyone pls help me out here?\nIs it possible for me to check if the PR is approved by atleast one reviewer? (I can enable branch protection, but wanted to know if any option exists for doing it in github actions)"}, {"role": "assistant", "content": "There is no pull-request-merged event.\nThe closest thing you can get is to subscribe to push event, since a merged PR will always create a push event to the branch it's being merged onto.\nIf you only care about PRs to master then you can specify that:\non:\n push:\n branches:\n - master\n\nThe other thing you can do is filter on each step individually\n - name: Do something\n if: github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged == true\n run: ...\n\n(Edit, as of 2022)\nPer the GitHub docs, this should be possible now via:\non:\n pull_request:\n types:\n - closed\n\njobs:\n if_merged:\n if: github.event.pull_request.merged == true\n runs-on: ubuntu-latest\n steps:\n - run: |\n echo The PR was merged"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How to copy a Gitlab project to another Gitlab repository?\n\nI want to copy a GitLab project to another repository which should be completely independent from the original project.\nFor this reason, I tried forking the original project into another project. But inside the original project, the maintainer still can see a list of forks and knows where the other forks are maintained.\nI want to have a complete copy without any link to the main project so it cannot be managed by the original project maintainer.\nHow can I do this?"}, {"role": "assistant", "content": "Another option is to use Gitlab's export/import feature.\n\nExisting projects running on any GitLab instance or GitLab.com can be exported with all their related data and be moved into a new GitLab instance.\n\nThe difference with the other answer is that it also copies the following:\n\nExported contents\nThe following items will be exported:\n\nProject and wiki repositories\nProject uploads\nProject configuration, excluding integrations\nIssues with comments, merge requests with diffs and comments, labels, milestones, snippets, and other project entities\nDesign Management files and data\nLFS objects\nIssue boards\nPipelines history\nPush Rules\n\n\nSo it depends on your use-case if you want to copy just the codes or if you also want to also migrate the other non-code items as listed above. The result would still be 2 separate projects (i.e. It will not appear as a fork).\nTake note that:\n\nThe GitLab import/export button is displayed if the project import option is enabled.\n\nTo export, go to your project's Settings > General page:\n\nThen wait for the email with the downloadable tar.gz. file.\n(On my version of Gitlab, if you click the button twice, you can download directly from the browser.)\nThen to import, on Gitlab, select the New button > New Project from the top bar.\nThen, select Import Project > Gitlab export.\n\nThe UI screenshots above may change on future Gitlab versions. Again, make sure to refer to your Gitlab instance's docs pages, or check out the public one from Gitlab EE: Project import/export ."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "What are the status tags, like [build | passing]\n\nMay be a well known question, but actually I'm asking this, because I'm not familiar with these tags.\n\nI've seen similar types of tags in various Github projects, especially in their README.md. My questions are manifold regarding these:\n\nWhat's the purpose of these tags?\nHow to generate them?\nIs there any good practice or documentation that suggests what types of tags can be used or should be used in a project?\nWhen a project can be determined viable using such a tag?"}, {"role": "assistant", "content": "What's the purpose of these tags?\n\nThese images are provided by external services, often continuous integration services, and are used to show interesting information about the repository.\nFor example, the first badge you show in your example says that the build is \"passing\" (the exact definition of this will be build-specific, but it commonly means that the tests pass and nothing blew up during the most recent build).\nThe third example, coverage: 12%, is a code coverage report.\n\nHow to generate them?\n\nEach service will have its own way.\nThe second badge in your example is from Scrutinizer, and unfortunately I can't find documentation about its badges. But most badging systems work by giving you a link for each project or job that you can use on your website or GitHub or whatever, and when a build happens the badge's appearance is updated accordingly.\nThe Travis CI documentation contains a good example.\nHaving answered the first to questions, I think your last two largely disappear. The badges that can be used are determined by whatever services you can find. The badges that should be used are entirely up to you."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "gitlab-runner x509: certificate signed by unknown authority\n\nI'm trying to register a new runner on gitlab following these steps :\nhttps://docs.gitlab.com/runner/register/index.html\nBut when I enter the url, token and tags, an error message pops-up saying:\n\nERROR: Registering runner... failed runner=CS-XXX status=couldn't execute POST against https://example.com/api/v4/runners: Post https://example.com/api/v4/runners: x509: certificate signed by unknown authority\n\nI'm working on a new server and already installed the gitlab-runner."}, {"role": "assistant", "content": "you need to use tls-ca-file option during registration or in the configuration of your runner.\nHere is an example of non-interactive registration with tls-ca-file option :\ngitlab-runner register \\\n --non-interactive \\\n --registration-token YOUTOKEN \\\n --url https://example.com/ \\\n --tls-ca-file /path/to/your/ca.crt\n\nOther way, you can refer the tls-ca-file option in your config.toml under the [[runners]] section\nmore info : https://docs.gitlab.com/runner/configuration/tls-self-signed.html"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "ssh: Could not resolve hostname git: Name or service not known fatal: Could not read from remote repository\nAfter I switched from HTTPS to SSH for my repo then I received this error when pushing to origin master:\nssh: Could not resolve hostname git: Name or service not known\nfatal: Could not read from remote repository.\n\nPlease make sure you have the correct access rights\nand the repository exists.\n\nI also add my ssh in the gitlab. What should I do?"}, {"role": "assistant", "content": "I was getting the same error.\n\nThis error typically occurs when there is an issue with the SSH configuration or the Git remote repository's hostname cannot be resolved.\n\nHere, you can check your remote by running:\ngit remote -v\n\nThere are few reasons why this error occurs:\n\nIncorrect Hostname\nSSH Configuration\nNetwork Connection\nDNS Resolution\nFirewall or Proxy\n\nTypically, you can solve this by Change the [remote \"origin\"] URL value in .gitconfig or .config/git/config file\nPreviously:\nhttps://[email protected]:userName/repo.git\n\nOR\nssh://[email protected]:userName/repo.git\n\nNew:\n[email protected]:userName/repo.git"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "gitattributes - Defining attributes per path"}, {"role": "assistant", "content": "EXAMPLES If you have these three gitattributes file: (in $GIT_DIR/info/attributes)\n\na*\tfoo !bar -baz\n\n(in .gitattributes)\nabc\tfoo bar baz\n\n(in t/.gitattributes)\nab*\tmerge=filfre\nabc\t-foo -bar\n*.c\tfrotz the attributes given to path t/abc are computed as follows: By examining t/.gitattributes (which is in the same\ndirectory as the path in question), Git finds that the first\nline matches. merge attribute is set. It also finds that\nthe second line matches, and attributes foo and bar are unset. Then it examines .gitattributes (which is in the parent\ndirectory), and finds that the first line matches, but t/.gitattributes file already decided how merge , foo and bar attributes should be given to this path, so it\nleaves foo and bar unset. Attribute baz is set. Finally it examines $GIT_DIR/info/attributes . This file\nis used to override the in-tree settings. The first line is\na match, and foo is set, bar is reverted to unspecified\nstate, and baz is unset. As the result, the attributes assignment to t/abc becomes: foo\tset to true\nbar\tunspecified\nbaz\tset to false\nmerge\tset to string value \"filfre\"\nfrotz\tunspecified"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git - the stupid content tracker GIT_TRACE_PACKFILE"}, {"role": "assistant", "content": "Enables tracing of packfiles sent or received by a\ngiven program. Unlike other trace output, this trace is\nverbatim: no headers, and no quoting of binary data. You almost\ncertainly want to direct into a file (e.g., GIT_TRACE_PACKFILE=/tmp/my.pack ) rather than displaying it on\nthe terminal or mixing it with other trace output. Note that this is currently only implemented for the client side\nof clones and fetches."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Gitflow: Should I squash commits when merging from a release branch into master?\nI am going to merge my release branch to master and I am wondering if I should squash the commits from develop into a single merge commit when merging into master.\nGeneral documentations about git flow contain figures like this one from in the Atlassian page:\n\nIn those figures only single commits appear on master instead of all commits made to develop.\nAcctually, I like the idea of having a master branch which release commits only.\nShould I retain all commits on develop when merging into master? Or do you squash the commits before merging to master when following Gitflow?\nLink to the source article: Gitflow Workflow - Atlassian"}, {"role": "assistant", "content": "In my opinion, and bear in mind, this is just an opinion, and you will likely get different answers, you should NOT squash the commits when merging into master from the develop branch. Doing so would lose a lot of the history of the changes that have been made. For example, almost all the commits I make are tagged with an issue number, so that there is full trace-ability back through the git history into the issues that were raised, and why changes were made.\nMore to the point, you shouldn't be merging directly from develop into master. Assuming you are following git-flow, then this transition should be being done through a release branch.\nIf you had asked whether, when on a feature or hotfix branch, should the commits be squashed then that would have been a different answer. In these cases, arguably the branch should be small enough to warrant only a single commit, so in these situations, I almost always rebase and squash commits into a single one, prior to merging into the target branch."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How can I delete a remote branch in a local git repository?\nAll the remote branches are visible as remotes in my local git repository after a git fetch.\nHow to selectively remove the remote branches in my local repository (not in the remote repository)?"}, {"role": "assistant", "content": "I had a slightly different but similar issue, but the solution might be useful to others who stumble on this question...\nI noticed that my local repository still had remote branches that no longer existed on the remote, so I wanted to remove them. The solution is simply to fetch with the --prune (or -p) option:\ngit fetch --prune"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-log - Show commit logs --numstat"}, {"role": "assistant", "content": "Similar to --stat , but shows number of added and\ndeleted lines in decimal notation and pathname without\nabbreviation, to make it more machine friendly. For\nbinary files, outputs two - instead of saying 0 0 ."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "In a Git repository, how to properly rename a directory?\nI think it should work to copy the directory to be renamed to a new directory with desired name, and delete the old directory, and git add, git commit and push everything. But is this the best way?"}, {"role": "assistant", "content": "Basic rename (or move):\ngit mv \n\nCase sensitive rename—eg. from casesensitive to CaseSensitive—you must use a two step:\ngit mv casesensitive tmp\ngit mv tmp CaseSensitive\n\n(More about case sensitivity in Git…)\n…followed by commit and push would be the simplest way to rename a directory in a git repo."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-diff - Show changes between commits, commit and working tree, etc --output="}, {"role": "assistant", "content": "Output to a specific file instead of stdout."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Jenkins - how to build a specific branch\n\nThis isn't as simple as just doing a parametrized build. I've already got a specific build process that will build and deploy whenever any of these branches are pushed to GitHub:\n\nSo if I've just pushed develop and it built successfully, how do I trigger a manual build and have it pull feature/my-new-feature (without doing a git push)? I tried enabling parametrized build, adding a new string called branch, and then adding a new branch specifier, */$branch. I then ran a build and set branch to feature/my-new-feature and it still pulled from develop."}, {"role": "assistant", "content": "Best solution can be:\nAdd a string parameter in the existing job \nThen in the Source Code Management section update Branches to build to use the string parameter you defined: \nIf you see a checkbox labeled Lightweight checkout, make sure it is unchecked.\nThe configuration indicated in the images will tell the jenkins job to use master as the default branch, and for manual builds it will ask you to enter branch details (FYI: by default it's set to master)"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Forking vs. Branching in GitHub\n\nI'd like to know more about the advantages and disadvantages of forking a github project vs. creating a branch of a github project.\nForking makes my version of the project more isolated from the original one because I don't have to be on the collaborators list of the original project. Since we're developing a project in house, there is no problem in adding people as collaborators. But, we'd like to understand if forking a project would make merge changes back to the main project harder. That is, I wonder if branching makes keeping the two projects in sync easier. In other words, is it easier to merge and push changes between my version of the main project and the main project when I branch?"}, {"role": "assistant", "content": "You cannot always make a branch or pull an existing branch and push back to it, because you are not registered as a collaborator for that specific project.\nForking is nothing more than a clone on the GitHub server side:\n\nwithout the possibility to directly push back\nwith fork queue feature added to manage the merge request\n\nYou keep a fork in sync with the original project by:\n\nadding the original project as a remote\nfetching regularly from that original project\nrebase your current development on top of the branch of interest you got updated from that fetch.\n\nThe rebase allows you to make sure your changes are straightforward (no merge conflict to handle), making your pulling request that more easy when you want the maintainer of the original project to include your patches in his project. \nThe goal is really to allow collaboration even though direct participation is not always possible.\n\nThe fact that you clone on the GitHub side means you have now two \"central\" repository (\"central\" as \"visible from several collaborators).\nIf you can add them directly as collaborator for one project, you don't need to manage another one with a fork. \n\nThe merge experience would be about the same, but with an extra level of indirection (push first on the fork, then ask for a pull, with the risk of evolutions on the original repo making your fast-forward merges not fast-forward anymore).\nThat means the correct workflow is to git pull --rebase upstream (rebase your work on top of new commits from upstream), and then git push --force origin, in order to rewrite the history in such a way your own commits are always on top of the commits from the original (upstream) repo.\nSee also:\n\nGit fork is git clone?\nPull new updates from original Github repository into forked Github repository"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git - the stupid content tracker -v --version"}, {"role": "assistant", "content": "Prints the Git suite version that the git program came from. This option is internally converted to git version ... and accepts\nthe same options as the git-version command. If --help is\nalso given, it takes precedence over --version ."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Why does git-rebase give me merge conflicts when all I'm doing is squashing commits?\nWe have a Git repository with over 400 commits, the first couple dozen of which were a lot of trial-and-error. We want to clean up these commits by squashing many down into a single commit. Naturally, git-rebase seems the way to go. My problem is that it ends up with merge conflicts, and these conflicts are not easy to resolve. I don't understand why there should be any conflicts at all, since I'm just squashing commits (not deleting or rearranging). Very likely, this demonstrates that I'm not completely understanding how git-rebase does its squashes.\nHere's a modified version of the scripts I'm using:\n\nrepo_squash.sh (this is the script that is actually run):\n\nrm -rf repo_squash\ngit clone repo repo_squash\ncd repo_squash/\nGIT_EDITOR=../repo_squash_helper.sh git rebase --strategy theirs -i bd6a09a484b8230d0810e6689cf08a24f26f287a\n\n\nrepo_squash_helper.sh (this script is used only by repo_squash.sh):\n\nif grep -q \"pick \" $1\nthen\n# cp $1 ../repo_squash_history.txt\n# emacs -nw $1\n sed -f ../repo_squash_list.txt < $1 > $1.tmp\n mv $1.tmp $1\nelse\n if grep -q \"initial import\" $1\n then\n cp ../repo_squash_new_message1.txt $1\n elif grep -q \"fixing bad import\" $1\n then\n cp ../repo_squash_new_message2.txt $1\n else\n emacs -nw $1\n fi\nfi\n\n\nrepo_squash_list.txt: (this file is used only by repo_squash_helper.sh)\n\n# Initial import\ns/pick \\(251a190\\)/squash \\1/g\n# Leaving \"Needed subdir\" for now\n# Fixing bad import\ns/pick \\(46c41d1\\)/squash \\1/g\ns/pick \\(5d7agf2\\)/squash \\1/g\ns/pick \\(3da63ed\\)/squash \\1/g\n\n\nI'll leave the \"new message\" contents to your imagination. Initially, I did this without the \"--strategy theirs\" option (i.e., using the default strategy, which if I understand the documentation correctly is recursive, but I'm not sure which recursive strategy is used), and it also didn't work. Also, I should point out that, using the commented out code in repo_squash_helper.sh, I saved off the original file that the sed script works on and ran the sed script against it to make sure it was doing what I wanted it to do (it was). Again, I don't even know why there would be a conflict, so it wouldn't seem to matter so much which strategy is used. Any advice or insight would be helpful, but mostly I just want to get this squashing working.\nUpdated with extra information from discussion with Jefromi:\nBefore working on our massive \"real\" repository, I used similar scripts on a test repository. It was a very simple repository and the test worked cleanly.\nThe message I get when it fails is:\nFinished one cherry-pick.\n# Not currently on any branch.\nnothing to commit (working directory clean)\nCould not apply 66c45e2... Needed subdir\n\nThis is the first pick after the first squash commit. Running git status yields a clean working directory. If I then do a git rebase --continue, I get a very similar message after a few more commits. If I then do it again, I get another very similar message after a couple dozen commits. If I do it yet again, this time it goes through about a hundred commits, and yields this message:\nAutomatic cherry-pick failed. After resolving the conflicts,\nmark the corrected paths with 'git add ', and\nrun 'git rebase --continue'\nCould not apply f1de3bc... Incremental\n\nIf I then run git status, I get:\n# Not currently on any branch.\n# Changes to be committed:\n# (use \"git reset HEAD ...\" to unstage)\n#\n# modified: repo/file_A.cpp\n# modified: repo/file_B.cpp\n#\n# Unmerged paths:\n# (use \"git reset HEAD ...\" to unstage)\n# (use \"git add/rm ...\" as appropriate to mark resolution)\n#\n# both modified: repo/file_X.cpp\n#\n# Changed but not updated:\n# (use \"git add/rm ...\" to update what will be committed)\n# (use \"git checkout -- ...\" to discard changes in working directory)\n#\n# deleted: repo/file_Z.imp\n\nThe \"both modified\" bit sounds weird to me, since this was just the result of a pick. It's also worth noting that if I look at the \"conflict\", it boils down to a single line with one version beginning it with a [tab] character, and the other one with four spaces. This sounded like it might be an issue with how I've set up my config file, but there's nothing of the sort in it. (I did note that core.ignorecase is set to true, but evidently git-clone did that automatically. I'm not completely surprised by that considering that the original source was on a Windows machine.)\nIf I manually fix file_X.cpp, it then fails shortly afterward with another conflict, this time between a file (CMakeLists.txt) that one version thinks should exist and one version thinks shouldn't. If I fix this conflict by saying I do want this file (which I do), a few commits later I get another conflict (in this same file) where now there's some rather non-trivial changes. It's still only about 25% of the way through the conflicts.\nI should also point out, since this might be very important, that this project started out in an svn repository. That initial history very likely was imported from that svn repository.\nUpdate #2:\nOn a lark (influenced by Jefromi's comments), I decided to do the change my repo_squash.sh to be:\nrm -rf repo_squash\ngit clone repo repo_squash\ncd repo_squash/\ngit rebase --strategy theirs -i bd6a09a484b8230d0810e6689cf08a24f26f287a\n\nAnd then, I just accepted the original entries, as is. I.e., the \"rebase\" shouldn't have changed a thing. It ended up with the same results describe previously.\nUpdate #3:\nAlternatively, if I omit the strategy and replace the last command with:\ngit rebase -i bd6a09a484b8230d0810e6689cf08a24f26f287a\n\nI no longer get the \"nothing to commit\" rebase problems, but I'm still left with the other conflicts.\nUpdate with toy repository that recreates problem:\ntest_squash.sh (this is the file you actually run):\n#========================================================\n# Initialize directories\n#========================================================\nrm -rf test_squash/ test_squash_clone/\nmkdir -p test_squash\nmkdir -p test_squash_clone\n#========================================================\n\n#========================================================\n# Create repository with history\n#========================================================\ncd test_squash/\ngit init\necho \"README\">README\ngit add README\ngit commit -m\"Initial commit: can't easily access for rebasing\"\necho \"Line 1\">test_file.txt\ngit add test_file.txt\ngit commit -m\"Created single line file\"\necho \"Line 2\">>test_file.txt \ngit add test_file.txt \ngit commit -m\"Meant for it to be two lines\"\ngit checkout -b dev\necho Meaningful code>new_file.txt\ngit add new_file.txt \ngit commit -m\"Meaningful commit\"\ngit checkout master\necho Conflicting meaningful code>new_file.txt\ngit add new_file.txt \ngit commit -m\"Conflicting meaningful commit\"\n# This will conflict\ngit merge dev\n# Fixes conflict\necho Merged meaningful code>new_file.txt\ngit add new_file.txt\ngit commit -m\"Merged dev with master\"\ncd ..\n\n#========================================================\n# Save off a clone of the repository prior to squashing\n#========================================================\ngit clone test_squash test_squash_clone\n#========================================================\n\n#========================================================\n# Do the squash\n#========================================================\ncd test_squash\nGIT_EDITOR=../test_squash_helper.sh git rebase -i HEAD@{7}\n#========================================================\n\n#========================================================\n# Show the results\n#========================================================\ngit log\ngit gc\ngit reflog\n#========================================================\n\ntest_squash_helper.sh (used by test_sqash.sh):\n# If the file has the phrase \"pick \" in it, assume it's the log file\nif grep -q \"pick \" $1\nthen\n sed -e \"s/pick \\(.*\\) \\(Meant for it to be two lines\\)/squash \\1 \\2/g\" < $1 > $1.tmp\n mv $1.tmp $1\n# Else, assume it's the commit message file\nelse\n# Use our pre-canned message\n echo \"Created two line file\" > $1\nfi\n\nP.S.: Yes, I know some of you cringe when you see me using emacs as a fall-back editor.\nP.P.S.: We do know we'll have to blow away all of our clones of the existing repository after the rebase. (Along the lines of \"thou shalt not rebase a repository after it's been published\".)\nP.P.P.S: Can anyone tell me how to add a bounty to this? I'm not seeing the option anywhere on this screen whether I'm in edit mode or view mode."}, {"role": "assistant", "content": "If you don't mind creating a new branch, this is how I dealt with the problem:\nBeing on main:\n# create a new branch\ngit checkout -b new_clean_branch\n\n# apply all changes\ngit merge original_messy_branch\n\n# forget the commits but have the changes staged for commit\ngit reset --soft main \n\ngit commit -m \"Squashed changes from original_messy_branch\""}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Authentication to GitHub using personal access token on macOS?\n\nAfter creating a personal access token, how do you unset any existing authentication and use the token in the macOS terminal?\nI tried running osxkeychain command git config --global credential.helper osxkeychain but it doesn't change anything. I also tried unsetting the user password with git config --global --unset user.password, and I tried opening Keychain Access application and delete GitHub entries, but neither worked."}, {"role": "assistant", "content": "Step 1: Unset existing credentials\nCopy this into your terminal:\ngit config --global --unset credential.helper\ngit credential-osxkeychain erase\nhost=github.com\nprotocol=https\n\nand hit 'Enter' twice to delete existing GitHub credentials (username and password) from your computer.\nRecommended: if you were previously authenticating using a GitHub Personal Access Token (PAT) and want to update to a new one, invalidate any old one(s) by visiting https://github.com/settings/tokens and clicking 'Delete' or 'Revoke All' to ensure an old token can no longer be used.\nStep 2\nGenerate a new access token: go to GitHub, click on your profile pic on the top right -> Settings -> Developer Settings -> Personal Access Tokens -> Tokens (classic) and create a new one (tip: if you're not sure what permissions to grant, just select full 'repos' permissions and nothing more - you can always create another token with more permissions later if required).\nStep 3\nGo into private repository and try to push/pull. GitHub will prompt you for your username (email or GitHub username) and password (the token you just generated)."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Echo Github Action Environment variables\n\nI'm trying to dive in the GitHub Action, and to understand the process I would like to echo some environment variables, such as ${{ github.repository }}, ${{ github.repository_owner }} or event secrets like ${{ secrets.GITHUB_TOKEN }}, etc. But then in the output I'm getting ***.\nIs there any way to force the output to show the actual values instead of the asterisks?\n\ndev.yml\n\nname: Dev\n\non:\n workflow_dispatch:\n push:\n branches:\n - dev\n\nenv:\n BUILD_TYPE: core\n DEFAULT_PYTHON: 3.8\n\njobs:\n any_name:\n runs-on: ubuntu-latest\n steps:\n - name: Any Name Bash Test Step\n shell: bash\n run: |\n echo \"GH_REPO: $GH_REPO\"\n echo \"GH_REPO_O: $GH_REPO_O\"\n echo \"GH_T: $GH_T\"\n env:\n GH_REPO: ${{ github.repository }}\n GH_REPO_O: ${{ github.repository_owner }}\n GH_T: ${{ secrets.GITHUB_TOKEN }}\n\n\noutput\n\nRun echo \"GH_REPO: $GH_REPO\"\n echo \"GH_REPO_O: $GH_REPO_O\"\n echo \"GH_T: $GH_T\"\n shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}\n env:\n BUILD_TYPE: core\n DEFAULT_PYTHON: 3.8\n GH_REPO: ***/core\n GH_REPO_O: ***\n GH_T: ***\nGH_REPO: ***/core\nGH_REPO_O: ***\nGH_T: ***"}, {"role": "assistant", "content": "name: This is an example\n\non: [pull_request]\n\njobs:\n one:\n runs-on: ubuntu-latest\n steps:\n - name: Dump GitHub context\n env:\n GITHUB_CONTEXT: ${{ toJson(github) }}\n run: echo \"$GITHUB_CONTEXT\"\n - name: Dump job context\n env:\n JOB_CONTEXT: ${{ toJson(job) }}\n run: echo \"$JOB_CONTEXT\"\n - name: Dump steps context\n env:\n STEPS_CONTEXT: ${{ toJson(steps) }}\n run: echo \"$STEPS_CONTEXT\"\n - name: Dump runner context\n env:\n RUNNER_CONTEXT: ${{ toJson(runner) }}\n run: echo \"$RUNNER_CONTEXT\"\n - name: Dump strategy context\n env:\n STRATEGY_CONTEXT: ${{ toJson(strategy) }}\n run: echo \"$STRATEGY_CONTEXT\"\n - name: Dump matrix context\n env:\n MATRIX_CONTEXT: ${{ toJson(matrix) }}\n run: echo \"$MATRIX_CONTEXT\"\n\n - name: Show default environment variables\n run: |\n echo \"The job_id is: $GITHUB_JOB\" # reference the default environment variables\n echo \"The id of this action is: $GITHUB_ACTION\" # reference the default environment variables\n echo \"The run id is: $GITHUB_RUN_ID\"\n echo \"The GitHub Actor's username is: $GITHUB_ACTOR\"\n echo \"GitHub SHA: $GITHUB_SHA\""}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-svn - Bidirectional operation between a Subversion repository and Git svn-remote..rewriteUUID"}, {"role": "assistant", "content": "Similar to the useSvmProps option; this is for users who need\nto remap the UUID manually. This may be useful in situations\nwhere the original UUID is not available via either useSvmProps\nor useSvnsyncProps."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-update-index - Register file contents in the working tree to the index --info-only"}, {"role": "assistant", "content": "Do not create objects in the object database for all\n arguments that follow this flag; just insert\ntheir object IDs into the index."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-checkout-index - Copy files from the index to the working tree -n --no-create"}, {"role": "assistant", "content": "Don’t checkout new files, only refresh files already checked\nout."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How can I view a git log of just one user's commits?\nWhen using git log, how can I filter by user so that I see only commits from that user?"}, {"role": "assistant", "content": "This works for both git log and gitk - the 2 most common ways of viewing history.\nYou don't need to use the whole name:\ngit log --author=\"Jon\"\n\nwill match a commit made by \"Jonathan Smith\"\ngit log --author=Jon\n\nand\ngit log --author=Smith\n\nwould also work. The quotes are optional if you don't need any spaces.\nAdd --all if you intend to search all branches and not just the current commit's ancestors in your repo.\nYou can also easily match on multiple authors as regex is the underlying mechanism for this filter. So to list commits by Jonathan or Adam, you can do this:\ngit log --author=\"\\(Adam\\)\\|\\(Jon\\)\"\n\nIn order to exclude commits by a particular author or set of authors using regular expressions as noted in this question, you can use a negative lookahead in combination with the --perl-regexp switch:\ngit log --author='^(?!Adam|Jon).*$' --perl-regexp\n\nAlternatively, you can exclude commits authored by Adam by using bash and piping:\ngit log --format='%H %an' | \n grep -v Adam | \n cut -d ' ' -f1 | \n xargs -n1 git log -1\n\nIf you want to exclude commits commited (but not necessarily authored) by Adam, replace %an with %cn. More details about this are in my blog post here: http://dymitruk.com/blog/2012/07/18/filtering-by-author-name/"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How can I use `git diff --color-words` outside a Git repository?\nHow can I get output like in git diff --color-words, but outside Git?\nClosest thing is wdiff -t, but it underlines/inverts things instead of using green/red colours and does not allow specifying my whitespace regex."}, {"role": "assistant", "content": "git diff --color-words --no-index old.txt new.txt"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git - the stupid content tracker GIT_DIR"}, {"role": "assistant", "content": "If the GIT_DIR environment variable is set then it\nspecifies a path to use instead of the default .git for the base of the repository.\nThe --git-dir command-line option also sets this value."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git - the stupid content tracker GIT_ALTERNATE_OBJECT_DIRECTORIES"}, {"role": "assistant", "content": "Due to the immutable nature of Git objects, old objects can be\narchived into shared, read-only directories. This variable\nspecifies a \":\" separated (on Windows \";\" separated) list\nof Git object directories which can be used to search for Git\nobjects. New objects will not be written to these directories. Entries that begin with \" (double-quote) will be interpreted\nas C-style quoted paths, removing leading and trailing\ndouble-quotes and respecting backslash escapes. E.g., the value \"path-with-\\\"-and-:-in-it\":vanilla-path has two paths: path-with-\"-and-:-in-it and vanilla-path ."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How to duplicate a git repository? (without forking)\n\nI have two repositories, and I need to copy whole of one onto the other empty one which has different access levels from the first one. The copy and the mother repository should not be linked together.\nI am new to git and it would be awesome if someone could help me with this."}, {"role": "assistant", "content": "See https://help.github.com/articles/duplicating-a-repository\nShort version:\nIn order to make an exact duplicate, you need to perform both a bare-clone and a mirror-push:\nmkdir foo; cd foo \n# move to a scratch dir\n\ngit clone --bare https://github.com/exampleuser/old-repository.git\n# Make a bare clone of the repository\n\ncd old-repository.git\ngit push --mirror https://github.com/exampleuser/new-repository.git\n# Mirror-push to the new repository\n\ncd ..\nrm -rf old-repository.git \n# Remove our temporary local repository\n\nNOTE: the above will work fine with any remote git repo, the instructions are not specific to github\nThe above creates a new remote copy of the repo. Then clone it down to your working machine."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "What does the \"at\" @ sign/symbol/character mean in Git?\nThe at-sign @ is often used in git to specify revisions in different\nways. For example,\n\n@{} specifies the reference at its state on .\nExample: git diff master@{yesterday} master.\n@{} specific the reference at its nth prior state.\nExample: git diff master@{1} master.\n@{-} specifies the nth previously checked-out branch before\nthe current one.\nExample: git checkout @{-5}.\n@{upstream} specifies the upstream branch for the reference.\nExample: git diff master@{upstream} master.\n\nHowever, the @ is being used in other ways in git commands too, like\ngit rebase -i @~4\ngit log @^^..@\n\nWhat does the at-sign @ mean in those examples?"}, {"role": "assistant", "content": "As of Git version 1.8.5, the at-sign @, without a leading branch/reference name and ordinal {n} suffix like HEAD@{1} and master@{1}, is just a synonym/alias/shortcut for the special Git reference HEAD:\n\nInstead of typing four capital letters \"HEAD\", you can say \"@\" now, e.g. \"git log @\".\n\nSo for these commands\ngit rebase -i @~4\ngit log @^^..@\n\nyou can simply substitute the first occurrence of @ with HEAD (or head if using Windows or OS X)\ngit rebase -i HEAD~4\ngit log HEAD^^..HEAD\n\nSo what does HEAD mean? As explained by the official Linux Kernel Git documentation for specifying Git revisions, HEAD is a special shortcut reference for the commit that you currently have checked-out as your working copy (or in Git terms, your \"working tree\"):\n\nHEAD names the commit on which you based the changes in the working tree.\n\nYou can also read these other Stack Overflow questions on what the special reference HEAD means:\n\nHEAD and ORIG_HEAD in Git.\nWhat is git HEAD, exactly?.\n\nVonC also found interesting information about why @ was chosen as a shortcut for head in this Stack Overflow answer (the last section at the bottom).\nNote that like it often happens with Git, while @ is a convenient shortcut, it isn't always a valid replacement for HEAD. Example:\n$ git bundle create temp.bundle @\nEnumerating objects: 25, done.\nCounting objects: 100% (25/25), done.\nCompressing objects: 100% (20/20), done.\nTotal 25 (delta 3), reused 0 (delta 0), pack-reused 0\n\n$ git bundle list-heads temp.bundle\nc006e049da432677d1a27f0eba661671e0524710 refs/heads/master\n\n$ git bundle create temp.bundle HEAD\nEnumerating objects: 25, done.\nCounting objects: 100% (25/25), done.\nCompressing objects: 100% (20/20), done.\nTotal 25 (delta 3), reused 0 (delta 0), pack-reused 0\n\n$ git bundle list-heads temp.bundle\nc006e049da432677d1a27f0eba661671e0524710 HEAD\n\nIn this case, using @ is more like a replacement for master (the branch that HEAD happened to be pointing to) rather than for HEAD. If you try to fetch from the resulting bundle later, you'll have to specify the ref you want to fetch (master) if you used @, and you won't have to to it if you specified HEAD explicitly."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Embed git commit hash in a .NET dll\nI'm building a C# application, using Git as my version control.\nIs there a way to automatically embed the last commit hash in the executable when I build my application?\nFor example, printing the commit hash to console would look something like:\nclass PrintCommitHash\n{\n private String lastCommitHash = ?? // What do I put here?\n static void Main(string[] args)\n {\n // Display the version number:\n System.Console.WriteLine(lastCommitHash );\n }\n}\n\nNote that this has to be done at build time, not runtime, as my deployed executable will not have the git repo accessible.\nA related question for C++ can be found here.\n\nEDIT\n\nPer @mattanja's request, I'm posting the git hook script I use in my projects. The setup:\n\nThe hooks are linux shell scripts, which are placed under: path_to_project\\.git\\hooks\nIf you are using msysgit, the hooks folder already contains some sample scripts. In order to make git call them, remove the '.sample' extension from the script name.\nThe names of the hook scripts match the event that invokes them. In my case, I modified post-commit and post-merge.\nMy AssemblyInfo.cs file is directly under the project path (same level as the .git folder). It contains 23 lines, and I use git to generate the 24th.\n\nAs my linux-shelling a bit rusty, the script simply reads the first 23-lines of AssemblyInfo.cs to a temporary file, echos the git hash to the last line, and renames the file back to AssemblyInfo.cs. I'm sure there are better ways of doing this:\n#!/bin/sh\ncmt=$(git rev-list --max-count=1 HEAD)\nhead -23 AssemblyInfo.cs > AssemblyInfo.cs.tmp\necho [assembly: AssemblyFileVersion\\(\\\"$cmt\\\"\\)] >> AssemblyInfo.cs.tmp\nmv AssemblyInfo.cs.tmp AssemblyInfo.cs"}, {"role": "assistant", "content": "UPDATE:\nThings have evolved since I originally answered this question. The Microsoft.NET.Sdk (meaning you must be using an sdk-style project) now includes support for adding the commit hash to both the assembly informational version as well as to the nuget package metadata, if some conditions are met:\n\nThe property must be defined. This can be done by adding a target like this:\n\n\n \n \n \n \n\n\nThis target executes a command that will set SourceRevisionId to be the abbreviated (8 character) hash. The BeforeTargets causes this to be run before the assembly informational version is created.\n\nTo include the hash in the nuget package metadata, the must also be defined.\n\n property must be true, this causes the nuget pack task to pick up the SourceRevisionId as well.\n\n\nI would steer people away from using the MSBuildGitHash package, since this new technique is cleaner and most consistent.\nORIGINAL:\nI've created a simple nuget package that you can include in your project which will take care of this for you: https://www.nuget.org/packages/MSBuildGitHash/\nThis nuget package implements a \"pure\" MSBuild solution. If you'd rather not depend on a nuget package you can simply copy these Targets into your csproj file and it should include the git hash as a custom assembly attribute:\n\n \n \n $(IntermediateOutputPath)gitver\n \n\n \n \n\n \n \n \n \n \n \n @(GitVersion)\n \n\n\n\n \n \n $(IntermediateOutputPath)CustomAssemblyInfo.cs\n \n \n \n \n \n \n \n \n <_Parameter1>GitHash\n <_Parameter2>$(BuildHash)\n \n \n \n \n\n\nThere are two targets here. The first one, \"GetGitHash\", loads the git hash into an MSBuild property named BuildHash, it only does this if BuildHash is not already defined. This allows you to pass it to MSBuild on the command line, if you prefer. You could pass it to MSBuild like so:\nMSBuild.exe myproj.csproj /p:BuildHash=MYHASHVAL\nThe second target, \"WriteGitHash\", will write the hash value to a file in the temporary \"obj\" folder named \"CustomAssemblyInfo.cs\". This file will contain a line that looks like:\n[assembly: AssemblyMetadata(\"GitHash\", \"MYHASHVAL\")]\nThis CustomAssemblyInfo.cs file will be compiled into your assembly, so you can use reflection to look for the AssemblyMetadata at runtime. The following code shows how this can be done when the AssemblyInfo class is included in the same assembly.\nusing System.Linq;\nusing System.Reflection;\n\npublic static class AssemblyInfo\n{\n /// Gets the git hash value from the assembly\n /// or null if it cannot be found. \n public static string GetGitHash()\n {\n var asm = typeof(AssemblyInfo).Assembly;\n var attrs = asm.GetCustomAttributes();\n return attrs.FirstOrDefault(a => a.Key == \"GitHash\")?.Value;\n }\n}\n\nSome benefits to this design is that it doesn't touch any files in your project folder, all the mutated files are under the \"obj\" folder. Your project will also build identically from within Visual Studio or from the command line. It can also be easily customized for your project, and will be source controlled along with your csproj file."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-notes - Add or inspect object notes -F --file="}, {"role": "assistant", "content": "Take the note message from the given file. Use - to\nread the note message from the standard input.\nLines starting with # and empty lines other than a\nsingle line between paragraphs will be stripped out.\nIf you wish to keep them verbatim, use --no-stripspace ."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Which version of the git file will be finally used: LOCAL, BASE or REMOTE?\nWhen there's a collison during git merge, I open a mergetool called Meld. It opens three files LOCAL, BASE and REMOTE. As I've read LOCAL is my local branch, BASE is common ancestor and REMOTE is the branch to be merged.\nNow to my question: which version of the file will be finally used? Is it REMOTE? If so, can I edit it as I want, regardless what's in the BASE branch for example?"}, {"role": "assistant", "content": "It's the one in the middle : BASE.\nIn fact, BASE is not the common ancestor, but the half-finished merge where conflicts are marked with >>>> and <<<<.\nYou can see the file names on the top of meld editing window.\nSee the screenshot here\n\nYou can edit the BASE file as you want with or without using meld commands.\nYou can also get rid of meld and just edit the file with your favorite text editor. \n\nThe code between <<<< HEAD and ===== markers is the one of your local file before the merge. \nThe code between ==== and >>>> is the one of the remote file."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How to diff in a comment on github?\n\nI've seen people show diffs of their code from other forks to illustrate a point in github like on this pull request thread: https://github.com/osTicket/osTicket/pull/3035\nI think it would be really helpful to show the diff of the commit from the current branch. How do you do it?"}, {"role": "assistant", "content": "You can pull the branch to your local copy, and make your modification. After that, copy the output of git diff and paste to GitHub as follows.\n```diff\nyour diff file contents\n```"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "'git init -b ' command in terminal is throwing an 'unknown switch' error\nI am trying to add an existing project to GitHub using the command line. I am in the relevant working directory in the terminal and am trying to use the git init -b main command.\nInitially, I was getting an error relating to xcode:\nxcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun\n\nI tried xcode-select --install but the software was unavailable from the update server, so I downloaded 'Command Line Tools for Xcode 12' from https://developer.apple.com/download/more/.\nNow on entering git init -b main I am getting the following:\nerror: unknown switch `b'\nusage: git init [-q | --quiet] [--bare] [--template=] [--shared[=]] []\n\n--template \n directory from which templates will be used\n--bare create a bare repository\n--shared[=]\n specify that the git repository is to be shared amongst several users\n-q, --quiet be quiet\n--separate-git-dir \n separate git dir from working tree\n\nI am running git version: 2.24.3 (Apple Git-128)\nAny help much appreciated!"}, {"role": "assistant", "content": "The -b flag is only available in version 2.28 or later, you need to upgrade your Git.\nOn debian-based Linux systems such as Ubuntu, do the following:\nsudo add-apt-repository -y ppa:git-core/ppa\nsudo apt update\nsudo apt install git -y"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Easy way to add 'copy to clipboard' to GitHub markdown?\n\nSpecifically, I have blocks of code for install that I want the user to be able to quickly copy and paste into a terminal. I'd like a button to 'copy to clipboard' for the code block. Since there's a 'copy to clipboard' button for the git clone URLs, I was wondering if I could piggy back off that or if not whether there was some relatively simple I could add to the MD to make this happen. Or is this simply not possible with the processing and 'safication' the MD text goes through?"}, {"role": "assistant", "content": "The copy button is now a reality (May 2021), as tweeted by Nat Friedman\n\nWe just added a \"Copy\" button to all code blocks on GitHub.\n\n\nTo create a copy button, make a Fenced code block as shown here, in a markdown document\n```\nfunction test() {\n console.log(\"This code will have a copy button to the right of it\");\n}\n```"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Close Gitlab issue via commit\n\nI spend my day doing this:\n\nRead an issue on a Gitlab-powered issue tracker,\nFix the issue,\nCommit and push to the same Gitlab-powered Git server,\nMark the issue as closed.\n\nTo remove the 4th step, how can I close the issue automatically when committing?"}, {"role": "assistant", "content": "Commit and push using this syntax:\ngit commit -m \"Sort more efficiently\" -m \"Closes #843\"\ngit push\n\nThis will commit and close the issue.\nNote that unlike Github a single -m will not work.\nThe following will appear on the issue page:\n\nReferences:\n\nhttps://docs.gitlab.com/ee/user/project/issues/managing_issues.html#closing-issues-automatically\nHow to commit a change with both \"message\" and \"description\" from the command line?"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-config - Get and set repository or global options mailmap.file"}, {"role": "assistant", "content": "The location of an augmenting mailmap file. The default\nmailmap, located in the root of the repository, is loaded\nfirst, then the mailmap file pointed to by this variable.\nThe location of the mailmap file may be in a repository\nsubdirectory, or somewhere outside of the repository itself.\nSee git-shortlog and git-blame ."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Locking binary files using git version control system\nFor one and a half years, I have been keeping my eyes on the git community in hopes of making the switch away from SVN. One particular issue holding me back is the inability to lock binary files. Throughout the past year I have yet to see developments on this issue. I understand that locking files goes against the fundamental principles of distributed source control, but I don't see how a web development company can take advantage of git to track source code and image file changes when there is the potential for binary file conflicts.\nTo achieve the effects of locking, a \"central\" repository must be identified. Regardless of the distributed nature of git, most companies will have a \"central\" repository for a software project. We should be able to mark a file as requiring a lock from the governing git repository at a specified address. Perhaps this is made difficult because git tracks file contents not files?\nDo any of you have experience in dealing with git and binary files that should be locked before modification?\nNOTE: It looks like Source Gear's new open source distributed version control project, Veracity, has locking as one of its goals."}, {"role": "assistant", "content": "Subversion has locks, and they aren't just advisory. They can be enforced using the svn:needs-lock attribute (but can also be deliberately broken if necessary). It's the right solution for managing non-mergeable files. The company I work for stores just about everything in Subversion, and uses svn:needs-lock for all non-mergeable files.\nI disagree with \"locks are just a communication method\". They are a much more effective method than push-notifications such as phone or e-mail. Subversion locks are self-documenting (who has the lock). On the other hand, if you have to communicate by other traditional push-notification channels, such as e-mail, who do you send the notification to? You don't know in advance who might want to edit the file, especially on open-source projects, unless you have a complete list of your entire development team. So those traditional communication methods aren't nearly as effective.\nA central lock server, while against the principles of DVCS, is the only feasible method for non-mergeable files. As long as DVCS don't have a central lock feature, I think it will keep the company I work for using Subversion.\nThe better solution would be to make a merge tool for all your binary file formats, but that's a longer-term and ongoing goal that will never be \"finished\".\nHere's an interesting read on the topic."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git - the stupid content tracker git-for-each-ref"}, {"role": "assistant", "content": "Output information on each ref"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Detach (move) subdirectory into separate Git repository\nI have a Git repository which contains a number of subdirectories. Now I have found that one of the subdirectories is unrelated to the other and should be detached to a separate repository.\nHow can I do this while keeping the history of the files within the subdirectory?\nI guess I could make a clone and remove the unwanted parts of each clone, but I suppose this would give me the complete tree when checking out an older revision etc. This might be acceptable, but I would prefer to be able to pretend that the two repositories doesn't have a shared history.\nJust to make it clear, I have the following structure:\nXYZ/\n .git/\n XY1/\n ABC/\n XY2/\n\nBut I would like this instead:\nXYZ/\n .git/\n XY1/\n XY2/\nABC/\n .git/\n ABC/"}, {"role": "assistant", "content": "The Easy Way™\nIt turns out that this is such a common and useful practice that the overlords of Git made it really easy (added in version 1.7.11 - May 2012). Also, there's a real-world example in the walkthrough below.\n\nPrepare the old repo\n cd \n git subtree split -P -b \n\nNote: must NOT contain leading or trailing characters. For instance, the folder named subproject MUST be passed as subproject, NOT ./subproject/\nNote: is a branch you will be creating in the existing/old repo, NOT the new one [that comes later].\nNote for Windows users: When your folder depth is > 1, must have *nix style folder separator (/). For instance, the folder named path1\\path2\\subproject MUST be passed as path1/path2/subproject\n\nCreate the new repo\n mkdir ~/ && cd ~/\n git init\n git pull \n\n\nLink the new repo to GitHub or wherever\n git remote add origin <[email protected]:user/new-repo.git>\n git push -u origin master\n\n\nCleanup inside , if desired\n git rm -rf \n\nNote: This leaves all the historical references in the repository. See the Appendix below if you're actually concerned about having committed a password or you need to decreasing the file size of your .git folder.\n\n\n\nWalkthrough\nThese are the same steps as above, but following my exact steps for my repository instead of using .\nHere's a project I have for implementing JavaScript browser modules in node:\ntree ~/node-browser-compat\n\nnode-browser-compat\n├── ArrayBuffer\n├── Audio\n├── Blob\n├── FormData\n├── atob\n├── btoa\n├── location\n└── navigator\n\nI want to split out a single folder, btoa, into a separate Git repository\ncd ~/node-browser-compat/\ngit subtree split -P btoa -b btoa-only\n\nI now have a new branch, btoa-only, that only has commits for btoa and I want to create a new repository.\nmkdir ~/btoa/ && cd ~/btoa/\ngit init\ngit pull ~/node-browser-compat btoa-only\n\nNext, I create a new repo on GitHub or Bitbucket, or whatever and add it as the origin\ngit remote add origin [email protected]:node-browser-compat/btoa.git\ngit push -u origin master\n\nHappy day!\nNote: If you created a repo with a README.md, .gitignore and LICENSE, you will need to pull first:\ngit pull origin master\ngit push origin master\n\nLastly, I'll want to remove the folder from the bigger repo\ngit rm -rf btoa\n\n\nClearing your history\nBy default, removing files from Git doesn't actually remove them; it just commits that they aren't there any more. If you want to actually remove the historical references (i.e. you committed a password), you need to do this:\ngit filter-branch --prune-empty --tree-filter 'rm -rf ' HEAD\n\nAfter that, you can check that your file or folder no longer shows up in the Git history at all:\ngit log -- # should show nothing\n\nHowever, you can't \"push\" deletes to GitHub and the like. If you try, you'll get an error and you'll have to git pull before you can git push - and then you're back to having everything in your history.\nSo if you want to delete history from the \"origin\" - meaning to delete it from GitHub, Bitbucket, etc - you'll need to delete the repo and re-push a pruned copy of the repo. But wait - there's more! - if you're really concerned about getting rid of a password or something like that you'll need to prune the backup (see below).\nMaking .git smaller\nThe aforementioned delete history command still leaves behind a bunch of backup files - because Git is all too kind in helping you to not ruin your repo by accident. It will eventually delete orphaned files over the days and months, but it leaves them there for a while in case you realize that you accidentally deleted something you didn't want to.\nSo if you really want to empty the trash to reduce the clone size of a repo immediately you have to do all of this really weird stuff:\nrm -rf .git/refs/original/ && \\\ngit reflog expire --all && \\\ngit gc --aggressive --prune=now\n\ngit reflog expire --all --expire-unreachable=0\ngit repack -A -d\ngit prune\n\nThat said, I'd recommend not performing these steps unless you know that you need to - just in case you did prune the wrong subdirectory, y'know? The backup files shouldn't get cloned when you push the repo, they'll just be in your local copy.\nCredit\n\nhttp://psionides.eu/2010/02/04/sharing-code-between-projects-with-git-subtree/\nRemove a directory permanently from git\nhttp://blogs.atlassian.com/2013/05/alternatives-to-git-submodule-git-subtree/\nHow to remove unreferenced blobs from my Git repository"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-log - Show commit logs %cE"}, {"role": "assistant", "content": "committer email (respecting .mailmap, see git-shortlog or git-blame )"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "GitHub: What is a \"wip\" branch?\n\nWhen I was browsing GitHub repositories I quite often saw \"wip\" branches (e.g. 3.1.0-wip). What does \"wip\" mean?\nI couldn't find the answer anywhere - neither on Google nor on GitHub:help."}, {"role": "assistant", "content": "Conventionally, \"wip\" stands for \"work in progress\"."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "TortoiseGit modified sign (icon overlay) is not updating\nI have made a small change in some code but TortoiseGit shows it as modified (red exclamation sign) although I have committed, pulled, pushed, but it stays. What should I do here? I have not seen this issue before."}, {"role": "assistant", "content": "I'm assuming you are using tortoise git? I've had the issue before, sometimes pressing F5 fixes it other times it just goes away after tortoise resyncs itself.\nHere is another possible fix link. \n\nThe current workaround is to kill TGitCache.exe with the Windows task manager."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-diff - Show changes between commits, commit and working tree, etc --submodule[=]"}, {"role": "assistant", "content": "Specify how differences in submodules are shown. When specifying --submodule=short the short format is used. This format just\nshows the names of the commits at the beginning and end of the range.\nWhen --submodule or --submodule=log is specified, the log format is used. This format lists the commits in the range like git-submodule summary does. When --submodule=diff is specified, the diff format is used. This format shows an\ninline diff of the changes in the submodule contents between the\ncommit range. Defaults to diff.submodule or the short format\nif the config option is unset."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How do you undo \"Discard all changes\" in VS Code/Git\nI fear I already know the answer but here goes anyway..\nI accidentally clicked \"Discard All Changes\" in VS Code (OSX) and now a month's worth of work is gone. Poof'd. Thing is, I didn't have GIT properly setup so I hadn't done any commits yet. Is there any way I can get my work back? Right now my working directory is as good as empty..\n[edit]\nI should clarify, the console log says it did a \"git clean -f -q\" which would mean the files are gone. But I was wondering if VSCode maybe has a backup or history or cache.. or anything. I'm desperate.."}, {"role": "assistant", "content": "I just know only one solution to resolve this problem.\nYou must remember every file name which you have changed.\nStep 1: Enter Ctrl + Shift + P on VSC\nStep 2: Choose the option \"Local History: Find Entry to Restore\"\nStep 3: Find the file which you want to restore\nStep 4: Choose a time you save that file\nStep 5: Copy file content and restore it"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "List all the projects and all the groups\n\nWhat is the easiest method to list all the projects and groups in GitLab using my private token?"}, {"role": "assistant", "content": "If only your private token is available, you can only use the API:\nPROJECTS\nUse the following command to request projects:\ncurl \"https:///api/v4/projects?private_token=\"\n\nThis will return you the first 20 entries. To get more you can add the paramater per_page\ncurl \"https:///api/v4/projects?private_token=&per_page=100\"\n\nwith this parameter you can request between 20and 100 entries (see REST API Pagination documentation).\nIf you now want all projects, you have to loop through the pages. To get to another page add the parameter page.\ncurl \"https:///api/v4/projects?private_token=&per_page=100&page=\"\n\nNow you may want to know how many pages there are. For that, add the curl parameter --head. This will not return the payload, but the header.\nThe result should look like this:\nHTTP/1.1 200 OK\nServer: nginx\nDate: Thu, 13 Jul 2017 17:43:24 GMT\nContent-Type: application/json\nContent-Length: 29428\nCache-Control: no-cache\nLink: \nVary: Origin\nX-Frame-Options: SAMEORIGIN\nX-Next-Page: 2\nX-Page: 1\nX-Per-Page: 20\nX-Prev-Page:\nX-Request-Id: 80ecc167-4f3f-4c99-b09d-261e240e7fe9\nX-Runtime: 4.117558\nX-Total: 312257\nX-Total-Pages: 15613\nStrict-Transport-Security: max-age=31536000\n\nThe two interesting parts here are X-Totaland X-Total-Pages. The first is the count of available entries and the second the count of total pages.\nI suggest to use python or some other kind of script to handle the requests and concat the results at the end.\nIf you want to refine the search, consult this wiki page:\nhttps://docs.gitlab.com/ce/api/projects.html#projects-api\nGROUPS\nFor groups simply replace projects with groups in the curls.\nhttps://docs.gitlab.com/ce/api/groups.html#list-groups\n\nUPDATE:\nHere is the official list of Gitlab API clients/wrappers: https://docs.gitlab.com/ee/api/rest/#third-party-clients\nI highly recommend using one of these."}]} {"messages": [{"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 -X --exclude-from="}, {"role": "assistant", "content": "Read exclude patterns from ; 1 per line."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How do I search for branch names in Git?\nI'd like to find a specific branch, and I know that its name would contain a specific substring (the id of the issue from our bug tracker), but I don't know the whole name of the branch (this is what I want to find out). \nHow can I search for this branch?"}, {"role": "assistant", "content": "git branch --all | grep "}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How do I add files without dots in them (all extension-less files) to the gitignore file?\nLike the title says, is it possible to add \"files without dots in them\" to the gitignore file?\nI imagine this would take care of all those bothersome extensionless files."}, {"role": "assistant", "content": "You can try a combination similar to:\n*\n!/**/\n!*.*\n\nThat gitignore exclusion rule (a negated pattern) should ignore all files, except the ones with an extension.\nAs mentioned below by Mad Physicist, the rule is:\nIt is not possible to re-include a file if a parent directory of that file is excluded. (*)\n(*: unless certain conditions are met in git 2.?+, see below)\nThat is why !/**/ is important (white-listing the parent folders recursively) if we want to white-list files.\nI mentioned that same rule in similar cases like:\n\nGitignore all except one folder and all its content - regardless of the nesting level\nGit except a sub directory and it's files of a ignored directory\nGitignore exclude certain files in all subdirectories\n\n\nAs Jakub Narębski comments, you might not want to ignore all extensionless files.\nMy advice:\n\nadd first the extensionless file that matters\nthen edit your .gitignore as shown above: the already versioned files won't be ignored (even if they don't have an extension). All the others will be ignored.\n\nFor any future extensionless files that you would want to version:\ngit add -f -- myFile\n\n\nNote that with git 2.9.x/2.10 (mid 2016?), it might be possible to re-include a file if a parent directory of that file is excluded if there is no wildcard in the path re-included.\nNguyễn Thái Ngọc Duy (pclouds) is trying to add this feature:\n\ncommit 506d8f1 for git v2.7.0, reverted in commit 76b620d git v2.8.0-rc0\ncommit 5e57f9c git v2.8.0-rc0,... reverted(!) in commit 5cee3493 git 2.8.0-rc4.\n\nHowever, since one of the rules to re-inclusion was:\n\nThe directory part in the re-include rules must be literal (i.e. no wildcards)\n\nThis wouldn't have worked here anyway."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git - the stupid content tracker git-branch"}, {"role": "assistant", "content": "List, create, or delete branches"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git rebase basics\nI have started using git rebase recently and am not 100% certain I'm doing it right. For the sake of the question, there are two branches in origin, master and next, which was branched from master.\nSince last sync between the two, master had 2 commits and next 6:\n$ git log --oneline origin/next..origin/master\n59b5552 master commit #2\n485a811 master commit #1\n\n$ git log --oneline origin/master..origin/next\n4ebf401 next commit #6\ne9b6586 next commit #5\n197ada0 next commit #4\n4a2c3c6 next commit #3\n040a055 next commit #2\n84537bf next commit #1\n\nWhen I checkout next and execute git rebase -i origin/master, I get the following:\n$ git status\n# On branch next\n# Your branch and 'origin/next' have diverged,\n# and have 8 and 6 different commits each, respectively.\n\nAnd finally after doing git pull --rebase, the two commits from master are in next:\n$ git log --oneline origin/next..next \n8741d09 master commit #2\n485a811 master commit #1\n\nQuestions:\n\nIs this correct approach?\nWhy are there 8 and 6 different commits until pull --rebase is run?\nIs it possible to simplify the flow?\n\nMuch obliged :)"}, {"role": "assistant", "content": "Let's start from the beginning. Here's a diagram of your original state:\n\nA-B-C (master, origin/master)\n \\\n D-E-F-G-H-I (next, origin/next)\n\nWhen you checked out next and rebased next onto origin/master, it created 6 new commits after the two that are already on origin/master. These new commits have \"master commit #2\" (C in my diagram) as their ancestor, not their original ancestor where origin/master and origin/next diverged (A in my diagram), so their hashes will be different. I believe this is why you'll see that next has 8 different commits from origin/next: the 2 from origin/master and the 6 \"rehashed\" commits that were on origin/next.\nAfter git checkout next ; git rebase -i origin/master, you should have this:\n\nA-B-C (master, origin/master)\n \\ \\\n \\ D'-E'-F'-G'-H'-I' (next)\n \\\n D-E-F-G-H-I (origin/next)\n\nYou can see that next does have 8 commits that aren't on origin/next, and origin/next does have 6 commits that aren't on next. Granted this is just according to the SHA-1 hashes of the commits. The actual content should match very closely if you git diff origin/next next -- the diff should just show the changes from B and C (as labeled in the diagram).\nWhen you do git pull --rebase while still on next, it fetches changes from the source (the remote origin/next) and rebases the current branch (next) onto that remote. This causes the changes that were in the next but not in origin/next to appear after origin/next on the new next branch. It should look like this:\n\nA-B-C (master, origin/master)\n \\\n D-E-F-G-H-I (origin/next)\n \\\n B'-C' (next)\n\nIf this is what you wanted the history graph to look like, then you've succeeded.\nHowever, I suspect you really wanted things to look like the middle diagram, especially if next is a feature branch where you're working on the next piece of the project and master is for stable code and small bug fixes. If so, then you should have done git push instead of git pull --rebase to make the remote reflect your version of history instead of the other way around."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-worktree - Manage multiple working trees --reason "}, {"role": "assistant", "content": "With lock or with add --lock , an explanation why the worktree\nis locked."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-diff - Show changes between commits, commit and working tree, etc --diff-filter=[(A|C|D|M|R|T|U|X|B)…​[*]]"}, {"role": "assistant", "content": "Select only files that are Added ( A ), Copied ( C ),\nDeleted ( D ), Modified ( M ), Renamed ( R ), have their\ntype (i.e. regular file, symlink, submodule, …​) changed ( T ),\nare Unmerged ( U ), are\nUnknown ( X ), or have had their pairing Broken ( B ).\nAny combination of the filter characters (including none) can be used.\nWhen * (All-or-none) is added to the combination, all\npaths are selected if there is any file that matches\nother criteria in the comparison; if there is no file\nthat matches other criteria, nothing is selected. Also, these upper-case letters can be downcased to exclude. E.g. --diff-filter=ad excludes added and deleted paths. Note that not all diffs can feature all types. For instance, copied and\nrenamed entries cannot appear if detection for those types is disabled."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Stash changes to specific files\nI have a large git project that I, stupidly, imported to eclipse and ran an autoformat on. Now, every file in the project is showing as modified. Rather than commit my formatted files, I would rather revert all the files that I have only been formatted and not had other changes. For instance:\n$ git status\n# On branch master\n# Changes not staged for commit:\n# (use \"git add ...\" to update what will be committed)\n# (use \"git checkout -- ...\" to discard changes in working directory)\n# (commit or discard the untracked or modified content in submodules)\n\n# modified: dir/file1.cpp\n# modified: dir/file1.h\n# modified: dir/file2.cpp\n# modified: dir/file2.h\n# modified: dir/file3.cpp\n# modified: dir/file3.h\n# modified: dir/file4.cpp\n# modified: dir/file4.h\n\nI know that file2.cpp, file2.h, and file3.cpp have been modified with content (i.e., not just formatted). I want to stash the changes to these three files and then checkout an old revision, so that I can reapply the changes to these files after. I would rather avoid something like:\n$ cp file2.cpp ~/tmp\n$ git checkout blahblahblah\n$ cp ~/tmp/file2.cpp .\n\nIf there's an obvious way to do this that doesnt involve stashing, let me know. whatever gets the job done."}, {"role": "assistant", "content": "You can add the files with changes you want to keep, then stash the rest of the files and clear the stash:\ngit add file2.cpp file2.h file3.cpp\ngit stash --keep-index\n\nAt this point, you've stashed your unwanted changes. If you'd like to permanently get rid of them, run:\ngit stash drop\n\nNow you have file2.cpp, file2.h, and file3.cpp staged for commit. If you then want to stash these files (and not commit them):\ngit reset\ngit stash\n\nNow you'll be at your previous commit, with only those three files stashed.\nUpdate:\nGit 2.13 and later includes a more direct way to stash specific files with git stash push, as VonC explains in his answer."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How can I force user and password prompt when pushing to my git repository?\nI recently updated my local Git installation to 1.8.1 from 1.8.0.1. \nI'm noticing that, when I work on GitHub, it doesn't prompt me for username and password on push anymore. \nThis troubles me, as I see having to type user and password every time as a good security measure. (what if someone else uses my computer?) \nI checked the following: \n\n1.8.0.1 on another computer still asks for username and password.\nmy account on github still enforces private/security controls.\nI am using https remote references, rather than ssh.\nFor good measure, I checked in my ~/.ssh fonder. Nothing wrong there.\nI'm not storing the login details in ~/.gitconfig or individual /.git/config files.\nI'm also not storing anything github-related in ~/.netrc.\nI created a new dummy archive: still doesn't prompt me for login.\n\nI couldn't find anything in the git release notes archive. \nDoes anyone know if this is a new git behaviour? How do I restore the prompt?"}, {"role": "assistant", "content": "Add a -v flag with your git command . e.g.\ngit pull -v\n\nv stands for verify ."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Find a commit on GitHub given the commit hash\nI am fairly new to Github and have come across an amateur-ish problem.\nI have been asked to do a code review and have been provided with a commit hash, however I have tried looking in Git if I can search using commit hashes but couldn't find anything.\nIs there a way I can find the changed code just by using the commit hash?"}, {"role": "assistant", "content": "A URL of the form https://github.com///commit/ will show you the changes introduced in that commit. For example here's a recent bugfix I made to one of my projects on GitHub:\nhttps://github.com/jerith666/git-graph/commit/35e32b6a00dec02ae7d7c45c6b7106779a124685\nYou can also shorten the hash to any unique prefix, like so:\nhttps://github.com/jerith666/git-graph/commit/35e32b\n\nI know you just asked about GitHub, but for completeness: If you have the repository checked out, from the command line, you can achieve basically the same thing with either of these commands (unique prefixes work here too):\ngit show 35e32b6a00dec02ae7d7c45c6b7106779a124685\ngit log -p -1 35e32b6a00dec02ae7d7c45c6b7106779a124685\n\nNote: If you shorten the commit hash too far, the command line gives you a helpful disambiguation message, but GitHub will just return a 404."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-format-patch - Prepare patches for e-mail submission --histogram"}, {"role": "assistant", "content": "Generate a diff using the \"histogram diff\" algorithm."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-fast-import - Backend for fast Git data importers --depth="}, {"role": "assistant", "content": "Maximum delta depth, for blob and tree deltification.\nDefault is 50."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How to compare different branches in Visual Studio Code\nHow do I compare two different branches in Visual Studio Code?\nIs it possible?"}, {"role": "assistant", "content": "2021 answer\nHere is the step by step guide:\n\nInstall the GitLens extension: GitLens\nThen, Click on Source Control:\n\n\n\nClick on Search & Compare\n\n\n\nClick on Compare References\n\n\n\nSelect the branches you want to compare:\n\n\n\nNow, You can select any file for which you want to see the diff from Search & Compare"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Using git with ssh-agent on Windows\nI'm on Windows. I installed git and posh-git (some helpers for Windows PowerShell). I can add keys with ssh-add and can authenticate with github and my webserver. I can also use git from the PowerShell to interact with my repositories.\nBut there is one thing I can't do: I use git-plus for the Atom editor. And I don't get it to push to my repo. What is my problem?"}, {"role": "assistant", "content": "posh-git and git for windows 2.7 should include everything you need to setup an ssh-agent. Once you have the module installed you can start the agent using something like:\nImport-Module ~\\Documents\\WindowsPowerShell\\Modules\\posh-git\\posh-git\nSet-Alias ssh-agent \"$env:ProgramFiles\\git\\usr\\bin\\ssh-agent.exe\"\nSet-Alias ssh-add \"$env:ProgramFiles\\git\\usr\\bin\\ssh-add.exe\"\nStart-SshAgent -Quiet\n\nYou then should see the SSH_AUTH_SOCK environmental variable is set:\nC:\\Code\\Go\\src\\bosun.org\\cmd\\scollector [master]> gci env:SSH_AUTH_SOCK\n\nName Value\n---- -----\nSSH_AUTH_SOCK /tmp/ssh-6ORcVQvRBZ2e/agent.11668\n\nWhich the git-plus atom package should be able to use when you run commands. I was able to use Ctrl+Shift+H to bring up the git menu in atom, select push, and then push to a remote repo (not it doesn't display errors if it fails, but the new branch I pushed was there). \nThe ssh-agent needs to be started BEFORE you open atom so that the SSH_AUTH_SOCK environmental variable is set. If it still doesn't work you may want to test ssh in PowerShell to verify that it can connect without a password:\nSet-Alias ssh \"$env:ProgramFiles\\git\\usr\\bin\\ssh.exe\"\nssh hostname"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-send-email - Send a collection of patches as emails --[no-]signed-off-by-cc"}, {"role": "assistant", "content": "If this is set, add emails found in the Signed-off-by trailer or Cc: lines to the\ncc list. Default is the value of sendemail.signedOffByCc configuration\nvalue; if that is unspecified, default to --signed-off-by-cc."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-config - Get and set repository or global options format.signature"}, {"role": "assistant", "content": "The default for format-patch is to output a signature containing\nthe Git version number. Use this variable to change that default.\nSet this variable to the empty string (\"\") to suppress\nsignature generation."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-send-email - Send a collection of patches as emails --[no-]cc-cover"}, {"role": "assistant", "content": "If this is set, emails found in Cc: headers in the first patch of\nthe series (typically the cover letter) are added to the cc list\nfor each email set. Default is the value of sendemail.ccCover configuration value; if that is unspecified, default to --no-cc-cover."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-branch - List, create, or delete branches branch..description"}, {"role": "assistant", "content": "Branch description, can be edited with git branch --edit-description . Branch description is\nautomatically added to the format-patch cover letter or\nrequest-pull summary."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-config - Get and set repository or global options sendemail.identity"}, {"role": "assistant", "content": "A configuration identity. When given, causes values in the sendemail. subsection to take precedence over\nvalues in the sendemail section. The default identity is\nthe value of sendemail.identity ."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-difftool - Show changes using common diff tools"}, {"role": "assistant", "content": "SYNOPSIS git difftool [] [ []] [--] […​]"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-merge-base - Find as good common ancestors as possible for a merge"}, {"role": "assistant", "content": "Discussion on fork-point mode After working on the topic branch created with git switch -c\ntopic origin/master , the history of remote-tracking branch origin/master may have been rewound and rebuilt, leading to a\nhistory of this shape: o---B2\n\t\t/\n---o---o---B1--o---o---o---B (origin/master)\n\t\\\n\t B0\n\t \\\n\t D0---D1---D (topic) where origin/master used to point at commits B0, B1, B2 and now it\npoints at B, and your topic branch was started on top of it back\nwhen origin/master was at B0, and you built three commits, D0, D1,\nand D, on top of it. Imagine that you now want to rebase the work\nyou did on the topic on top of the updated origin/master. In such a case, git merge-base origin/master topic would return the\nparent of B0 in the above picture, but B0^..D is not the range of\ncommits you would want to replay on top of B (it includes B0, which\nis not what you wrote; it is a commit the other side discarded when\nit moved its tip from B0 to B1). git merge-base --fork-point origin/master topic is designed to\nhelp in such a case. It takes not only B but also B0, B1, and B2\n(i.e. old tips of the remote-tracking branches your repository’s\nreflog knows about) into account to see on which commit your topic\nbranch was built and finds B0, allowing you to replay only the\ncommits on your topic, excluding the commits the other side later\ndiscarded. Hence $ fork_point=$(git merge-base --fork-point origin/master topic) will find B0, and $ git rebase --onto origin/master $fork_point topic will replay D0, D1, and D on top of B to create a new history of this\nshape: o---B2\n\t\t/\n---o---o---B1--o---o---o---B (origin/master)\n\t\\ \\\n\t B0 D0'--D1'--D' (topic - updated)\n\t \\\n\t D0---D1---D (topic - old) A caveat is that older reflog entries in your repository may be\nexpired by git gc . If B0 no longer appears in the reflog of the\nremote-tracking branch origin/master , the --fork-point mode\nobviously cannot find it and fails, avoiding to give a random and\nuseless result (such as the parent of B0, like the same command\nwithout the --fork-point option gives). Also, the remote-tracking branch you use the --fork-point mode\nwith must be the one your topic forked from its tip. If you forked\nfrom an older commit than the tip, this mode would not find the fork\npoint (imagine in the above sample history B0 did not exist,\norigin/master started at B1, moved to B2 and then B, and you forked\nyour topic at origin/master^ when origin/master was B1; the shape of\nthe history would be the same as above, without B0, and the parent\nof B1 is what git merge-base origin/master topic correctly finds,\nbut the --fork-point mode will not, because it is not one of the\ncommits that used to be at the tip of origin/master)."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Git: getting changes from another branch\nI have a project which uses git and I'd like to start a new branch to add a major new feature.\nUnder the main branch, I'll continue to add bug fixes and minor features. At regular intervals I'd like to pull the changes from the main branch into my \"major new feature\" branch. What's the best way to do this? \nEventually, I'll merge the \"major new feature\" branch into the main branch."}, {"role": "assistant", "content": "git checkout featurebranch && git rebase master\n\nAs long as you haven't pushed yet, it is better to replay your changes on top of master. \nSee:\n\ngit rebase vs. merge\ngit workflow and rebase vs merge questions"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-config - Get and set repository or global options trace2.normalBrief"}, {"role": "assistant", "content": "Boolean. When true time , filename , and line fields are\nomitted from normal output. May be overridden by the GIT_TRACE2_BRIEF environment variable. Defaults to false."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-rev-list - Lists commit objects in reverse chronological order %aE"}, {"role": "assistant", "content": "author email (respecting .mailmap, see git-shortlog or git-blame )"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Docker login: access denied you must use a personal access token\n\nTrying to login from docker to gitlab using the command:\nsudo docker login registry.gitlab.com?private_token=XXX\n\nBut I still have the following error message:\nError response from daemon: Get https://registry.gitlab.com/v2/: unauthorized: HTTP Basic: Access denied\\nYou must use a personal access token with 'api' scope for Git over HTTP.\\nYou can generate one at https://gitlab.com/-/profile/personal_access_tokens\n\nThe token has the right access I doubled checked... I am rather new to docker, any hint/help? thanks!"}, {"role": "assistant", "content": "The correct command line (that works in my case at least) was:\ndocker login registry.example.com -u -p "}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Git blame showing no history\nWhen I run git blame on a file (using msysgit) I always get the following sort of printout:\n00000000 (Not Committed Yet 2011-01-09 11:21:30 +0200 1) package co\n00000000 (Not Committed Yet 2011-01-09 11:21:30 +0200 2) {\n00000000 (Not Committed Yet 2011-01-09 11:21:30 +0200 3) impor\n00000000 (Not Committed Yet 2011-01-09 11:21:30 +0200 4) impor\n00000000 (Not Committed Yet 2011-01-09 11:21:30 +0200 5) impor\n00000000 (Not Committed Yet 2011-01-09 11:21:30 +0200 6) impor\n00000000 (Not Committed Yet 2011-01-09 11:21:30 +0200 7) impor\n\ni.e. it shows all lines as Not Yet Committed.\nI tried this on many files, that have many commits - always the same results. I also tried using relative/full path, but it seems to make no difference.\nWhen I try to use TortoiseGit's blame it always shows every line as being last committed at the first commit:\n\neven thought, as I've said, there are actually tens of commits in the history of these files..\nIdeas?\nEdit - More Info\n\nGit blame works fine on GitHub, where this repo is hosted.\nIt also works fine if I clone it to a linux machine and do the blame there\nIt seems that only on msysgit this doesn't work"}, {"role": "assistant", "content": "git blame file.txt blames the version of file.txt in your working copy. If file.txt has Windows-newlines (CRLF) in the repo and you have core.autocrlf = true, then every line of file.txt will be considered different and will be reported by git blame as not yet committed.\nThe reason why git blame (or even better git blame HEAD, which works no matter what branch you're on) works, is that it doesn't blame the working copy version so there's no potential for lines not yet being committed."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-log - Show commit logs %cd"}, {"role": "assistant", "content": "committer date (format respects --date= option)"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How does Git handle symbolic links?\nIf I have a file or directory that is a symbolic link and I commit it to a Git repository, what happens to it?\nI would assume that it leaves it as a symbolic link until the file is deleted and then if you pull the file back from an old version it just creates a normal file.\nWhat does it do when I delete the file it references? Does it just commit the dangling link?"}, {"role": "assistant", "content": "From linux symlink manual (assuming you are in Linux):\n\nA symbolic link is a special type of file whose contents are a string that is the pathname of another file, the file to which the link refers. (The contents of a symbolic link can be read using readlink(2).)\n\nSo a symbolic link is one more file, just as a README.md or a Makefile. Git just stores the contents of the link (i.e. the aforementioned path of the file system object that it links to) in a 'blob' just like it would for any other file. It then stores the name, mode and type (including the fact that it is a symlink) in the tree object that represents its containing directory.\nWhen you checkout a tree containing the link, it restores the object as a symlink regardless of whether the target file system object exists or not.\nIf you delete the file that the symlink references it doesn't affect the Git-controlled symlink in any way. You will have a dangling reference. It is up to the user to either remove or change the link to point to something valid if needed."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Is there a git-merge --dry-run option?\nI'm merging in a remote branch that may have a lot of conflicts. How can I tell if it will have conflicts or not?\nI don't see anything like a --dry-run on git-merge."}, {"role": "assistant", "content": "As noted previously, pass in the --no-commit flag, but to avoid a fast-forward commit, also pass in --no-ff, like so:\n$ git merge --no-commit --no-ff $BRANCH\n\nTo examine the staged changes:\n$ git diff --cached\n\nAnd you can undo the merge, even if it is a fast-forward merge:\n$ git merge --abort"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How to make a git repository read-only?\nI have some git repositories accessed remotely through SSH and I want to make some of them read-only to prevent more pushes. Some people have remotes pointing to these repositories.\nThese bare repositories were initialised --shared=group, so is setting file permissions to 660 for all files good enough to still allow SSH access, but disallow writes? Or is there an easier way?\nCheers."}, {"role": "assistant", "content": "There is more than one possible way to do this.\n\nIf your users each have a shell account (perhaps limited), and each of them accessing git repositories via their own account, you can use filesystem permissions to control SSH access to git repositories. On Unix those would be write permissions on directories, perhaps with the help of creating a group and specific permissions for a group (with \"sticky group ID\" set).\n\nPushing requires git-receive-pack to be in $PATH of user, and be executable for them... although I am not sure how feasible this approach would be.\n\nYou can use update or pre-receive hook to do access control to repository, for example using update-paranoid example hook from contrib/hooks in git sources.\n\nWith larger number of users you could be better with using a tool to manage access to git repositories, like Gitosis (in Python, requires setuptools) or Gitolite (in Perl).\n\nFor read only access you can setup git daemon to provide read-only anonymous (and unauthenticated) access via git:// protocol, instead of access via SSH protocol.\nSee documentation for url..insteadOf config variable for a way to ease the transition from SSH to GIT protocol.\n\n\n\nSee also Chapter 4. \"Git on the Server\" of Pro Git book by Scott Chacon (CC-BY-NC-SA licensed)."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-config - Get and set repository or global options core.quotePath"}, {"role": "assistant", "content": "Commands that output paths (e.g. ls-files , diff ), will\nquote \"unusual\" characters in the pathname by enclosing the\npathname in double-quotes and escaping those characters with\nbackslashes in the same way C escapes control characters (e.g. \\t for TAB, \\n for LF, \\\\ for backslash) or bytes with\nvalues larger than 0x80 (e.g. octal \\302\\265 for \"micro\" in\nUTF-8). If this variable is set to false, bytes higher than\n0x80 are not considered \"unusual\" any more. Double-quotes,\nbackslash and control characters are always escaped regardless\nof the setting of this variable. A simple space character is\nnot considered \"unusual\". Many commands can output pathnames\ncompletely verbatim using the -z option. The default value\nis true."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-tag - Create, list, delete or verify a tag object signed with GPG "}, {"role": "assistant", "content": "The name of the tag to create, delete, or describe.\nThe new tag name must pass all checks defined by git-check-ref-format . Some of these checks\nmay restrict the characters allowed in a tag name."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Create a patch by comparing a specific branch on the remote with a specific local branch\nI've been working with git for a few weeks, but now I'd like to contribute back to this open source project. I've merged my work with the latest, remote by pulling editing out conflicts and it all looks the way it should in gitk. Now I need to create a patch that is against the latest version of origin (remote) master.\nSo I thought the following command would work:\ngit format-patch origin:master --stdout > 25032011.patch \nbut I get:\nfatal: Invalid object name 'origin'.\nSo I've obviously got the command wrong. So how would I create a patch by comparing a specific branch on the remote with a specific local branch?"}, {"role": "assistant", "content": "Use git format-patch origin/master. This creates a patch file for each commit on your checked out branch, which is not in origin/master.\nTo have one file instead of multiple files you can use\ngit format-patch master --stdout > mypatch.patch"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Why can't stash be applied to the working directory?\nI cannot apply stash back to the working directory.\nLittle story:\nFirst I tried to push some committed changes, but it said: \"no you can't, pull first\"... OK then, I'll pull things from GitHub and then push my changes. When I tried to pull, it said that I had changes that would be overwritten, and that I should stash my changes. OK, I stashed the changes... did the pull, and push the committed changes. But now, I cannot restore the uncommitted changes I was working on.\nThis is the error:\nMyPath/File.cs already exists, no checkout\nCould not restore untracked files from stash\n\nFor sure I don't yet understand all the concepts of git, they confuse me a bit... maybe I did something wrong.\nIt would be great if someone could help me solve this... I've been searching google and everything for more than an hour now, and I didn't come to a solution yet.\nHelp is much appreciated. Thanks!"}, {"role": "assistant", "content": "It sounds like your stash included an untracked file that was subsequently added to the repo. When you try and check it out, git rightly refuses because it would be overwriting an existing file.\nTo fix, you could do something like deleting that file (it's okay, it's still in the repo), applying your stash, and then replacing the stashed version of the file with the in-repo version as appropriate.\nEdit: It's also possible that the file has only been created in the working tree without having been added to the repo. In this case, don't simply delete the local file, rather:\n\nmove it somewhere else\napply the stash\nmanually merge the two file versions (working tree vs. moved)."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-config - Get and set repository or global options grep.extendedRegexp"}, {"role": "assistant", "content": "If set to true, enable --extended-regexp option by default. This\noption is ignored when the grep.patternType option is set to a value\nother than default ."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-diff - Show changes between commits, commit and working tree, etc …​"}, {"role": "assistant", "content": "The parameters, when given, are used to limit\nthe diff to the named paths (you can give directory\nnames and get diff for all files under them)."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Is there a way to get colored text in GitHubflavored Markdown? [duplicate]\n\nThis question already has answers here:\n \n \n\n\n\n\nHow to add color to GitHub's README.md file\n\n (22 answers)\n \n\nClosed 6 years ago.\n\n\n\nI need to document a library on GitHub that output colored text in the terminal.\nI've tried both span and , but it seems to strip out both tags.\nIs the only way to do this is with images of colored text?\n\nI ended up adding screenshots to Git and using image links with GitHub relative URLs."}, {"role": "assistant", "content": "In case this may be helpful for someone who just needs to show colors rather than output, as a hackish workaround (and FYI), since GitHub supports Unicode (as Unicode, numeric character references or HTML entities), you could try colored Unicode symbols, though it depends on the font rendering them in color (as it happens to be appearing for me on Windows 10 and Mac 10.12.5, at least, though on the Mac at least, the up/down-pointing small red triangles don't show in red):\n\nRED APPLE (🍎): 🍎\nGREEN APPLE (🍏): 🍏\nBLUE HEART (💙): 💙\nGREEN HEART (💚): 💚\nYELLOW HEART (💛): 💛\nPURPLE HEART (💜): 💜\nGREEN BOOK (📗): 📗\nBLUE BOOK (📘): 📘\nORANGE BOOK (📙): 📙\nLARGE RED CIRCLE (🔴): 🔴\nLARGE BLUE CIRCLE (🔵): 🔵\nLARGE ORANGE DIAMOND (🔶): 🔶\nLARGE BLUE DIAMOND (🔷): 🔷\nSMALL ORANGE DIAMOND (🔸): 🔸\nSMALL BLUE DIAMOND (🔹): 🔹\nUP-POINTING RED TRIANGLE (🔺): 🔺\nDOWN-POINTING RED TRIANGLE (🔻): 🔻\nUP-POINTING SMALL RED TRIANGLE (🔼): 🔼\nDOWN-POINTING SMALL RED TRIANGLE (🔽): 🔽"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-merge - Join two or more development histories together merge.log"}, {"role": "assistant", "content": "In addition to branch names, populate the log message with at\nmost the specified number of one-line descriptions from the\nactual commits that are being merged. Defaults to false, and\ntrue is a synonym for 20."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Git-svn and Eclipse?\nIs there a plugin for Eclipse for git-svn? I'm looking for a way to handle the SVN repo with Git (for fast branch switching etc.)"}, {"role": "assistant", "content": "It does not look like there is a Git plugin for Eclipse that supports git-svn yet.\nEGit appears to be the most active and popular Git plugin for Eclipse at the moment and it does not support git-svn, but there isn't anything stopping you from using EGit with Eclipse and interacting with git-svn via command line (or via tortoise git for example).\nEclipse bug 315264 is the EGit bug for supporting git-svn, and it looks like something that the maintainers of EGit are willing implement, but they have other priorities atm. So make sure you vote for this bug if you want the feature."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "cannot push into git repository\nThis is what I have done so far and I will say this procedure worked on Ubuntu 9.10 which perhaps had a different version of git.\nserver: mkdir ~/git\n\nlocal: scp -r /../project [email protected]:~/git/\nserver: cd git\n cd project\n git init \n git add .\n git commit -a -m \"initial\"\n\nlocal: git clone [email protected]:/../git/project /home/name/project\n cd project\n capify . (from the ruby gem capistrano)\n git add .\n git commit -a -m \"capified\"\n git push\n\nWhen I try to push this out I get this error message:\n remote: error: refusing to update checked out branch: refs/heads/master\n remote: error: By default, updating the current branch in a non-bare repository\n remote: error: is denied, because it will make the index and work tree inconsistent\n remote: error: with what you pushed, and will require 'git reset --hard' to match\n remote: error: the work tree to HEAD.\n remote: error: \n remote: error: You can set 'receive.denyCurrentBranch' configuration variable to\n remote: error: 'ignore' or 'warn' in the remote repository to allow pushing into\n remote: error: its current branch; however, this is not recommended unless you\n remote: error: arranged to update its work tree to match what you pushed in some\n remote: error: other way.\n remote: error: \n remote: error: To squelch this message and still keep the default behaviour, set\n remote: error: 'receive.denyCurrentBranch' configuration variable to 'refuse'.\n To ...\n ! [remote rejected] master -> master (branch is currently checked out)\n error: failed to push some refs to"}, {"role": "assistant", "content": "At server side, do this:\ngit config receive.denyCurrentBranch ignore\n\nThen you can push at local."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-pull - Fetch from and integrate with another repository or a local branch --depth="}, {"role": "assistant", "content": "Limit fetching to the specified number of commits from the tip of\neach remote branch history. If fetching to a shallow repository\ncreated by git clone with --depth= option (see git-clone ), deepen or shorten the history to the specified\nnumber of commits. Tags for the deepened commits are not fetched."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Clone private git repo with dockerfile\nI have copied this code from what seems to be various working dockerfiles around, here is mine:\nFROM ubuntu\n\nMAINTAINER Luke Crooks \"[email protected]\"\n\n# Update aptitude with new repo\nRUN apt-get update\n\n# Install software \nRUN apt-get install -y git python-virtualenv\n\n# Make ssh dir\nRUN mkdir /root/.ssh/\n\n# Copy over private key, and set permissions\nADD id_rsa /root/.ssh/id_rsa\nRUN chmod 700 /root/.ssh/id_rsa\nRUN chown -R root:root /root/.ssh\n\n# Create known_hosts\nRUN touch /root/.ssh/known_hosts\n\n# Remove host checking\nRUN echo \"Host bitbucket.org\\n\\tStrictHostKeyChecking no\\n\" >> /root/.ssh/config\n\n# Clone the conf files into the docker container\nRUN git clone [email protected]:Pumalo/docker-conf.git /home/docker-conf\n\nThis gives me the error\nStep 10 : RUN git clone [email protected]:Pumalo/docker-conf.git /home/docker-conf\n ---> Running in 0d244d812a54\nCloning into '/home/docker-conf'...\nWarning: Permanently added 'bitbucket.org,131.103.20.167' (RSA) to the list of known hosts.\nPermission denied (publickey).\nfatal: Could not read from remote repository.\n\nPlease make sure you have the correct access rights\nand the repository exists.\n2014/04/30 16:07:28 The command [/bin/sh -c git clone [email protected]:Pumalo/docker-conf.git /home/docker-conf] returned a non-zero code: 128\n\nThis is my first time using dockerfiles, but from what I have read (and taken from working configs) I cannot see why this doesn't work.\nMy id_rsa is in the same folder as my dockerfile and is a copy of my local key which can clone this repo no problem.\nEdit: \nIn my dockerfile I can add:\nRUN cat /root/.ssh/id_rsa\n\nAnd it prints out the correct key, so I know its being copied correctly.\nI have also tried to do as noah advised and ran:\nRUN echo \"Host bitbucket.org\\n\\tIdentityFile /root/.ssh/id_rsa\\n\\tStrictHostKeyChecking no\" >> /etc/ssh/ssh_config\n\nThis sadly also doesn't work."}, {"role": "assistant", "content": "My key was password protected which was causing the problem, a working file is now listed below (for help of future googlers)\nFROM ubuntu\n\nMAINTAINER Luke Crooks \"[email protected]\"\n\n# Update aptitude with new repo\nRUN apt-get update\n\n# Install software \nRUN apt-get install -y git\n# Make ssh dir\nRUN mkdir /root/.ssh/\n\n# Copy over private key, and set permissions\n# Warning! Anyone who gets their hands on this image will be able\n# to retrieve this private key file from the corresponding image layer\nADD id_rsa /root/.ssh/id_rsa\n\n# Create known_hosts\nRUN touch /root/.ssh/known_hosts\n# Add bitbuckets key\nRUN ssh-keyscan bitbucket.org >> /root/.ssh/known_hosts\n\n# Clone the conf files into the docker container\nRUN git clone [email protected]:User/repo.git"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-symbolic-ref - Read, modify and delete symbolic refs --recurse --no-recurse"}, {"role": "assistant", "content": "When showing the value of as a symbolic ref, if\n refers to another symbolic ref, follow such a chain\nof symbolic refs until the result no longer points at a\nsymbolic ref ( --recurse , which is the default). --no-recurse stops after dereferencing only a single level\nof symbolic ref."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-log - Show commit logs zebra"}, {"role": "assistant", "content": "Blocks of moved text are detected as in blocks mode. The blocks\nare painted using either the color.diff.{old,new}Moved color or color.diff.{old,new}MovedAlternative . The change between\nthe two colors indicates that a new block was detected."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git: fatal: Could not read from remote repository\nI am trying to set git up with http://danielmiessler.com/study/git/#website to manage my site.\nI have gotten to the last step in the instructions: git push website +master:refs/heads/master\nI am working using the git ming32 command line in win7\n$ git push website +master:refs/heads/master\nBill@***.com's password:\nConnection closed by 198.91.80.3\nfatal: Could not read from remote repository.\n\nPlease make sure you have the correct access rights\nand the repository exists.\n\nOne problem here may be that the program is looking for Bill@***.com. when I connect via ssh to my site I have a different username( lets say 'abc'). so maybe this should be abc@***.com. If so I don't know how to change this or if I can push under an alias"}, {"role": "assistant", "content": "Your ssh key most likely had been removed from ssh agent\nssh-add ~/.ssh/id_rsa\n\nwhere id_rsa is a ssh key associated with git repo\nUpdate\nYou may get Could not open a connection to your authentication agent. error to resolve that you need to start the agent first by:\neval `ssh-agent -s`"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "This job is stuck, because the project doesn't have any runners online assigned to it. Go to Runners page [closed]\n\nClosed. This question is not about programming or software development. It is not currently accepting answers.\n \n \n\n\n\n\n\n\n\n\n\n\n\n This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.\n\n\nClosed last year.\n\n\nThe community reviewed whether to reopen this question last year and left it closed:\n\nOriginal close reason(s) were not resolved\n\n\n\n\n\n\n Improve this question\n \n\n\n\nI am learning GitLab CI/CD.\nI installed GitLab and GitLab Runner from Officials. Whenever I run the pipeline during Maven build, the job gets stuck. I have a registered runner and it is available to my project, but jobs get stuck.\n.gitlab-ci.yml\nimage: docker:latest\nservices:\n- docker:dind\n\nvariables:\n DOCKER_DRIVER: overlay\n SPRING_PROFILES_ACTIVE: gitlab-ci\n\nstages:\n- build\n- package\n- deploy\n\nmaven-build:\n image: maven:3-jdk-8\n stage: build\n script: \"mvn package -B\"\n artifacts:\n paths:\n - target/*.jar\n\ndocker-build:\nstage: package\nscript:\n - docker build -t registry.com/ci-cd-demo .\n - docker push registry.com/ci-cd-demo\n\nk8s-deploy:\n image: google/cloud-sdk\n stage: deploy\n script:\n - echo \"$GOOGLE_KEY\" > key.json\n - gcloud container clusters get-credentials standard-cluster-demo -- \n zone us-east1-c --project ascendant-study-222206\n - kubectl apply -f deployment.yml\n\nMy runner settings\n\n\nError message when runner is already associated with project:\n\nCan you help me?"}, {"role": "assistant", "content": "The job is stuck because your runners have tags and your jobs don't. Follow these 4 steps to enable your runner to run without tags:\n\n\nOr set tags to your jobs. For more info: Configuration of your jobs with .gitlab-ci.yml - Tags"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-rm - Remove files from the working tree and from the index -q --quiet"}, {"role": "assistant", "content": "git rm normally outputs one line (in the form of an rm command)\nfor each file removed. This option suppresses that output."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-show - Show various types of objects %Cgreen"}, {"role": "assistant", "content": "switch color to green"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-am - Apply a series of patches from a mailbox --committer-date-is-author-date"}, {"role": "assistant", "content": "By default the command records the date from the e-mail\nmessage as the commit author date, and uses the time of\ncommit creation as the committer date. This allows the\nuser to lie about the committer date by using the same\nvalue as the author date."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "What is the meaning of ^M in 'git diff'?\nI am diffing a file between forked and upstream Bitbucket repositories:\n$ git diff origin/branchA..upstream/branchB -- some/file/path.xyz\nIt seems to return the same difference for almost every file:\n-@using Sitecore.Mvc\n+@using Sitecore.Mvc^M\n\nWhat is the exact meaning of ^M that only shows up after the first line? I see this issue when I compare other files as well. I am on a Windows Server 2008 R2 machine. core.autocrlf is set to true. The .gitattributes is set to text eol=lf. My Git version is 2.5.1.windows.1."}, {"role": "assistant", "content": "^M represents carriage return (CR). This diff means something removed a Unicode BOM from the beginning of the line and added a CR at the end.\nIf ^M is in the new-changes side (right/green side), then that means the file's line-endings were changed from LF to CRLF, otherwise, file was CRLF and is now changed to LF.\nThe ^ symbol stands for Control, so ^M means Ctrl+M.\nTo get from that to the actual ASCII character code, you take the base character and flip bit 6 (i.e. XOR with 64). For letters, that just means subtract 64. So e.g. ^A is character code 1 (because A is 65). ^M is 77 - 64 = 13 (because M is 77), which corresponds to carriage return in ASCII.\n\nYou may also already know:\n^L represents the form-feed character (FF is the abbreviation, not hexadecimal), and has ASCII value 12 or 0x0C.\n\nIn printing contexts: may be used to tell the printer to skip current page/paper and continue printing at the top of next paper.\nOr, in some terminal and/or console contexts: is used to clear the console's screen.\n\nSee also What are carriage return, linefeed, and form feed?"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "What is the difference between merge --squash and rebase?\nI'm trying to understand the difference between a squash and a rebase. As I understand it, one performs a squash when doing a rebase."}, {"role": "assistant", "content": "Merge commits: retains all of the commits in your branch and interleaves them with commits on the base branch\nMerge Squash: retains the changes but omits the individual commits from history\n\nRebase: This moves the entire feature branch to begin on the tip of the master branch, effectively incorporating all of the new commits in master\n\nMore on here\n\nThe first two diagrams come from About pull request merges on the GitHub Docs"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "After Git clone from GitHub, I do not see my branch\nI have a repository on GitHub. It contains master and one branch.\nWhen I clone it, I obtain only master and do not see my branch.\nWhy is it so? How can I see all branches in the repository?"}, {"role": "assistant", "content": "By default, git clone creates only one branch: the currently checked out one, generally master. However, it does create remote tracking branches for all other branches in the remote. Think of these as local copies of the remote's branches, which can be updated by fetching. They're not real local branches, as they're intended only as pointers to where the remote's branches are, not for you to work on. \nIf you run git branch -a you'll see all branches, local and remote. If you want to see just the remote ones, use git branch -r. If you prefer a visual history display, try gitk --all (or gitk --remotes). \nTo create a local branch to work on, use\ngit branch origin/\n\nThat'll create a new local branch using the remote's branch as the starting point."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How do I use Git's interactive rebase with a local-only repository (no remote / origin)?\nI use git as a local source control system mostly for history and diff tracking. I still want to use rebase to do fixup / squash on WIP commits that I will make periodically. When I try to do git rebase -i though, I get the following: \nThere is no tracking information for the current branch.\nPlease specify which branch you want to rebase against.\nSee git-rebase(1) for details\n\n git rebase \n\nIf you wish to set tracking information for this branch you can do so with:\n\n git branch --set-upstream-to=/ MyBranch\n\nIt seems like git doesn't expect you to use interactive rebase without an upstream remote? How do I do that?"}, {"role": "assistant", "content": "git rebase -i in shorthand, without specifying a destination branch, will make git assume that you are trying to rebase against a remote branch tracked by your branch. That's why the error message is mentioning stuff about remotes.\nWhen you do specify a target, git will rebase against that commit-ish:\ngit rebase -i "}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-config - Get and set repository or global options branch.sort"}, {"role": "assistant", "content": "This variable controls the sort ordering of branches when displayed by git-branch . Without the \"--sort=\" option provided, the\nvalue of this variable will be used as the default.\nSee git-for-each-ref field names for valid values."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-archive - Create an archive of files from a named tree -l --list"}, {"role": "assistant", "content": "Show all available formats."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "remote: Write access to repository not granted. fatal: unable to access\n\nI have the error message:\nremote: Write access to repository not granted.\nfatal: unable to access 'https://github.com/...../...../': \nThe requested URL returned error: 403\n\nMy friend invited me to his repository, and I used his personal token while cloning it.\nBut it says the above error.\nI also tried with my own token but it says the same.\nI also faced this when I created my own repository and was making initial commit and push.\nThis issue has grown ever since Git*Hub has brought token authentication into account.\nHow can I get past this?"}, {"role": "assistant", "content": "In your Github project, go to Settings > Actions > General.\nScroll down to Workflow permissions."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-svn - Bidirectional operation between a Subversion repository and Git -n --dry-run"}, {"role": "assistant", "content": "This can be used with the dcommit , rebase , branch and tag commands. For dcommit , print out the series of Git arguments that would show\nwhich diffs would be committed to SVN. For rebase , display the local branch associated with the upstream svn\nrepository associated with the current branch and the URL of svn\nrepository that will be fetched from. For branch and tag , display the urls that will be used for copying when\ncreating the branch or tag."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-diff - Show changes between commits, commit and working tree, etc diff.srcPrefix"}, {"role": "assistant", "content": "If set, git diff uses this source prefix. Defaults to \"a/\"."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Change github diff to be side by side comparison?\n\nFor github web browsing, it is not shown as side by side as lots of diff tool does. Can I change the diff mode to side by side? I mean on the github web."}, {"role": "assistant", "content": "2023: It is hidden behind the cog wheel ⚙ symbol (right to \"Conversations\").\n\n2014:\nYes, it is possible since Sept. 3rd 2014: see \"Introducing split diffs\":\n\n\nDiffs now come in two flavors, unified and split.\nSwitch between them on pull request, commit, and compare pages using the toggle in the top right of the page.\nThe mode you last used will become your preferred default.\n\n\nNote: since Sept. 4th 2014, it also support word diff highlights.\nSee \"Does Github have a view that shows diffs between file versions?\".\n\nSince 2014, and the introduction of dark theme(!) in 2020, the UI is now:\n\nfrom Unified:\n\n\n\nTo split diff:\n\n\nusing: \nNote: adding \"&diff=split\" at the end of the URL will give you the same result: a split diff."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Checkout remote branch using git svn\nI have checked out a svn repository using git svn. Now I need to checkout one of the branches and track it. Which is the best way to do it?"}, {"role": "assistant", "content": "Standard Subversion layout\nCreate a git clone of that includes your Subversion trunk, tags, and branches with\ngit svn clone http://svn.example.com/project -T trunk -b branches -t tags\nThe --stdlayout option is a nice shortcut if your Subversion repository uses the typical structure:\ngit svn clone http://svn.example.com/project --stdlayout\nMake your git repository ignore everything the subversion repo does:\ngit svn show-ignore >> .git/info/exclude\nYou should now be able to see all the Subversion branches on the git side:\ngit branch -r\nSay the name of the branch in Subversion is waldo. On the git side, you'd run\ngit checkout -b waldo-svn remotes/waldo\nThe -svn suffix is to avoid warnings of the form\nwarning: refname 'waldo' is ambiguous.\nTo update the git branch waldo-svn, run\ngit checkout waldo-svn\ngit svn rebase\n\nStarting from a trunk-only checkout\nTo add a Subversion branch to a trunk-only clone, modify your git repository's .git/config to contain\n[svn-remote \"svn-mybranch\"]\n url = http://svn.example.com/project/branches/mybranch\n fetch = :refs/remotes/mybranch\nYou'll need to develop the habit of running\ngit svn fetch --fetch-all\nto update all of what git svn thinks are separate remotes. At this point, you can create and track branches as above. For example, to create a git branch that corresponds to mybranch, run\ngit checkout -b mybranch-svn remotes/mybranch\nFor the branches from which you intend to git svn dcommit, keep their histories linear!\n\nFurther information\nYou may also be interested in reading an answer to a related question."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How can I uncommit the last commit in a git bare repository?\nTaking into consideration that there are several git commands that make no sense in a bare repository (because bare repositories don't use indexes and do not have a working directory), \ngit reset --hard HEAD^ \n\nis not a solution to uncommit the last change in such a repository.\nSearching through the Internet, all I could find related to the topic is this, in which I am presented three ways of doing this:\n1. \"update the ref manually (which involves plumbing)\";\n2. \"git push -f from a non-bare repository\";\n3. \"git branch -f this $that\".\nWhich solution do yo think is more appropriate or what other ways are there to do this? Unfortunately, the documentation I found about git bare repositories is fairly poor."}, {"role": "assistant", "content": "You can use the git update-ref command. To remove the last commit, you would use:\n$ git update-ref HEAD HEAD^\n\nOr if you're not in the branch from which you cant to remove the last commit:\n$ git update-ref refs/heads/branch-name branch-name^\n\nYou could also pass a sha1 if you want:\n$ git update-ref refs/heads/branch-name a12d48e2\n\nSee the documentation of the git-update-ref command."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Why do I need to explicitly push a new branch?\nI am new in git and I am practicing. I created a local branch but I saw that when I did git push my branch was not uploaded to the repository. I had to actually do: git push -u origin --all.\nWhy is this? Isn't a branch a new change to be pushed by default? Why do I need to run the second command?"}, {"role": "assistant", "content": "The actual reason is that, in a new repo (git init), there is no branch (no master, no branch at all, zero branches)\nSo when you are pushing for the first time to an empty upstream repo (generally a bare one), that upstream repo has no branch of the same name.\nAnd:\n\nthe default push policy was 'matching' (push all the branches of the same name, creating them if they don't exist),\nthe default push policy is now 'simple' (push only the current branch, and only if it has a similarly named remote tracking branch on upstream, since git 1.7.11)\n\nIn both cases, since the upstream empty repo has no branch:\n\nthere is no matching named branch yet\nthere is no upstream branch at all (with or without the same name! Tracking or not)\n\nThat means your local first push has no idea:\n\nwhere to push\nwhat to push (since it cannot find any upstream branch being either recorded as a remote tracking branch, and/or having the same name)\n\nSo you need at least to do a:\ngit push origin master\n\nBut if you do only that, you:\n\nwill create an upstream master branch on the upstream (now non-empty repo): good.\nwon't record that the local branch 'master' needs to be pushed to upstream (origin) 'master' (upstream branch): bad.\n\nThat is why it is recommended, for the first push, to do a:\ngit push -u origin master\n\nOr, using Git 2.37 and the new global option push.autoSetupRemote :\ngit config --global push.autoSetupRemote true\ngit push\n\nThat will record origin/master as a remote tracking branch, and will enable the next push to automatically push master to origin/master.\ngit checkout master\n# Git 2.23+\ngit switch master\ngit push\n\nAnd that will work too with push policies 'current' or 'upstream'.\nIn each case, after the initial git push -u origin master, a simple git push will be enough to continue pushing master to the right upstream branch."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-status - Show the working tree status -s --short"}, {"role": "assistant", "content": "Give the output in the short-format."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How to find the commit in which a given file was added?\nSay I have a file foo.js that was committed some time ago. I would like to\nsimply find the commit where this file was first added.\nAfter reading the answers and my own tinkering, this works for me\ngit log --follow --diff-filter=A --find-renames=40% -- foo.js"}, {"role": "assistant", "content": "Here's simpler, \"pure Git\" way to do it, with no pipeline needed:\ngit log --diff-filter=A -- foo.js\n\nCheck the documentation. You can do the same thing for Deleted, Modified, etc.\nhttps://git-scm.com/docs/git-log#Documentation/git-log.txt---diff-filterACDMRTUXB82308203\nI have a handy alias for this, because I always forget it:\ngit config --global alias.whatadded \"log --diff-filter=A\"\n\nThis makes it as simple as:\ngit whatadded -- foo.js\n\n\nThe below one liner will recursively search through sub directories of the $PWD for foo.js without having to supply an absolute or relative path to the file, nor will the file need to be in the same directory as the $PWD\ngit log --diff-filter=A -- **foo.js"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "gitlab-ci.yml - override a specific job and script execution\n\nI have a .gitlab-ci.yml file that says:\ninclude:\n - project: 'my-proj/my-gitlab-ci'\n ref: master\n file: '/pipeline/gitlab-ci.yml'\n\nBecause of some \"Inconvenience\" I would like to override some specific stage that is defined on the above mentioned gitlab-ci.yml file injected on my top level .gitlab-ci.yml file. The plan stage I am interested in has the following thing:\nplan-dummy:\n stage: plan\n script:\n - terraform plan -lock=false -var-file=vars/vars.tfvars\n\nWhat I want to do is override the above on the main .gitlab-ci.yml file such that only the script is executed as an override:\nplan-dummy:\n stage: plan\n script:\n - terraform refresh # This is the line I want to add as an additional step before next \n - terraform plan -lock=false -var-file=vars/dev.tfvars\n\nHow do I achieve that without fiddling with the injected file? Yes, I know that alternative is to do dirty copy-paste from child file, but I don't want to do that.\nRegards,"}, {"role": "assistant", "content": "simply reuse the same job name and add the configuration you need:\nplan-dummy:\n before_script:\n - terraform refresh"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "run git merge algorithm on two individual files\nI want to take advantage of the git-merge algorithm on two arbitrary files in a git repo. Here is my working directory:\nfolder/\n file1\n file2\n\nfile1 and file2 are similar, but I want to see how git would merge them as if they were different versions of the same file. In other words, I want something like this:\ngit merge-files file1 file2 > merge_of_file1_file2\n\nIs there a way to do this?"}, {"role": "assistant", "content": "This doesn't really make sense, because you're not providing a common ancestor. If you do have one, however, you can use:\ngit merge-file \n\nThis places the results in the current version file; if you want them elsewhere, use:\ngit merge-file -p > \n\nIt needs the common ancestor to provide something to consider changes relative to. You could hack it, by providing an empty file or a copy of an older version of one of them from the history of your repository, but the quality of results will depend on how well you select a common ancestor, since it's merging the two diffs, between that and each of the new versions. An empty file will only work well if the two are very similar (many runs of at least three identical lines).\nWithout that, all you can really do is look at the differences:\ngit diff --no-index file1 file2"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-mergetool - Run merge conflict resolution tools to resolve merge conflicts mergetool..path"}, {"role": "assistant", "content": "Override the path for the given tool. This is useful in case\nyour tool is not in the PATH."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How can I specify a branch/tag when adding a Git submodule?\nHow does git submodule add -b work?\nAfter adding a submodule with a specific branch, a new cloned repository (after git submodule update --init) will be at a specific commit, not the branch itself (git status on the submodule shows \"Not currently on any branch\").\nI can't find any information on .gitmodules or .git/config about the submodule's branch or any specific commit, so how does Git figure it out?\nAlso, is it possible to specify a tag instead of a branch?"}, {"role": "assistant", "content": "I'd like to add an answer here that is really just a conglomerate of other answers, but I think it may be more complete.\nYou know you have a Git submodule when you have these two things.\n\nYour .gitmodules has an entry like so:\n[submodule \"SubmoduleTestRepo\"]\n path = SubmoduleTestRepo\n url = https://github.com/jzaccone/SubmoduleTestRepo.git\n\n\nYou have a submodule object (named SubmoduleTestRepo in this example) in your Git repository. GitHub shows these as \"submodule\" objects. Or do git submodule status from a command line. Git submodule objects are special kinds of Git objects, and they hold the SHA information for a specific commit.\nWhenever you do a git submodule update, it will populate your submodule with content from the commit. It knows where to find the commit because of the information in the .gitmodules.\nNow, all the -b does is add one line in your .gitmodules file. So following the same example, it would look like this:\n[submodule \"SubmoduleTestRepo\"]\n path = SubmoduleTestRepo\n url = https://github.com/jzaccone/SubmoduleTestRepo.git\n branch = master\n\n\nNote: only branch name is supported in a .gitmodules file, but SHA and TAG are not supported! (instead of that, the branch's commit of each module can be tracked and updated using \"git add .\", for example like git add ./SubmoduleTestRepo, and you do not need to change the .gitmodules file each time)\n\nThe submodule object is still pointing at a specific commit. The only thing that the -b option buys you is the ability to add a --remote flag to your update as per Vogella's answer:\ngit submodule update --remote\n\nInstead of populating the content of the submodule to the commit pointed to by the submodule, it replaces that commit with the latest commit on the master branch, THEN it populates the submodule with that commit. This can be done in two steps by djacobs7 answer. Since you have now updated the commit the submodule object is pointing to, you have to commit the changed submodule object into your Git repository.\ngit submodule add -b is not some magically way to keep everything up to date with a branch. It is simply adds information about a branch in the .gitmodules file and gives you the option to update the submodule object to the latest commit of a specified branch before populating it."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-log - Show commit logs %(describe[:])"}, {"role": "assistant", "content": "human-readable name, like git-describe ; empty string for\nundescribable commits. The describe string may be followed by a colon and\nzero or more comma-separated options. Descriptions can be inconsistent when\ntags are added or removed at the same time. tags[=] : Instead of only considering annotated tags,\nconsider lightweight tags as well. abbrev= : Instead of using the default number of hexadecimal digits\n(which will vary according to the number of objects in the repository with a\ndefault of 7) of the abbreviated object name, use digits, or as many\ndigits as needed to form a unique object name. match= : Only consider tags matching the given glob(7) pattern, excluding the \"refs/tags/\" prefix. exclude= : Do not consider tags matching the given glob(7) pattern, excluding the \"refs/tags/\" prefix."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Github remote permission denied\n\nI'm trying to upload to my repo on GitHub. I go through all the steps up to:\ngit push -u origin master\nAt that point it gives me the following error:\n\nremote: Permission to samrao2/manager-4.git denied to samrao1.\nfatal: unable to access 'https://github.com/samrao2/manager-4.git/':\nThe requested URL returned error: 403\n\nI think the issue is that I was logged into another Git account before \"samrao1\" and now I am trying to push to \"samrao2\".\nCan someone help me reset this to where I can successfully push to \"samrao2\"? I assume I will be prompted for my password the first time I try to do it."}, {"role": "assistant", "content": "Unable to access https means: this has nothing to do with SSH (and switching to SSH, while possible, does not explain the original issue)\nThis has to do with credential caching, meaning Git will be default provide the credentials (GitHub account and password PAT Personal Access Token) of the old account while you are trying to push to the new account.\n\nReminder, most Git repository hosting service uses token as password, not your actual user account password.\nFor instance, GitHub no longer accept password since Aug. 2021.\n\nSee if you have a credential helper that would have cached your (old account) credentials (username/password) used to authentication you.\ngit config credential.helper \n\nOn Mac, as commented by Arpit J, just goto/open your keychain access->search for github.com related file->and edit credentials there.\n\nSee \"Updating credentials from the OSX Keychain\"\nOn Windows (And, in 2021, possibly Linux or even Mac), that would be the Windows Credential Managers GCMC: Git Credential Manager.\nOpen the Windows Credential Store, and see if the first user is registered there: delete that entry, and you will be able to authenticate with the second user.\n(Here is an example for BitBucket)\n\n\nIn command-line (see git credential), for a manager core credential helper:\n\nGet the old password or token:\nprintf \"protocol=https\\nhost=github.com\\nusername=\" | \\\n git credential-manager-core get\n\n# output:\nprotocol=https\nhost=github.com\nusername=\npassword=\n\n\nRemove the old password:\nprintf \"protocol=https\\nhost=github.com\\nusername=\" | \\\n git credential-manager-core erase\n\n\n\n(Replace by your GitHub user account name)"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "In gitlab, is it possible to create two or more repositories into only one project?\n\nI'm running GitLab in a container of Docker but it's okay so far, no problem with that at all. I'm just in doubt about the creation of repositories in projects. I've created my first project in GitLab then after it creation i'd been redirected to a page with some commands to use in terminal. There were three sections, one of them were \"Create a repository\", i've used those commands and so i could create my repository of my project. However, after this, that page with commands went out and i could just see it again when i created a new project. After all,here goes my question again, is it possible to create two or more repositories into only one project?"}, {"role": "assistant", "content": "I only have time to give a short answer right now, but I hope it helps:\n\nIn short: NO\nBut also: YES, after a fashion\n\nThere is a one-to-one correspondence between repositories and projects (which would perhaps better be called repositories as well). \nOne Solution: Gitlab supports the creation of groups of projects/repos, which can be managed as a project consisting of multiple repos.\n\nGit-based/local Options\nIf you are interested in git-based solutions to including a repository inside of another repository check out my answer here. If you use either the subtree merge method (at least a variant of it that tracks history) or subrepository method in this answer, your subprojects will appear in your master project in Gitlab, but the master project will also track changes in the subprojects. \nAlternative Solution: Create a dummy repo that contains all of your desired repos as subrepos. This master repo will then track all subrepo changes. However; there are a few logistical issues, the .git files for the subrepos will not exist on Gitlab, so you might want a dedicated client with these files to pull the master repo from Gitlab (probably one commit at a time, if you want the subrepo histories to match the main repo history) and update the corresponding local subrepos (these could also be stored independently on GitLab)."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "OS X - Can't start Git: /usr/bin/git Probably the path to Git executable is not valid\nI get this error in Android Studio:\n\nCan't start Git: /usr/bin/git\n Probably the path to Git executable is not valid.\n\nIt gives me an option to fix it, where it takes me to the area in Android Studio to set the path to git. I see it is set to \n\n/usr/bin/git\n\nAnd I check that path, and that path is indeed the path to the git executable. Why is Android Studio unable to start git?\nEDIT: When I try to use git commands in the Android Studio terminal it says:\n\nAgreeing to the Xcode/iOS license requires admin privileges, please\n re-run as root via sudo."}, {"role": "assistant", "content": "You should run sudo git --version on your command line.\nIt will ask you to agree to the git xcode license agreement, once done everything will work as before."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-am - Apply a series of patches from a mailbox -m --message-id"}, {"role": "assistant", "content": "Pass the -m flag to git mailinfo (see git-mailinfo ),\nso that the Message-ID header is added to the commit message.\nThe am.messageid configuration variable can be used to specify\nthe default behaviour."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How do I pull a missing file back into my branch?\n\nI have cloned a Git project into a local Git repository. Then I have done something nasty to one of the files and in that panic I deleted file physically from the drive (rm style.css) and also removed it from Git (git rm style.css).\nI want to get the original style.css file back from origin to my development branch. Unfortunately my Git thinks it is up-to-date and won't do anything.\ncd ~/project.me\ngit status\n\n# On branch dev\nnothing to commit (working directory clean)\n\ngit pull origin dev\n\nPassword for 'https://[email protected]':\nFrom https://github.com/somewhere/project.me\n* branch dev -> FETCH_HEAD\nAlready up-to-date.\n\nWhat do I need to do to tell git that I want to download original style.css file back into my dev branch?"}, {"role": "assistant", "content": "If you want to restore all the missing files from the local repository\ngit checkout .\n\nWarning: This method also restores all changed files and drops all the changes"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Delete files from git index when they are already deleted from fs\nI have a bunch of files deleted from the fs and listed as deleted in git status.\nHow can I stage this changes faster then running git rm for each file?"}, {"role": "assistant", "content": "You can do this with:\ngit ls-files --deleted -z | xargs -0 git rm\n\nWhenever this question is asked, people suggest git add -u, but the problem with that answer is that it also stages other modifications in your working copy, not just deletions. That might be OK in many situations, but if you want to just stage the deletion of files that have been deleted from the working copy, the suggestion I've made is more precise.\nThere's actually a section of the git rm documentation that discusses how to do what you want - I believe that the command suggested in the \"Other ways\" section is equivalent to what I've suggested here."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "What is the precise meaning of \"ours\" and \"theirs\" in git?\nThis might sound like too basic of a question, but I have searched for answers and I am more confused now than before.\nWhat does \"ours\" and \"theirs\" mean in git when merging my branch into my other branch?\nBoth branches are \"ours\". \nIn a merge conflict is \"ours\" always the upper of the two versions displayed? \nDoes \"ours\" always refer to the branch that HEAD was pointing to when the merge began? If so then why not use a clear possessive reference like \"current branch's\" instead of using a possessive pronoun like \"ours\" that is referentially ambiguous (since both branches are technically ours)? \nOr just use the branch name (instead of saying \"ours\" just say \"local master's\" or such)?\nThe most confusing part to me is if I specify in a specific branch's .gitattributes file. Lets say in test branch I have the following .gitattributes file:\nconfig.xml merge=ours\n\nNow I checkout and point HEAD to master then merge in test. Since master is ours, and test's .gitattributes is not checked out, will it even have an effect? If it does have an effect, since master is now \"ours\", then what will happen?"}, {"role": "assistant", "content": "I suspect you're confused here because it's fundamentally confusing. To make things worse, the whole ours/theirs stuff switches roles (becomes backwards) when you are doing a rebase.\nUltimately, during a git merge, the \"ours\" branch refers to the branch you're merging into:\ngit checkout merge-into-ours\n\nand the \"theirs\" branch refers to the (single) branch you're merging:\ngit merge from-theirs\n\nand here \"ours\" and \"theirs\" makes some sense, as even though \"theirs\" is probably yours anyway, \"theirs\" is not the one you were on when you ran git merge.\nWhile using the actual branch name might be pretty cool, it falls apart in more complex cases. For instance, instead of the above, you might do:\ngit checkout ours\ngit merge 1234567\n\nwhere you're merging by raw commit-ID. Worse, you can even do this:\ngit checkout 7777777 # detach HEAD\ngit merge 1234567 # do a test merge\n\nin which case there are no branch names involved!\nI think it's little help here, but in fact, in gitrevisions syntax, you can refer to an individual path in the index by number, during a conflicted merge\ngit show :1:README\ngit show :2:README\ngit show :3:README\n\nStage #1 is the common ancestor of the files, stage #2 is the target-branch version, and stage #3 is the version you are merging from.\n\nThe reason the \"ours\" and \"theirs\" notions get swapped around during rebase is that rebase works by doing a series of cherry-picks, into an anonymous branch (detached HEAD mode). The target branch is the anonymous branch, and the merge-from branch is your original (pre-rebase) branch: so \"--ours\" means the anonymous one rebase is building while \"--theirs\" means \"our branch being rebased\".\n\nAs for the gitattributes entry: it could have an effect: \"ours\" really means \"use stage #2\" internally. But as you note, it's not actually in place at the time, so it should not have an effect here ... well, not unless you copy it into the work tree before you start.\nAlso, by the way, this applies to all uses of ours and theirs, but some are on a whole file level (-s ours for a merge strategy; git checkout --ours during a merge conflict) and some are on a piece-by-piece basis (-X ours or -X theirs during a -s recursive merge). Which probably does not help with any of the confusion.\nI've never come up with a better name for these, though. And: see VonC's answer to another question, where git mergetool introduces yet more names for these, calling them \"local\" and \"remote\"!"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Github gist editing without changing URL\n\nI have a gist with some javascript code in a script tag, like so:\n\n\nAnd I will need to keep editing the JS file on github. However, when you edit a gist it changes the URL of the gist. How do I keep the same URL?"}, {"role": "assistant", "content": "Gist changed the path to this file pattern:\nhttps://gist.github.com///raw//\n\nYou will notice that now the top answers' links are 404'ing.\nSimply apply this new pattern and voilà! \nhttps://gist.github.com///raw/\n\nFor instance:\nhttps://gist.githubusercontent.com/wesbos/cd16b8b1815825f111a2/raw/lol.js"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "gitattributes - Defining attributes per path Set"}, {"role": "assistant", "content": "A path to which the diff attribute is set is treated\nas text, even when they contain byte values that\nnormally never appear in text files, such as NUL."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Unable to print string containing double quotes in GitLab CI YAML\n\nI'm using the CI Lint tester to try and figure out how to store an expected JSON result, which I later compare to a curl response. Neither of these work:\nAttempt 1\n---\n image: ruby:2.1\n script:\n - EXPECT_SERVER_OUTPUT='{\"message\": \"Hello World\"}'\n\nFails with:\n\ndid not find expected key while parsing a block mapping at line 4 column 5\n\nAttempt 2\n---\n image: ruby:2.1\n script:\n - EXPECT_SERVER_OUTPUT=\"{\\\"message\\\": \\\"Hello World\\\"}\"\n\nFails with:\n\njobs:script config should be a hash\n\nI've tried using various combinations of echo as well, without a working solution."}, {"role": "assistant", "content": "You could use literal block scalar1 style notation and put the variable definition and subsequent script lines on separate lines2 without worrying about quoting:\nmyjob:\n script:\n - |\n EXPECT_SERVER_OUTPUT='{\"message\": \"Hello World\"}'\n\nor you can escape the nested double quotes:\nmyjob:\n script:\n - \"EXPECT_SERVER_OUTPUT='{\\\"message\\\": \\\"Hello World\\\"}'\"\n\nbut you may also want to just use variables like:\nmyjob:\n variables:\n EXPECT_SERVER_OUTPUT: '{\"message\": \"Hello World\"}'\n script:\n - dothething.sh\n\nNote: variables are by default expanded inside variable definitions so take care with any $ characters inside the variable value (they must be written as $$ to be literal). This feature can also be turned off.\n1See this answer for an explanation of this and related notation\n2See this section of the GitLab docs for more info on multi-line commands"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Git apply patch fails silently (no errors but nothing happens)\nI'm trying to apply a patch, and git apply patch doesn't give me any errors:\nsashoalm@SASHOALM-PC /c/Workspace/tesseract-git/api (master)\n$ git apply ../../commit-d0d9477\n\nsashoalm@SASHOALM-PC /c/Workspace/tesseract-git/api (master)\n$\n\nAs you can see, no error messages are given. But when I open the history, nothing is committed, and the index is empty. It's as if I haven't issued the git apply command.\nI'm at a loss how to troubleshoot this, since there no errors to Google.\nEdit: I forgot to say, but I'm trying to transplant my patches from a repository of Tesseract, where I got the source without version control, created my own empty git repo, and made some commits. Later I cloned the Tesseract repository using git svn, and now I'm trying to move my patches there."}, {"role": "assistant", "content": "I found this while googling for the issue: http://data.agaric.com/git-apply-does-not-work-from-within-local-checkout-unrelated-git-repository\n\ngit apply will fail to do anything when used within a local checkout of a git repository (other than the one for the project the patch is made for), such as if you are patching a module that is within a site that is in Git version control. \nUse patch -p1 < path/file.patch instead."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Git log: filter by commit's author date\nI have such a commit\ncommit 8a183536da1641afa6bd5a27ae391b387b7cd052\nAuthor: hidden\nAuthorDate: Fri Sep 7 10:13:59 2012\nCommit: hidden\nCommitDate: Fri Dec 7 17:29:24 2012\n\nI want to filter the log and show the commit by AuthorDate.\nI tried --since & --until options, but it actually filter the CommitDate.\nThat means I can only get the commit by \ngit log --since='2012-12-01' --until='2012-12-10'\n\nIf I want to get the commit filter by start_date '2012-09-01' and end_date '2012-09-10'\nAny tips?"}, {"role": "assistant", "content": "git log --format=format:\"%ai %aE %s\"\n\nand then grep by AuthorName and/or date!"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-for-each-ref - Output information on each ref describe[:options]"}, {"role": "assistant", "content": "A human-readable name, like git-describe ;\nempty string for undescribable commits. The describe string may\nbe followed by a colon and one or more comma-separated options. tags= Instead of only considering annotated tags, consider\nlightweight tags as well; see the corresponding option in git-describe for details. abbrev= Use at least hexadecimal digits; see the corresponding\noption in git-describe for details. match= Only consider tags matching the given glob(7) pattern,\nexcluding the \"refs/tags/\" prefix; see the corresponding option\nin git-describe for details. exclude= Do not consider tags matching the given glob(7) pattern,\nexcluding the \"refs/tags/\" prefix; see the corresponding option\nin git-describe for details."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-log - Show commit logs --no-walk[=(sorted|unsorted)]"}, {"role": "assistant", "content": "Only show the given commits, but do not traverse their ancestors.\nThis has no effect if a range is specified. If the argument unsorted is given, the commits are shown in the order they were\ngiven on the command line. Otherwise (if sorted or no argument\nwas given), the commits are shown in reverse chronological order\nby commit time.\nCannot be combined with --graph ."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-merge-base - Find as good common ancestors as possible for a merge --fork-point"}, {"role": "assistant", "content": "Find the point at which a branch (or any history that leads\nto ) forked from another branch (or any reference)\n. This does not just look for the common ancestor of\nthe two commits, but also takes into account the reflog of\n to see if the history leading to forked from\nan earlier incarnation of the branch (see discussion\nof this mode below)."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-diff - Show changes between commits, commit and working tree, etc changes"}, {"role": "assistant", "content": "Compute the dirstat numbers by counting the lines that have been\nremoved from the source, or added to the destination. This ignores\nthe amount of pure code movements within a file. In other words,\nrearranging lines in a file is not counted as much as other changes.\nThis is the default behavior when no parameter is given."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Docker volume cleanup of gitlab-runner\n\nI am new to docker and jenkins. However ultimately I am creating a job in jenkins so that I can delete the volume cache of gitlab-runner which is stored in our linux machines (CentOS7)\nTo achieve this, I am creating a periodic job every 6 hours with the following command in jenkins:\ndocker volume prune -f \n\nHowever it doesn't clean up the space at all. This is the output of jenkins job :\nStarted by timer\nRunning as SYSTEM\nBuilding remotely on buildbng17 (gitlab) in workspace /mnt/data0/jenkins/workspace/gitlab-cleanup\n[WS-CLEANUP] Deleting project workspace...\n[WS-CLEANUP] Deferred wipeout is used...\n[WS-CLEANUP] Done\n[gitlab-cleanup] $ /bin/sh -xe /tmp/jenkins3799570002967825583.sh\n+ find /mnt/data0/gitlab/data/backups/ -name '*.tgz' -mtime +30\n/mnt/data0/gitlab/data/backups/etc-gitlab-1611415968.tgz\nStarted calculate disk usage of build\nFinished Calculation of disk usage of build in 0 seconds\nStarted calculate disk usage of workspace\nFinished Calculation of disk usage of workspace in 0 seconds\nFinished: SUCCESS\n\nWhen I went to my buildbng17 machine and checked if there is any volume their, so there was volume which I had to clean up by performing\ndocker volume prune\n\nThe only drawback is that I need to do it manually and give that \"y\" when it asks for confirmation. And the data gets clean.\nWhat command should I give in jenkins so that it will automatically clean up the volume without asking for confirmation? (because docker volume prune -f is not working)\nI even tried to run the docker volume prune -f command manually in my linux machine, it still doesn't clean up the volume and shows 0kb freed up (However there is the volume which I checked from docker volume ls)\nIs there any better approach we can do to automate it inside gitlab-runner itself ?\nOr some better feature of jenkins or docker of which I am not aware of?\nThe gitlab-runner keeps on running and covers the diskspace.\nOne more thing : We are using Gitlab and Gitlab-runner on docker.\nThanks in advance,\nSameer"}, {"role": "assistant", "content": "Run these commands to do cleanup:\n# Remove exited containers\ndocker ps -a -q -f status=exited | xargs --no-run-if-empty docker rm -v\n\n# Remove dangling images\ndocker images -f \"dangling=true\" -q | xargs --no-run-if-empty docker rmi\n\n# Remove unused images\ndocker images | awk '/ago/ { print $3}' | xargs --no-run-if-empty docker rmi\n\n# Remove dangling volumes\ndocker volume ls -qf dangling=true | xargs --no-run-if-empty docker volume rm"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "There isn't anything to compare. Nothing to compare, branches are entirely different commit histories\n\nI have a CMS theme installed on my machine. I'm tracking changes to it via git\nand decided to back it up on GitHub so I could share those changes.\nThe theme as provided is also available on GitHub. On my machine I have added\nthis as a remote upstream. Now I can easily see the changes between my master\nand the remote upstream by using the following command:\ngit diff --color master upstream/number\n\nIf I could add the remote upstream on GitHub I could easily share these changes.\nIs it possible to set this relationship on GitHub?\nI have tried the following:\ngit push -u origin upstreambranch\n\nwhich adds an upstreambranch to the master on GitHub. However trying to\ncompare both branches doesn't work, the result I get on GitHub is that: \"There\nisn't anything to compare\"\nIs there an alternative way to compare these?"}, {"role": "assistant", "content": "If the problem is \"main and master are entirely different commit histories.\", the following will work\ngit checkout master \ngit branch main master -f \ngit checkout main \ngit push origin main -f"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-rev-parse - Pick out and massage parameters --sq-quote"}, {"role": "assistant", "content": "Use git rev-parse in shell quoting mode (see SQ-QUOTE\nsection below). In contrast to the --sq option below, this\nmode only does quoting. Nothing else is done to command input."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-merge - Join two or more development histories together diff-algorithm=[patience|minimal|histogram|myers]"}, {"role": "assistant", "content": "Use a different diff algorithm while merging, which can help\navoid mismerges that occur due to unimportant matching lines\n(such as braces from distinct functions). See also git-diff --diff-algorithm . Note that ort specifically uses diff-algorithm=histogram , while recursive defaults to the diff.algorithm config setting."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Can I make releases public from a private github repo?\n\nI have an application which is in a private github repo, and am wondering if the releases could be made public so that the app can auto-update itself from github instead of us having to host it.\nAdditionally I'm wondering if it's possible to use the github api from the deployed app to check for new updates."}, {"role": "assistant", "content": "A workaround would be to create a public repo, composed of:\n\nempty commits (git commit --allow-empty)\neach commit tagged\neach tag with a release\neach release with the deliveries (the binaries of your private app)\n\nThat way, you have a visible repo dedicated for release hosting, and a private repos for source development."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Create a GitHub webhook for when a pull request is accepted & merged to master\nI have a webhook that currently fires on push to any branch. This triggers the webhook far too frequently. Ideally, the webhook would only fire when a pull request is merged into master. I don't see that as an option, though:\n\nIs there a way to get additional webhook options or to customize the webhook somehow?"}, {"role": "assistant", "content": "So, you can't customize the conditions of the trigger, but as LeGec mentions you can customize your code to only trigger when the Pull Request is merged.\nTo do that, make sure your script responds to the PullRequestEvent. The conditions to test are:\n\n\"action\" is \"closed\"\n\"merged\" (inside of \"pull_request\") is true\n\nThis way your script can ignore all the pings it receives when any other activity occurs on the Pull Request (including closing without merging)."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-config - Get and set repository or global options mergetool.writeToTemp"}, {"role": "assistant", "content": "Git writes temporary BASE , LOCAL , and REMOTE versions of\nconflicting files in the worktree by default. Git will attempt\nto use a temporary directory for these files when set true .\nDefaults to false ."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How to REALLY show logs of renamed files with Git\nI'm relatively new to Git. I used Subversion (SVN) before.\nI noticed that most of the graphical Git front-ends and IDE plugins don't seem to be able to display the history of a file if the file has been renamed. When I use\ngit log --follow\n\non the command line, I can see the whole log across renames.\nAccording to Linus Torvalds (alternative link) the --follow switch is a \"SVN noob\" pleaser; serious Git users don't use it:\n\n--follow is a total hack, meant to just satisfy ex-SVN users who never\nknew anything about things like\nparenthood or nice revision graphs\nanyway.\nIt's not totally fundamental, but the\ncurrent implementation of \"--follow\"\nis really a quick preprocessing thing\nbolted onto the revision walking\nlogic, rather than being anything\nreally integral.\nIt literally was designed as a \"SVN\nnoob\" pleaser, not as a \"real git\nfunctionality\" thing. The idea was\nthat you'd get away from the (broken)\nmindset of thinking that renames\nmatter in the big picture.\n\nHow do the hardcore Git users get the history of a file when it was renamed? What is the 'real' way to do this?"}, {"role": "assistant", "content": "I think that the general drive behind Linus' point is that—and take this with a pinch of salt—hardcore Git users don't ever care about the history of a \"file\". You put content in a Git repository because the content as a whole has a meaningful history.\nA file rename is a small special case of \"content\" moving between paths. You might have a function that moves between files which a Git user might track down with the \"pickaxe\" functionality (e.g., log -S).\nOther \"path\" changes include combining and splitting files; Git doesn't really care which file you consider renamed and which one you consider copied (or renamed and deleted). It just tracks the complete content of your tree.\nGit encourages \"whole tree\" thinking whereas many version control systems are very file-centric. This is why Git refers to \"paths\" more often than it refers to \"filenames\"."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How to merge a remote branch locally\nI've pulled all remote branches via git fetch --all. I can see the branch I'd like to merge via git branch -a as remotes/origin/branchname. Problem is it is not accessible. I can't merge or checkout."}, {"role": "assistant", "content": "You can reference those remote tracking branches ~(listed with git branch -r) with the name of their remote.\nYou need to fetch the remote branch:\ngit fetch origin aRemoteBranch\n\nIf you want to merge one of those remote branches on your local branch:\ngit checkout aLocalBranch\ngit merge origin/aRemoteBranch\n\nNote 1: For a large repo with a long history, you will want to add the --depth=1 option when you use git fetch.\nNote 2: These commands also work with other remote repos so you can setup an origin and an upstream if you are working on a fork.\nNote 3: user3265569 suggests the following alias in the comments:\n\nFrom aLocalBranch, run git combine remoteBranch\nAlias:\ncombine = !git fetch origin ${1} && git merge origin/${1}\n\n\n\nOpposite scenario: If you want to merge one of your local branch on a remote branch (as opposed to a remote branch to a local one, as shown above), you need to create a new local branch on top of said remote branch first:\ngit checkout -b myBranch origin/aBranch\ngit merge anotherLocalBranch\n\nThe idea here, is to merge \"one of your local branch\" (here anotherLocalBranch) to a remote branch (origin/aBranch).\nFor that, you create first \"myBranch\" as representing that remote branch: that is the git checkout -b myBranch origin/aBranch part.\nAnd then you can merge anotherLocalBranch to it (to myBranch)."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Git pull after forced update\nI just squashed some commits with git rebase and did a git push --force (which is evil, I know).\nNow the other software engineers have a different history and when they do a git pull, Git will merge. Is there a way to fix this, except doing a rm my-repo; git clone [email protected]:my-repo.git?\nI need something like the opposite of git push --force, but git pull --force did not give the intended results."}, {"role": "assistant", "content": "To receive the new commits\ngit fetch\n\nReset\nYou can reset the commit for a local branch using git reset.\nTo change the commit of a local branch:\ngit reset origin/main --hard\n\nBe careful though, as the documentation puts it:\n\nResets the index and working tree. Any changes to tracked files in the working tree since are discarded.\n\nIf you want to actually keep whatever changes you've got locally - do a --soft reset instead. Which will update the commit history for the branch, but not change any files in the working directory (and you can then commit them).\nRebase\nYou can replay your local commits on top of any other commit/branch using git rebase:\ngit rebase -i origin/main\n\nThis will invoke rebase in interactive mode where you can choose how to apply each individual commit that isn't in the history you are rebasing on top of.\nIf the commits you removed (with git push -f) have already been pulled into the local history, they will be listed as commits that will be reapplied - they would need to be deleted as part of the rebase or they will simply be re-included into the history for the branch - and reappear in the remote history on the next push.\nUse the help git command --help for more details and examples on any of the above (or other) commands."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-shortlog - Summarize git log output - -n --max-count="}, {"role": "assistant", "content": "Limit the number of commits to output."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Create Pull Request Button is disabled\n\nI would like to make a pull request from my fork repo to the upstream repository.\nAs always I was following these steps here from the guidance from Github.\nBut this time I can not make a pull request, as the button is disabled.\nThe branches can be automatically merged.\nI do have changes in my forked repo and I can see commits made.\nBase repo and head repo are indicated correctly."}, {"role": "assistant", "content": "In my case, the pull request Title field didn't auto-populate like it usually does. Once I typed in a title, the button became active."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How to check if remote branch exists on a given remote repository?\nI need to do a subtree merge for a specific branch, if it exists on a given remote repository. The problem is that the remote repository is not checked out locally, so I can't use git branch -r. All I have is a remote address, something like this https://github.com/project-name/project-name.git. Is there a way to list remote branches just by a remote address? I couldn't find anything usefull :("}, {"role": "assistant", "content": "$ git ls-remote --heads [email protected]:user/repo.git refs/heads/[branch-name]\n# or\n$ git ls-remote --heads origin refs/heads/[branch-name]\n\nIn case [branch-name] is found you will get the following output:\nb523c9000c4df1afbd8371324083fef218669108 refs/heads/branch-name\n\nOtherwise no output will be sent.\nSo piping it to wc will give you 1 or 0:\n$ git ls-remote --heads [email protected]:user/repo.git refs/heads/[branch-name] | wc -l\n\nAlternatively you can set --exit-code flag on git ls-remote which will return exit code 2 in case no matching refs are found. The result can be checked directly in a shell test or by checking the status variable $?.\n$ git ls-remote --exit-code --heads [email protected]:user/repo.git refs/heads/[branch-name]\n\nNote that you should prefix the [branch-name] with refs/heads/ otherwise it will do partial matches, e.g. bar will match branches bar and foo/bar."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-config - Get and set repository or global options uploadpackfilter..allow"}, {"role": "assistant", "content": "Explicitly allow or ban the object filter corresponding to , where may be one of: blob:none , blob:limit , object:type , tree , sparse:oid , or combine .\nIf using combined filters, both combine and all of the nested\nfilter kinds must be allowed. Defaults to uploadpackfilter.allow ."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "In what ways is an SSH Key different from tokens for git authentication?\n\nI recently started getting notifications about the GitHub deprecation of basic authentication using a password to Git - see their blog post https://github.blog/2020-12-15-token-authentication-requirements-for-git-operations/.\nIn this post, they say the following:\n\nFor developers, if you are using a password to authenticate Git operations with GitHub.com today, you must begin using a personal access token over HTTPS (recommended) or SSH key by August 13, 2021, to avoid disruption.\n\nA short while ago, I started using SSH keys on some of the machines I use anyway to avoid entering my password regularly or storing it unencrypted with credential helper. However, as per above, they say personal access tokens are \"recommended\".\nWhat I would like to know is what are the key differences between each of these methods? This is to get some insight into why tokens are \"recommended\" and whether it is worth switching to this method of authentication."}, {"role": "assistant", "content": "From the blog post you linked, I can see at least one benefit of tokens over SSH keys: while tokens and SSH keys both share the Unique, Revocable, and Random benefits quoted in the blog post below, tokens are also Limited in comparison to SSH keys in that they come with their own scoped permissions baked in:\n\nWhile SSH keys can be read-only or read-write enabled, or scoped to specific repositories, personal access tokens do have an edge in terms of their finer-grained permissions model in comparison. This is likely why GitHub recommends tokens over SSH keys.\n\nTokens offer a number of security benefits over password-based\nauthentication:\n\nUnique – tokens are specific to GitHub and can be generated per use or\nper device\nRevocable – tokens can can be individually revoked at any\ntime without needing to update unaffected credentials\nLimited – tokens\ncan be narrowly scoped to allow only the access necessary for the use\ncase\nRandom – tokens are not subject to the types of dictionary or\nbrute force attempts that simpler passwords that you need to remember\nor enter regularly might be"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-log - Show commit logs --full-history without parent rewriting"}, {"role": "assistant", "content": "This mode differs from the default in one point: always follow\nall parents of a merge, even if it is TREESAME to one of them.\nEven if more than one side of the merge has commits that are\nincluded, this does not imply that the merge itself is! In\nthe example, we get I A B N D O P Q M was excluded because it is TREESAME to both parents. E , C and B were all walked, but only B was !TREESAME, so the others\ndo not appear. Note that without parent rewriting, it is not really possible to talk\nabout the parent/child relationships between the commits, so we show\nthem disconnected."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git - the stupid content tracker git-rebase"}, {"role": "assistant", "content": "Reapply commits on top of another base tip"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git - the stupid content tracker git-for-each-repo"}, {"role": "assistant", "content": "Run a Git command on a list of repositories"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Is there a way to use OR condition with needs in GitLab CI job\n\nI am trying to create a job dependency with \"OR\" condition for previous stage jobs using \"needs\" in \".gitlab.ci.yml\" file but unable to find a solution for this.\n.gitlab-ci.yml file ->\nstages:\n - build\n - test\n - deploy\n\n\nBuild_job: \n stage: build\n script:\n - echo \"hello from build job\"\n\nTest_job1:\n stage: test\n script:\n - echo \"Start test 1\"\n when: manual\n\nTest_job2:\n stage: test\n script:\n - echo \"Start test 2\"\n when: manual\n\nDeploy_job:\n stage: deploy\n script:\n - echo \"Start deploying the job\"\n when: manual\n needs:\n - job: Test_job1\n optional: true\n - job: Test_job2\n optional: true\n\nMy aim is either of Test_job1 or Test_job2 is passed Deploy_job should be enabled.\nBut with the above code, I am unable to do so as Deploy_job is getting enabled only when both previous two test jobs are passed.\n\nIs there a way if something can be used like needs: [Test_job1 or Test_job2]?"}, {"role": "assistant", "content": "The needs:optional: keyword is confusingly named. It is for setting up needs: requirements when jobs might not exist in the pipeline due to other pipeline/job logic (the jobs can optionally exist).\nHowever, any optional needs:job: names that do exist in the pipeline will all be required.\nI see a few options to get close to your desired pipeline:\nautomation path\nYou could use the rules: keyword in your Test_job jobs to conditionally add them to the pipeline.\nThe humans that are deciding which Test_job to run (an assumption based on the fact that you're using when: manual) are likely following decision logic of some sort--or a preset decision logic can be decided on by the team. You would then build that logic into your needs:if: condition to determine whether or not your Test_job# jobs exist in the pipeline--then only the Test_jobs that are added to the pipeline will be required by the Deploy_job:.\nFor example, if one test should run on your default branch and the other on feature branches, you could use the following to automatically run the relevant Test_job and have the Deploy_job depend on it:\nTest_job1:\n stage: test\n script:\n - echo \"Start test 1\"\n # this job is only added for pipelines on the default branch\n rules:\n - if $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH\n when: on_success\n - when: never\n\nTest_job2:\n stage: test\n script:\n - echo \"Start test 2\"\n # this job is only added for pipelines NOT on the default branch\n rules:\n - if $CI_COMMIT_REF_NAME != $CI_DEFAULT_BRANCH\n when: on_success\n - when: never\n\nDeploy_job:\n stage: deploy\n script:\n - echo \"Start deploying the job\"\n # this is the default value, it's added here to show the automation difference from the question's pipeline\n rules:\n - when: on_success\n # depend on Test_job1 AND Test_job2 if they individually exist in the pipeline\n needs:\n - job: Test_job1\n optional: true\n - job: Test_job2\n optional: true\n\nmanual path\nYou could swap when:manual back in place for when:on_success if you still need humans in the loop on triggering the test jobs or deploy job.\nreally manual path\nAlternatively, if you really just want your humans to manually make the Test_job: decisions ad-hoc, then just remove the needs: keyword from your Deploy_job: and use the existing Stage dependency structure. The when: manual key implicitly sets allow_failure: true, so your jobs are already optional as is. If your humans can't be trusted to manage the \"Test before Deploy\" dependency on their own with manual jobs, then take the humans out of the loop and see the \"automation path\" above."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Failed to add the host to the list of know hosts\n\nMac OSX Lion 10.7.\nIn an effort to get around weird environment stuff (homebrew wasn't installing wget, and I had all sorts of weird blocks and errors), I uninstalled zschrc and homebrew and a bunch of other stuff, then installed fish shell.\nNow, whenever I try to push/pull to/from github, I get this error:\nThe authenticity of host 'github.com (204.232.175.90)' can't be established.\nRSA key fingerprint is .\nAre you sure you want to continue connecting (yes/no)? yes\nFailed to add the host to the list of known hosts (/Users/sasha/.ssh/known_hosts).\n\nSo I tried to check the permissions of my ~./ssh folder, and got this, which looks fine to me:\n-rw-r--r-- 1 sasha staff 97B Jul 9 22:56 config\n-rw------- 1 sasha staff 1.7K May 16 2012 id_rsa\n-rw-r--r-- 1 sasha staff 403B May 16 2012 id_rsa.pub\ndrwx------ 5 sasha staff 170B Jul 15 09:56 known_hosts\n\nAll that's in known_hosts is a pem file I used for ssh'ing (also with the \"authenticity...\" prompt) to an Amazon ec2 instance, though I tried copying id_rsa and id_rsa.pub there when things got desperate. \nAny idea what's going on? I'd love to fix this so I don't get prompted all the many times I push/pull.\nEDIT I followed these instructions successfully a while ago, so I do have my ssh keys on Github, and they're recognized, so that when I run ssh -T [email protected], I get \nHi sashafklein! You've successfully authenticated, but GitHub does not provide shell access.\n\nIt seems to be exclusively my local computer that's unhappy with my ssh situation."}, {"role": "assistant", "content": "In your specific case, your known_hosts is a folder, so you need to remove it first.\nFor other people which experiencing similar issue, please check the right permission to your ~/ssh/known_hosts as it may be owned by different user (e.g. root). So you may try to run:\nsudo chown -v $USER ~/.ssh/known_hosts\n\nto fix it."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Move .git repo to parent directory [duplicate]\nThis question already has answers here:\n \n \n\n\n\n\nMy Git repository is in the wrong root directory. Can I move it? (../ instead of ./)\n\n (10 answers)\n \n\nClosed 7 years ago.\n\n\n\nI have a subdirectory named \"www\" that is a repo:\nsite\n|-- www/\n| |-- .git/\n| |-- index.html\n|-- design/\n| |-- images.jpg\n\nI'd like to change the repo to the parent directory so that the repo structure mirrors the original file structure as follows:\nsite\n|-- .git/\n|-- www/\n| |-- index.html\n|-- design/\n| |-- images.jpg\n\nCan this be done? Are there implications with then pushing the changes up to Gitlab?"}, {"role": "assistant", "content": "Create a www directory in your repo.\ngit mv the HTML files to that directory. Optionally commit this step.\nmv the design directory into your repo, and git add .\nCommit.\nRename/move your whole repo."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-log - Show commit logs --no-prefix"}, {"role": "assistant", "content": "Do not show any source or destination prefix."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Using someone else's repo as a Git Submodule on GitHub\n\nI am trying to find out if it is possible to use someone else's repository (or branch of a repository) as a Submodule in your own Git repository. Documentation on github itself is either missing, or I'm not using the right terminology to look for it. If this isn't the preferred way to go about including a public repository as a shared library within ones git project, suggestions as an alternative best practice would be appreciated."}, {"role": "assistant", "content": "Yes, you can add any repository as a submodule in your project. Just do:\ngit submodule add git://github.com/whomsoever/whatever.git\n\n... in the top level of your repository. This is indeed the easiest way with git to use some existing useful repository within your own. For more information on submodules, you could look at:\n\nPro Git's section on submodules\nThe quite readable bit in the git manual\nThe section on submodules in the git community book\n\nUpdate: as jfountain points out below, if you want to add the submodule at a subdirectory path (or with a name different from the default) you can supply that as an additional parameter to that command, e.g.:\ngit submodule add git://github.com/whomsoever/whatever.git foo/bar"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git - the stupid content tracker GIT_TRACE"}, {"role": "assistant", "content": "Enables general trace messages, e.g. alias expansion, built-in\ncommand execution and external command execution. If this variable is set to \"1\", \"2\" or \"true\" (comparison\nis case insensitive), trace messages will be printed to\nstderr. If the variable is set to an integer value greater than 2\nand lower than 10 (strictly) then Git will interpret this\nvalue as an open file descriptor and will try to write the\ntrace messages into this file descriptor. Alternatively, if the variable is set to an absolute path\n(starting with a / character), Git will interpret this\nas a file path and will try to append the trace messages\nto it. Unsetting the variable, or setting it to empty, \"0\" or\n\"false\" (case insensitive) disables trace messages."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-config - Get and set repository or global options advice.*"}, {"role": "assistant", "content": "These variables control various optional help messages designed to\naid new users. When left unconfigured, Git will give the message\nalongside instructions on how to squelch it. You can tell Git\nthat you do not need the help message by setting these to false : addEmbeddedRepo Shown when the user accidentally adds one\ngit repo inside of another. addEmptyPathspec Shown when the user runs git add without providing\nthe pathspec parameter. addIgnoredFile Shown when the user attempts to add an ignored file to\nthe index. amWorkDir Shown when git-am fails to apply a patch\nfile, to tell the user the location of the file. ambiguousFetchRefspec Shown when a fetch refspec for multiple remotes maps to\nthe same remote-tracking branch namespace and causes branch\ntracking set-up to fail. checkoutAmbiguousRemoteBranchName Shown when the argument to git-checkout and git-switch ambiguously resolves to a\nremote tracking branch on more than one remote in\nsituations where an unambiguous argument would have\notherwise caused a remote-tracking branch to be\nchecked out. See the checkout.defaultRemote configuration variable for how to set a given remote\nto be used by default in some situations where this\nadvice would be printed. commitBeforeMerge Shown when git-merge refuses to\nmerge to avoid overwriting local changes. detachedHead Shown when the user uses git-switch or git-checkout to move to the detached HEAD state, to tell the user how\nto create a local branch after the fact. diverging Shown when a fast-forward is not possible. fetchShowForcedUpdates Shown when git-fetch takes a long time\nto calculate forced updates after ref updates, or to warn\nthat the check is disabled. forceDeleteBranch Shown when the user tries to delete a not fully merged\nbranch without the force option set. ignoredHook Shown when a hook is ignored because the hook is not\nset as executable. implicitIdentity Shown when the user’s information is guessed from the\nsystem username and domain name, to tell the user how to\nset their identity configuration. mergeConflict Shown when various commands stop because of conflicts. nestedTag Shown when a user attempts to recursively tag a tag object. pushAlreadyExists Shown when git-push rejects an update that\ndoes not qualify for fast-forwarding (e.g., a tag.) pushFetchFirst Shown when git-push rejects an update that\ntries to overwrite a remote ref that points at an\nobject we do not have. pushNeedsForce Shown when git-push rejects an update that\ntries to overwrite a remote ref that points at an\nobject that is not a commit-ish, or make the remote\nref point at an object that is not a commit-ish. pushNonFFCurrent Shown when git-push fails due to a\nnon-fast-forward update to the current branch. pushNonFFMatching Shown when the user ran git-push and pushed\n\"matching refs\" explicitly (i.e. used : , or\nspecified a refspec that isn’t the current branch) and\nit resulted in a non-fast-forward error. pushRefNeedsUpdate Shown when git-push rejects a forced update of\na branch when its remote-tracking ref has updates that we\ndo not have locally. pushUnqualifiedRefname Shown when git-push gives up trying to\nguess based on the source and destination refs what\nremote ref namespace the source belongs in, but where\nwe can still suggest that the user push to either refs/heads/* or refs/tags/* based on the type of the\nsource object. pushUpdateRejected Set this variable to false if you want to disable pushNonFFCurrent , pushNonFFMatching , pushAlreadyExists , pushFetchFirst , pushNeedsForce , and pushRefNeedsUpdate simultaneously. refSyntax Shown when the user provides an illegal ref name, to\ntell the user about the ref syntax documentation. resetNoRefresh Shown when git-reset takes more than 2\nseconds to refresh the index after reset, to tell the user\nthat they can use the --no-refresh option. resolveConflict Shown by various commands when conflicts\nprevent the operation from being performed. rmHints Shown on failure in the output of git-rm , to\ngive directions on how to proceed from the current state. sequencerInUse Shown when a sequencer command is already in progress. skippedCherryPicks Shown when git-rebase skips a commit that has already\nbeen cherry-picked onto the upstream branch. statusAheadBehind Shown when git-status computes the ahead/behind\ncounts for a local ref compared to its remote tracking ref,\nand that calculation takes longer than expected. Will not\nappear if status.aheadBehind is false or the option --no-ahead-behind is given. statusHints Show directions on how to proceed from the current\nstate in the output of git-status , in\nthe template shown when writing commit messages in git-commit , and in the help message shown\nby git-switch or git-checkout when switching branches. statusUoption Shown when git-status takes more than 2\nseconds to enumerate untracked files, to tell the user that\nthey can use the -u option. submoduleAlternateErrorStrategyDie Shown when a submodule.alternateErrorStrategy option\nconfigured to \"die\" causes a fatal error. submoduleMergeConflict Advice shown when a non-trivial submodule merge conflict is\nencountered. submodulesNotUpdated Shown when a user runs a submodule command that fails\nbecause git submodule update --init was not run. suggestDetachingHead Shown when git-switch refuses to detach HEAD\nwithout the explicit --detach option. updateSparsePath Shown when either git-add or git-rm is asked to update index entries outside the current sparse\ncheckout. waitingForEditor Shown when Git is waiting for editor input. Relevant\nwhen e.g. the editor is not launched inside the terminal. worktreeAddOrphan Shown when the user tries to create a worktree from an\ninvalid reference, to tell the user how to create a new unborn\nbranch instead."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Comment on a line in Github without a commit?\n\nIn github, you can comment on lines in a commit. Is there a way to comment on a line, while viewing a file in a branch, without having a particular commit?"}, {"role": "assistant", "content": "Unfortunately it is not possible to comment on a line in Github without a commit.\nBut you can create links to lines in your file (click on line and copy link on browser bar). For example you can use this links in your issues to discuss about code line:\nhttps://github.com/laravel/framework/blob/10.x/README.md?plain=1#L1\nUpdate\nYou can also hold shift to obtain a link to a block of lines"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-diff - Show changes between commits, commit and working tree, etc --patch-with-stat"}, {"role": "assistant", "content": "Synonym for -p --stat ."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How can I commit files with git?\nNone of the tutorials will help!\nThey all do that thing where they just assume I know what to do..\nCurrently, my terminal window starts with..\n# Please enter the commit message for your changes. Lines starting\n# with '#' will be ignored, and an empty message aborts the commit.\n# On branch master\n# Changes to be committed:\n# (use \"git reset HEAD ...\" to unstage)\n#\n# deleted: httpdocs/newsite/manifest/cache/0a432970ba6491fe65dad60b012e5c95_louloumay2011en-1-4dea3186b7f7b.jpg\n# deleted: httpdocs/newsite/manifest/cache/0a61b5d7a9e97da78fe602e1ad41edb6_5-4dec7c3d57c80.jpg\n# deleted: httpdocs/newsite/manifest/cache/0afb6a7716a85d0de46cdd03bb30f75f_fifa_panorama_full_page-01_thu-4dea3d1a0e0f5.jpg\n# deleted: httpdocs/newsite/manifest/cache/0b3bc9be76a5d3e1e36af4b8dcf98658_free2-4df0e2e08761f.jpg\n# deleted: httpdocs/newsite/manifest/cache/0b6342913b8e599fac76da452af98ec5_si-feb-2009-1-4dea3d1abcb61.jpg\n# deleted: httpdocs/newsite/manifest/cache/0b9ddc587340f7744e03c4b2dafacf7f_lou-lou-winter-2009-cover-4dea3d1a9b1a0.jpg\n# deleted: httpdocs/newsite/manifest/cache/0bf64ff8fc22720b3da20d0730fa6a04_chatelaine-dec-2009-4dea3d18daa30.jpg\n# deleted: httpdocs/newsite/manifest/cache/0bf664e03eb0a2255b69b02aed85add0_summumfeb2011-2-4dea3188766aa.jpg\n\nbut there's no way to know how to do what they say to do here..\nhttp://learn.github.com/p/normal.html\nAll it says is\n\nWe simply type our commit message and exit the editor.\n\nWhat does that mean?!\nJust because you write the word simply doesn't mean it is simple..\nWhen I start to type it does wierd stuff, says \"recording\" or \"inserting\" and there are about 300 files, and it wants me to replace every line with a message?!?\nHelp !\nI would use their handy Mac application for this, but if it's over 20 files or so, it freezes up !\nWhat's up with that??"}, {"role": "assistant", "content": "When you run git commit with no arguments, it will open your default editor to allow you to type a commit message. Saving the file and quitting the editor will make the commit.\nIt looks like your default editor is Vi or Vim. The reason \"weird stuff\" happens when you type is that Vi doesn't start in insert mode - you have to hit i on your keyboard first! If you don't want that, you can change it to something simpler, for example:\ngit config --global core.editor nano\n\nThen you'll load the Nano editor (assuming it's installed!) when you commit, which is much more intuitive for users who've not used a modal editor such as Vi.\nThat text you see on your screen is just to remind you what you're about to commit. The lines are preceded by # which means they're comments, i.e. Git ignores those lines when you save your commit message. You don't need to type a message per file - just enter some text at the top of the editor's buffer.\nTo bypass the editor, you can provide a commit message as an argument, e.g.\ngit commit -m \"Added foo to the bar\""}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git apply changes from one commit onto another branch\nI want to do something similar to git rebase but without collapsing parallel commits.\nLet's say I have the following commits:\n B (bar)\n /\nA-C-D (foo)\n\nNow I want to take the changes that D introduced to C in branch foo, and apply them to B in branch bar. so that I end up with the following:\n B-E (bar)\n /\nA-C-D (foo)\n\nWhere the difference between commits B and E is equal to difference between commits C and D. Is this possible? Is there a way to do it without creating a patch?"}, {"role": "assistant", "content": "Yes:\ngit checkout -b mergebranch B\ngit cherry-pick D"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-diff - Show changes between commits, commit and working tree, etc diff.autoRefreshIndex"}, {"role": "assistant", "content": "When using git diff to compare with work tree\nfiles, do not consider stat-only changes as changed.\nInstead, silently run git update-index --refresh to\nupdate the cached stat information for paths whose\ncontents in the work tree match the contents in the\nindex. This option defaults to true. Note that this\naffects only git diff Porcelain, and not lower level diff commands such as git diff-files ."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-config - Get and set repository or global options core.editor"}, {"role": "assistant", "content": "Commands such as commit and tag that let you edit\nmessages by launching an editor use the value of this\nvariable when it is set, and the environment variable GIT_EDITOR is not set. See git-var ."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-rev-list - Lists commit objects in reverse chronological order --until= --before="}, {"role": "assistant", "content": "Show commits older than a specific date."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-log - Show commit logs first-parent, 1"}, {"role": "assistant", "content": "Show full diff with respect to first parent. This is the same\nformat as --patch produces for non-merge commits."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git - the stupid content tracker GIT_CONFIG_NOSYSTEM"}, {"role": "assistant", "content": "Whether to skip reading settings from the system-wide $(prefix)/etc/gitconfig file. This Boolean environment variable can\nbe used along with $HOME and $XDG_CONFIG_HOME to create a\npredictable environment for a picky script, or you can set it\nto true to temporarily avoid using a buggy /etc/gitconfig file while\nwaiting for someone with sufficient permissions to fix it."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How to apply a git patch from one repository to another?\nI have two repositories, one is the main repo for a library, and the other is a project using that library.\nIf I make a fix to the in the subservient project, I'd like an easy way to apply that patch back upstream.\nThe file's location is different in each repository.\n\nMain repo: www.playdar.org/static/playdar.js\nProject: playlick.com/lib/playdar.js\n\nI tried using git format-patch -- lib/playdar.js on the playlick project, and then git am on the main playdar repo, but the differing file locations in the patch file raised an error.\nIs there an easy way to apply the patch from a given commit on a given file to another arbitrary file elsewhere?\nFor bonus points, what if the file you want to apply the patch to isn't in a git repository?"}, {"role": "assistant", "content": "If manually editing the patch file is out of the question or infeasible, this can be done with standard options (available in git apply, git format-patch and GNU patch).\n\n-p removes n leading directories from the paths in the patch.\nAfter processing -p, --directory= prepends root to each of the paths in the patch before applying.\n\nExample\nSo, for your example, to take a patch that was originally on static/playdar.js and apply it to lib/playdar.js, you would run:\n$ cat patch_file | git am \\ \n -p1 \\ # remove 1 leading directory ('static/')\n --directory='lib/' # prepend 'lib/'"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Unable to find stash/apply functionalitit in EGit\nI'm working with Eclipse Kepler and EGit 3.0.0. Where can I find the GIT stash/apply functionality.\nI cannot find stash in the package explorer team pop-up nor anywhere in the Team Synchronizing perspective."}, {"role": "assistant", "content": "After all I found it, hidden in the \"Git Repository view\":"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Git: Remove committed file after push\n\nIs there a possibility to revert a committed file in Git? I've pushed a commit to GitHub and then I realized that there's a file which I didn't want to be pushed (I haven't finished the changes)."}, {"role": "assistant", "content": "update: added safer method\npreferred method:\n\ncheck out the previous (unchanged) state of your file; notice the double dash \ngit checkout HEAD^ -- /path/to/file\n\ncommit it:\ngit commit -am \"revert changes on this file, not finished with it yet\"\n\npush it, no force needed:\ngit push\n\nget back to your unfinished work, again do (3 times arrow up):\ngit checkout HEAD^ -- /path/to/file\n\n\neffectively 'uncommitting':\nTo modify the last commit of the repository HEAD, obfuscating your accidentally pushed work, while potentially running into a conflict with your colleague who may have pulled it already, and who will grow grey hair and lose lots of time trying to reconcile his local branch head with the central one:\nTo remove file change from last commit:\n\nto revert the file to the state before the last commit, do:\ngit checkout HEAD^ /path/to/file\n\nto update the last commit with the reverted file, do:\ngit commit --amend\n\nto push the updated commit to the repo, do:\ngit push -f\n\n\nReally, consider using the preferred method mentioned before."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-am - Apply a series of patches from a mailbox"}, {"role": "assistant", "content": "DESCRIPTION Splits mail messages in a mailbox into commit log messages,\nauthorship information, and patches, and applies them to the\ncurrent branch. You could think of it as a reverse operation\nof git-format-patch run on a branch with a straight\nhistory without merges."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git - the stupid content tracker GIT_TRACE2"}, {"role": "assistant", "content": "Enables more detailed trace messages from the \"trace2\" library.\nOutput from GIT_TRACE2 is a simple text-based format for human\nreadability. If this variable is set to \"1\", \"2\" or \"true\" (comparison\nis case insensitive), trace messages will be printed to\nstderr. If the variable is set to an integer value greater than 2\nand lower than 10 (strictly) then Git will interpret this\nvalue as an open file descriptor and will try to write the\ntrace messages into this file descriptor. Alternatively, if the variable is set to an absolute path\n(starting with a / character), Git will interpret this\nas a file path and will try to append the trace messages\nto it. If the path already exists and is a directory, the\ntrace messages will be written to files (one per process)\nin that directory, named according to the last component\nof the SID and an optional counter (to avoid filename\ncollisions). In addition, if the variable is set to af_unix:[:] , Git will try\nto open the path as a Unix Domain Socket. The socket type\ncan be either stream or dgram . Unsetting the variable, or setting it to empty, \"0\" or\n\"false\" (case insensitive) disables trace messages. See Trace2 documentation for full details."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "SSH Key - Still asking for password and passphrase\n\nI've been somewhat 'putting up' with Github always asking for my username and password when I clone a repository. I want to bypass this step because it is an annoyance within my workflow. \nI tried setting up an SSH key (which I successfully did) using this guide. https://help.github.com/articles/generating-ssh-keys and I was successful. \nMy problem is that I am still asked for my github password and passphrase when cloning a repository (using SSH). My understanding was that after I set up this SSH key, I would no longer have to do that.\nI am a little unsure what to ask, so I will just state my goal. \n\nI want to be able to clone repositories without having to put in my Github information all the time.\n\nWhat am I missing with my SSH key? If anyone can provide some guidance or resources I would appreciate it, because I've always felt a little lost when it came to SSH authentication in GitHub.\nFrom my knowledge, this is a command that tests if things are working properly, here are the output from my console:\n~ $ ssh -T [email protected]\nSaving password to keychain failed\nEnter passphrase for key '/Users/MYNAME/.ssh/id_rsa':\nHi MYNAME! You've successfully authenticated, but GitHub does not provide shell access.\n\nWhen I input my password, should that fail first? Then, when I enter my passphrase, it passes."}, {"role": "assistant", "content": "Add Identity without Keychain\nThere may be times in which you don't want the passphrase stored in the keychain, but don't want to have to enter the passphrase over and over again.\nYou can do that like this:\nssh-add ~/.ssh/id_rsa \n\nThis will ask you for the passphrase, enter it and it will not ask again until you restart.\nAdd Identity Using Keychain\nAs @dennis points out in the comments, to persist the passphrase through restarts by storing it in your keychain, you can use the --apple-use-keychain option (-k for Ubuntu) when adding the identity like this:\nssh-add --apple-use-keychain ~/.ssh/id_rsa\n\nOnce again, this will ask you for the passphrase, enter it and this time it will never ask again for this identity."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-log - Show commit logs --output-indicator-new= --output-indicator-old= --output-indicator-context="}, {"role": "assistant", "content": "Specify the character used to indicate new, old or context\nlines in the generated patch. Normally they are + , - and\n' ' respectively."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-show - Show various types of objects %N"}, {"role": "assistant", "content": "commit notes"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Cherry pick shows no -m option was given error\nI have two branch master and development\nI need to get some commit id from development branch in master branch so I do it by cherry-pick but it shows me some error\n$> git cherry-pick cf0d52b\n\nerror: Commit cf0d52b900f990300c3aa17936ddbae1476d461a is a merge but no -m option was given.\nfatal: cherry-pick failed\n\nI am not getting this error, why this error comes and how will I get rid of this."}, {"role": "assistant", "content": "You are trying to cherry-pick a merge. A merge is build up from at several parents. You have to supply the parent id to the merge.\nYou have to supply any of the followings:\n\n-m parent-number / --mainline parent-number\nUsually you cannot cherry-pick a merge because you do not know which side of the merge should be considered the mainline.\nThis option specifies the parent number (starting from 1) of the mainline and allows cherry-pick to replay the change relative to the specified parent.\n\n\nHow to find out what are the commit parents?\nUse the git show command to view the commit parents and then you can choose the parent index or the SHA-1"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Show history of a file? [duplicate]\nThis question already has answers here:\n \n \n\n\n\nClosed 11 years ago.\n\n\n\n\nPossible Duplicate:\nView the change history of a file using Git versioning \n\nSometimes I want to step through the history of a particular file. In the past I used P4V and this was very quick and intuitive. \n\nRight click on a file and select history.\nScrolling through the dates and see a nice diff of exactly what changed in that file on that date. Simple.\n\nSwitching to git this is now a grueling task. \n\n\"git log filename\"\nLook at history and pick a date, copy hash\n\"git diff hash\"\nScroll through diff for the stuff that changed in the file I am interested in.\nNope, that's not it, lets try a different date - back to step 2, rinse and repeat.\n\nI've searched SO, and I've tried a few of the commonly suggested guis: github, gitk, gitg, git-gui.\nThese all remove the need to manually run commands, but the workflow is the same for this. View history of file; view commit; search through diff of lots of irrelevant files. It's slow and repetitive.\nAll the data is in the repo so I see no reason this simple common use case could not be more streamlined.\nCan anyone recommend a tool that does this - or a more efficient way to utilize the command line to do what I want?\nThanks for any suggestions."}, {"role": "assistant", "content": "You can use git log to display the diffs while searching:\ngit log -p -- path/to/file"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How to cherry-pick only changes to certain files?\n\nIf I want to merge into a Git branch the changes made only to some of the files changed in a particular commit which includes changes to multiple files, how can this be achieved?\nSuppose the Git commit called stuff has changes to files A, B, C, and D but I want to merge only stuff's changes to files A and B. It sounds like a job for git cherry-pick but cherry-pick only knows how to merge entire commits, not a subset of the files."}, {"role": "assistant", "content": "I'd do it with cherry-pick -n (--no-commit) which lets you inspect (and modify) the result before committing:\ngit cherry-pick -n \n\n# unstage modifications you don't want to keep, and remove the\n# modifications from the work tree as well.\n# this does work recursively!\ngit checkout HEAD \n\n# commit; the message will have been stored for you by cherry-pick\ngit commit\n\nIf the vast majority of modifications are things you don't want, instead of checking out individual paths (the middle step), you could reset everything back, then add in what you want:\n# unstage everything\ngit reset HEAD\n\n# stage the modifications you do want\ngit add \n\n# make the work tree match the index\n# (do this from the top level of the repo)\ngit checkout ."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-checkout-index - Copy files from the index to the working tree Using git checkout-index to \"export an entire tree\""}, {"role": "assistant", "content": "The prefix ability basically makes it trivial to use git checkout-index as an \"export as tree\" function.\nJust read the desired tree into the index, and do: $ git checkout-index --prefix=git-export-dir/ -a git checkout-index will \"export\" the index into the specified\ndirectory. The final \"/\" is important. The exported name is literally just\nprefixed with the specified string. Contrast this with the\nfollowing example."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "how can I list all the different versions of a file, and diff them also?\nusing git, I want to list all the different revisions of a given file.\nThen, I want to choose a particular version and compare it when another.\nHow can I do this?"}, {"role": "assistant", "content": "To show a history of changes to a particular file, you can use git log:\ngit log -p -- path/to/file\n\nThe -p tells it to show the diff between each revision and its parent. To get a cumulative diff between two revisions, take the ID of the two revisions, and pass them to git diff:\ngit diff abc123 def456 -- path/to/file.\n\nWhere abc123 and def456 are the revision IDs."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "What does 'git blame' do?\nI saw a lot of questions about methods of using git blame, but I don't really understand them.\nI see a Blame button on top of files on the GitHub interface. Upon clicking it, it shows some diff with usernames on the left bar. What does that indicate?\nWhy is git blame actually used, apart from GitHub?"}, {"role": "assistant", "content": "From git-blame:\n\nAnnotates each line in the given file with information from the revision which last modified the line. Optionally, start annotating from the given revision.\nWhen specified one or more times, -L restricts annotation to the requested lines.\n\nExample:\n[email protected]:~# git blame .htaccess\n...\n^e1fb2d7 (John Doe 2015-07-03 06:30:25 -0300 4) allow from all\n^72fgsdl (Arthur King 2015-07-03 06:34:12 -0300 5)\n^e1fb2d7 (John Doe 2015-07-03 06:30:25 -0300 6) \n^72fgsdl (Arthur King 2015-07-03 06:34:12 -0300 7) RewriteEngine On\n...\n\nPlease note that git blame does not show the per-line modifications history in the chronological sense.\nIt only shows who was the last person to have changed a line in a document up to the last commit in HEAD. \nThat is to say that in order to see the full history/log of a document line, you would need to run a git blame path/to/file for each commit in your git log."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How do I set up a private Git repository on GitHub? Is it even possible?\nI intend to share my source code on an invite-only basis to a few dozen users maybe. The source code itself should not be public. Participants are allowed and encouraged to submit their changes. So I need source control, preferably Git, hosted on a public server with private access for multiple users.\nI learned that it is possible to set up private Git repositories on GitHub which use https:// links. On GitHub itself such a project does not show up in searches. For participating users the project shows a \"lock\" icon. So there are obviously private repositories; I just don't know how set one up. A lot of tutorials use SSH to set up private repositories but they all require you to have \"your own server\".\nI don't care about secure connections when pushing/pulling source code nor do I have trust issues with GitHub. All I care about is giving access only to users I invite. Maybe I'm naive and such a solution is only available via commercial hosting (e.g., Unfuddle, Assembla), but if not, I'd really like to know how it's done!"}, {"role": "assistant", "content": "On January 7th 2019, GitHub announced free and unlimited private repositories for all GitHub users, paying or not. When creating a new repository, you can simply select the Private option."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-filter-branch - Rewrite branches --commit-filter "}, {"role": "assistant", "content": "This is the filter for performing the commit.\nIf this filter is specified, it will be called instead of the git commit-tree command, with arguments of the form\n\" [(-p )…​]\" and the log message on\nstdin. The commit id is expected on stdout. As a special extension, the commit filter may emit multiple\ncommit ids; in that case, the rewritten children of the original commit will\nhave all of them as parents. You can use the map convenience function in this filter, and other\nconvenience functions, too. For example, calling skip_commit \"$@\" will leave out the current commit (but not its changes! If you want\nthat, use git rebase instead). You can also use the git_commit_non_empty_tree \"$@\" instead of git commit-tree \"$@\" if you don’t wish to keep commits with a single parent\nand that makes no change to the tree."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-pull - Fetch from and integrate with another repository or a local branch"}, {"role": "assistant", "content": "NAME git-pull - Fetch from and integrate with another repository or a local branch"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Why does git stash pop say that it could not restore untracked files from stash entry?\nI had a bunch of staged and unstaged changes and I wanted to quickly switch to another branch and then switch back.\nSo I staged my changes using:\n$ git stash push -a\n\n(In hindsight I probably could have used --include-untracked instead of --all)\nThen when I went to pop the stash I get a whole lot of errors along the lines of:\n$ git stash pop\nfoo.txt already exists, no checkout\nbar.txt already exists, no checkout\n...\nCould not restore untracked files from stash entry\n\nThere doesn't seem to be any changes restored from the stash.\nI also tried $ git stash branch temp but that shows the same errors.\nI did figure out a way around this which was to use:\n$ git stash show -p | git apply\n\nDisaster averted for now but this raises some questions.\nWhy did this error happen in the first place and how do I avoid it next time?"}, {"role": "assistant", "content": "I managed to recreate your issue. It seems if you stash untracked files and then you create those files (in your example, foo.txt and bar.txt), then you have local changes to untracked files that would be overwritten when you apply git stash pop.\nTo get around this issue, you can use the following command. This will override any unsaved local changes so be careful.\ngit checkout stash -- .\n\nHere is some further information I found on the previous command."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Azure DevOps - Pull Request Git \"Next steps: Manually resolve these conflicts and push new changes to the source branch.\"\nI have created a branch named dev.\nI have done a pull request to send dev code to master, when I do this pull request it tell me:\n\n50+ conflicts prevent automatic merging\n\"Next steps: Manually resolve these conflicts and push new changes to the source branch.\"\nWhere do I go from here? I just want all the dev branch to replace whatever is in master. I see no options to resolve these conflicts."}, {"role": "assistant", "content": "You will have to do the following on your PC\nOn branch dev\n$ git pull --no-rebase origin master - This will create a merge commit and you will have to resolve the conflicts in the files which are changed both on dev and master. git status will show the list of files with conflicting changes.\nAfter resolving conflicts, commit all the changes and push your branch. After that you should be able to complete the PR.\nFYI: --no-rebase makes sure that a merge is done even if the pull behavior is overwritten to default to rebase.\nHelp link for more details"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-log - Show commit logs notes.rewriteRef"}, {"role": "assistant", "content": "When copying notes during a rewrite, specifies the (fully\nqualified) ref whose notes should be copied. May be a glob,\nin which case notes in all matching refs will be copied. You\nmay also specify this configuration several times. Does not have a default value; you must configure this variable to\nenable note rewriting. Set it to refs/notes/commits to enable\nrewriting for the default commit notes. Can be overridden with the GIT_NOTES_REWRITE_REF environment variable.\nSee notes.rewrite. above for a further description of its format."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-diff - Show changes between commits, commit and working tree, etc git diff HEAD:file1 file2"}, {"role": "assistant", "content": "compares an (o)bject and a (w)ork tree entity;"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Favicon with GitHub Pages\n\nI'm hosting a few sites with GitHub Pages (User and Project Pages), but they are not displaying their favicons (in the browser).\n\n\nIs the problem that GitHub displays the site with ? I know it's possible to display favicons (at least with Jekyll), but can I display a favicon on it's own?"}, {"role": "assistant", "content": "Yes, you can.\nPut this into the head part of your webpage:\n \n\nIt is important to not put the slash before the favicon.ico part. Put the favicon.ico file in your repository's home directory."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-apply - Apply a patch to files and/or to the index -p"}, {"role": "assistant", "content": "Remove leading path components (separated by slashes) from\ntraditional diff paths. E.g., with -p2 , a patch against a/dir/file will be applied directly to file . The default is\n1."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How can I delete all commits before a given date in Git history?\nGiven a repository, I want to delete all commits that were before a particular commit, or a date in history.\nI have around 10000 commits in my repository, and I want to only keep the last 1000 or so, and delete the rest. Basically what I want to do is to say move the first commit forward to X.\nAt first I thought I could just rebase and squash all of those commits into one, but that causes a lot of merge conflicts during the rebase. If there was a way to squash commits such that the version after the squash is the last commit, that'd work too."}, {"role": "assistant", "content": "Warning: the following is dangerous, as it rewrites history. Always make sure you have a backup of your repo before doing any kind of major history rewriting like this.\nReplace the hash in the following with the hash of the parent of the commit you want to have as your new first commit.\ngit filter-branch --parent-filter '\n read parent\n if [ \"$parent\" = \"-p 5bdd44e5919cb0a95a9924817529cd7c980f88b5\" ]\n then\n echo\n else\n echo \"$parent\"\n fi'\n\nThis rewrites the parents of each commit; for most commits, it leaves them the same, but the one with the parent matching the given hash, it replaces with an empty parent, meaning it will now become a commit with no parent. This will detach all of your old history.\nNote that if what you want to be your first commit is a merge commit, you'll need to match against something like -p parent1 -p parent2 -p parent3 for each of the parents of the merge commit, in the correct order.\nIf you want to apply this to all branches and tags instead of just the current branch, pass in --all at the end of the command (after the script).\nAfter you have done this, and checked that it worked properly, you can delete the original branch and run a gc to clean out the now unreferenced commits:\ngit update-ref -d refs/original/refs/heads/master\n\nNote that since git tends to try to preserve data, in order to actually free up the space you will also have to remove the commits from your reflog, and then run the gc to clean it up.\ngit reflog expire --expire-unreachable=all --all\ngit gc --prune=all\n\nIf you are not doing this to save space or eradicate the old commits, you can keep the old history around in a branch, such as git branch old-master refs/original/refs/heads/master; you can even \"virtually reattach\" it using git replace, at which point you would have two unconnected histories (so when you push to a remote repo, you'll only push the truncated history) but when you look through history in your local repo you will see the full history."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-log - Show commit logs notes.rewriteMode"}, {"role": "assistant", "content": "When copying notes during a rewrite (see the\n\"notes.rewrite.\" option), determines what to do if\nthe target commit already has a note. Must be one of overwrite , concatenate , cat_sort_uniq , or ignore .\nDefaults to concatenate . This setting can be overridden with the GIT_NOTES_REWRITE_MODE environment variable."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Git - Cherry pick a single commit for pull request\nI might not have the terminology down yet.\nI made file to be added to a open project on git.\nI forked the project.\nI made some changes and my last commit is the file I want to request to the project and not the small changes I made before hand.\nWhen I go to github site and make pull request, I get all the commits before the one I want (which is last one of a file).\nI don't want to submit all of the other commits, because I don't think it's necessary for the project. Just my own changes.\nWhat do I do?\nShould I just make another res, or attach the file singularly and submit?"}, {"role": "assistant", "content": "You need to create a fresh branch from the remote HEAD, cherry-pick the commit to that branch, push the branch to your repo on GitHub, then create a pull request.\ngit checkout -b mybranch\ngit fetch upstream\ngit reset --hard upstream/master\ngit cherry-pick \ngit push origin mybranch:mybranch"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-shortlog - Summarize git log output --stdin"}, {"role": "assistant", "content": "In addition to getting arguments from the command line, read\nthem from standard input as well. This accepts commits and\npseudo-options like --all and --glob= . When a -- separator\nis seen, the following input is treated as paths and used to\nlimit the result. Flags like --not which are read via standard input\nare only respected for arguments passed in the same way and will not\ninfluence any subsequent command line arguments."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Pushing to a different git repo\n\nI have a repo called react. \nI cloned it into a different repo locally called different-repo.\nHow can I then get different-repo to push remotely to different-repo because currently it is pushing to react.\nEffectively I want to clone many times from react into different named repos but then when i push from those repos they push to their own repo."}, {"role": "assistant", "content": "You have to add an other remote. Usually, you have an origin remotes, which points to the github (maybe bitbucket) repository you cloned it from. Here's a few example of what it is:\n\nhttps://github.com/some-user/some-repo (the .git is optional)\n[email protected]:some-user/some-repo (this is ssh, it allows you to push/pull without having to type your ids every single time)\nC:/some/folder/on/your/computer Yes! You can push to an other directory on your own computer.\n\nSo, when you\n$ git push origin master\n\norigin is replaced with it's value: the url\nSo, it's basically just a shortcut. You could type the url yourself each time, it'd do the same!\nNote: you can list all your remotes by doing git remote -v.\nFor your problem\n\nHow can I then get different-repo to push remotely to different-repo because currently it is pushing to react.\n\nI'm guessing you want to create a second repository, right? Well, you can create an other remote (or replace the current origin) with the url to this repo!\nAdd an other remote — recommended\ngit remote add \n\nSo, for example:\n$ git remote add different-repo https://github.com/your-username/your-repo\n\nAnd then, just\n$ git push different-repo master\n\nChange the origin remote\ngit remote set-url \n\nSo\ngit remote set-url origin https://github.com/your-username/your-repo"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "What does git fsck stand for?\nWhat is the meaning in behind the fsck command name?\nThe documentation of the command does not seem to mention what the name stands for."}, {"role": "assistant", "content": "It stands for File System ChecK. The name is taken from the Unix fsck command, which is used to validate a file system.\nWhile Git is not technically a file system, it can be used analogously and the command name is a metaphor on this."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How do I push a local repo to Bitbucket using SourceTree without creating a repo on bitbucket first?\nIs there a way to import my local git repos to SourceTree and push them to my Bitbucket account, having new repos identical to my local repos be created on my account? Or do I have to make a repo online first and push to that? Github has a way to publish your local repos directly from it's client, and it creates it automatically when you publish, but it has limited private repos. I'm just doing homework so there's no reason for it to be public, hence why I'm trying to use bitbucket."}, {"role": "assistant", "content": "(updated on 3-29-2019 to use the https instead of ssh, so you don't need to use ssh keys)\nIt seems like for BitBucket, you do have to create a repo online first. Using the instructions from Atlassian, simply create a new BitBucket repository, copy the repository url to the clipboard, and then add that repository as a new remote to your local repository (full steps below):\nGet Repo URL\n\nin your BitBucket repo, choose \"Clone\" on the top-right\nchoose \"HTTPS\" instead of \"SSH\" in the top-right of the dialog\nit should show your repo url in the form git clone \n\nAdd Remote Using CLI\n\ncd /path/to/my/repo\ngit remote add origin https://bitbucket.org//.git\ngit push -u origin --all\n\nAdd Remote Using SourceTree\n\nRepository>Add Remote...\nPaste the BitBucket repository url (https://bitbucket.org//.git)\n\n\nOld Method: Creating & Registering SSH Keys\n(this method is if you use the ssh url instead of the https url, which looks like ssh://[email protected]//.git. I recommend just using https)\nBitBucket is great for private repos, but you'll need to set up an ssh key to authorize your computer to work with your BitBucket account. Luckily Sourcetree makes it relatively simple:\nCreating a Key In SourceTree:\n\nIn Tools>Options, make sure SSH Client: is set to PuTTY/Plink under the General tab\nSelect Tools>Create or Import SSH Keys\nIn the popup window, click Generate and move your mouse around to give randomness to the key generator\nYou should get something like whats shown in the screenshot below. Copy the public key (highlighted in blue) to your clipboard\n\nClick Save private Key and Save public key to save your keys to wherever you choose (e.g. to /putty/ssk-key.ppk and /putty/ssh-key.pub respectively) before moving on to the next section\n\nRegistering The Key In BitBucket\n\nLog in to your BitBucket account, and on the top right, click your profile picture and click Settings\nGo to the SSH Keys tab on the left sidebar\nClick Add SSH Key, give it a name, and paste the public key you copied in step 4 of the previous section\n\nThat's it! You should now be able to push/pull to your BitBucket private repos. Your keys aren't just for Git either, many services use ssh keys to identify users, and the best part is you only need one. If you ever lose your keys (e.g. when changing computers), just follow the steps to create and register a new one.\nSidenote: Creating SSH Keys using CLI\nJust follow this tutorial"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "error: pathspec 'test-branch' did not match any file(s) known to git\n\nI am a new user of Git. I have forked a repository called Spoon-Knife (available for practicing forking with Git). Then, I cloned it locally by running\ngit clone https://github.com/rohinichoudhary/Spoon-Knife.git\n\nThis repository contains three branches, i.e.\n\nmaster,\ntest-branch,\nchange-the-title.\n\nWhen I run git branch, it only shows *master, not the remaining two branches. And when I run\ngit checkout test-branch\n\nI get the following error:\n\nerror: pathspec 'test-branch' did not match any file(s) known to git.\n\nWhy is this happening? How can I solve this problem?"}, {"role": "assistant", "content": "The modern Git should able to detect remote branches and create a local one on checkout.\nHowever if you did a shallow clone (e.g. with --depth 1), try the following commands to correct it:\ngit config remote.origin.fetch '+refs/heads/*:refs/remotes/origin/*'\ngit fetch --all\n\nand try to checkout out the branch again.\nAlternatively try to unshallow your clone, e.g. git fetch --unshallow and try again.\nSee also: How to fetch all remote branches?"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Why can't I delete a branch in a remote GitLab repository?\n\nI'm trying to delete a branch both locally and in a remote GitLab repository. Its name is origin/feat. I tried git push --delete origin feat. Git complains:\nremote: error: By default, deleting the current branch is denied, because the next\nremote: 'git clone' won't result in any file checked out, causing confusion.\nremote: \nremote: You can set 'receive.denyDeleteCurrent' configuration variable to\nremote: 'warn' or 'ignore' in the remote repository to allow deleting the\nremote: current branch, with or without a warning message.\nremote: \nremote: To squelch this message, you can set it to 'refuse'.\nremote: error: refusing to delete the current branch: refs/heads/feat\n\nOK makes sense, so I tried switching to origin/master with git checkout master and it tells me: Already on 'master'. Does the current branch also need to be set in the remote directory? How would I do that?"}, {"role": "assistant", "content": "Try\ngit push origin --delete "}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-rev-list - Lists commit objects in reverse chronological order --missing="}, {"role": "assistant", "content": "A debug option to help with future \"partial clone\" development.\nThis option specifies how missing objects are handled. The form --missing=error requests that rev-list stop with an error if\na missing object is encountered. This is the default action. The form --missing=allow-any will allow object traversal to continue\nif a missing object is encountered. Missing objects will silently be\nomitted from the results. The form --missing=allow-promisor is like allow-any , but will only\nallow object traversal to continue for EXPECTED promisor missing objects.\nUnexpected missing objects will raise an error. The form --missing=print is like allow-any , but will also print a\nlist of the missing objects. Object IDs are prefixed with a “?” character. If some tips passed to the traversal are missing, they will be\nconsidered as missing too, and the traversal will ignore them. In case\nwe cannot get their Object ID though, an error will be raised."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Link to a line Markdown file on GitHub\n\nI often link to GitHub source code via the #L param in the URI.\ne.g. : https://github.com/github/learn.github.com/blob/gh-pages/episodes.yaml#L1\nBut is there a way to link to lines within a Markdown file?\ne.g. https://github.com/github/learn.github.com/blob/gh-pages/README.md#L1 (does not work!)\nI know I can link to 'sections', but lines are much better!\ne.g. https://github.com/github/learn.github.com/blob/gh-pages/README.md#learngithubcom"}, {"role": "assistant", "content": "As it is currently not possible, I take the next best option: use blame and then highlight the lines, e.g. https://github.com/rails/rails/blame/master/guides/source/configuring.md#L166"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How to complete a milestone on GitHub?\n\nHow do I close/complete milestones on GitHub projects? I've already three milestones that are \"overdue\" but they are completed already. I simply don't know how to mark them \"completed\" - can anyone help me?\nI already tried to Google this issue, and browsed the GitHub help pages, but couldn't find any information on using milestones."}, {"role": "assistant", "content": "Update: this is an old answer for an old question. The nowerdays correct answer is the one by seeker.\nMilestones now must be closed manually. --- A.J. Brown\n\nSimply creating and closing an issue for a milestone, will mark the milestone completed:\n\nWhen all issues of the milestone are closed, the milestone should be closed as well. \n\n--- Felix King\nThanks."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-update-index - Register file contents in the working tree to the index --stdin"}, {"role": "assistant", "content": "Instead of taking a list of paths from the command line,\nread a list of paths from the standard input. Paths are\nseparated by LF (i.e. one path per line) by default."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How to copy commits from one branch to another?\nI've got two branches from my master:\n\nv2.1: (version 2) I've been working on for several months\nwss: that I created yesterday to add one specific feature to my master (in production)\n\nIs there a way to copy yesterday's commits from wss to v2.1?"}, {"role": "assistant", "content": "Use \ngit cherry-pick \n\nto apply to your current branch. \nI myself would probably cross-check the commits I pick in gitk and cherry-pick them with right-clicks on the commit entry there instead.\n\nIf you want to go more automatic (with all its dangers) and assuming all commits since yesterday happened on wss you could generate the list of commits using git log (with --pretty suggested by Jefromi)\ngit log --reverse --since=yesterday --pretty=%H\n\nso everything together assuming you use bash\nfor commit in $(git log --reverse --since=yesterday --pretty=%H);\ndo\n git cherry-pick $commit\ndone\n\nIf something goes wrong here (there is a lot of potential) you are in trouble since this works on the live checkout, so either do manual cherry-picks or use rebase like suggested by Jefromi."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Revert changes to a file in a commit\nI want to revert changes made by a particular commit to a given file only.\nCan I use git revert command for that?\nAny other simple way to do it?"}, {"role": "assistant", "content": "The cleanest way I've seen of doing this is described here\ngit show some_commit_sha1 -- some_file.c | git apply -R\n\nSimilar to VonC's response but using git show and git apply."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Which are the plumbing and porcelain commands?\nFor git commands there is this distinction between \"plumbing\" and \"porcelain\" commands. How can I determine what would be classified as a plumbing one or a porcelain one? i.e. What is the border line that allows me to differentiate?\nI'm not asking what a porcelain or plumbing command is, but rather how, given a command, I can say which type it is."}, {"role": "assistant", "content": "As blue112 noted, the dividing line is fuzzy. The very first documentation page, however, has an explicit list (and as R.M. notes below, one primary criterion is, or at least is supposed to be, stability of interface—for which some nominally-porcelain commands have --porcelain1 to force a more stable and/or more machine-readable output). You can choose to use their list, or decide that some commands are too high level to be low level, or too low level to be high level. For instance you might disagree that git apply is a plumbing command, yet the Git page says it is. Or, you might consider things like git fast-import to be something you would only use inside a script.\n\nEdit, 31 May 2020: The Git documentation has changed since 2016 to reassign commands to new sections; the data below are now out of date. Consult the documentation for your own Git version (via git help git for instance) to see what your own system says. See also VonC's answer with a link to a 2018 change to the documentation.\n\nThe list below is simply extracted from the documentation, with descriptions and additional classifications stripped to leave only \"porcelain\" vs \"plumbing\". (Sub-classifications remain visible as inversions in the alphabetic sort order. I did not construct links for each entry, as this would be considerably more difficult with StackOverflow markdown—this just needed a simple
...
wrapper.)\nporcelain\n\ngit-add git-rebase git-cherry\ngit-am git-reset git-count-objects\ngit-archive git-revert git-difftool\ngit-bisect git-rm git-fsck\ngit-branch git-shortlog git-get-tar-commit-id\ngit-bundle git-show git-help\ngit-checkout git-stash git-instaweb\ngit-cherry-pick git-status git-merge-tree\ngit-citool git-submodule git-rerere\ngit-clean git-tag git-rev-parse\ngit-clone git-worktree git-show-branch\ngit-commit gitk git-verify-commit\ngit-describe git-config git-verify-tag\ngit-diff git-fast-export git-whatchanged\ngit-fetch git-fast-import gitweb\ngit-format-patch git-filter-branch git-archimport\ngit-gc git-mergetool git-cvsexportcommit\ngit-grep git-pack-refs git-cvsimport\ngit-gui git-prune git-cvsserver\ngit-init git-reflog git-imap-send\ngit-log git-relink git-p4\ngit-merge git-remote git-quiltimport\ngit-mv git-repack git-request-pull\ngit-notes git-replace git-send-email\ngit-pull git-annotate git-svn\ngit-push git-blame\n\nplumbing\n\ngit-apply git-for-each-ref git-receive-pack\ngit-checkout-index git-ls-files git-shell\ngit-commit-tree git-ls-remote git-upload-archive\ngit-hash-object git-ls-tree git-upload-pack\ngit-index-pack git-merge-base git-check-attr\ngit-merge-file git-name-rev git-check-ignore\ngit-merge-index git-pack-redundant git-check-mailmap\ngit-mktag git-rev-list git-check-ref-format\ngit-mktree git-show-index git-column\ngit-pack-objects git-show-ref git-credential\ngit-prune-packed git-unpack-file git-credential-cache\ngit-read-tree git-var git-credential-store\ngit-symbolic-ref git-verify-pack git-fmt-merge-msg\ngit-unpack-objects git-daemon git-interpret-trailers\ngit-update-index git-fetch-pack git-mailinfo\ngit-update-ref git-http-backend git-mailsplit\ngit-write-tree git-send-pack git-merge-one-file\ngit-cat-file git-update-server-info git-patch-id\ngit-diff-files git-http-fetch git-sh-i18n\ngit-diff-index git-http-push git-sh-setup\ngit-diff-tree git-parse-remote git-stripspace\n\n\n1It would seem more logical to call this --plumbing, but as VonC notes in this answer to a related question, one can view this instead as a request: \"I am implementing porcelain so please give me plumbing-style output.\" The flaw in this argument is that you might be implementing complex plumbing, and want to use simple plumbing to do it: now there's no porcelain in sight, and yet, your complex plumbing passes --porcelain to some simple plumbing."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git - the stupid content tracker git-difftool"}, {"role": "assistant", "content": "Show changes using common diff tools"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "gitglossary - A Git Glossary object type"}, {"role": "assistant", "content": "One of the identifiers \" commit \",\n\" tree \", \" tag \" or\n\" blob \" describing the type of an object ."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How can I sync documentation with Github Pages?\n\nI have a project together with several people and we have a README.md file with a bunch of GitHub Flavored Markdown that is rendered on our GitHub page. We also set up a GitHub Pages branch which is hosted under our GitHub Organization's subdomain, and used the Automatic Page Generator simply loading in our README.md file when we created our page. However, I notice that when I update our README.md file, it does not update the project page. Instead, we must go to the GitHub settings tab and recreate the project page, reloading the README.md file when we do it. \nAlso, after reading about relative linking working between documentation files on the GitHub project directory pages. I very much like the markdown as it saves tons of time from having to write all the HTML out by hand for our documentation. What I would like however is to be able to have one README.md file which is able to include relative links to other documentation files located at docs/*.md. I was hoping there was an easy solution so that my other documentation files might also be included in my gh-pages branch and be hosted under my GitHub Pages subdomain and be rendered and/or themed.\nIn other words, my questions are:\n\nIs there a way to have my README.md file automatically update on my Github Page subdomain?\n\n\n[ EDIT ] : No appears to be the answer if using the Automatic Page Generator. You must go to the settings page for the repo and reload it every time there is a change in order to update it.\n \n\nIs there a way I can have my relative links to my documentation on my README.md file work on my Github Pages, perhaps my somehow syncing my /docs/*.md to my Github Pages and somehow rendering and/or theming them?\n\n\n[ EDIT ] : From what I've learned since writing this question it appears that this is only possible on GitHub pages through the use of a static site generator like the ruby gem Jekyll and probably some uses of the webhooks supported by GitHub that are mentioned in the comments below. I am trying currently trying to find an optimal solution.\n \n\nBetter yet, is there an even easier way I can do this and perhaps have just one copy of my README.md and documentation that is used on both gh-pages and my main branch and makes everything easiest?\n\n\n[ EDIT ] : It seems this one is almost definitely a no. I was thinking about the possibility of something built into GitHub to allow this. It seems that better support for this kind of thing may could be built into GitHub Pages in the future, or at least I definitely hope it will be."}, {"role": "assistant", "content": "I am going to post a solution that I setup that takes advantage of the fact that GitHub Pages uses Jekyll already using the Automatic Page Generator.\n\ngit checkout gh-pages\nmkdir _layouts\nmv index.html _layouts\ngit checkout master -- README.md\nmv README.md index.md\nPrepend the following text to index.md \n\n \n---\nlayout: index\n---\n\nYou also need to open the index.html file and make the following changes:\n\nRemove the rendered HTML from the markdown in your README.md file. This is usually between
or
tags. Replace this HTML with the text {{ content }} this will allow us to use this file as a jekyll. The file we apply the layout to will be placed where the content tag is.\nLocate the CSS for your project page theme. for me this was a line like the following:\n\n\n\nThis needs to be changed to\n\n\n\nAny other assets stored on your site that will be used in this layout will also need to be prefixed with {{ site.path }}.\n\nBy doing this, Jekyll will render the markdown file as the content of the index.html layout in the _layouts directory. In order to automate this process for not just the README.md file, but also other docs you may have in your master branch, I have taken the following steps:\nCreated the file called post-commit containing the following:\n \n#!/bin/bash\n###\n### The following block runs after commit to \"master\" branch\n###\nif [ `git rev-parse --abbrev-ref HEAD` == \"master\" ]; then\n\n # Layout prefix is prepended to each markdown file synced\n ###################################################################\n LAYOUT_PREFIX='---\\r\\nlayout: index\\r\\n---\\r\\n\\r\\n'\n\n # Switch to gh-pages branch to sync it with master\n ###################################################################\n git checkout gh-pages\n\n # Sync the README.md in master to index.md adding jekyll header\n ###################################################################\n git checkout master -- README.md\n echo -e $LAYOUT_PREFIX > index.md\n cat README.md >> index.md\n rm README.md\n git add index.md\n git commit -a -m \"Sync README.md in master branch to index.md in gh-pages\"\n\n # Sync the markdown files in the docs/* directory\n ###################################################################\n git checkout master -- docs\n FILES=docs/*\n for file in $FILES\n do\n echo -e $LAYOUT_PREFIX | cat - \"$file\" > temp && mv temp \"$file\"\n done\n\n git add docs\n git commit -a -m \"Sync docs from master branch to docs gh-pages directory\"\n\n # Uncomment the following push if you want to auto push to\n # the gh-pages branch whenever you commit to master locally.\n # This is a little extreme. Use with care!\n ###################################################################\n # git push origin gh-pages\n\n # Finally, switch back to the master branch and exit block\n git checkout master\nfi\n\nEDIT: I updated the above script for both the README.md file and the markdown in docs/* to both use the same layout file. This is a much better setup than what I had before. This script goes in your .git/hooks/ directory. bash must be in your path.\nCreate the file _config.yml with the following\nmarkdown: redcarpet\npath: http://username.github.io/reponame\n\nThe above script also syncs markdown files found in the docs/* directory of the master branch, in order that they may be viewed on the GitHub Pages site as well. Relative linking to these documents works if you include the following jQuery function in order to strip the .md extension from the anchors on the gh-pages branch. You can add the following script to index.html in the _layouts directory:\n$(document).on('ready', function () {\n $('a').each(function (i, e) {\n var href = e.href;\n if (href.search('.md') > 0)\n $(this).attr('href', href.split('.md')[0]);\n });\n});\n\nEDIT: I changed the code above in my repository, this was a quick and dirty way to do this, but it won't work right in all cases if you know what I mean.. For example, the markdown file company.mdata.md would not be processed correctly. To fix this I updated this to the following script which more carefully checks out the href and removes the extension if found. I also made the script more generic, allowing it to be used to remove other extensions by changing the ext variable. Here is the code:\n$(function () {\n $('a').each(function () {\n var ext = '.md';\n var href = $(this).attr('href');\n var position = href.length - ext.length;\n if (href.substring(position) === ext)\n $(this).attr('href', href.substring(0, position));\n });\n});\n\nI setup an example repo at CoryG89/docsync, which has a project page here, if you'd like to see how all this works together."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-log - Show commit logs %GS"}, {"role": "assistant", "content": "show the name of the signer for a signed commit"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-diff-index - Compare a tree to the working tree or index ignore-space-change"}, {"role": "assistant", "content": "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."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How can I merge two commits into one if I already started rebase?\nI am trying to merge 2 commits into 1, so I followed “squashing commits with rebase” from git ready.\nI ran\ngit rebase --interactive HEAD~2\n\nIn the resulting editor, I change pick to squash and then save-quit, but the rebase fails with the error\n\nCannot 'squash' without a previous commit\n\nNow that my work tree has reached this state, I’m having trouble recovering. \nThe command git rebase --interactive HEAD~2 fails with:\n\nInteractive rebase already started\n\nand git rebase --continue fails with\n\nCannot 'squash' without a previous commit"}, {"role": "assistant", "content": "Summary\nThe error message\n\nCannot 'squash' without a previous commit\n\nmeans you likely attempted to “squash downward.” Git always squashes a newer commit into an older commit or “upward” as viewed on the interactive rebase todo list, that is into a commit on a previous line. Changing the command on your todo list’s very first line to squash will always produce this error as there is nothing for the first commit to squash into.\nThe Fix\nFirst get back to where you started with\n$ git rebase --abort\n\nSay your history is\n$ git log --pretty=oneline\na931ac7c808e2471b22b5bd20f0cad046b1c5d0d c\nb76d157d507e819d7511132bdb5a80dd421d854f b\ndf239176e1a2ffac927d8b496ea00d5488481db5 a\n\nThat is, a was the first commit, then b, and finally c. After committing c we decide to squash b and c together:\n(Note: Running git log pipes its output into a pager, less by default on most platforms. To quit the pager and return to your command prompt, press the q key.)\nRunning git rebase --interactive HEAD~2 gives you an editor with\npick b76d157 b\npick a931ac7 c\n\n# Rebase df23917..a931ac7 onto df23917\n#\n# Commands:\n# p, pick = use commit\n# r, reword = use commit, but edit the commit message\n# e, edit = use commit, but stop for amending\n# s, squash = use commit, but meld into previous commit\n# f, fixup = like \"squash\", but discard this commit's log message\n#\n# If you remove a line here THAT COMMIT WILL BE LOST.\n# However, if you remove everything, the rebase will be aborted.\n#\n\n(Notice that this todo list is in the reverse order as compared with the output of git log.)\nChanging b’s pick to squash will result in the error you saw, but if instead you squash c into b (newer commit into the older or “squashing upward”) by changing the todo list to\npick b76d157 b\nsquash a931ac7 c\n\nand save-quitting your editor, you'll get another editor whose contents are\n# This is a combination of 2 commits.\n# The first commit's message is:\n\nb\n\n# This is the 2nd commit message:\n\nc\n\nWhen you save and quit, the contents of the edited file become commit message of the new combined commit:\n$ git log --pretty=oneline\n18fd73d3ce748f2a58d1b566c03dd9dafe0b6b4f b and c\ndf239176e1a2ffac927d8b496ea00d5488481db5 a\n\nNote About Rewriting History\nInteractive rebase rewrites history. Attempting to push to a remote that contains the old history will fail because it is not a fast-forward.\nIf the branch you rebased is a topic or feature branch in which you are working by yourself, no big deal. Pushing to another repository will require the --force option, or alternatively you may be able, depending on the remote repository’s permissions, to first delete the old branch and then push the rebased version. Examples of those commands that will potentially destroy work is outside the scope of this answer.\nRewriting already-published history on a branch in which you are working with other people without very good reason such as leaking a password or other sensitive details forces work onto your collaborators and is antisocial and will annoy other developers. The “Recovering From an Upstream Rebase” section in the git rebase documentation explains, with added emphasis.\n\nRebasing (or any other form of rewriting) a branch that others have based work on is a bad idea: anyone downstream of it is forced to manually fix their history. This section explains how to do the fix from the downstream’s point of view. The real fix, however, would be to avoid rebasing the upstream in the first place. …"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-diff - Show changes between commits, commit and working tree, etc git diff [] [--merge-base] [--] […​]"}, {"role": "assistant", "content": "This is to view the changes between two arbitrary\n. If --merge-base is given, use the merge base of the two commits for the\n\"before\" side. git diff --merge-base A B is equivalent to git diff $(git merge-base A B) B ."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-config - Get and set repository or global options boolean"}, {"role": "assistant", "content": "When a variable is said to take a boolean value, many\nsynonyms are accepted for true and false ; these are all\ncase-insensitive. true Boolean true literals are yes , on , true ,\nand 1 . Also, a variable defined without = is taken as true. false Boolean false literals are no , off , false , 0 and the empty string. When converting a value to its canonical form using the --type=bool type\nspecifier, git config will ensure that the output is \"true\" or\n\"false\" (spelled in lowercase)."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How can I view file history in Git?\nWith Subversion I could use TortoiseSVN to view the history/log of a file.\nHow can I do this with Git?\nI am just looking for the history record for a particular file, and then the ability to compare the different versions."}, {"role": "assistant", "content": "Use git log to view the commit history. Each commit has an associated revision specifier that is a hash key (e.g. 14b8d0982044b0c49f7a855e396206ee65c0e787 and b410ad4619d296f9d37f0db3d0ff5b9066838b39). To view the difference between two different commits, use git diff with the first few characters of the revision specifiers of both commits, like so:\n# diff between commits 14b8... and b410...\ngit diff 14b8..b410\n# only include diff of specified files\ngit diff 14b8..b410 path/to/file/a path/to/file/b\n\nIf you want to get an overview over all the differences that happened from commit to commit, use git log or git whatchanged with the patch option:\n# include patch displays in the commit history\ngit log -p\ngit whatchanged -p\n# only get history of those commits that touch specified paths\ngit log path/a path/b\ngit whatchanged path/c path/d"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Undo a git merge (hasn't been pushed yet)\nI just committed some changes into one of my feature branches (\"feedback_tab\") then, checked out \"master\" and merged them in there. I actually meant to merge them into my \"development\" branch.\nNow, master is ahead of 'origin/master' (its remote) by 17 commits - I haven't pushed the merge up (and don't want to, obviously). How can I revert master back to the same state as before the accidental merge? I'm confused between git revert and git reset with this stuff.\nI looked in my git log and there's no entry for merging feedback_tab into master. I'd have thought it would be the top entry?\nBit confused :/ any help welcome! max"}, {"role": "assistant", "content": "To undo a merge that was NOT pushed:\ngit reset --merge ORIG_HEAD\n\nIf during the merge you get a conflict, the best way to undo the merge is:\ngit merge --abort"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-log - Show commit logs %cn"}, {"role": "assistant", "content": "committer name"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-am - Apply a series of patches from a mailbox -3 --3way --no-3way"}, {"role": "assistant", "content": "When the patch does not apply cleanly, fall back on\n3-way merge if the patch records the identity of blobs\nit is supposed to apply to and we have those blobs\navailable locally. --no-3way can be used to override\nam.threeWay configuration variable. For more information,\nsee am.threeWay in git-config ."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How to enter command with password for git pull?\nI want to do this command in one line: \ngit pull && [my passphrase]\n\nHow to do it?"}, {"role": "assistant", "content": "This is not exactly what you asked for, but for http(s):\n\nyou can put the password in .netrc file (_netrc on windows). From there it would be picked up automatically. It would go to your home folder with 600 permissions.\nyou could also just clone the repo with https://user:pass@domain/repo but that's not really recommended as it would show your user/pass in a lot of places...\na new option is to use the credential helper. Note that credentials would be stored in clear text in your local config using standard credential helper. credential-helper with wincred can be also used on windows.\n\nUsage examples for credential helper\n\ngit config credential.helper store - stores the credentials indefinitely.\ngit config credential.helper 'cache --timeout=3600'- stores for 60 minutes\n\nFor ssh-based access, you'd use ssh agent that will provide the ssh key when needed. This would require generating keys on your computer, storing the public key on the remote server and adding the private key to relevant keystore."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "could not find compatible versions for pod\nI am new in IOS development and git. I am having a problem after merging my local repo to the dev repo. After merging when I build the project I get an error in the Xcode that says, \"The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\"\nBuild Error\nI searched about this and tried the usual solution reinstalling the pods. But executing \npod install\n\nI get another error in terminal that says \nTerminal Error\nAt this point I tried deleting the files associated with the \"FTPopOverMenu\" pod and reinstalling with pod install. The error doesn't go away. Also, I tried solving it in this way - Error:“The sandbox is not in sync with the Podfile.lock…” after installing RestKit with cocoapods\n\nBut both error in the Xcode and in the terminal still remains. I'm new to IOS and Git. I really don't understand what is really happening here."}, {"role": "assistant", "content": "As per my guess you are working on an old project means which is already developed in Xcode 8 series and now you are working with latest Xcode and you have updated the code accordingly.\nSo just do the below steps:\n\n\"pod deintegrate\"\n\"pod install\"\n\"pod update\" (if it is necessary so do it else if you have all latest pod so don't use it.)\n\nIt will remove all old cocoapods traces.\nOR Alternate way to do it (Temp Work Around)\n\nRemove that cocoa pod temporary, after all your work finish add to your project and give a try cause in my case it is the only work around i have that worked."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-diff - Show changes between commits, commit and working tree, etc diff..wordRegex"}, {"role": "assistant", "content": "The regular expression that the diff driver should use to\nsplit words in a line. See gitattributes for\ndetails."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git, msysgit, accents, utf-8, the definitive answers\nI've read in some places that there are problems with git (or just msysgit?) and character encoding - I believe it's only a problem in file names.\nWhat I'd like is some 'definitive' (or at least authoritative) information about:\n\nWhat exactly are the 'problems'? (The symptoms)\nWhat are the causes? (Briefly)\nIn what scenarios is this a show stopper?\nIs there any resolution in sight, or failing that any workarounds?\n\nI hope this question isn't too vague, I think it would be good to have all of this information in one place to be able to point people to it..."}, {"role": "assistant", "content": "Update Oct. 2023: with Git 2.43 (Q4 2023), the display width table for unicode characters has been updated for Unicode 15.1\nSee commit 872976c (25 Sep 2023) by Beat Bolli (bbolli).\n(Merged by Junio C Hamano -- gitster -- in commit 64b2419, 04 Oct 2023)\n\nunicode: update the width tables to Unicode 15.1\nSigned-off-by: Beat Bolli\n\n\nUnicode 15.1 has been announced on 2023-09-12, so update the character width tables to the new version.\n\n\nUpdate Apr. 2023: with Git 2.41 (Q2 2023), the Unicode character width table (used for output alignment) has been updated.\nSee commit b10cbda (30 Mar 2023) by Beat Bolli (bbolli).\n(Merged by Junio C Hamano -- gitster -- in commit 5ae4bd1, 31 Mar 2023)\n\nunicode: update the width tables to Unicode 15\nSigned-off-by: Beat Bolli\n\n\nUnicode version 15 was released in September 2022, and we have so far neglected to update our width tables.\nDo this now.\n\n\nUpdate Oct. 2021: With Git 2.34 (Q4 2021), the Unicode character width table (used for output alignment) has been updated.\nSee commit 187fc8b (17 Sep 2021) by Carlo Marcelo Arenas Belón (carenas).\n(Merged by Junio C Hamano -- gitster -- in commit 3d875f9, 28 Sep 2021)\n\nunicode: update the width tables to Unicode 14\n\nUpdate Feb. 2017 (Git 2.12): The character width table has been updated to match Unicode 9.0.\nThe update_unicode.sh is moved it into contrib/update-unicode: see its README.\nUpdate August 2014 (git 2.1): commit a67c821 (Torsten Bögershausen (tboegi)) adds support for Unicode 7.0.\nUpdate April 2014: commit d813ab9 (Torsten Bögershausen (tboegi)) adds support for Unicode 6.3\n(git 1.9.2):\n\nUnicode 6.3 defines more code points as combining or accents.\nFor example, the character \"ö\" could be expressed as an \"o\" followed by U+0308 COMBINING DIARESIS (aka umlaut, double-dot-above).\nWe should consider that such a sequence of two codepoints occupies one display column for the alignment purposes, and for that, git_wcwidth() should return 0 for them.\nAffected codepoints are:\nU+0358..U+035C\nU+0487\nU+05A2, U+05BA, U+05C5, U+05C7\nU+0604, U+0616..U+061A, U+0659..U+065F\n\nEarlier unicode standards had defined these as \"reserved\".\nOnly the range 0..U+07FF has been checked to see which codepoints need to be marked as 0-width while preparing for this commit; more updates may be needed.\n\n\nUpdate April 2012: Unicode support is released in version 1.7.10. See this page for notes and settings you should set.\nNamely:\ngit config [--global] core.quotepath off\ngit config [--global] i18n.logoutputencoding utf8\ngit config [--global] i18n.commitencoding utf8\ngit config [--global] --unset svn.pathnameencoding\n\nThe recodetree check command scans the entire history of a git repository and prints all non-ASCII file names. If the output is empty, no migration is necessary.\n\nUpdate February 2012: patches for UTF-8 supports are comming in branch 'devel' of msysgit repo on GitHub, including Update less settings for UTF-8 .\nThe Git for Windows Google+ page mentions:\n\nKarsten Blees' UTF-8 patches for Git for Windows has now been merged to 'devel'.\nThis means the upcoming release will support Unicode filenames!\n\n\nMay 2011\nI believe the msysgit issue 80 has the latest on that bug.\nAlso described in issue 376.\nFor example:\n\nThis is what happens:\n\ngit on Windows operates on file names and treats them essentially as byte streams.\nIn your case, the streams happen to be UTF8 encoded text.\n\ngit on Windows asks the runtime to create a file, and passes it the byte stream.\n\nSince internally on Windows everything is Unicode, the runtime converts the byte\nstream to UTF16 using the currently set locale (aka \"codepage\").\nThat is, it effectively interprets the byte stream as CP949 (Korean) encoded text.\nApparently, some of the UTF8 byte sequences are invalid CP949 sequences, and the conversion fails (\"Invalid argument\"); or if the UTF8 sequences happen to be correct CP949 sequences, the result is (most likely) a different character.\n\n\n\nThe true fix should be on MingW though:\n\nIt occurs to me that one solution would be this: solve it at the GCC C run-time\nlibrary level.\nThat is, for the mingw GCC run-time library on Windows, make it possible via build-time options to be in a mode where the command-line parameters (passed to main()) and file I/O functions use the underlying Windows Unicode API calls, and translate to/from UTF-8 encoding in C's standard function APIs that use byte-strings.\nThat would \"just work\" for git perhaps, and could be useful for other Linux-originated open source projects running the Windows environment.\n\nak2 comments that MingW isn't the right place for this fix:\n\n\"MinGW compilers provide access to the functionality of the Microsoft C runtime and some language-specific runtimes.\nMinGW, being Minimalist, does not, and never will, attempt to provide a POSIX runtime environment for POSIX application deployment on MS-Windows.\nIf you want POSIX application deployment on this platform, please consider Cygwin instead.\"\n\nThere is some work in progress on a msysgit variant to support unicode."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How do I get Jenkins to build on push to a BitBucket git repository?\nI have a git repository hosted on BitBucket, and have set up SSH authentication between the repository and my Jenkins server. I can build on Jenkins manually, but cannot get the Jenkins service on BitBucket to trigger builds.\nJenkins configuration: \n- Project Name: [my_jenkins_job] \n- Build Triggers: \n--Trigger Builds Remotely: \n---Token: [token]\n\nBitBucket configuration: \n- Endpoint: http://[my_jenkins_address]/job/[my_jenkins_job]/build (I've also tried build?token=[token]) \n- Project Name: [my_jenkins_job] \n- Module Name: [blank] \n- Token: [token]\n\nVisiting http://{my_jenkins_address}/job/{my_jenkins_job}/build?token={token} kicks off a build properly.\nWhy doesn't pushing a change to BitBucket cause Jenkins to initiate a build?"}, {"role": "assistant", "content": "Due to the Jenkins Hook of Bitbucket is not working at all for me and I have different Jenkins projects for different branches I had come to this solution:\n\nInstall Bitbucket Plugin at your Jenkins\nAdd a normal Post as Hook to your Bitbucket repository (Settings -> Hooks) and use following url: \n\n\nhttps://YOUR.JENKINS.SERVER:PORT/bitbucket-hook/\n\nand if you have setup authentication on jenkins then URL must be like\n\nhttps://USERNAME:[email protected]:PORT/bitbucket-hook/\n\n\nConfigure your Jenkins project as follows:\nunder build trigger enable Build when a change is pushed to BitBucket\nunder Source Code Management select GIT; enter your credentials and define Branches to build (like **feature/*)\n\nBy this way I have three build projects, one for all features, one for develop and one for release branch. Make sure to include the slash ('/') on the end of the URL or the hook won't work.\nAnd best of it, you don't have to ad new hooks for new Jenkins projects."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "GitLab CI secret variables for Gradle publish\n\nHow to setup Gradle publish task user credentials with GitLab CI secret variables? I am using gradle maven publish plugin, and here is snippet from build.gradle\nrepositories {\n maven {\n credentials {\n username artifactUser\n password artifactPass\n }\n url \"...\"\n }\n }\n\nI've tried to use gradle.properties as below\nartifactUser=${env.MAVEN_REPO_USER}\nartifactPass=${env.MAVEN_REPO_PASS}\n\nAnd several ways of accessing secret variables in .gitlab-ci.yml file (because gradle.properties is not picked up from gradle or variables are not transformed correctly, it is in root project dir)\nMethod 1\n'./gradlew publish -x test -PartifactUser=${env.MAVEN_REPO_USER} -PartifactPass=${env.MAVEN_REPO_PASS}'\n\nError: /bin/bash: line 56: -PartifactUser=${env.MAVEN_REPO_USER}: bad substitution\nMethod 2\n before_script:\n - chmod +x ./gradlew\n - export REPO_USER=${env.MAVEN_REPO_USER}\n - export REPO_PASS=${env.MAVEN_REPO_PASS}\n ...\n deploy:\n stage: deploy\n script:\n - ./gradlew publish -x test -PartifactUser=$REPO_USER -PartifactPass=$REPO_PASS\n\nI am using openjdk:8-jdk-slim image for build using gradle wrapper. Seems like there are several issues with this kind of variable usage, do we have any workaround?"}, {"role": "assistant", "content": "You don't need env. prefinx in your .gitlab-ci.yml. You don't need to re-export the variables as well.\nIf you have defined a variables named MAVEN_REPO_USER and MAVEN_REPO_PASS in Gitlab CI/CD settings for the project, you can just use them in Gradle script:\nrepositories {\n maven {\n credentials {\n username System.getenv(\"MAVEN_REPO_USER\")\n password System.getenv(\"MAVEN_REPO_PASS\")\n }\n url \"…\"\n }\n}"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "gitignore - fatal: no files added\nI have an issue with git, more precisely with gitignore.\nI have created an empty folder\nInitialized git\nmkdir fold\ncd fold\ngit init\n\nUpdated gitignore (as below)\n *.prjx\n\nCommitted gitignore\ngit add .gitignore\ngit commit -m \"update gitignore\"\n\nNow I have several files (among them a .prjx) and folders in my root (fold) and I'd like to add all of them, but when I run\ngit add *\n\nI get the message below\nThe following paths are ignored by one of your .gitignore files:\nftc.prjx\nUse -f if you really want to add them.\nfatal: no files added\n\nI don't want to add it, I simply want add all the other files and folders.\nFrom my understanding .gitignore should handle exactly that so why I get the message above?\nAm I missing something?"}, {"role": "assistant", "content": "you should run git add . rather than git add *\nthe * is interpreted by the shell and substituted with all file and folder in the current location. obviously ftc.prjx is one of them and git is just warning that the file is in the ignorelist."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-rev-parse - Pick out and massage parameters , e.g. dae86e1950b1277e545cee180551750029cfe735 , dae86e"}, {"role": "assistant", "content": "The full SHA-1 object name (40-byte hexadecimal string), or\na leading substring that is unique within the repository.\nE.g. dae86e1950b1277e545cee180551750029cfe735 and dae86e both\nname the same commit object if there is no other object in\nyour repository whose object name starts with dae86e."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-config - Get and set repository or global options --unset-all"}, {"role": "assistant", "content": "Remove all lines matching the key from config file."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How to customise config.toml on Kubernetes?\n\nI'm have a Gitlab cloud connected to a k8s cluster running on Google (GKE).\nThe cluster was created via Gitlab cloud.\nI want to customise the config.toml because I want to fix the cache on k8s as suggested in this issue.\nI found the config.toml configuration in the runner-gitlab-runner ConfigMap.\nI updated the ConfigMap to contain this config.toml setup:\n config.toml: |\n concurrent = 4\n check_interval = 3\n log_level = \"info\"\n listen_address = '[::]:9252'\n [[runners]]\n executor = \"kubernetes\"\n cache_dir = \"/tmp/gitlab/cache\"\n [runners.kubernetes]\n memory_limit = \"1Gi\"\n [runners.kubernetes.node_selector]\n gitlab = \"true\"\n [[runners.kubernetes.volumes.host_path]]\n name = \"gitlab-cache\"\n mount_path = \"/tmp/gitlab/cache\"\n host_path = \"/home/core/data/gitlab-runner/data\"\n\nTo apply the changes I deleted the runner-gitlab-runner-xxxx-xxx pod so a new one gets created with the updated config.toml.\nHowever, when I look into the new pod, the /home/gitlab-runner/.gitlab-runner/config.toml now contains 2 [[runners]] sections:\nlisten_address = \"[::]:9252\"\nconcurrent = 4\ncheck_interval = 3\nlog_level = \"info\"\n\n[session_server]\n session_timeout = 1800\n\n[[runners]]\n name = \"\"\n url = \"\"\n token = \"\"\n executor = \"kubernetes\"\n cache_dir = \"/tmp/gitlab/cache\"\n [runners.kubernetes]\n host = \"\"\n bearer_token_overwrite_allowed = false\n image = \"\"\n namespace = \"\"\n namespace_overwrite_allowed = \"\"\n privileged = false\n memory_limit = \"1Gi\"\n service_account_overwrite_allowed = \"\"\n pod_annotations_overwrite_allowed = \"\"\n [runners.kubernetes.node_selector]\n gitlab = \"true\"\n [runners.kubernetes.volumes]\n\n [[runners.kubernetes.volumes.host_path]]\n name = \"gitlab-cache\"\n mount_path = \"/tmp/gitlab/cache\"\n host_path = \"/home/core/data/gitlab-runner/data\"\n\n[[runners]]\n name = \"runner-gitlab-runner-xxx-xxx\"\n url = \"https://gitlab.com/\"\n token = \"\"\n executor = \"kubernetes\"\n [runners.cache]\n [runners.cache.s3]\n [runners.cache.gcs]\n [runners.kubernetes]\n host = \"\"\n bearer_token_overwrite_allowed = false\n image = \"ubuntu:16.04\"\n namespace = \"gitlab-managed-apps\"\n namespace_overwrite_allowed = \"\"\n privileged = true\n service_account_overwrite_allowed = \"\"\n pod_annotations_overwrite_allowed = \"\"\n [runners.kubernetes.volumes]\n\nThe file /scripts/config.toml is the configuration as I created it in the ConfigMap.\nSo I suspect the /home/gitlab-runner/.gitlab-runner/config.toml is somehow updated when registering the Gitlab-Runner with the Gitlab cloud.\nIf if changing the config.toml via the ConfigMap does not work, how should I then change the configuration? I cannot find anything about this in Gitlab or Gitlab documentation."}, {"role": "assistant", "content": "Inside the mapping you can try to append the volume and the extra configuration parameters:\n# Add docker volumes\ncat >> /home/gitlab-runner/.gitlab-runner/config.toml << EOF\n\n [[runners.kubernetes.volumes.host_path]]\n name = \"var-run-docker-sock\"\n mount_path = \"/var/run/docker.sock\"\nEOF\n\nI did the runner deployment using a helm chart; I guess you did the same, in the following link you will find more information about the approach I mention: https://gitlab.com/gitlab-org/gitlab-runner/issues/2578\nIf after appending the config your pod is not able to start, check the logs, I did test the appending approach and had some errors like \"Directory not Found,\" and it was because I was appending in the wrong path, but after fixing those issues, the runner works fine."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "What's the difference between git-tf and git-tfs?\nI've recently been getting really fed up with TFS. I've heard that there is a light at the end of the tunnel though. Apparently I can use either git-tf or git-tfs and treat my code as if it was managed by git, but be able to push/pull to/from a central TFS server.\nMy main question is I'm not sure which one of these I should use. There is git-tf which is officially supported by Microsoft, and there is git-tfs which has been around a lot longer. What's the differences between these and which should I try out first?"}, {"role": "assistant", "content": "Disclaimer: I started the git-tf project and although the project is now in very capable hands without me as a frequent contributor, you should absolutely consider my opinions on this to be strongly biased. (And, assuming you're on Windows, perhaps unexpected.)\nThere are two fundamental differences between the two tools:\n\ngit-tfs was built for Windows users and written on top of the .NET TFS SDK. The TFS SDK will not run under Mono, so this makes git-tfs unsuitable for cross-platform use.\ngit-tf was built for cross-platform users and written on top of the Java TFS SDK. Thus, it will run anywhere that's supported by the Java TFS SDK (Windows, Mac, Linux, AIX, HP-UX, Solaris, etc...) git-tf was explicitly created to allow Xcode users to access TFS.\n\nOn Windows, of course, you can use either. I'm not going to necessarily say one is better than the other. But I will say:\n\nMy biggest complaint about git-tfs is that it won't work on Mac OS. If there was a way to make git-tfs cross-platform, then git-tf almost certainly wouldn't exist.\ngit-tfs is faster in some cases than git-tf. Performance was not our priority in the first few revisions, correctness was.\nBecause git-tf has a wide platform support matrix, this means that its functionality is necessarily constrained. For example, there is no UI. git-tfs, on the other hand, has a checkintool command that will open the normal TFS Checkin dialog. This can be exceptionally helpful in visualizing your changes. (If I recall, you can open up a proper visual diff from there, etc.)\ngit-tf works by populating the git repository directly, downloading TFS objects directly into the git object database. git-tfs works by creating a TFS working folder mapping in a hidden folder, then populating the git repository from that. There's a disk penalty here, so if you have superginormous repositories, you might feel this.\ngit-tfs can try to map your TFS branches to your git branches. A lot of people will see this as a positive for git-tfs, though I don't: git's branching model (at the repository level) and TFS's branching model (represented as folders in the repository) are so radically different as to cause problems in anything but the most simplistic workflows. But your mileage may vary.\ngit-tfs is actively developed by a community. git-tf has not had the community adoption.\n\nI don't want to make it sound like I'm saying git-tf is bad. It's not. I think it's actually pretty good. But it may not be your best choice.\n\nUpdate: git-tf has reached end-of-life. It is no longer maintained or supported by Microsoft. We recommend git-tfs if you want a bidirectional TFS <-> git solution."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-log - Show commit logs --check"}, {"role": "assistant", "content": "Warn if changes introduce conflict markers or whitespace errors.\nWhat are considered whitespace errors is controlled by core.whitespace configuration. By default, trailing whitespaces (including\nlines that consist solely of whitespaces) and a space character\nthat is immediately followed by a tab character inside the\ninitial indent of the line are considered whitespace errors.\nExits with non-zero status if problems are found. Not compatible\nwith --exit-code."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Git log out user from command line\nIs there a command for logging out of git? I'm turning my computer over to somebody else and don't want the git to be attached to my account in the terminal."}, {"role": "assistant", "content": "I came across this same problem, and the above answer didn't work for me because github was being fed my credentials through windows credential manager instead of git bash.\nYou may have to check windows credential manager and delete the github entry under control panel > user accounts > credential manager > Windows credentials > Generic credentials"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git : empty ident name (for <>) not allowed\nI was applying a diff file of an opensource project on the top of my repository using git-am :\n git am -3 < /Downloads/refactorWork.diff\n\nbut it had conflicts and i had to resolve them; but after resolving the conflicts and staging them, when i did git am --continue i got :\nfatal : empty ident name (for <>) not allowed\n\nI looked up on the internet and found this which seemed to be similar to my problem but my usename and email were already added up in global and local git directories. Here is the output of git config list :\nrohan@~/Documents/libo : $ git config --global --list\n[email protected]\nuser.name=Rohan Kumar\nalias.l=log --oneline --graph --pretty\ncredential.helper=cache\n\nAlthough i solved this by first commiting the staged changes and then using git am --skip, I am interested in knowing what does that error means and whether what i did was the correct way of doing it, or is there any better way?"}, {"role": "assistant", "content": "This diff file is a plain diff, not something generated by git format-patch. A format-patch generated diff contains information about the commit author, author date, commit message, ... and maintains this information when creating the commit(s).\nYour plain diff does not have these information, so git am will complain that it is missing, naturally.\nYou should instead have used git apply which is meant to apply simple patch files like you have in this case which will only apply the patch to the worktree (and index if you tell it to) but does not create any commit automatically."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git - the stupid content tracker git-imap-send"}, {"role": "assistant", "content": "Send a collection of patches from stdin to an IMAP folder"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Make some files private in a repository\nI want to host the source code for a website I created in a public repository on Github. I want it to be public so that I can also show the source code to others, however there are some files that I want to remain private. Files that may contain passwords and such (like when connecting to databases). Is there a way to do that?"}, {"role": "assistant", "content": "Although keeping passwords in the repository is a bad practice as @aspyct has explained, I want to add that not all things that one might want to keep private in a repository are passwords, e.g., one might want to develop a new feature but not expose it until it's done(or maybe expose it never).\nIn these cases, we can create two remote repositories both associated with the same local repository, but each corresponding to a different branch. Here's a step by step instruction:\n\nCreate two remote repositories(on GitHub or BitBucket or wherever else) with different names, for example: one myrepo and the other privates.myrepo. Make the myrepo a public repository and the privates.myrepo a private repository.\nOn local, initiate a single git repository: git init.\nAdd the non-private files now in the repository and make an initial commit.\nConnect this repository to the public remote:\n\ngit remote add \n\nin our example which becomes:\ngit remote add origin https://github.com//myrepo.git\n\n\nPush: git push -u origin master\n\nNow add a branch to the local repository and switch to it: git checkout -b private_work\n\nHere comes the important step: Connect this branch to the other remote, i.e, the private one. In our example:\n\n\ngit remote add privates https://github.com//privates.myrepo.git\n\n\nNext, add the private files to the local repository and make a commit.\nPush the private_work branch to the privates remote: git push -u privates private_work\n\n\nRead more explanation on how it works here: https://24ways.org/2013/keeping-parts-of-your-codebase-private-on-github/. I've also learned this from him.\nSee a cool terminal-show recording of all these steps together here: http://showterm.io/04130676d3401229e7df6\nAlso, you can add an alias like alias private_push='git push privates private_work in an startup script like .bashrc in case you're on Linux, in order to lower the chances of making a wrong push of private work to the public repository."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-log - Show commit logs %S"}, {"role": "assistant", "content": "ref name given on the command line by which the commit was reached\n(like git log --source ), only works with git log"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Gitlab Runner Docker login not working error during connect: Post http://docker:2375/v1.40/auth: dial tcp: lookup docker on 67.207.67.3:53\n\nI am using docker executor on gitlab runner as an image I am using docker:stable\nI am getting this error:\n$ docker login gitlab.mydomain.com:5050 -u myusername-p mytoken\nWARNING! Using --password via the CLI is insecure. Use --password-stdin.\nerror during connect: Post http://docker:2375/v1.40/auth: dial tcp: lookup docker on 67.207.67.3:53: no such host\nCleaning up project directory and file based variables\n00:01\nERROR: Job failed: exit code 1\n\nHere is my config.toml\nconcurrent = 1\ncheck_interval = 0\n\n[session_server]\n session_timeout = 1800\n\n[[runners]]\n name = \"dev-env\"\n url = \"https://gitlab.mydomain.com/\"\n token = \"REDACTED\"\n executor = \"docker\"\n [runners.custom_build_dir]\n [runners.cache]\n [runners.cache.s3]\n [runners.cache.gcs]\n [runners.cache.azure]\n [runners.docker]\n tls_verify = false\n image = \"docker:stable\"\n privileged = false\n disable_entrypoint_overwrite = false\n oom_kill_disable = false\n disable_cache = false\n volumes = [\"/cache\"]\n shm_size = 0\n\nHere is my ci file\ndeploy-dev:\n stage: deploy\n before_script:\n - apk add make\n script:\n - docker login gitlab.mydomain.com:5050 -u myusnerma -p mytoken\n only:\n - mybranch\n tags:\n - dev"}, {"role": "assistant", "content": "You must add the docker:dind service to your job configuration:\ndeploy-dev:\n variables:\n # these values may need to be different if using TLS, k8s, etc.\n # You can alternatively set defaults in your runner config\n DOCKER_TLS_CERTDIR: \"\"\n DOCKER_HOST: \"tcp://docker:2375\"\n services:\n - docker:dind\n # ...\n\nFor the dind container to work, your runner must allow privileged containers:\n [runners.docker]\n privileged = true\n # ..."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-submodule - Initialize, update or inspect submodules absorbgitdirs"}, {"role": "assistant", "content": "If a git directory of a submodule is inside the submodule,\nmove the git directory of the submodule into its superproject’s $GIT_DIR/modules path and then connect the git directory and\nits working directory by setting the core.worktree and adding\na .git file pointing to the git directory embedded in the\nsuperprojects git directory. A repository that was cloned independently and later added as a submodule or\nold setups have the submodules git directory inside the submodule instead of\nembedded into the superprojects git directory. This command is recursive by default."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How can I pass GitLab artifacts to another stage?\n\nI'd like to use GitLab CI with the .gitlab-ci.yml file to run different stages with separate scripts. The first stage produces a tool that must be used in a later stage to perform tests. I've declared the generated tool as an artifact.\nNow how can I execute that tool in a later stage job? What is the correct path, and what files will there be around it?\nFor example the first stage builds artifacts/bin/TestTool/TestTool.exe and that directory contains other required files (DLLs and others). My .gitlab-ci.yml file looks like this:\nreleasebuild:\n script:\n - chcp 65001\n - build.cmd\n stage: build\n artifacts:\n paths:\n - artifacts/bin/TestTool/\n\nsystemtests:\n script:\n - chcp 65001\n - WHAT TO WRITE HERE?\n stage: test\n\nThe build and test jobs run on Windows if that's relevant."}, {"role": "assistant", "content": "Use dependencies. With this config, the test stage will download the untracked files that were created during the build stage:\nbuild:\n stage: build\n artifacts:\n untracked: true\n script:\n - ./Build.ps1\n\ntest:\n stage: test\n dependencies:\n - build\n script:\n - ./Test.ps1"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git - the stupid content tracker git-grep"}, {"role": "assistant", "content": "Print lines matching a pattern"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "What is a good workflow for submodule forks\nSuppose we have the following repository structure on github:\ncompany:project.git\n \\- company:submodule.git\n\nA developer in my company forks the company project, making his workspace look like this:\ndeveloper:project.git\n \\- company:submodule.git\n\nThis is fine for 90% of the developers since they don't change the submodule library, they only work in the project. Now suppose there's a new feature which requires improvements in the submodule. The developer charged with this converts his workspace to this:\ndeveloper:project.git\n \\- developer:submodule.git\n\nGetting there is not trivial as he needs to replace a submdule with another submodule (to git, the original and the fork of the submodule are two different things).\nIf this developer works on the library for a bit longer, he commits this structure to his master branch, so his fork on github always uses the forked submodule.\nOnce he's ready with development, he'll create a pull request. The problem is that when merging the pull request the main repository will look like this:\ncompany:project.git\n \\- developer:submodule.git\n\nThis is problematic as now every developer that tracks the company branch will end up with the developer's submodule.\nTo workaround the problem, before the developer makes a pull request, his master branch should be moved back to the company:submodule.git - which is just very awkward, especially since locally he'll always still want to work with developer:submodule.git.\nWe've tried several workflows, and the above issue is the only one where we don't have a good workflow yet."}, {"role": "assistant", "content": "When the developer creates a commit with the submodule at a particular version, that's a strong statement that the supermodule works with the submodule at that exact version. If his code does actually work with the company's version of the submodule, I think the right thing to do is for the developer to:\n\nbranch the supermodule\ncheckout the company version in the submodule\nupdate .gitmodules in the supermodule, if the developer changed that from the upstream version\nstage and commit that change\ntest everything\nissue the pull request\n\nHe can then switch back to his normal development branch in the supermodule.\nOne thing I don't understand about your question is the following:\n\nGetting there is not trivial as he needs to replace a submdule with another submodule (to git, the original and the fork of the submodule are two different things).\n\nOn the contrary, the submodule can be any git repository so long as it contains the commit which the supermodule points to. If there are two different remote repositories, he can just add an extra remote in the submodule. (The developer should change .gitmodules as well if they're going to share their repository with anyone else.)\n\nIn response to your comment below, perhaps it's worth going through how to switch a submodule from pointing to one version to another. Let's suppose that the developer is using their own repositories for the super and submodule, but those are both cloned from the company's versions (i.e. so most of the history is the same), and the submodule is at the path lib. The developer now wants to switch the submodule to point to the company's version instead. They can do the following:\n\nEdit the url parameter for the submodule in .gitmodules to point to the company's repository.\ncd lib\ngit remote add company developer@company:/srv/git/lib.git\ngit fetch company\ngit checkout -b upstream-master company/master\ncd ..\ngit add .gitmodules lib\ngit commit -m \"Switch the lib submodule to point back to the company's version\"\n\nSteps 3 to 5 can just be changed to git checkout once the remote and branch are set up."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How do I remove local (untracked) files from the current Git working tree?\nHow do I delete untracked local files from the current working tree?"}, {"role": "assistant", "content": "git-clean - Remove untracked files from the working tree\nSynopsis\ngit clean [-d] [-f] [-i] [-n] [-q] [-e ] [-x | -X] [--] …​\n\nDescription\nCleans the working tree by recursively removing files that are not under version control, starting from the current directory.\nNormally, only files unknown to Git are removed, but if the -x option is specified, ignored files are also removed. This can, for example, be useful to remove all build products.\nIf any optional ... arguments are given, only those paths are affected.\n\n\nStep 1 is to show what will be deleted by using the -n option:\n# Print out the list of files and directories which will be removed (dry run)\ngit clean -n -d\n\nClean Step - beware: this will delete files:\n# Delete the files from the repository\ngit clean -f\n\n\nTo remove directories, run git clean -f -d or git clean -fd\nTo remove ignored files, run git clean -f -X or git clean -fX\nTo remove ignored and non-ignored files, run git clean -f -x or git clean -fx\n\nNote the case difference on the X for the two latter commands.\nIf clean.requireForce is set to \"true\" (the default) in your configuration, one needs to specify -f otherwise nothing will actually happen.\nAgain see the git-clean docs for more information.\n\n\nOptions\n-f, --force\nIf the Git configuration variable clean.requireForce is not set to\nfalse, git clean will refuse to run unless given -f, -n or -i.\n-x\nDon’t use the standard ignore rules read from .gitignore (per\ndirectory) and $GIT_DIR/info/exclude, but do still use the ignore\nrules given with -e options. This allows removing all untracked files,\nincluding build products. This can be used (possibly in conjunction\nwith git reset) to create a pristine working directory to test a clean\nbuild.\n-X\nRemove only files ignored by Git. This may be useful to rebuild\neverything from scratch, but keep manually created files.\n-n, --dry-run\nDon’t actually remove anything, just show what would be done.\n-d\nRemove untracked directories in addition to untracked files. If an\nuntracked directory is managed by a different Git repository, it is\nnot removed by default. Use -f option twice if you really want to\nremove such a directory."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-config - Get and set repository or global options format.subjectPrefix"}, {"role": "assistant", "content": "The default for format-patch is to output files with the [PATCH] subject prefix. Use this variable to change that prefix."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How to get diff between all files inside 2 folders that are on the web?\nSo I want to compare this folder http://cloudobserver.googlecode.com/svn/branches/v0.4/Boost.Extension.Tutorial/libs/boost/extension/ with this http://svn.boost.org/svn/boost/sandbox/boost/extension/. I want to get a diff file as a result. These folders are under svn control but I'd prefer git styled diff file (like one shown here) I tried git diff but it seems not to work that way for web folders. So how to do the same thing with one command on Linux?\nUpdate:\nSo we had a great answer. But it works strangely - it seems to me it shows that all files (same files) have all theire contents replaced with very same contents (while I know for sure that there were only like 3-4 code lines changed at all)...\nUpdate 2:\nTo achieve what I really needed (dif file with only really changed lines, with git styling, on Linux) do:\n$ svn export http://cloudobserver.googlecode.com/svn/branches/v0.4/Boost.Extension.Tutorial/libs/boost/extension/ repos2 --native-eol CRLF\n$ svn export http://svn.boost.org/svn/boost/sandbox/boost/extension/ repos --native-eol CRLF\n$ git diff repos repos2 > fileWithReadableDiff.diff"}, {"role": "assistant", "content": "Once you have the source trees, e.g.\ndiff -ENwbur repos1/ repos2/ \n\nEven better\ndiff -ENwbur repos1/ repos2/ | kompare -o -\n\nand have a crack at it in a good gui tool :)\n\n-Ewb ignore the bulk of whitespace changes\n-N detect new files\n-u unified\n-r recurse"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "gitattributes - Defining attributes per path Set to string value \"lf\""}, {"role": "assistant", "content": "This setting uses the same line endings in the working directory as\nin the index when the file is checked out."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git - the stupid content tracker "}, {"role": "assistant", "content": "a valid head name (i.e. a refs/heads/ reference)."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-log - Show commit logs git log --since=\"2 weeks ago\" -- gitk"}, {"role": "assistant", "content": "Show the changes during the last two weeks to the file gitk .\nThe -- is necessary to avoid confusion with the branch named gitk"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-clean - Remove untracked files from the working tree -x"}, {"role": "assistant", "content": "Don’t use the standard ignore rules (see gitignore ), but\nstill use the ignore rules given with -e options from the command\nline. This allows removing all untracked\nfiles, including build products. This can be used (possibly in\nconjunction with git restore or git reset ) to create a pristine\nworking directory to test a clean build."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-init - Create an empty Git repository or reinitialize an existing one --separate-git-dir= "}, {"role": "assistant", "content": "Instead of initializing the repository as a directory to either $GIT_DIR or ./.git/ , create a text file there containing the path to the actual\nrepository. This file acts as a filesystem-agnostic Git symbolic link to the\nrepository. If this is a reinitialization, the repository will be moved to the specified path."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How can I fix the Git error \"object file ... is empty\"?\nWhen I try to commit changes, I get this error:\nerror: object file .git/objects/31/65329bb680e30595f242b7c4d8406ca63eeab0 is empty\nfatal: loose object 3165329bb680e30595f242b7c4d8406ca63eeab0 (stored in .git/objects/31/65329bb680e30595f242b7c4d8406ca63eeab0) is corrupt\n\nI tried git fsck I've got:\nerror: object file .git/objects/03/dfd60a4809a3ba7023cbf098eb322d08630b71 is empty\nfatal: loose object 03dfd60a4809a3ba7023cbf098eb322d08630b71 (stored in .git/objects/03/dfd60a4809a3ba7023cbf098eb322d08630b71) is corrupt\n\nHow can I solve this error?"}, {"role": "assistant", "content": "I had a similar problem. My laptop ran out of battery during a Git operation. Boo.\nI didn't have any backups. (N.B. Ubuntu One is not a backup solution for Git; it will helpfully overwrite your sane repository with your corrupted one.)\nTo the Git wizards, if this was a bad way to fix it, please leave a comment. It did, however, work for me... at least temporarily.\nStep 1: Make a backup of folder .git (in fact I do this in between every step that changes something, but with a new copy-to name, e.g., .git-old-1, .git-old-2, etc.):\ncd ~/workspace/mcmc-chapter\ncp -a .git .git-old\n\nStep 2: Run git fsck --full\ngit fsck --full\n\nerror: object file .git/objects/8b/61d0135d3195966b443f6c73fb68466264c68e is empty\nfatal: loose object 8b61d0135d3195966b443f6c73fb68466264c68e (stored in .git/objects/8b/61d0135d3195966b443f6c73fb68466264c68e) is corrupt\n\nStep 3: Remove the empty file. I figured what the heck; it's blank anyway.\nrm .git/objects/8b/61d0135d3195966b443f6c73fb68466264c68e\n\nrm: remove write-protected regular empty file `.git/objects/8b/61d0135d3195966b443f6c73fb68466264c68e'? y\n\nStep 3: Run git fsck again. Continue deleting the empty files. You can also cd into the .git directory and run find . -type f -empty -delete -print to remove all empty files. Eventually Git started telling me it was actually doing something with the object directories:\ngit fsck --full\n\nChecking object directories: 100% (256/256), done.\nerror: object file .git/objects/e0/cbccee33aea970f4887194047141f79a363636 is empty\nfatal: loose object e0cbccee33aea970f4887194047141f79a363636 (stored in .git/objects/e0/cbccee33aea970f4887194047141f79a363636) is corrupt\n\nStep 4: After deleting all of the empty files, I eventually came to git fsck actually running:\ngit fsck --full\n\nChecking object directories: 100% (256/256), done.\nerror: HEAD: invalid sha1 pointer af9fc0c5939eee40f6be2ed66381d74ec2be895f\nerror: refs/heads/master does not point to a valid object!\nerror: refs/heads/master.u1conflict does not point to a valid object!\nerror: 0e31469d372551bb2f51a186fa32795e39f94d5c: invalid sha1 pointer in cache-tree\ndangling blob 03511c9868b5dbac4ef1343956776ac508c7c2a2\nmissing blob 8b61d0135d3195966b443f6c73fb68466264c68e\nmissing blob e89896b1282fbae6cf046bf21b62dd275aaa32f4\ndangling blob dd09f7f1f033632b7ef90876d6802f5b5fede79a\nmissing blob caab8e3d18f2b8c8947f79af7885cdeeeae192fd\nmissing blob e4cf65ddf80338d50ecd4abcf1caf1de3127c229\n\nStep 5: Try git reflog. Fail because my HEAD is broken.\ngit reflog\n\nfatal: bad object HEAD\n\nStep 6: Google. Find this. Manually get the last two lines of the reflog:\ntail -n 2 .git/logs/refs/heads/master\n\nf2d4c4868ec7719317a8fce9dc18c4f2e00ede04 9f0abf890b113a287e10d56b66dbab66adc1662d Nathan VanHoudnos <[email protected]> 1347306977 -0400 commit: up to p. 24, including correcting spelling of my name\n9f0abf890b113a287e10d56b66dbab66adc1662d af9fc0c5939eee40f6be2ed66381d74ec2be895f Nathan VanHoudnos <[email protected]> 1347358589 -0400 commit: fixed up to page 28\n\nStep 7: Note that from Step 6 we learned that the HEAD is currently pointing to the very last commit. So let's try to just look at the parent commit:\ngit show 9f0abf890b113a287e10d56b66dbab66adc1662d\n\ncommit 9f0abf890b113a287e10d56b66dbab66adc1662d\nAuthor: Nathan VanHoudnos \nDate: Mon Sep 10 15:56:17 2012 -0400\n\n up to p. 24, including correcting spelling of my name\n\ndiff --git a/tex/MCMC-in-IRT.tex b/tex/MCMC-in-IRT.tex\nindex 86e67a1..b860686 100644\n--- a/tex/MCMC-in-IRT.tex\n+++ b/tex/MCMC-in-IRT.tex\n\nIt worked!\nStep 8: So now we need to point HEAD to 9f0abf890b113a287e10d56b66dbab66adc1662d.\ngit update-ref HEAD 9f0abf890b113a287e10d56b66dbab66adc1662d\n\nWhich didn't complain.\nStep 9: See what fsck says:\ngit fsck --full\n\nChecking object directories: 100% (256/256), done.\nerror: refs/heads/master.u1conflict does not point to a valid object!\nerror: 0e31469d372551bb2f51a186fa32795e39f94d5c: invalid sha1 pointer in cache-tree\ndangling blob 03511c9868b5dbac4ef1343956776ac508c7c2a2\nmissing blob 8b61d0135d3195966b443f6c73fb68466264c68e\nmissing blob e89896b1282fbae6cf046bf21b62dd275aaa32f4\ndangling blob dd09f7f1f033632b7ef90876d6802f5b5fede79a\nmissing blob caab8e3d18f2b8c8947f79af7885cdeeeae192fd\nmissing blob e4cf65ddf80338d50ecd4abcf1caf1de3127c229\n\nStep 10: The invalid sha1 pointer in cache-tree seemed like it was from a (now outdated) index file (source). So I killed it and reset the repository.\nrm .git/index\ngit reset\n\nUnstaged changes after reset:\nM tex/MCMC-in-IRT.tex\nM tex/recipe-example/build-example-plots.R\nM tex/recipe-example/build-failure-plots.R\n\nStep 11: Looking at the fsck again...\ngit fsck --full\n\nChecking object directories: 100% (256/256), done.\nerror: refs/heads/master.u1conflict does not point to a valid object!\ndangling blob 03511c9868b5dbac4ef1343956776ac508c7c2a2\ndangling blob dd09f7f1f033632b7ef90876d6802f5b5fede79a\n\nThe dangling blobs are not errors. I'm not concerned with master.u1conflict, and now that it is working I don't want to touch it anymore!\nStep 12: Catching up with my local edits:\ngit status\n\n# On branch master\n# Changes not staged for commit:\n# (use \"git add ...\" to update what will be committed)\n# (use \"git checkout -- ...\" to discard changes in working directory)\n#\n# modified: tex/MCMC-in-IRT.tex\n# modified: tex/recipe-example/build-example-plots.R\n# modified: tex/recipe-example/build-failure-plots.R\n#\n< ... snip ... >\nno changes added to commit (use \"git add\" and/or \"git commit -a\")\n\n\ngit commit -a -m \"recovering from the git fiasco\"\n\n[master 7922876] recovering from the git fiasco\n 3 files changed, 12 insertions(+), 94 deletions(-)\n\ngit add tex/sept2012_code/example-code-testing.R\ngit commit -a -m \"adding in the example code\"\n\n[master 385c023] adding in the example code\n 1 file changed, 331 insertions(+)\n create mode 100644 tex/sept2012_code/example-code-testing.R"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-shortlog - Summarize git log output --not"}, {"role": "assistant", "content": "Reverses the meaning of the ^ prefix (or lack thereof)\nfor all following revision specifiers, up to the next --not .\nWhen used on the command line before --stdin, the revisions passed\nthrough stdin will not be affected by it. Conversely, when passed\nvia standard input, the revisions passed on the command line will\nnot be affected by it."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-config - Get and set repository or global options core.preloadIndex"}, {"role": "assistant", "content": "Enable parallel index preload for operations like git diff This can speed up operations like git diff and git status especially\non filesystems like NFS that have weak caching semantics and thus\nrelatively high IO latencies. When enabled, Git will do the\nindex comparison to the filesystem data in parallel, allowing\noverlapping IO’s. Defaults to true."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-rev-list - Lists commit objects in reverse chronological order --cherry-pick"}, {"role": "assistant", "content": "Omit any commit that introduces the same change as\nanother commit on the “other side” when the set of\ncommits are limited with symmetric difference. For example, if you have two branches, A and B , a usual way\nto list all commits on only one side of them is with --left-right (see the example below in the description of\nthe --left-right option). However, it shows the commits that were\ncherry-picked from the other branch (for example, “3rd on b” may be\ncherry-picked from branch A). With this option, such pairs of commits are\nexcluded from the output."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-diff - Show changes between commits, commit and working tree, etc default , myers"}, {"role": "assistant", "content": "The basic greedy diff algorithm. Currently, this is the default."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git unpack error on push to gerrit\nOn push of a new branch to a gerrit server we encounter the following error:\nde@roma:~/git-hate/www$ git push origin landingpage\nCounting objects: 149, done.\nDelta compression using up to 2 threads.\nCompressing objects: 100% (73/73), done.\nWriting objects: 100% (111/111), 2.77 MiB, done.\nTotal 111 (delta 68), reused 80 (delta 38)\nremote: Resolving deltas: 100% (68/68)\nerror: unpack failed: error Missing tree 30c4809ade0b4b0c81cb7f882450774862b82361\nfatal: Unpack error, check server log\nTo ssh://user@git-server/repository\n ! [remote rejected] landingpage -> landingpage (n/a (unpacker error))\nerror: failed to push some refs to 'ssh://user@git-server/repository'\n\nWe tried to copy the mentioned tree object to the remote git manually without success.\nOn gerrit side we get a stacktrace:\n[2013-05-16 13:43:42,753] ERROR com.google.gerrit.sshd.BaseCommand : Internal server error (user de account 1000000) during git-receive-pack '/repository'\ncom.google.gerrit.sshd.BaseCommand$Failure: fatal: Unpack error, check server log\n at com.google.gerrit.sshd.commands.Receive.runImpl(Receive.java:157)\n at com.google.gerrit.sshd.AbstractGitCommand.service(AbstractGitCommand.java:106)\n at com.google.gerrit.sshd.AbstractGitCommand.access$000(AbstractGitCommand.java:34)\n at com.google.gerrit.sshd.AbstractGitCommand$1.run(AbstractGitCommand.java:72)\n at com.google.gerrit.sshd.BaseCommand$TaskThunk.run(BaseCommand.java:430)\n at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)\n at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)\n at java.util.concurrent.FutureTask.run(FutureTask.java:166)\n at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:165)\n at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:266)\n at com.google.gerrit.server.git.WorkQueue$Task.run(WorkQueue.java:337)\n at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)\n at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)\n at java.lang.Thread.run(Thread.java:636)\nCaused by: java.io.IOException: Unpack error on project \"repository\":\n AdvertiseRefsHook: org.eclipse.jgit.transport.AdvertiseRefsHookChain@7047125class org.eclipse.jgit.transport.AdvertiseRefsHookChain\n\n at com.google.gerrit.sshd.commands.Receive.runImpl(Receive.java:156)\n ... 13 more\nCaused by: org.eclipse.jgit.errors.UnpackException: Exception while parsing pack stream\n at org.eclipse.jgit.transport.ReceivePack.service(ReceivePack.java:202)\n at org.eclipse.jgit.transport.ReceivePack.receive(ReceivePack.java:142)\n at com.google.gerrit.sshd.commands.Receive.runImpl(Receive.java:98)\n ... 13 more\nCaused by: org.eclipse.jgit.errors.MissingObjectException: Missing tree 30c4809ade0b4b0c81cb7f882450774862b82361\n at org.eclipse.jgit.transport.BaseReceivePack.checkConnectivity(BaseReceivePack.java:996)\n at org.eclipse.jgit.transport.BaseReceivePack.receivePackAndCheckConnectivity(BaseReceivePack.java:756)\n at org.eclipse.jgit.transport.ReceivePack.service(ReceivePack.java:167)\n ... 15 more\n\nFolks: any ideas what to do?"}, {"role": "assistant", "content": "Pushing with --no-thin argument works as a workaround for me:\ngit push --no-thin omnigerrit HEAD:refs/for/android-4.4"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-diff - Show changes between commits, commit and working tree, etc diff.algorithm"}, {"role": "assistant", "content": "Choose a diff algorithm. The variants are as follows: default , myers The basic greedy diff algorithm. Currently, this is the default. minimal Spend extra time to make sure the smallest possible diff is\nproduced. patience Use \"patience diff\" algorithm when generating patches. histogram This algorithm extends the patience algorithm to \"support\nlow-occurrence common elements\"."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Git diff to show only lines that have been modified\nWhen I do a git diff, it shows lines that have been added:\n+ this line is added\n\nlines that have been removed:\n- this line is removed\n\nbut it also shows many lines which are not modified:\nthis line is not modified\nthis line is also not modified\n\nThis results in the actual git diff looking something like this:\n+ this line is added\n this line is not modified\n- this line is removed\n this line is not modified\n\nCan I ask git to show only lines that have been modified and ignore all other code which has not been modified? I have written a method which will remove all the lines which don't have a \"+\" or \"-\" sign in front of them, but I am sure there must be a simpler way to do this.\nIn my git diff, I am only interested in seeing the lines that have been modified."}, {"role": "assistant", "content": "What you want is a diff with 0 lines of context. You can generate this with:\ngit diff --unified=0\n\nor\ngit diff -U0\n\nYou can also set this as a config option for that repository:\ngit config diff.context 0\n\nTo have it set globally, for any repository:\ngit config --global diff.context 0"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "why is Issues tab not present in my repo's github page?\nI want to create issues in a github repo to correct technical debt in the repo. I am not able to see the issues tab. For other repos the issues tab present below the pull request tab. How can I enable the issues tab for my repo?"}, {"role": "assistant", "content": "You have to enable the Issues first. You can do that by clicking to Settings and enable the Issues section. Then you can use it."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How do I change which GitHub project I forked from?\nI forked a project, made some changes, and got a pull request accepted. But now, the project I forked moved to another repository and is a fork of that repository.\nThat is:\nOriginal -> MyFork\n\nNow:\nNewOriginal -> Original -> MyFork\n\nHow would I get it to the following?\nNewOriginal -> MyFork"}, {"role": "assistant", "content": "NOTE: The following solution is incomplete as you'll lose all wiki content and issues specific to your fork.\nYou can achieve this using the following steps:\n\nPull down all branches and tags from your existing fork.\nDelete your repository on GitHub.\nFork from the new repository.\nUpdate the remote URL if necessary.\nPush all your local branches and tags to the new repository."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How to point Go module dependency in go.mod to a latest commit in a repo?\nStarting with v1.11 Go added support for modules. Commands\ngo mod init \ngo build\n\nwould generate go.mod and go.sum files that contain all found versions for the package dependencies. If a module does not have any releases, the latest commit of that module is used. If a module does have releases, the latest one is picked as a dependency.\nHowever sometimes I would need functionality that is not in a published release yet, but from a commit made after that release. How do I set go.mod to point not to a release of a module, but to a specific commit in the module's repository? It looks like I can do it by hand in go.mod with\nmodule /my/module\n \nrequire (\n ...\n github.com/someone/some_module v0.0.0-20181121201909-af044c0995fe\n ...\n)\n\nwhere v0.0.0 does not correspond to the last published release tag, 20181121201909 would be a commit timestamp and af044c0995fe would be the commit hash? Should such information to be found and entered by hand, or there is a better way?"}, {"role": "assistant", "content": "Just 'go get' at the commit hash you want:\ngo get github.com/someone/some_module@af044c0995fe\n\n'go get' will correctly update the dependency files (go.mod, go.sum).\nMore information: https://github.com/golang/go/wiki/Modules#how-to-upgrade-and-downgrade-dependencies"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Referencing the child of a commit in Git\nIf you want to move the HEAD to the parent of the current HEAD, that's easy:\ngit reset --hard HEAD^\n\nBut is there any simple way to do the exact opposite of this operation, that is, set the head to the current head's first child commit?\nRight now, I use gitk as a workaround (alt-tab, up-arrow, alt-tab, middle-click), but I would like a more elegant solution, one that can also be used when gitk is not available."}, {"role": "assistant", "content": "Very probably not the fastest possible solution, but it does what I need:\n#!/bin/bash\n\nREV=$1\n\nif [[ -z \"$REV\" ]]; then\n echo \"Usage: git-get-child []\"\n exit\nfi\n\nHASH=$(git rev-parse $REV)\n\nNUM=$2\n\nif [[ -z \"$NUM\" ]]; then\n NUM=1\nfi\n\ngit rev-list --all --parents | grep \" $HASH\" | sed -n \"${NUM}s/\\([^ ]*\\) .*$/\\\\1/p\"\n\nThe git rev-list --all --parents does exactly what I need: it iterates over all reachable commits, and prints the following line for each:\nSHA1_commit SHA1_parent1 SHA1_parent2 etc.\nThe space in the grep expression ensures that only those lines are found where the SHA1 in question is a parent. Then we get the nth line for the nth child and get the child's SHA1."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Can't ignore UserInterfaceState.xcuserstate\nI'm using Git for Xcode 4 project version control. I've explicitly added ProjectFolder.xcodeproj/project.xcworkspace/xcuserdata/myUserName.xcuserdatad/UserInterfaceState.xcuserstate to .gitignore, but Git it won't ignore it. Any ideas why this is so?"}, {"role": "assistant", "content": "Git is probably already tracking the file.\nFrom the gitignore docs:\n\nTo stop tracking a file that is currently tracked, use git rm --cached.\n\nUse this, replacing [project] and [username] with your info:\ngit rm --cached [project].xcodeproj/project.xcworkspace/xcuserdata/[username].xcuserdatad/UserInterfaceState.xcuserstate\ngit commit -m \"Removed file that shouldn't be tracked\"\n\nAlternatively you can use the -a option to git commit that will add all files that have been modified or deleted.\nOnce you've removed the file from git, it will respect your .gitignore."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Msysgit bash is horrendously slow in Windows 7\nI love git and use it on OS X pretty much constantly at home. At work, we use svn on Windows, but want to migrate to git as soon as the tools have fully matured (not just TortoiseGit, but also something akin the really nice Visual Studio integration provided by VisualSVN). But I digress...\nI recently installed msysgit on my Windows 7 machine, and when using the included version of bash, it is horrendously slow. And not just the git operations; clear takes about five seconds. AAAAH!\nHas anyone experienced a similar issue?\n\nEdit: It appears that msysgit is not playing nicely with UAC and might just be a tiny design oversight resulting from developing on XP or running Vista or 7 with UAC disabled; starting Git Bash using Run as administrator results in the lightning speed I see with OS X (or on 7 after starting Git Bash w/o a network connection - see @Gauthier answer).\nEdit 2: AH HA! See my answer."}, {"role": "assistant", "content": "You can significantly speed up Git on Windows by running three commands to set some config options:\ngit config --global core.preloadindex true\ngit config --global core.fscache true\ngit config --global gc.auto 256\n\nNotes:\n\ncore.preloadindex does filesystem operations in parallel to hide latency (update: enabled by default in git 2.1)\ncore.fscache fixes UAC issues so you don't need to run Git as administrator (update: enabled by default in Git for Windows 2.8)\ngc.auto minimizes the number of files in .git/"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Install Gem from Github Branch?\n\nIn my gemfile I have this:\ngem \"authlogic\", git: \"git://github.com/odorcicd/authlogic.git\", branch: \"rails3\"\n\nHow do I install that as a gem so I can test it?"}, {"role": "assistant", "content": "You don't need to build the gem locally. In your gemfile you can specify a github source with a ref, branch or tag.\ngem 'rails', git: 'git://github.com/rails/rails.git', ref: '4aded'\ngem 'rails', git: 'git://github.com/rails/rails.git', branch: '2-3-stable'\ngem 'rails', git: 'git://github.com/rails/rails.git', tag: 'v2.3.5'\n\nThen you run bundle install or the short form is just bundle.\nRead more about it here: http://bundler.io/man/gemfile.5.html#GIT\nUpdate: There's a github source identifier.\ngem 'country_select', github: 'stefanpenner/country_select'\n\nHowever, they warn against using it: NOTE: This shorthand should be avoided until Bundler 2.0, since it currently expands to an insecure git:// URL. This allows a man-in-the-middle attacker to compromise your system.\nAfter Bundler 2.0, you can get around the above issue with this statement near the top of the Gemfile:\ngit_source(:github) { |repo| \"https://github.com/#{repo}.git\" }"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Gitlab login error: invalid email or password [closed]\n\nIt's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.\n \n \n\n\n\nClosed 11 years ago.\n\n\n\nI installed gitlab on my homeserver, the server is running. I can access the login page but I can't login. \n[email protected].\n5iveL!fe\nError: invalid email or password. \nWhat could be the problem?"}, {"role": "assistant", "content": "/home/gitlab/github/app/observers/user_observer.rb\n\nNotify.delay.new_user_email(user.id, user.password) \n\nto change:\nNotify.new_user_email(user.id, user.password)\n\nRun: \n[email protected] ~/gitlab/github $ bundle exec rake db:seed_fu RAILS_ENV=production"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How to normalize working tree line endings in Git?\nI have cloned a repository that had inconsistend line endings. I have added a .gitattributes that sets the text attribute for the files I want to normalize. Now when I commit changes I get the message:\nwarning: CRLF will be replaced by LF in FILE.\nThe file will have its original line endings in your working directory.\n\nHow can I make git normalize my working copy of the file for me? Preferably I would like git to normalize the entire working tree."}, {"role": "assistant", "content": "For those using v2.16 or better, you can simply use:\ngit add --renormalize . # Update index with renormalized files\ngit status # Show the files that will be normalized\ngit commit -m \"Introduce end-of-line normalization\"\n\nThese directions are straight out of the gitattributes. For older versions, the docs \n(prior to v2.12) provide a different answer:\nrm .git/index # Remove the index to force git to\ngit reset # re-scan the working directory\ngit status # Show files that will be normalized\ngit add -u\ngit add .gitattributes\ngit commit -m \"Introduce end-of-line normalization\"\n\nDo this sequence after you have edited .gitattributes.\nUpdate\nIt appears some users have had trouble with the above instructions. Updated docs for gitattributes (2.12 to 2.14) shows a new set of instructions (after editing the .gitattributes files):\ngit read-tree --empty # Clean index, force re-scan of working directory\ngit add .\ngit status # Show files that will be normalized\ngit commit -m \"Introduce end-of-line normalization\"\n\nThanks to @vossad01 for pointing this out.\nAlso, with either solution the files in your working copy still retain their old line endings. If you want to update them, make sure your working tree is clean and use:\ngit rm --cached -r .\ngit reset --hard\n\nNow the line endings will be correct in your working tree."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-request-pull - Generates a summary of pending changes -p"}, {"role": "assistant", "content": "Include patch text in the output."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-log - Show commit logs %t"}, {"role": "assistant", "content": "abbreviated tree hash"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How do I add files in Git to the path of a former submodule?\nI have a project that used to contain a submodule, at path mysubmodule. I installed the latest Git from source (1.8.3-rc2) and ran git submodule deinit mysubmodule. I then deleted the .gitmodules file and committed the change. I also deleted the .git directory from the mysubmodule folder.\nI'd like to commit the files from mysubmodule into my repo directly now, but git says there are no changes. If I type git add mysubmodule it does nothing. If I type git add mysubmodule/file.txt it says fatal: Path 'mysubmodule/file.txt' is in submodule 'mysubmodule'\nI've also discovered if you check out a fresh version of the repo, it creates a mysubmodule directory, despite having no .gitmodules file. And running git submodule init gives you a No submodule mapping found in .gitmodules for path 'mysubmodule' error.\nHow do I fix this?"}, {"role": "assistant", "content": "Git still think mysubmodule is a submodule, because it is recorded in the index with a special mode \"160000\".\nSee \"git submodule update needed only initially?\" for more.\nTo check that, as in in this answer, you can do a:\n $ git ls-tree HEAD mysubmodule \n 160000 commit c0f065504bb0e8cfa2b107e975bb9dc5a34b0398 mysubmodule \n\nThat doesn't depend on the presence of the .gitmodule file, or on the content of mysubmodule.\nYou need to remove that entry from the index first:\n git rm --cached mysubmodule\n\nThen you can proceed."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-log - Show commit logs -O"}, {"role": "assistant", "content": "Control the order in which files appear in the output.\nThis overrides the diff.orderFile configuration variable\n(see git-config ). To cancel diff.orderFile ,\nuse -O/dev/null . The output order is determined by the order of glob patterns in\n.\nAll files with pathnames that match the first pattern are output\nfirst, all files with pathnames that match the second pattern (but not\nthe first) are output next, and so on.\nAll files with pathnames that do not match any pattern are output\nlast, as if there was an implicit match-all pattern at the end of the\nfile.\nIf multiple pathnames have the same rank (they match the same pattern\nbut no earlier patterns), their output order relative to each other is\nthe normal order. is parsed as follows: Blank lines are ignored, so they can be used as separators for\nreadability. Lines starting with a hash (\" # \") are ignored, so they can be used\nfor comments. Add a backslash (\" \\ \") to the beginning of the\npattern if it starts with a hash. Each other line contains a single pattern. Patterns have the same syntax and semantics as patterns used for\nfnmatch(3) without the FNM_PATHNAME flag, except a pathname also\nmatches a pattern if removing any number of the final pathname\ncomponents matches the pattern. For example, the pattern \" foo*bar \"\nmatches \" fooasdfbar \" and \" foo/bar/baz/asdf \" but not \" foobarx \"."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How to upload a project to GitHub\n\nAfter checking How can I upload my project's Git repository to GitHub?, I still have no idea how to get a project uploaded to my GitHub repository.\nI created a repository and want to upload my project to it.\nI've looked on the repository page for an upload button of some kind, but I haven't seen anything of the sort.\nI've looked at the links provided so far, but I'm still getting nowhere. They mention command line; is that Windows command line or Git Bash? Because I can't get either to do anything.\nI also tried using the Git GUI, but when I select the folder I want it says that it's not a Git repository...does it need to be zipped up? I tried adding the .gitconfig file in the folder, but it doesn't make a difference."}, {"role": "assistant", "content": "GitHub released a native Windows client which makes all the below steps redundant.\nYou can also use Sourcetree to get both Git and Mercurial setup on Windows.\n\nHere is how you would do it in Windows:\n\nIf you don't have Git installed, see this article on how to set it up.\n\nOpen up a Windows command prompt.\n\nChange into the directory where your source code is located in the command prompt.\n\nFirst, create a new repository in this directory git init. This will say \"Initialized empty git repository in ....git\" (... is the path).\n\nNow you need to tell Git about your files by adding them to your repository. Do this with git add filename. If you want to add all your files, you can do git add .\n\nNow that you have added your files and made your changes, you need to commit your changes so Git can track them. Type git commit -m \"adding files\". -m lets you add the commit message in line.\n\n\nSo far, the above steps is what you would do even if you were not using GitHub. They are the normal steps to start a Git repository. Remember that Git is distributed (decentralized), meaning you don't need to have a \"central server\" (or even a network connection), to use Git.\nNow you want to push the changes to your Git repository hosted with GitHub. You do this by telling Git to add a remote location, and you do that with this command:\ngit remote add origin https://github.com/yourusername/your-repo-name.git\n*Note: your-repo-name should be created in GitHub before you do a git remote add origin ...\nOnce you have done that, Git now knows about your remote repository. You can then tell it to push (which is \"upload\") your committed files:\ngit push -u origin master"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-config - Get and set repository or global options showBranch.default"}, {"role": "assistant", "content": "The default set of branches for git-show-branch .\nSee git-show-branch ."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How to overwrite remote branch with different local branch with git\nI have a remote branch that is the basis for a pullrequest.\nI mainly worked on a different branch, however that should now replace the old branch. \nI tried to do a git push remote oldBranch -f but that only pushes my latest local oldBranch to the git server instead of the current branch - no matter which branch i am currently on.\nHow can I replace the remote branch with my local branch?\nEDIT:\nIf anybody else is interested, this is how i got this to work:\ngit checkout oldBranch\ngit branch -m 'oldBranchToBeReplaced'\ngit checkout newBranch\ngit branch -m oldBranch\ngit push myrepo oldBranch -f"}, {"role": "assistant", "content": "You can use the local-name:remote-name syntax for git push:\ngit push origin newBranch:oldBranch\n\nThis pushes newBranch, but using the name oldBranch on origin.\nBecause oldBranch probably already exists, you have to force it:\ngit push origin +newBranch:oldBranch\n\n(I prefer the + instead of -f, but -f will work, too)\nTo delete a branch on the remote side, push an \"empty branch\" like so:\ngit push origin :deleteMe"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Invalid VCS root mapping - 3 errors on my project\nWhen I import project to Android Studio, I found this errors:\n\n\nError:No resource found that matches the given name (at 'label' with value '@string/filter_title_awesomeChat').\nError:No resource found that matches the given name (at 'label' with value '@string/filter_title_awesomeChat').\nError:Execution failed for task ':app:processFreeReleaseResources'.\n com.android.ide.common.process.ProcessException: Failed to execute aapt\nInvalid VCS root mapping\nThe directory C:\\Users\\alfayed\\Desktop\\awesome-chat is registered as a Git root, but no Git repositories were found there.\n\n\nScreenshot of errors"}, {"role": "assistant", "content": "For the Invalid VCS root mapping error you can fix it by deleting the vcs.xml file located in the .idea folder of your project and then rebuild your project."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-describe - Give an object a human readable name based on an available ref --contains"}, {"role": "assistant", "content": "Instead of finding the tag that predates the commit, find\nthe tag that comes after the commit, and thus contains it.\nAutomatically implies --tags."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Standard to follow when writing git commit messages [duplicate]\nThis question already has answers here:\n \n \n\n\n\n\nGit Commit Messages: 50/72 Formatting\n\n (5 answers)\n \n\nClosed 9 years ago.\n\n\n\nI find myself managing very many files (over 60 but below 70) and my commit messages so far follow this pattern:\nwhen I have added something like on layout.css, my commit message is \"added something on layout.css file\", and when I remove something, my commit message is \"removed something from layout.css file\".\nSome files down the line, I look at my commits feed and added... and removed... messages dominate. Sometimes I don't remember what I removed or what I added in layout.css since I make so many changes at a go and so I struggle to come up with an appropriate commit message.\nIs there a standard I should follow to help me come up with my commit messages?"}, {"role": "assistant", "content": "When you just describe what you've done (in technical yet fuzzy terms like \"added a function\"), you're not adding much to what Git already stores in the commit. Imagine yourself reading the commit message some time later; what kind of summary would help you most remembering / communicating to other developers the essence of that change?! The exact contents depend on your project and processes, but I find that a good guideline.\nTherefore, first and foremost add context (the why, not the how) with your commit message (e.g. \"frobnize the message to enable persistence\") instead of \"added frob() function\"). It's more effort (you have to reflect and think), but it is worth so much more.\nIf you want to explore more about this topic, there's a wealth of information, for example this blog article by Peter Hutterer or this funny slide."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git - the stupid content tracker git-sh-i18n"}, {"role": "assistant", "content": "Git’s i18n setup code for shell scripts"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": ".gitignore only on local\nI would like to know how to gitignore files but only on local, without pushing it (because the other people working on the project should not get this update of gitignore of files I added there.\nTo be simple, after a git status I only have :\nmodified: .gitignore\n\nbecause I added my files to ignore to my gitignore but well now I want the line above gone without pushing it."}, {"role": "assistant", "content": "For local ignores you should use the .git/info/exclude file, not .gitignore:\n\nPatterns which are specific to a particular repository but which do not need to be shared with other related repositories (e.g., auxiliary files that live inside the repository but are specific to one user’s workflow) should go into the $GIT_DIR/info/exclude file.\n\nThe two files accept the same format."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How can I turn on a pager for the output of git status?\nI want the output of git status to be returned in a less-like environment. This already works for git diff, but not git status. I already tried adding the following to ~/.gitconfig, but it didn't work:\n[core]\n pager = less\n\nWhat am I missing? Thanks."}, {"role": "assistant", "content": "You can turn on and off paging of specific commands with the pager. setting, in this case pager.status:\n\nIf the value is boolean, turns on or off pagination of the output of a particular Git subcommand when writing to a tty. Otherwise, turns on pagination for the subcommand using the pager specified by the value of pager..\n\nRun the following to enable paging for status subcommand:\ngit config --global pager.status true\n\nor manually add the following to the end of your ~/.gitconfig:\n[pager]\n status = true\n\nIf you just want to turn paging on or off for a specific invocation, you can use option -p/--paginate respectively -P/--no-pager to the git command itself as well, e.g.:\ngit -p status"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-show - Show various types of objects --word-diff[=]"}, {"role": "assistant", "content": "Show a word diff, using the to delimit changed words.\nBy default, words are delimited by whitespace; see --word-diff-regex below. The defaults to plain , and\nmust be one of: color Highlight changed words using only colors. Implies --color . plain 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. porcelain Use a special line-based format intended for script\nconsumption. Added/removed/unchanged runs are printed in the\nusual unified diff format, starting with a + / - /` `\ncharacter at the beginning of the line and extending to the\nend of the line. Newlines in the input are represented by a\ntilde ~ on a line of its own. none Disable word diff again. Note that despite the name of the first mode, color is used to\nhighlight the changed parts in all modes if enabled."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How to specify which SSH key to use within git for git push in order to have gitorious as a mirror?\nI have a project hosted on git.debian.org (alioth) and I'd like to configure a post-receive hook to update a mirror of the repository on http://gitorious.org\nI suppose I'll have to use git push --mirror gitorious\nNow, I'll need to have Alioth authorized on gitorious for the push to succeed. How do I do that?\nI suppose I need to configure a user on gitorious and create a ssh key for it. And then when I do the git push in the post-receive hook, make sure this ssh key is used.\nI could use a ~/.ssh/config but the problem is that many users can push on alioth, and everyone would have to log in and configure the ~/.ssh/config. Instead, I'd like to have a command line option or an environment variable to tell ssh which key to use. Can I do that?\nAlso, do you have other ideas how mirroring can be achieved? And, is it possible to configure it the other way around (gitorious pushing on alioth)?"}, {"role": "assistant", "content": "The answer is to be found in the git reference manual.\n\nGIT_SSH\nIf this environment variable is set then git fetch and git push will use this command instead of ssh when they need to connect to a remote system. The $GIT_SSH command will be given exactly two arguments: the username@host (or just host) from the URL and the shell command to execute on that remote system.\nTo pass options to the program that you want to list in GIT_SSH you will need to wrap the program and options into a shell script, then set GIT_SSH to refer to the shell script.\nUsually it is easier to configure any desired options through your personal .ssh/config file. Please consult your ssh documentation for further details.\n\nSo, I need to write a wrapper script, I write this push-gitorious.sh script:\n#!/bin/sh\n\n\nif [ \"run\" != \"$1\" ]; then\n exec ssh -i \"$GITORIOUS_IDENTITY_FILE\" -o \"StrictHostKeyChecking no\" \"$@\"\nfi\n\nremote=YOUR_SSH_GITORIOUS_URL\n\necho \"Mirroring to $remote\"\n\nexport GITORIOUS_IDENTITY_FILE=\"`mktemp /tmp/tmp.XXXXXXXXXX`\"\nexport GIT_SSH=\"$0\"\n\ncat >\"$GITORIOUS_IDENTITY_FILE\" <\"$GITORIOUS_IDENTITY_FILE.pub\" <"}, {"role": "assistant", "content": "Sure, being in master branch all you need to do is:\ngit merge \n\nwhere commit-id is hash of the last commit from newbranch that you want to get in your master branch.\nYou can find out more about any git command by doing git help . It that case it's git help merge. And docs are saying that the last argument for merge command is ..., so you can pass reference to any commit or even multiple commits. Though, I never did the latter myself."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Remove file from git repository (history)\n(solved, see bottom of the question body)\nLooking for this for a long time now, what I have till now is:\n\nhttp://dound.com/2009/04/git-forever-remove-files-or-folders-from-history/\nand\nhttp://progit.org/book/ch9-7.html\n\nPretty much the same method, but both of them leave objects in pack files... Stuck.\nWhat I tried:\ngit filter-branch --index-filter 'git rm --cached --ignore-unmatch file_name'\nrm -Rf .git/refs/original\nrm -Rf .git/logs/\ngit gc\n\nStill have files in the pack, and this is how I know it: \ngit verify-pack -v .git/objects/pack/pack-3f8c0...bb.idx | sort -k 3 -n | tail -3\n\nAnd this:\ngit filter-branch --index-filter \"git rm -rf --cached --ignore-unmatch file_name\" HEAD\nrm -rf .git/refs/original/ && git reflog expire --all && git gc --aggressive --prune\n\nThe same...\nTried git clone trick, it removed some of the files (~3000 of them) but the largest files are still there...\nI have some large legacy files in the repository, ~200M, and I really don't want them there... And I don't want to reset the repository to 0 :(\nSOLUTION:\nThis is the shortest way to get rid of the files:\n\ncheck .git/packed-refs - my problem was that I had there a refs/remotes/origin/master line for a remote repository, delete it, otherwise git won't remove those files\n(optional) git verify-pack -v .git/objects/pack/#{pack-name}.idx | sort -k 3 -n | tail -5 - to check for the largest files\n(optional) git rev-list --objects --all | grep a0d770a97ff0fac0be1d777b32cc67fe69eb9a98 - to check what are those files\ngit filter-branch --index-filter 'git rm --cached --ignore-unmatch file_names' - to remove a file from all revisions\nrm -rf .git/refs/original/ - to remove git's backup\ngit reflog expire --all --expire='0 days' - to expire all the loose objects\ngit fsck --full --unreachable - to check if there are any loose objects\ngit repack -A -d - repacking\ngit prune - to finally remove those objects"}, {"role": "assistant", "content": "I can't say for sure without access to your repository data, but I believe there are probably one or more packed refs still referencing old commits from before you ran git filter-branch. This would explain why git fsck --full --unreachable doesn't call the large blob an unreachable object, even though you've expired your reflog and removed the original (unpacked) refs.\nHere's what I'd do (after git filter-branch and git gc have been done):\n1) Make sure original refs are gone:\nrm -rf .git/refs/original\n2) Expire all reflog entries:\ngit reflog expire --all --expire='0 days'\n3) Check for old packed refs\nThis could potentially be tricky, depending on how many packed refs you have. I don't know of any Git commands that automate this, so I think you'll have to do this manually. Make a backup of .git/packed-refs. Now edit .git/packed-refs. Check for old refs (in particular, see if it packed any of the refs from .git/refs/original). If you find any old ones that don't need to be there, delete them (remove the line for that ref).\nAfter you finish cleaning up the packed-refs file, see if git fsck notices the unreachable objects:\ngit fsck --full --unreachable\nIf that worked, and git fsck now reports your large blob as unreachable, you can move on to the next step.\n4) Repack your packed archive(s)\ngit repack -A -d\nThis will ensure that the unreachable objects get unpacked and stay unpacked.\n5) Prune loose (unreachable) objects\ngit prune\nAnd that should do it. Git really should have a better way to manage packed refs. Maybe there is a better way that I don't know about. In the absence of a better way, manual editing of the packed-refs file might be the only way to go."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-clone - Clone a repository into a new directory --template= "}, {"role": "assistant", "content": "Specify the directory from which templates will be used;\n(See the \"TEMPLATE DIRECTORY\" section of git-init .)"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-rev-parse - Pick out and massage parameters --branches[=] --tags[=] --remotes[=]"}, {"role": "assistant", "content": "Show all branches, tags, or remote-tracking branches,\nrespectively (i.e., refs found in refs/heads , refs/tags , or refs/remotes , respectively). If a pattern is given, only refs matching the given shell glob are\nshown. If the pattern does not contain a globbing character ( ? , * , or [ ), it is turned into a prefix match by appending /* ."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git - the stupid content tracker git-mktree"}, {"role": "assistant", "content": "Build a tree-object from ls-tree formatted text"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How to \"unversion\" a file in either svn and/or git\nIt happens to me all the time. I accidentally version a file, I do not want to be versioned (i.e. developer/machine specific config-files).\nIf I commit this file, I will mess up the paths on all the other developer machines - they will be unhappy.\nIf I do delete the file from versioning, it will be deleted from the other developers machines - they will be unhappy.\nIf I choose to never commit the file, I always have a \"dirty\" checkout - I am unhappy.\nIs a clean way to \"unversion\" a file from revision-control, that will result in no-one being unhappy?\nedit: trying to clarify a bit: I have already commited the file to the repository and I want to only remove it from versioning - I specifically do not want it to be physically deleted from everyone doing a checkout. I initially wanted it to be ignored.\nAnswer: If I could accept a second answer, it would be this. It answers my question with respect to git - the accepted answer is about svn."}, {"role": "assistant", "content": "In Git, in order to delete it from the tree, but NOT from the working directory, which I think is what you want, you can use the --cached flag, that is:\ngit rm --cached "}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git - remote add origin vs remote set-url origin\n\nI create a new repository:\ngit init\necho \"# MESSAGE\" >> README.md\ngit add README.md\ngit commit -m \"first commit\"\n\nThen I want to push my commit to the empty remote repository created on github so I have to set remote.\nWhat is difference between using following commands ? :\ngit remote add origin [email protected]:User/UserRepo.git\ngit remote set-url origin [email protected]:User/UserRepo.git\n\nAt the end I perform push:\ngit push -u origin master\n\nWhat happens when I call git remote set-url origin just after git init? Does git remote set-url origin create origin? If origin already exists after git init there is no difference between using those commands in my scenario, right?"}, {"role": "assistant", "content": "below is used to add a new remote:\ngit remote add \"origin\" [email protected]:User/UserRepo.git\n\nbelow is used to change the url of an existing remote repository:\ngit remote set-url \"origin\" [email protected]:User/UserRepo.git\n\nbelow will push your code to the master branch of the remote repository defined with \"origin\" and -u let you point your current local branch to the remote master branch:\ngit push -u origin main\n\nDocumentation"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-config - Get and set repository or global options index.threads"}, {"role": "assistant", "content": "Specifies the number of threads to spawn when loading the index.\nThis is meant to reduce index load time on multiprocessor machines.\nSpecifying 0 or true will cause Git to auto-detect the number of\nCPUs and set the number of threads accordingly. Specifying 1 or false will disable multithreading. Defaults to true ."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Step through a file's history in git; similar to p4v timelapse\nI'm seeking a tool to help when probing a file's history. Specifically, I want to view the entire contents of the file, but be able to step backward and forward in time. Extra joy for decorations indicating the diff from previous rev or some other specified rev.\nCurrently I use git blame, and can see what changes impacted each current line. Then I have to relaunch a viewer for that file with some particular commit. It's labor intensive, and if a tool already automates this I'd love to use it!\nPerforce's timelapse view is the best tool to date I've seen for this task."}, {"role": "assistant", "content": "gitk -- filename should do what you want, if you kick up the lines of context in the middle, and scroll up and down through the revisions."}]} {"messages": [{"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 ..master git cherry-pick ^HEAD master"}, {"role": "assistant", "content": "Apply the changes introduced by all commits that are ancestors\nof master but not of HEAD to produce new commits."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How to resolve \"Error: bad index – Fatal: index file corrupt\" when using Git\nAfter git init, I added and committed a few files, made some changes, added and committed. Set up the git daemon (running under Cygwin on WinXP) and cloned the repository once.\nNow, I get this error with the cloned repository:\n$ git status\nerror: bad index file sha1 signature\nfatal: index file corrupt\n\nIs there any way to fix this, other than getting a new copy of the repository?"}, {"role": "assistant", "content": "If the problem is with the index as the staging area for commits (i.e. .git/index), you can simply remove the index (make a backup copy if you want), and then restore index to version in the last commit:\nOn OSX/Linux/Windows(With Git bash):\nrm -f .git/index\ngit reset\n\nOn Windows (with CMD and not git bash):\ndel .git\\index\ngit reset\n\n(The reset command above is the same as git reset --mixed HEAD)\nYou can alternatively use lower level plumbing git read-tree instead of git reset.\n\nIf the problem is with index for packfile, you can recover it using git index-pack."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-svn - Bidirectional operation between a Subversion repository and Git --prefix="}, {"role": "assistant", "content": "This allows one to specify a prefix which is prepended\nto the names of remotes if trunk/branches/tags are\nspecified. The prefix does not automatically include a\ntrailing slash, so be sure you include one in the\nargument if that is what you want. If --branches/-b is\nspecified, the prefix must include a trailing slash.\nSetting a prefix (with a trailing slash) is strongly\nencouraged in any case, as your SVN-tracking refs will\nthen be located at \"refs/remotes/$prefix/ \", which is\ncompatible with Git’s own remote-tracking ref layout\n(refs/remotes/$remote/ ). Setting a prefix is also useful\nif you wish to track multiple projects that share a common\nrepository.\nBy default, the prefix is set to origin/ . Note Before Git v2.0, the default prefix was \"\" (no prefix). This\nmeant that SVN-tracking refs were put at \"refs/remotes/*\", which is\nincompatible with how Git’s own remote-tracking refs are organized.\nIf you still want the old default, you can get it by passing --prefix \"\" on the command line ( --prefix=\"\" may not work if\nyour Perl’s Getopt::Long is < v2.37)."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How do you merge two Git repositories?\nConsider the following scenario:\nI have developed a small experimental project A in its own Git repo. It has now matured, and I'd like A to be part of larger project B, which has its own big repository. I'd now like to add A as a subdirectory of B.\nHow do I merge A into B, without losing history on any side?"}, {"role": "assistant", "content": "If you want to merge project-a into project-b:\ncd path/to/project-b\ngit remote add project-a /path/to/project-a\ngit fetch project-a --tags\ngit merge --allow-unrelated-histories project-a/master # or any branch you want to merge\ngit remote remove project-a\n\nTaken from: git merge different repositories?\nThis method worked pretty well for me, it's shorter and in my opinion a lot cleaner.\nIn case you want to put project-a into a subdirectory, you can use git-filter-repo (filter-branch is discouraged). Run the following commands before the commands above:\ncd path/to/project-a\ngit filter-repo --to-subdirectory-filter project-a\n\nAn example of merging 2 big repositories, putting one of them into a subdirectory: https://gist.github.com/x-yuri/9890ab1079cf4357d6f269d073fd9731\nNote: \nThe --allow-unrelated-histories parameter only exists since git >= 2.9. See Git - git merge Documentation / --allow-unrelated-histories\nUpdate: \nAdded --tags as suggested by @jstadler in order to keep tags."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-pull - Fetch from and integrate with another repository or a local branch --update-shallow"}, {"role": "assistant", "content": "By default when fetching from a shallow repository, git fetch refuses refs that require updating\n.git/shallow. This option updates .git/shallow and accepts such\nrefs."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How can I automatically push after committing in Git?\nHow do I set Git to automatically push to a remote\nrepository (including automatically providing my passphrase) after each commit to the local repository?"}, {"role": "assistant", "content": "First, make sure that you can push manually without providing your password. If you are pushing over HTTP or HTTPS, that will be a case of either creating a .netrc file with the login details or adding your username and password into the URL for the remote. If you're using SSH, you can either create a keypair where the private key doesn't have a password, or use ssh-agent to cache your private key.\nThen you should create an executable (chmod +x) file in .git/hooks/post-commit that contains the following:\n#!/bin/sh\ngit push origin master\n\n... customizing that line if you want to push to a remote other than origin, or push a branch other than master. Make sure that you make that file executable."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-log - Show commit logs --ignore-blank-lines"}, {"role": "assistant", "content": "Ignore changes whose lines are all blank."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git hooks : is there a clone hook?\nWe want to store some meta-information about the commit in an external database. During a clone or a checkout, this database should be referred and we copy the meta information to a file in the repo which is cloned. The database is required rather than just using a file is for the sake of indexing and searches etc ...\nI thought if there is a clone hook, we could trigger this. I couldn't find the clone hooks in the sample in .git/hooks. is there one? is post-checkout hook the only possibility at client side?"}, {"role": "assistant", "content": "ok, one way to do this is to use the clone --template option.\nSpecify the location where the client side hooks will be stored as value to the --template switch. The hooks are copied to the clone, and the post-checkout hook is fired immediately!"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Git resolve conflict using --ours/--theirs for all files\nIs there a way to resolve conflict for all files using checkout --ours and --theirs? I know that you can do it for individual files but couldn't find a way to do it for all."}, {"role": "assistant", "content": "Just grep through the working directory and send the output through the xargs command:\ngrep -lr '<<<<<<<' . | xargs git checkout --ours\n\nor\ngrep -lr '<<<<<<<' . | xargs git checkout --theirs\n\nHow this works: grep will search through every file in the current directory (the .) and subdirectories recursively (the -r flag) looking for conflict markers (the string '<<<<<<<')\nthe -l or --files-with-matches flag causes grep to output only the filename where the string was found. Scanning stops after first match, so each matched file is only output once.\nThe matched file names are then piped to xargs, a utility that breaks up the piped input stream into individual arguments for git checkout --ours or --theirs \nMore at this link.\nSince it would be very inconvenient to have to type this every time at the command line, if you do find yourself using it a lot, it might not be a bad idea to create an alias for your shell of choice: Bash is the usual one.\nThis method should work through at least Git versions 2.4.x"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Push fails in GitKraken with errormessage \"Push Failed cannot read property 'fullName' of undefined\"\nI was trying to push and create a pull-request from my local feature-branch, as usual, being in my feature-branch and right-clicking on the remote origin/develop -branch (I'm using Git Flow), and this error message popped out:\n\nCan't find anything with that error message. Any ideas?"}, {"role": "assistant", "content": "I had this problem as well when there was a HEAD tag at a commit behind the current local master or origin/master.\nTry double-clicking your local master (which eliminates HEAD) and then push your changes.\nNote that if you do not have a local master, right-click on remote origin master and choose 'Checkout origin/master'. Then pull, commit, push your changes."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-log - Show commit logs log.decorate"}, {"role": "assistant", "content": "Print out the ref names of any commits that are shown by the log\ncommand. If short is specified, the ref name prefixes refs/heads/ , refs/tags/ and refs/remotes/ will not be printed. If full is\nspecified, the full ref name (including prefix) will be printed.\nIf auto is specified, then if the output is going to a terminal,\nthe ref names are shown as if short were given, otherwise no ref\nnames are shown. This is the same as the --decorate option\nof the git log ."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-config - Get and set repository or global options core.fsmonitorHookVersion"}, {"role": "assistant", "content": "Sets the protocol version to be used when invoking the\n\"fsmonitor\" hook. There are currently versions 1 and 2. When this is not set,\nversion 2 will be tried first and if it fails then version 1\nwill be tried. Version 1 uses a timestamp as input to determine\nwhich files have changes since that time but some monitors\nlike Watchman have race conditions when used with a timestamp.\nVersion 2 uses an opaque string so that the monitor can return\nsomething that can be used to determine what files have changed\nwithout race conditions."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Various ways to remove local Git changes\nI just cloned a git repository and checked out a branch. I worked on it, and then decided to remove all my local changes, as I wanted the original copy.\nIn short, I had to do the following two commands to remove my local changes\ngit checkout .\n\ngit clean -f\n\nMy question is,\n(1) Is this the correct approach in getting rid of local changes, or else please let me know the correct approach.\n(2) when do we use git reset --hard as i am able to reset even without this command\nThanks\n*Solution : Major Edit(s): 03/26 : * \nReplaced many of vague terms with git specific terminology\n [tracked/untracked/staged/unstaged]\nThere could be only three categories of files when we make local changes:\n\nType 1. Staged Tracked files\nType 2. Unstaged Tracked files\nType 3. Unstaged UnTracked files a.k.a UnTracked files\n\n\nStaged - Those that are moved to staging area/ Added to index\nTracked - modified files\nUnTracked - new files. Always unstaged. If staged, that means they are tracked.\n\nWhat each commands do:\n\ngit checkout . - Removes Unstaged Tracked files ONLY [Type 2]\ngit clean -f - Removes Unstaged UnTracked files ONLY [Type 3]\ngit reset --hard - Removes Staged Tracked and UnStaged Tracked files ONLY[Type 1, Type 2]\ngit stash -u - Removes all changes [Type 1, Type 2, Type 3]\n\nConclusion:\nIt's clear that we can use either \n(1) combination of `git clean -f` and `git reset --hard` \n\nOR\n(2) `git stash -u`\n\nto achieve the desired result.\nNote: Stashing, as the word means 'Store (something) safely and secretly in a specified place.' This can always be retrieved using git stash pop.\nSo choosing between the above two options is developer's call.\nThank you Christoph and Frederik Schøning.\nEdit: 03/27\nI thought it's worth putting the 'beware' note to git clean -f\ngit clean -f\nThere is no going back. Use -n or --dry-run to preview the damage you'll do.\nIf you want to also remove directories, run git clean -f -d\nIf you just want to remove ignored files, run git clean -f -X\nIf you want to remove ignored as well as non-ignored files, run git clean -f -x\nreference : more on git clean : How to remove local (untracked) files from the current Git working tree?\nEdit: 05/20/15\nDiscarding all local commits on this branch [Removing local commits]\nIn order to discard all local commits on this branch, to make the local branch identical \nto the \"upstream\" of this branch, simply run git reset --hard @{u}\nReference: http://sethrobertson.github.io/GitFixUm/fixup.html\nor do git reset --hard origin/master [if local branch is master]\nNote: 06/12/2015\nThis is not a duplicate of the other SO question that's marked as duplicate. This question address how to remove local GIT changes [remove a file added, remove changes added to existing file etc and the various approaches; Where in the other SO thread only address how to remove local commit. If you added a file, and you want to remove that alone, then the other SO thread doesn't discuss about it. Hence this is not a duplicate of the other one]\nEdit: 06/23/15\nHow to revert a commit already pushed to a remote repository?\n$ git revert ab12cd15\n\nEdit: 09/01/2015\nDelete a previous commit from local branch and remote branch\nCase: You just commited a change to your local branch and immediately pushed to the remote branch,\nSuddenly realized , Oh no! I dont need this change. Now do what?\ngit reset --hard HEAD~1 [for deleting that commit from local branch]\ngit push origin HEAD --force [both the commands must be executed. For deleting from remote branch]\nWhats the branch ? Its the currently checked out branch.\nEdit 09/08/2015 - Remove local git merge:\nI am on master branch and merged master branch with a newly working branch phase2\n$ git status\n# On branch master\n\n$ git merge phase2\n\n$ git status\n# On branch master\n# Your branch is ahead of 'origin/master' by 8 commits.\n\nQ: How to get rid of this merge?\nTried git reset --hard and git clean -d -f\nBoth didn't work.\nThe only thing that worked are any of the below ones:\n$ git reset --hard origin/master\n\nor\n$ git reset --hard HEAD~8\n\nor\n$ git reset --hard 9a88396f51e2a068bb7 [sha commit code - this is the one that was present before all your merge commits happened]"}, {"role": "assistant", "content": "It all depends on exactly what you are trying to undo/revert. Start out by reading the post in Ube's link. But to attempt an answer:\nHard reset\ngit reset --hard [HEAD]\n\ncompletely remove all staged and unstaged changes to tracked files.\nI find myself often using hard resetting, when I'm like \"just undo everything like if I had done a complete re-clone from the remote\". In your case, where you just want your repo pristine, this would work.\nClean\ngit clean [-f]\n\nRemove files that are not tracked.\nFor removing temporary files, but keep staged and unstaged changes to already tracked files. Most times, I would probably end up making an ignore-rule instead of repeatedly cleaning - e.g. for the bin/obj folders in a C# project, which you would usually want to exclude from your repo to save space, or something like that.\nThe -f (force) option will also remove files, that are not tracked and are also being ignored by git though ignore-rule. In the case above, with an ignore-rule to never track the bin/obj folders, even though these folders are being ignored by git, using the force-option will remove them from your file system. I've sporadically seen a use for this, e.g. when scripting deployment, and you want to clean your code before deploying, zipping or whatever.\nGit clean will not touch files, that are already being tracked.\nCheckout \"dot\"\ngit checkout .\n\nI had actually never seen this notation before reading your post. I'm having a hard time finding documentation for this (maybe someone can help), but from playing around a bit, it looks like it means:\n\"undo all changes in my working tree\".\nI.e. undo unstaged changes in tracked files. It apparently doesn't touch staged changes and leaves untracked files alone.\nStashing\nSome answers mention stashing. As the wording implies, you would probably use stashing when you are in the middle of something (not ready for a commit), and you have to temporarily switch branches or somehow work on another state of your code, later to return to your \"messy desk\". I don't see this applies to your question, but it's definitely handy.\nTo sum up\nGenerally, if you are confident you have committed and maybe pushed to a remote important changes, if you are just playing around or the like, using git reset --hard HEAD followed by git clean -f will definitively cleanse your code to the state, it would be in, had it just been cloned and checked out from a branch. It's really important to emphasize, that the resetting will also remove staged, but uncommitted changes. It will wipe everything that has not been committed (except untracked files, in which case, use clean).\nAll the other commands are there to facilitate more complex scenarios, where a granularity of \"undoing stuff\" is needed :)\nI feel, your question #1 is covered, but lastly, to conclude on #2: the reason you never found the need to use git reset --hard was that you had never staged anything. Had you staged a change, neither git checkout . nor git clean -f would have reverted that.\nHope this covers."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How to download source in ZIP format from GitHub? [duplicate]\nThis question already has answers here:\n \n \n\n\n\n\nHow to download .zip from GitHub for a particular commit sha?\n\n (4 answers)\n \n\nClosed 8 months ago.\n\n\n\nI see something strange like: \nhttp://github.com/zoul/Finch.git\nNow I'm not that CVS, SVN, etc. dude. When I open that in the browser it tells me that I did something wrong. So I bet I need some hacker-style tool? Some client?\n(I mean... why not just provide a ZIP file? Isn't the world complex enough?)"}, {"role": "assistant", "content": "What happens when the repository owner has not prepared a zip file, and you just want a download to use yourself? There is an answer and you don't need to go though that horrid process to download software, install and register keys and whatnot on GitHub, etc.!\nTo simply download a repository as a zip file: add the extra path '/zipball/master/' to the end of the repository URL and voila, it gives you a zip file of the whole lot.\nFor example,\n\nhttp://github.com/zoul/Finch/\n\nbecomes:\n\nhttp://github.com/zoul/Finch/zipball/master/\n\nIt then gives you a zip file to download."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "gitmodules - Defining submodule properties"}, {"role": "assistant", "content": "EXAMPLES Consider the following .gitmodules file: [submodule \"libfoo\"]\n\tpath = include/foo\n\turl = git://foo.com/git/lib.git\n\n[submodule \"libbar\"]\n\tpath = include/bar\n\turl = git://bar.com/git/lib.git This defines two submodules, libfoo and libbar . These are expected to\nbe checked out in the paths include/foo and include/bar , and for both\nsubmodules a URL is specified which can be used for cloning the submodules."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How to make git diff write to stdout?\nBy default git diff prints all +- lines to the stdout however I have a (devian) machine (which I connect through ssh) where git diff leads me to an editor (which I don't know which is) and I need to press q to continue.\nI've checker git config and it looks like :\n$ git config --list\nuser.name=XXX\nuser.email=XXX@XXX\ncolor.ui=false\ndifftool.prompt=false\nmergetool.prompt=false\ncore.repositoryformatversion=0\ncore.filemode=true\ncore.bare=false\ncore.logallrefupdates=true\nremote.origin.fetch=+refs/heads/*:refs/remotes/origin/*\nremote.origin.url=XXX\nbranch.master.remote=origin\nbranch.master.merge=refs/heads/master\n$ git config --global --list\nuser.name=XXX\nuser.email=XXX@XXX\ncolor.ui=false\ndifftool.prompt=false\nmergetool.prompt=false\n$ git config --system --list\n'/etc/gitconfig': No such file or directory\n\nIs there a place I am missing? Maybe the unknown tool is a fallback or something because I my machine is missing something? Any help is appreciated. Thanks."}, {"role": "assistant", "content": "By default, Git sends its diff output (and generally any output that may be more than a screenful) to the system's pager, which is a utility that prints only one screenful of output at a time. If you want to disable the pager when you run a command, pass --no-pager to Git:\n$ git --no-pager \n\nThis can be run for any Git command.\nIf you want to disable it by default for diff only, you can set the diff pager to cat by running:\n$ git config pager.diff false\n\nIf you want to disable it by default for all commands, you can set the Git pager to cat by running:\n$ git config --global core.pager cat"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Only use a proxy for certain git urls/domains?\n\nIs it possible to configure git to use a proxy only for specific domains?\nI'd like to use our corporate proxy to access Github but leave it off for accessing our own internal git repos.\nI'm using bower and it needs to require items both within our firewall and on github so I can't do this as a per project setting. It needs to be some kind of global configuration option. Any thoughts?"}, {"role": "assistant", "content": "To add another possibility, you can define a proxy through the git config http.proxy.\ngit config --global http.proxy http://mydomain\\\\myusername:mypassword@myproxyserver:proxyport\n\nBut what is really neat is, starting git1.8.5 (October 2013), you can set http settings per url.\nThe \"http.*\" variables can now be specified per URL that the configuration applies.\nFor example,\n[http]\n sslVerify = true\n[http \"https://weak.example.com/\"]\n sslVerify = false\n\n\nwould flip http.sslVerify off only when talking to that specified site.\n\n\nSee commit d4770964d5:\n$ git config --bool --get-urlmatch http.sslVerify https://good.example.com\ntrue\n$ git config --bool --get-urlmatch http.sslVerify https://weak.example.com\nfalse\n\n\nWith only
specified, you can get a list of all variables in the section with their values that apply to the given URL. E.g\n\n$ git config --get-urlmatch http https://weak.example.com\nhttp.sslverify false\n\n\nAll the details are in commit 6a56993b:\nhttp..*::\n\n\nAny of the http.* options above can be applied selectively to some urls.\n For a config key to match a URL, each element of the config key is compared to that of the URL, in the following order:\n\n\nScheme (e.g., https in https://example.com/).\nHost/domain name (e.g., example.com in https://example.com/).\nPort number (e.g., 8080 in http://example.com:8080/).\nPath (e.g., repo.git in https://example.com/repo.git). \nUser name (e.g., user in https://[email protected]/repo.git)\n\n\nThe list above is ordered by decreasing precedence; a URL that matches a config key's path is preferred to one that matches its user name.\n For example, if the URL is https://[email protected]/foo/bar a config key match of https://example.com/foo will be preferred over a config key match of https://[email protected].\nAll URLs are normalized before attempting any matching (the password part, if embedded in the URL, is always ignored for matching purposes) so that equivalent urls that are simply spelled differently will match properly. \nEnvironment variable settings always override any matches.\n The urls that are matched against are those given directly to Git commands.\n This means any URLs +visited as a result of a redirection do not participate in matching."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Using the slash character in Git branch name\nI'm pretty sure I saw somewhere in a popular Git project the branches had a pattern like \"feature/xyz\".\nHowever when I try to create a branch with the slash character, I get an error:\n$ git branch labs/feature\nerror: unable to resolve reference refs/heads/labs/feature: Not a directory\nfatal: Failed to lock ref for update: Not a directory\n\nSame problem for (my initial attempt):\n$ git checkout -b labs/feature\n\nHow does one create a branch in Git with the slash character?"}, {"role": "assistant", "content": "Are you sure branch labs does not already exist (as in this thread)?\n\nYou can't have both a file, and a directory with the same name.\nYou're trying to get git to do basically this:\n% cd .git/refs/heads\n% ls -l\ntotal 0\n-rw-rw-r-- 1 jhe jhe 41 2009-11-14 23:51 labs\n-rw-rw-r-- 1 jhe jhe 41 2009-11-14 23:51 master\n% mkdir labs\nmkdir: cannot create directory 'labs': File exists\n\nYou're getting the equivalent of the \"cannot create directory\" error.\nWhen you have a branch with slashes in it, it gets stored as a\ndirectory hierarchy under .git/refs/heads.\n\n\nNote that labs must not be an existing branch, as ddruganov points out in the comments:\n git switch -c 19023-commerce/19033-commerce-view 19023-commerce\n\n # Fails with:\n\n fatal: cannot lock ref 'refs/heads/19073-commerce-view/99999-test-branch': \n 'refs/heads/19073-commerce-view' exists; \n cannot create 'refs/heads/19073-commerce-view/99999-test-branch'\n\nAs explained in \"git push: refs/heads/my/subbranch exists, cannot create\":\n\n\nIf branch b exists, no branch named b/anything can be created.\nLikewise, if branch dev/b exists, dev/b/c cannot be created.\n\nThis is a git internal limitation."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-show - Show various types of objects combined, c"}, {"role": "assistant", "content": "Show differences from each of the parents to the merge\nresult simultaneously instead of showing pairwise diff between\na parent and the result one at a time. Furthermore, it lists\nonly files which were modified from all parents."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-diff - Show changes between commits, commit and working tree, etc files"}, {"role": "assistant", "content": "Compute the dirstat numbers by counting the number of files changed.\nEach changed file counts equally in the dirstat analysis. This is\nthe computationally cheapest --dirstat behavior, since it does\nnot have to look at the file contents at all."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "giteveryday - A useful minimum set of commands for Everyday Git"}, {"role": "assistant", "content": "NAME giteveryday - A useful minimum set of commands for Everyday Git"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Where does pre-commit install \"environments\"?\nI'm trying to setup pre-commit for a Python project's repository. Upon running pre-commit install I see an output like this:\n[INFO] Installing environment for https://github.com/asottile/seed-isort-config.\n[INFO] Once installed this environment will be reused.\n[INFO] This may take a few minutes...\n[INFO] Installing environment for https://github.com/pre-commit/mirrors-isort.\n[INFO] Once installed this environment will be reused.\n[INFO] This may take a few minutes...\n[INFO] Installing environment for https://github.com/pre-commit/pre-commit-hooks.\n[INFO] Once installed this environment will be reused.\n[INFO] This may take a few minutes...\n[INFO] Installing environment for https://github.com/pre-commit/mirrors-pylint.\n[INFO] Once installed this environment will be reused.\n[INFO] This may take a few minutes...\n\nWhat are these \"environments\" and where are they being installed to?"}, {"role": "assistant", "content": "The environments are installed into a cache:\n\npre-commit by default places its repository store in ~/.cache/pre-commit -- this can be configured in two ways:\n\nPRE_COMMIT_HOME: if set, pre-commit will use that location instead.\nXDG_CACHE_HOME: if set, pre-commit will use $XDG_CACHE_HOME/pre-commit following the XDG Base Directory Specification.\n\n\n\ndisclaimer: I am the author"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-config - Get and set repository or global options core.fsync"}, {"role": "assistant", "content": "A comma-separated list of components of the repository that\nshould be hardened via the core.fsyncMethod when created or\nmodified. You can disable hardening of any component by\nprefixing it with a - . Items that are not hardened may be\nlost in the event of an unclean\tsystem shutdown. Unless you\nhave special requirements, it is recommended that you leave\nthis option empty or pick one of committed , added ,\nor all . When this configuration is encountered, the set of components starts with\nthe platform default value, disabled components are removed, and additional\ncomponents are added. none resets the state so that the platform default\nis ignored. The empty string resets the fsync configuration to the platform\ndefault. The default on most platforms is equivalent to core.fsync=committed,-loose-object , which has good performance,\nbut risks losing recent work in the event of an unclean system shutdown. none clears the set of fsynced components. loose-object hardens objects added to the repo in loose-object form. pack hardens objects added to the repo in packfile form. pack-metadata hardens packfile bitmaps and indexes. commit-graph hardens the commit-graph file. index hardens the index when it is modified. objects is an aggregate option that is equivalent to loose-object,pack . reference hardens references modified in the repo. derived-metadata is an aggregate option that is equivalent to pack-metadata,commit-graph . committed is an aggregate option that is currently equivalent to objects . This mode sacrifices some performance to ensure that work\nthat is committed to the repository with git commit or similar commands\nis hardened. added is an aggregate option that is currently equivalent to committed,index . This mode sacrifices additional performance to\nensure that the results of commands like git add and similar operations\nare hardened. all is an aggregate option that syncs all individual components above."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git rebase: copy instead of moving\nMy branches are:\no---o support.2013.16\n \\\n o---o---o---o---o master\n \\\n o---o---o hotfix/A\n\nI need to copy hotfix/A to support.2013.16. I'm aware of cherry-picking, but is it possible to do something like\ngit rebase --onto support.2013.16 master hotfix/A\n\nbut without moving a branch but copying it instead?"}, {"role": "assistant", "content": "Git rebase really does copy the original branch to a new one; but because it moves the branch head, it feels like a move rather than a copy. If you used git branch to add an additional branch head to the original branch, you would still have easy access to the original branch after git rebase had made the rebased copy. So in your example\ngit branch rebased-A hotfix/A\ngit rebase --onto support.2013.16 master rebased-A\n\nleaves you with\n o---o---o rebased-A (hotfix/A')\n /\no---o support.2013.16\n \\\n o---o---o---o---o master\n \\\n o---o---o hotfix/A"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-restore - Restore working tree files --recurse-submodules --no-recurse-submodules"}, {"role": "assistant", "content": "If names an active submodule and the restore location\nincludes the working tree, the submodule will only be updated if\nthis option is given, in which case its working tree will be\nrestored to the commit recorded in the superproject, and any local\nmodifications overwritten. If nothing (or --no-recurse-submodules ) is used, submodules working trees will\nnot be updated. Just like git-checkout , this will detach HEAD of the submodule."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "gitglossary - A Git Glossary head ref"}, {"role": "assistant", "content": "A synonym for head ."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How do I run a code formatter over my source without modifying git history?\nI am trying to format an entire repo using a code formatter tool. In doing so, I want to keep information about who committed which line, so that commands like git blame still show the correct information. By this, I mean it should show the author that previously edited each line (before it was formatted).\nThere is the git filter-branch command which allows you to run a command against each revision of the repo starting from the beginning of time.\ngit filter-branch --tree-filter '\\\n npx prettier --write \"src/main/web/app/**/**.{js, jsx}\" || \\\n echo \"Error: no JS files found or invalid syntax\"' \\\n -- --all\n\nIt will take forever to run this and really I don't care about the past. I just want to format the master branch going forward without changing ownership of each line. How can I do this? I tried playing with the rev-list at the end and other filter types but it still doesn't work. There must be a way to format the codebase while preserving the author information for each line."}, {"role": "assistant", "content": "You can make git blame ignoring certain commits, which do only mass reformatting etc.:\nCreate a file .git-blame-ignore-revs like:\n # Format commit 1 SHA:\n 1234af5.....\n # Format commit 2 SHA:\n 2e4ac56.....\n\nThen do\ngit config blame.ignoreRevsFile .git-blame-ignore-revs\n\n, so that you don't have to use the --ignore-revs-file option every time with git blame.\nUpvote https://github.com/github/feedback/discussions/5033 to get that feature into github's web blame viewer."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-fast-import - Backend for fast Git data importers date-format export-marks relative-marks no-relative-marks force"}, {"role": "assistant", "content": "Act as though the corresponding command-line option with\na leading -- was passed on the command line\n(see OPTIONS, above)."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How can set an older commit to be HEAD?\nI realized that I made some mistakes on HEAD, checked out an older commit and started coding from there. When I attempt a push I'm told that my current commit is behind and I need to merge with HEAD. Git recommends \"git pull\". However, HEAD has the code I want to ignore. How do I solve this problem?\nFlowchart:\n-------- HEAD (bad) ---------------------- + (behind conflict, requires\n \\ / merge with HEAD, which is\n \\------- Current commit (good) ----/ bad and needs to be ignored)"}, {"role": "assistant", "content": "Here is what you can do:\ngit checkout \ngit reset --hard \ngit push -f\n\nIf you don't force the push, git will throw this error: Updates were rejected because the tip of your current branch is behind. \nNote that this will tamper your git history, so another way of doing this is revert each commit you don't want. That way you retain your history:\ngit revert commit-id\n\nCheers"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How to open 2 Visual Studio instances, with same Git projects and different branches\nI need to open 2 Visual Studio instances: one will be to just look at the code of the Project X / Branch 1, and the other will be used to code in the Project X / Branch 2.\nHow can I do that without losing changes when committing?"}, {"role": "assistant", "content": "The issue here isn't to do with Visual studio, but how Git works.\nWhen you check out a branch in git, it places that branch into your working tree or (file structure, whatever you wish to call it).\nWith git you can only have one branch checked out at a time, but wait there is a solution!\nBy utilising the git worktree command, you can create a second worktree for the same repository in a different directory. You can then open that work tree in visual studio to have two different branches checked out.\nLet's say you have C:\\projects\\the_project and you want to make a new work tree at e.g, C:\\projects\\the_project_2, open git bash, navigate to the project's directory and run\ngit worktree add ../the_project_2 \nwhere is the branch you want checked out in the new work tree.\nThis will create a new directory \"C:\\projects\\the_project_2\") and checkout the branch into it, without having to re-clone the repository.\nFor more information see the git worktree documentation.\nNote: Earlier versions of Visual Studio does not know how to treat additional work trees, and will not recognise them as git repositories."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Git: How to pull a single file from a server repository in Git?\nI am working on a site with a server running Git. I am using Git for deployment (not GitHub). This was set up prior to my involvement using a hook method, and I referred to this question and entered the commands below, but it didn't work.\nHow do I pull a single file from the server? For instance, if I wanted to update my local file index.php? git pull index.php?"}, {"role": "assistant", "content": "Short Answer\nIt is possible to do (in the deployed repository):\ngit fetch --all\n// git fetch will download all the recent changes, but it will not put it in your current checked out code (working area).\n\nFollowed by:\ngit checkout origin/master -- path/to/file\n// git checkout / -- path/to/file will checkout the particular file from the downloaded changes (origin/master).\n\nFull Example\n$ cd /project/directory\n\n$ git branch\n* develop\n\ncheck the remote name\n$ git remote -v\norigin [email protected]:abc/123.git\n\nConfirmed it's origin and\nI am on branch develop and need a file from branch main\nFile i need is src/scss/main.scss\ngit fetch --all\n\ngit checkout origin/main -- src/scss/main.scss"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Is it possible to configure user.name and user.email per wildcard domains in .gitconfig?\nI have a work computer, and it's configured globally to use my work email and name when committing. This is good. However, I'd like to make some sort of rule that says, \"if the repo origin is github, use user X and email Y\"\nI realize you can make a config entry per repository, but I'd like it to be more automatic: if the clone is github, it should use github user details. If I clone from work, it should use work details.\nIs there any way to configure this globally based on the remote domain? Or another way?\nEDIT/UPDATE\nI have accepted the answer below, but modified the script just a bit:\n#!/usr/bin/env bash\n\n# \"Real\" git is the second one returned by 'which'\nREAL_GIT=$(which -a git | sed -n 2p)\n\n# Does the remote \"origin\" point to GitHub?\nif (\"$REAL_GIT\" remote -v 2>/dev/null | grep '^origin\\b.*github.com.*(push)$' >/dev/null 2>&1); then\n\n # Yes. Set username and email that you use on GitHub.\n export GIT_AUTHOR_NAME=$(\"$REAL_GIT\" config --global user.ghname)\n export GIT_AUTHOR_EMAIL=$(\"$REAL_GIT\" config --global user.ghemail)\n\nfi\n\n\"$REAL_GIT\" \"$@\"\n\nThe primary addition is the requirement for two git config values.\ngit config --global user.ghname \"Your Name\"\ngit config --global user.ghemail \"[email protected]\"\n\nThis avoids hard coding the values in the script, allowing it to be more portable. Maybe?"}, {"role": "assistant", "content": "Git 2.13 adds support for conditional config includes. If you organize your checkouts into directories for each domain of work, then you can add custom settings based on where the checkouts are. In your global git config:\n[includeIf \"gitdir:code/work/\"]\n path = /Users/self/code/work/.gitconfig\n\nAnd then in ~/code/work/.gitconfig:\n[user]\n email = [email protected]\n\nAnd of course you can do that for as many domains of work as you like."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-grep - Print lines matching a pattern -i --ignore-case"}, {"role": "assistant", "content": "Ignore case differences between the patterns and the\nfiles."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Visual Studio 2015 How to merge a branch into master?\nI am new to GIT, so far I had been using Visual Studio Online TFS for my version control and I am the only developer. When I created my last project I was kind of mislead into thinking GIT was the best option for this.\nSo I checked-in my master. Then when I was going to work on a Feature I read I had to create a branch (this was not necessary in TFS) so I created \"development_print\" as a new branch and worked on my feature.\nNow my feature is complete but I don't know how to merge it back into master. I am not interested in multiple branches at the moment, just want my new feature merged into master and remain with master.\nIn VS there is a merge branch option but it only allows me to merge into development_print (I want my feature into master!) so it does not let me set Into Current Branch and for Merge From Branch shows: \n\nDevelopment_print\nmaster\norigin/development_print\norigin/master\n\nwhich is kind of confusing? it seems all backwards. So how do I get out of this mess without losing all the work I did on the feature?"}, {"role": "assistant", "content": "The way to merge development_print branch into master branch as below:\nVS -> Team Explorer -> Branches -> double click master branch -> Merge -> select development_print for Merge from branch -> Merge.\nThe select box shows: \ndevelopment_print\nmaster\norigin/development_print\norigin/master\n\nThat means you have branches development_print and master for both local and remote. origin/ means branches exist in remote.\nIf you don’t want the development_print branch after merging you can delete it for local and remote: \nTeam Explorer -> Branches -> select development_print -> right click -> Delete -> select development_print under remotes/origin -> Delete Branch From Remote."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-symbolic-ref - Read, modify and delete symbolic refs"}, {"role": "assistant", "content": "NAME git-symbolic-ref - Read, modify and delete symbolic refs"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-svn - Bidirectional operation between a Subversion repository and Git -B --before"}, {"role": "assistant", "content": "Don’t require an exact match if given an SVN revision, instead find\nthe commit corresponding to the state of the SVN repository (on the\ncurrent branch) at the specified revision."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Show number of changed lines per author in git\nI want to see the number of removed/added line, grouped by author for a given branch in Git history. There is git shortlog -s which shows me the number of commits per author. Is there anything similar to get an overall diffstat?"}, {"role": "assistant", "content": "It's an old post but if someone is still looking for it:\ninstall git extras\nbrew install git-extras\n\nthen\ngit summary --line\n\nhttps://github.com/tj/git-extras"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-shortlog - Summarize git log output -P --perl-regexp"}, {"role": "assistant", "content": "Consider the limiting patterns to be Perl-compatible regular\nexpressions. Support for these types of regular expressions is an optional\ncompile-time dependency. If Git wasn’t compiled with support for them\nproviding this option will cause it to die."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "The \"git\" command requires the command line developer tools. Would you like to install?\nI'm super new to coding (actually trying to teach myself some Python), but there's a thing bugging me that I cannot seem to find any info online about my particular case: When I run git on the terminal, there is:\n\nThe \"git\" command requires the command line developer\ntools. Would you like to install..\"\n\nNow, since I have a very basic Macbook 12, I try to keep it as lightweight and uncluttered as possible, so I don't want to install any IDE or anything, I'm practising coding with vim 7.3, but in order to install Vundle.vim to manage any plugins, I need git, is there a way I can install it without having to install Homebrew?\nThanks for any input! And sorry if I didn't express myself correctly. So basically to sum up:\n– I need git to install Vundle.vim, (or is there any other way?).\n– I run git on terminal and get an error that I need to install Xcode, which is like 7GB heavy.\n– I don't want to install Xcode or Homebrew."}, {"role": "assistant", "content": "For me problem has resolved with:\nxcodebuild -runFirstLaunch"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-diff-index - Compare a tree to the working tree or index -l"}, {"role": "assistant", "content": "The -M and -C options involve some preliminary steps that\ncan detect subsets of renames/copies cheaply, followed by an\nexhaustive fallback portion that compares all remaining\nunpaired destinations to all relevant sources. (For renames,\nonly remaining unpaired sources are relevant; for copies, all\noriginal sources are relevant.) For N sources and\ndestinations, this exhaustive check is O(N^2). This option\nprevents the exhaustive portion of rename/copy detection from\nrunning if the number of source/destination files involved\nexceeds the specified number. Defaults to diff.renameLimit.\nNote that a value of 0 is treated as unlimited."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Why does git revert complain about a missing -m option?\n\nSo I'm working on a project with other people, and there's multiple github forks being worked on. Someone just made a fix for a problem and I merged with his fork, but then I realized that I could find a better solution. I want to revert the commit I just made. I tried doing this with git revert HEAD but it gave me this error: \nfatal: Commit is a merge but no -m option was given.\nWhat does that mean? When I merged and committed, I did use the -m option to say \"Merged with \".\nWhat am I doing wrong here?"}, {"role": "assistant", "content": "By default git revert refuses to revert a merge commit as what that actually means is ambiguous. I presume that your HEAD is in fact a merge commit.\nIf you want to revert the merge commit, you have to specify which parent of the merge you want to consider to be the main trunk, i.e. what you want to revert to.\nOften this will be parent number one, for example if you were on master and did git merge unwanted and then decided to revert the merge of unwanted. The first parent would be your pre-merge master branch and the second parent would be the tip of unwanted.\nIn this case you could do:\ngit revert -m 1 HEAD\n\ngit cat-file -p [MERGE_COMMIT_ID] will show the parent branches in order. The first one listed would be -m 1, the second -m 2."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-stash - Stash the changes in a dirty working directory away stash.showIncludeUntracked"}, {"role": "assistant", "content": "If this is set to true, the git stash show command will show\nthe untracked files of a stash entry. Defaults to false. See\nthe description of the show command in git-stash ."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Gitlab Self-Hosted: ERROR: Uploading artifacts as \"archive\" to coordinator... too large archive\n\nSome time ago, our Gitlab (self-hosted) instance started to throw errors that the archives are too big:\n\nERROR: Uploading artifacts as \"archive\" to coordinator... too large\narchive id=something responseStatus=413 Request Entity Too Large\nstatus=413 token=something FATAL: too large\nERROR: Job failed: exit code 1\n\nThe only resolution ideas we found was to set the max build artifact size (it's under /admin/application_settings). This did not work for us, the error still occurred.\nReference articles:\n\nhttps://gitlab.com/gitlab-com/gl-infra/infrastructure/-/issues/3813\nhttps://dzone.com/articles/gitlab-ci-runner-artifacts-size-error-quottoo-larg\nhttps://www.kevinhooke.com/2018/07/30/gitlab-ci-runner-artifacts-size-error-too-large-archive/\nhttps://forum.gitlab.com/t/uploading-artifacts-too-large-archive-error-413/4867\nHow to increase maximum artifacts size for Gitlab on-premises"}, {"role": "assistant", "content": "From gitlab official docs:\nThe maximum size of the job artifacts can be set at:\n\nThe value is in MB and the default is 100MB per job.\n\nTo change it at the instance level:\nOn the top bar, select Menu > Admin.\nOn the left sidebar, select Settings > CI/CD.\nChange the value of maximum artifacts size (in MB).\nSelect Save changes for the changes to take effect.\nGroup level (this overrides the instance setting):\nTo change it at the group level:\nGo to the group’s Settings > CI/CD > General Pipelines.\nChange the value of maximum artifacts size (in MB).\nSelect Save changes for the changes to take effect.\nProject level (this overrides the instance and group settings):\nTo change it at the project level:\nGo to the project’s Settings > CI/CD > General Pipelines.\nChange the value of maximum artifacts size (in MB).\nSelect Save changes for the changes to take effect.\nRef: Maximum artifacts size"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-rev-list - Lists commit objects in reverse chronological order --first-parent"}, {"role": "assistant", "content": "When finding commits to include, follow only the first\nparent commit upon seeing a merge commit. This option\ncan give a better overview when viewing the evolution of\na particular topic branch, because merges into a topic\nbranch tend to be only about adjusting to updated upstream\nfrom time to time, and this option allows you to ignore\nthe individual commits brought in to your history by such\na merge."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How can I git stash a specific file?\nHow can I stash a specific file leaving the others currently modified out of the stash I am about to save?\nFor example, if git status gives me this:\nyounker % gst \n# On branch master\n# Your branch is ahead of 'origin/master' by 1 commit.\n#\n# Changes not staged for commit:\n# (use \"git add ...\" to update what will be committed)\n# (use \"git checkout -- ...\" to discard changes in working directory)\n#\n# modified: app/controllers/cart_controller.php\n# modified: app/views/cart/welcome.thtml\n#\nno changes added to commit (use \"git add\" and/or \"git commit -a\")\n\nand I only want to stash app/views/cart/welcome.thtml, how would I do that? Something like (but of course this does not work):\ngit stash save welcome_cart app/views/cart/welcome.thtml"}, {"role": "assistant", "content": "EDIT: Since git 2.13, there is a command to save a specific path to the stash: git stash push . For example: \ngit stash push -m welcome_cart app/views/cart/welcome.thtml\n\nOLD ANSWER:\nYou can do that using git stash --patch (or git stash -p) -- you'll enter interactive mode where you'll be presented with each hunk that was changed. Use n to skip the files that you don't want to stash, y when you encounter the one that you want to stash, and q to quit and leave the remaining hunks unstashed. a will stash the shown hunk and the rest of the hunks in that file.\nNot the most user-friendly approach, but it gets the work done if you really need it."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How to delete all remote git branches which have already been integrated?\nAt work we are using topic branches which are integrated into a few (3) master branches at some point.\nNow I'd like to delete all topic branches from my remote repository which have been fully integrated into a master branch. If that's not possible, retrieving a list of local branches which have been integrated would be fine, too."}, {"role": "assistant", "content": "Another answer edited in by someone who thought it's the best (and it looks good):\ngit branch -r --merged origin/master | grep -v master | grep \"origin/\" | cut -d \"/\" -f 2- | xargs -n 20 git push --delete origin\n\nExplanation:\n\ngit branch -r --merged origin/master\n\n-r/--remotes list the remote-tracking branches.\n--merged origin/master only list branches whose tips are reachable from origin/master.\n\ngrep -v master remove any branch name containing master from list.1 -v means negative match.\ngrep \"origin/\" select only branches on origin remote.\ncut -d \"/\" -f 2- drop the origin/ prefix\nxargs -n 20 git push --delete origin do something similar to git push --delete origin branch-a branch-b branch-c …\n\n-n 20/--max-args=20 use at most 20 arguments per command line.\n\n\nAs for -n, I choose 20 just as an example. Fewer arguments will make it slower, for example -n 1 makes it delete one at a time; you have more progress hints, because it will report each time it deletes a branch. More arguments like -n 200 will make it faster (less total time), but it only reports once every 200 branches, making you think that it is frozen at first (while it is not). Tune the number to your need. If you omit this option, the default number is really large (2048 in my machine).\n1. Note that this also removes origin/HEAD -> origin/master, but you won't want to mess with origin/HEAD anyway.\nOriginal answer:\ngit push --delete remote topicbranch\n\nor\ngit push remote :topicbranch\n\nGiving a list of branches, would be something with git branch --merged master"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-push - Update remote refs along with associated objects git push origin master:refs/heads/experimental"}, {"role": "assistant", "content": "Create the branch experimental in the origin repository\nby copying the current master branch. This form is only\nneeded to create a new branch or tag in the remote repository when\nthe local name and the remote name are different; otherwise,\nthe ref name on its own will work."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-submodule - Initialize, update or inspect submodules add [-b ] [-f|--force] [--name ] [--reference ] [--depth ] [--] []"}, {"role": "assistant", "content": "Add the given repository as a submodule at the given path\nto the changeset to be committed next to the current\nproject: the current project is termed the \"superproject\". is the URL of the new submodule’s origin repository.\nThis may be either an absolute URL, or (if it begins with ./\nor ../), the location relative to the superproject’s default remote\nrepository (Please note that to specify a repository foo.git which is located right next to a superproject bar.git , you’ll\nhave to use ../foo.git instead of ./foo.git - as one might expect\nwhen following the rules for relative URLs - because the evaluation\nof relative URLs in Git is identical to that of relative directories). The default remote is the remote of the remote-tracking branch\nof the current branch. If no such remote-tracking branch exists or\nthe HEAD is detached, \"origin\" is assumed to be the default remote.\nIf the superproject doesn’t have a default remote configured\nthe superproject is its own authoritative upstream and the current\nworking directory is used instead. The optional argument is the relative location for the cloned\nsubmodule to exist in the superproject. If is not given, the\ncanonical part of the source repository is used (\"repo\" for\n\"/path/to/repo.git\" and \"foo\" for \"host.xz:foo/.git\"). If \nexists and is already a valid Git repository, then it is staged\nfor commit without cloning. The is also used as the submodule’s\nlogical name in its configuration entries unless --name is used\nto specify a logical name. The given URL is recorded into .gitmodules for use by subsequent users\ncloning the superproject. If the URL is given relative to the\nsuperproject’s repository, the presumption is the superproject and\nsubmodule repositories will be kept together in the same relative\nlocation, and only the superproject’s URL needs to be provided.\ngit-submodule will correctly locate the submodule using the relative\nURL in .gitmodules ."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "giteveryday - A useful minimum set of commands for Everyday Git"}, {"role": "assistant", "content": "SYNOPSIS Everyday Git With 20 Commands Or So"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git - the stupid content tracker git-column"}, {"role": "assistant", "content": "Display data in columns"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-config - Get and set repository or global options gc.rerereResolved"}, {"role": "assistant", "content": "Records of conflicted merge you resolved earlier are\nkept for this many days when git rerere gc is run.\nYou can also use more human-readable \"1.month.ago\", etc.\nThe default is 60 days. See git-rerere ."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-show - Show various types of objects --diff-filter=[(A|C|D|M|R|T|U|X|B)…​[*]]"}, {"role": "assistant", "content": "Select only files that are Added ( A ), Copied ( C ),\nDeleted ( D ), Modified ( M ), Renamed ( R ), have their\ntype (i.e. regular file, symlink, submodule, …​) changed ( T ),\nare Unmerged ( U ), are\nUnknown ( X ), or have had their pairing Broken ( B ).\nAny combination of the filter characters (including none) can be used.\nWhen * (All-or-none) is added to the combination, all\npaths are selected if there is any file that matches\nother criteria in the comparison; if there is no file\nthat matches other criteria, nothing is selected. Also, these upper-case letters can be downcased to exclude. E.g. --diff-filter=ad excludes added and deleted paths. Note that not all diffs can feature all types. For instance, copied and\nrenamed entries cannot appear if detection for those types is disabled."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How to un-approve github review after new commits automatically\n\nOnce a pull request is approved, if there are further commits: \nThe Pull request should go to un-approved state automatically.\nCan this be done?"}, {"role": "assistant", "content": "The ability to Dismiss stale pull request approvals when new commits are pushed is a setting under Require pull request reviews before merging in the branch protection settings. This is disabled by default."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-format-patch - Prepare patches for e-mail submission --cc="}, {"role": "assistant", "content": "Add a Cc: header to the email headers. This is in addition\nto any configured headers, and may be used multiple times.\nThe negated form --no-cc discards all Cc: headers added so\nfar (from config or command line)."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git - the stupid content tracker git-worktree"}, {"role": "assistant", "content": "Manage multiple working trees"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Problems with entering Git commit message with Vim\nOS: Windows\nI write\n$ git commit\n\nthen \n\n\"# Please enter the commit message\"\n\nI write some text, like\n\n\"Form validation added\"\n\nPress Enter and not commited. Then i press Shift+Enter, Ctrl+Enter, Alt+Enter - still not commited.\nI think its stupid trouble, but What i must to do?"}, {"role": "assistant", "content": "If it is VIM for Windows, you can do the following:\n\nenter your message following the presented guidelines\npress Esc to make sure you are out of the insert mode\nthen type :wqEnter or ZZ.\n\nNote that in VIM there are often several ways to do one thing. Here there is a slight difference though. :wqEnter always writes the current file before closing it, while ZZ, :xEnter, :xiEnter, :xitEnter, :exiEnter and :exitEnter only write it if the document is modified.\nAll these synonyms just have different numbers of keypresses."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git: symlink/reference to a file in an external repository\nIs it possible in git to have a \"link\" to a particular file in a git repo? Like what git submodules do for folders but my question is about a particular file, not a full directory:\nmy-project/\n class1.java\n class2.java\n logback.xml (link to a particular file, say https://github.com/theHilikus/JRoboCom/blob/master/jrobocom-core/src/main/resources/logback.xml)\n\nSo as can be seen, in this case it doesn't make sense to have a whole submodule folder, it is just one file.\nI'm ok with the link being locked to a particular commit but it would be better if it's moving as it changes in its own project's lifecycle\nAs a note, this has nothing to do with file-system's symbolic links; I'm talking about a reference to a file in another project, repo, branch, or anything. it's ok if the content of the file is a duplicate and not a file-system symlink"}, {"role": "assistant", "content": "Git has features that you can use to achieve what you need. It supports file system symlinks and it supports submodules. Submodules is already a standard way to handle references to other repositories. You can use them in conjunction with a way to reference files locally. That can be handled directly using relative symbolic links or indirectly using a script that copies over files from the submodule to where you need them.\nYou should have one submodule per external git tree and you should treat the submodules with care, as they are not only links to external repositories but also to their specific commits. The following to solutions will show you how to use individual files from an external repostiory but still maintain all the advantages of submodules.\nAn alternative way is to fetch the files directly but then you will lose the advantage of submodules entirely or you will have to build the features yourself. As I already stated, submodules are the standard way to handle this sort of task and you should use it unless you have special needs like to avoid downloading other files at all cost.\nUsing a submodule and a symlink\nOnce you have a submodule ready, you can just add filesystem symlinks pointing into the submodule directory structure.\nRun this in a shell in your project directory:\n$ git submodule add https://github.com/theHilikus/JRoboCom\n$ ln -s JRoboCom/jrobocom-core/src/main/resources/logback.xml\n$ git add .gitmodules logback.xml\n$ git commit -m \"add a symbolic link to logback.xml with the respective submodule\"\n\nNow you have a symlink:\nlogback.xml -> JRoboCom/jrobocom-core/src/main/resources/logback.xml\n\nUsing a submodule and a script\nAs an alternative, you can use custom scripts that copy over ordinary files from your submodules. In very special cases you could handle the external repositories from the script without submodules but I would normally not recommend it.\nCreate a file bootstrap.sh containing:\n#!/bin/sh\ngit submodule init\ngit submodule update\n\ncp JRoboCom/jrobocom-core/src/main/resources/logback.xml .\n\nRun this in a shell in your project directory:\n$ git submodule add https://github.com/theHilikus/JRoboCom\n$ git add .gitmodules bootstrap.sh\n$ git commit -m \"add a script to fetch logback.xml from the respective submodule\"\n\nNote that we are not adding the logback.xml file to Git, as it will be fetched from the submodule.\nInstruct users of the repository to first run the script above. It will prepare their repositories for using submodules, will fetch the submodule data and will copy the file to its location. Sometimes there's already some sort of bootstrap script in the project.\nUsing a script to fetch a single file via git protocol\nFound another solution for Git >= 1.7.9.5 using git archive.\nCreate a file bootstrap.sh containing:\n#!/bin/sh\ngit archive --remote=https://github.com/theHilikus/JRoboCom master:JRoboCom/jrobocom-core/src/main/resources logback.xml | tar -x\n\nRun this in a shell in your project directory:\n$ git add bootstrap.sh\n$ git commit -m \"add a script to fetch logback.xml directly from the remote project\"\n\nUsing a script to fetch a single file via HTTP\nIf the repository hosting service also serves the individual files via HTTP, you can simply use curl or wget to download them.\nCreate a file bootstrap.sh containing:\n#!/bin/sh\ncurl -O https://raw.githubusercontent.com/theHilikus/JRoboCom/master/jrobocom-core/src/main/resources/logback.xml\n\nRun this in a shell in your project directory:\n$ git add bootstrap.sh\n$ git commit -m \"add a script to fetch logback.xml directly from github\"\n\nNotes on scripts fetching single files\nYou could also store the references in files with a specific extention (like *.url) or maintain the list of references in one file (like .references in your project directory) and build a more comprehensive script that goes through all the references and downloads the respective files."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-blame - Show what revision and author last modified each line of a file --abbrev="}, {"role": "assistant", "content": "Instead of using the default 7+1 hexadecimal digits as the\nabbreviated object name, use +1 digits, where is at\nleast but ensures the commit object names are unique.\nNote that 1 column\nis used for a caret to mark the boundary commit."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "'User is missing the Overall/Read permission' error with Jenkins GitHub OAuth Plugin\n\nI'm using the github oauth plugin for our logins but for all of our users in the Organisation I get an error: \nAccess Denied\n\n is missing the Overall/Read permission\n\nI have tried everything I can possibly think of to try to make this work and I'm probably going to fallback to making everyone an admin user, which i would prefer not to do. \nAny advise would be appreciated."}, {"role": "assistant", "content": "This is how I resolved the authentication problem:\n\nEdit config.xml file, e.g.\nsudo vi /var/lib/jenkins/config.xml\n\n\nChange useSecurity element's value to false, e.g.\nfalse\n\nRemove authorizationStrategy block\n\nRestart Jenkins: /etc/init.d/jenkins restart.\nAccess Jenkins through URL as usual and reconfigure security again."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How do I connect github to JIRA?\nI've been trying to find a way to update JIRA when I commit to github.\nIt doesn't look like there are any service hooks to do it at github, but you never know, someone might have a ninja way, so I thought I'd ask."}, {"role": "assistant", "content": "UPDATE\nFor integrating with Bitbucket, check out the following link:\nLinking Bitbucket and GitHub accounts to JIRA\nORIGINAL POST\nJIRA GitHub Connector is deprecated:\n\nThis plugin has been superseded by the JIRA DVCS Connector, which includes GitHub functionality.\n\nSo to connect Jira to github use JIRA DVCS Connector for Bitbucket and GitHub:\n\nYou can connect Bitbucket or GitHub accounts with JIRA using the free JIRA DVCS Connector plugin. This plugin comes with JIRA OnDemand. For JIRA download users, this is a system plugin that you can install. Using the DVCS connector, you can:\n\nLink all or a subset of your existing repositories (both public and private to JIRA).\nCreate new repositories and have them link automatically to JIRA.\nReference JIRA issues from DVCS commit message and have those commits appear in the issue's Commits tab in JIRA.\nTransition issues through a JIRA OnDemand workflow (for example, Close, Reopen, and so forth) using smart commit messages.\n\n\ncheck out Using the JIRA DVCS Connector Plugin for more information."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Why can't I create an empty Pull Request for discussion prior to developing changes?\n\nI want to branch from master and immediately create an empty Pull Request to discuss implementation details of a specific feature.\nAfter selecting my branch and clicking \"Pull Request\", Github claims \"Nothing to Compare\" and doesn't offer any \"Create Pull Request\" button.\nGithub's own documentation on Flow states (click the right-arrow twice):\n\nYou can open a Pull Request at any point during the development process: when you have little or no code but want to share some screenshots or general ideas, when you're stuck and need help or advice, or when you're ready for someone to review your work.\n\nBut their own documentation on Pull Requests here states:\n\nPull requests can only be opened if there are differences between your branch and the upstream branch\n\nI would like to utilise Github collaboration features with my team prior to committing changes to code. As we understand it, Pull Requests are for code changes and discussion of implementation details (ie: the \"solution\"), while Issues are higher level, for discussing features/bugs (ie: the \"problem\").\nAm I misunderstanding these things?\nEdit:\nApparently I can circumvent the process by changing the branch with an empty commit:\n\ngit commit --allow-empty -m \"make pull request\"\n\nbut I am trying to better understand why my (default) decision to create an empty PR was wrong in the first place, and why their documentation appears contradictory. Is there a strict \"discuss code explicitly in PRs\" policy or similar? Is this a contentious issue?\nUpdate\nGithub have released Draft Pull Requests, but (alas) they can't be created if the 2 branches are identical."}, {"role": "assistant", "content": "The documentation talking about \"no code\" dates from... December 2013:\n\nIt is possible they changed their policy in the official documentation, which is up-to-date and apply to github.com as well as GitHub Enterprise.\nSo you might want to contact GitHub support to mention this inaccuracy."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How to change the default target branch for merges in Gitlab\n\nwe are using Gitlab 8.10.1 with many groups and projects. Many of the projects happen to be forks of other projects.\nOur problem is that whenever somebody opens a merge request for a project the default target branch is NOT the default branch of the project but from one very specific other project. Is there a way to override this setting somehow?\nJust to make it clear, I know how to set the default branch of a project and those settings appear to be correct, however gitlab doesn't seem to use them when creating merge requests.\nThis issue is very annoying and has led to weird situations when people didn't pay attention and made merge requests with a completely different \"master\" as target."}, {"role": "assistant", "content": "The default MR target depends on whether or not the repository is a GitLab fork.\nForks\nIf the repository is a GitLab fork, then the default MR target will be the default branch of the upstream repository. This relationship can be removed via the \"Remove fork relationship\" option on the Project settings page, after which the default MR target will be determined as normal for a non-fork repository (described below).\nAt time of writing, it is not possible to override the default MR target without removing the fork relationship, but that functionality has been requested in gitlab issue #14522.\nNon-Forks\nIf the repository has no fork relationship, then the Default Branch setting on the Project settings page sets both (1) the default MR target, and (2) the HEAD reference of the repo on the GitLab server (which determines the branch that's checked out when the repo is cloned). Note that, due to a bug/quirk in git, problems can occur if a branch that was once the Default Branch is later deleted from GitLab.\nAt time of writing, it is not possible to change the default MR target independently of the Default Branch, but this functionality has been requested in gitlab issue #17909."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How can I visualize per-character differences in a unified diff file?\nSay I get a patch created with git format-patch. The file is basically a unified diff with some metadata. If I open the file in Vim, I can see which lines have been modified, but I cannot see which characters in the changed lines differ. Does anyone know a way (in Vim, or some other free software that runs on Ubuntu) to visualize per-character differences?\nA counter example where per-character diff is visualized is when executing vimdiff a b.\nupdate Fri Nov 12 22:36:23 UTC 2010\ndiffpatch is helpful for the scenario where you're working with a single file.\nupdate Thu Jun 16 17:56:10 UTC 2016\nCheck out diff-highlight in git 2.9. This script does exactly what I was originally seeking."}, {"role": "assistant", "content": "In git, you can merge without committing. Merge your patch first, then do:\ngit diff --word-diff-regex=.\n\nNote the dot after the equals sign."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-rebase - Reapply commits on top of another base tip "}, {"role": "assistant", "content": "Upstream branch to compare against. May be any valid commit,\nnot just an existing branch name. Defaults to the configured\nupstream for the current branch."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Table divider/bold row line in GitLab Flavored Markdown\n\nI have made a long table in GitLab, but would like to divide the rows within the table to highlight different groups. I would wish for a bold table row line as a divider or different background colors for the different groups.\nFrom what I have read, it does not seem to be possible by using only the GitLab Flavored Markdown syntax, and the closest I have come is to use an empty row as a divider, but I am not fully satisfied with that solution.\n| ---- |Precision | Recall | F1 | Support |\n| ---- | ---- | ---- | ---- |---- | ---- |\n| Group 1 |0.5 | 0.6 | 0.55 | 5 |\n| Group 1 |0.5 | 0.6 | 0.55 | 5 |\n| | | | | |\n| Group 2 |0.5 | 0.6 | 0.55 | 5 |\n| Group 2 |0.5 | 0.6 | 0.55 | 5 |\n\nresults in this:\n\nAre there any other ways to do this more nicely? Perhaps with html/css?"}, {"role": "assistant", "content": "Have a Look at the gitlab markdown guide. A bold line separator isn't possible but the guide describes some options you can try to make your Groups differ:\nmix html and markdown\nyou can add html elements in your markdown. You could use that to color your groups differently\nstyles\ngitlab markdown allows you to define styles in your document:\n\n\nYou can then apply this style like this:\nHey! Hover the cursor over me and guess what?! :)\n{: .purple}\n\nMaybe those options help you"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git - the stupid content tracker gitformat-pack"}, {"role": "assistant", "content": "Git pack format"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": ".gitlab-ci stages execution order\n\nI have this .gitlab-ci.yml file:\nstepA:\n script:\n - echo \"A\"\ndeploy:\n script:\n - echo \"1\"\nstepB:\n script:\n - echo \"B\"\n\nHow can I set which stage should be run in first ?\nSome jobs can be run in parallel by multiple gitlab runners.\nI just want to be sure step A to B are finished before running deploy stage"}, {"role": "assistant", "content": "This is exactly what stages is for. You are using the word \"stage\" here when actually describing a \"job\". \nJobs in the same stage may be run in parallel (if you have the runners to support it) but stages run in order.\nFirst define your 2 stages at the top level of the .gitlab-ci.yml:\nstages:\n - build\n - dist\n\nThen on each job, specify the stage it belongs to:\nstepA:\n stage: build\n script:\n - echo \"A\"\ndeploy:\n stage: dist\n script:\n - echo \"1\"\nstepB:\n stage: build\n script:\n - echo \"B\"\n\nNow stepA and stepB will run first (in any order or even in parallel) followed by deploy provided the first stage succeeds."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Can you have additional .gitignore per directory within a single repo?\nCan you create a .gitignore file in a directory that only applies to files (and directories) within that directory?"}, {"role": "assistant", "content": "Yes, you can. Try it, it works fine. Put a .gitignore in the root of your repo, and put another .gitignore with additional things to ignore in a subdirectory."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "automatically stash save/pop changes on git rebase?\nmy git workflow uses rebase a lot. I always fetch upstream changes (the main repo i forked from) and then merge to my branches, and then rebase to remove useless (to me :D) merge commits and tree splits.\none thing on this workflow that annoys me is:\n$ git rebase upstream/master\nCannot rebase: You have unstaged changes.\nPlease commit or stash them.\n\n$ git stash\nSaved working directory and index state WIP on cc: abc1234 Merge remote-tracking branch 'upstream/master' into local_branch\nHEAD is now at abc1234 Merge remote-tracking branch 'upstream/master' into local_branch\n\n$ git rebase upstream/master\nFirst, rewinding head to replay your work on top of it...\nApplying: awesome code change\n\n$ git stash pop\n\nso here we have 4 commands, 1=failed rebase, 2=stash, 3=rebase, 4=stash pop. anything but 3 is just mindless work.\nSo, the question is: What is the most recommended way of automating it? an alias to run git stash/rebase/pop everytime? some git config that forces rebase to stash or treat it as another commit to reapply afterwards? something else?"}, {"role": "assistant", "content": "Edit: As of Git version 1.8.4, but with an important side bug fixed in Git version 2.0.1, git rebase now has --autostash. You can configure git rebase to use --autostash by default as well, with git config --global rebase.autoStash true. Please note the following sentence from the documentation:\n\nHowever, use with care: the final stash\n application after a successful rebase might result in non-trivial\n conflicts.\n\n(I still prefer to just make commits.)\nTL;DR answer: just make a commit (then unmake it later)\nIt may help you to realize that git stash is really just git commit (in a more complicated form, which commits the index first, then the work-tree—when you apply a stash, you can maintain the separation of index and work-tree, or combine them into just a work-tree change).\nWhat makes a stash special is that the commits it makes—the two or, with -u or -a, even three commits—are made in an unusual form (as a merge commit that's not really a merge) and not placed on any branch (instead, the special refs/stash reference is used to retain and find them).\nSince they're not on a branch, rebase does not touch them, and in your workflow, it's the git stash pop that brings the work-tree changes into your new work-tree. However, if you make your own (normal) commit, on a branch, and rebase and include that commit, this normal commit will be rebased along with any others. We'll get to one last problem in a moment; for now, let's draw this up, as a series of commits that do (or don't) get rebased:\n... do some work ...\n... make some commits ...\n... more work ...\n... do something that causes upstream/master to update, such as git fetch upstream\n$ git stash\n\nAt this point, here's what you have:\n... - o - * - A - B - C <-- HEAD=master\n \\ |\\\n \\ i-w <-- stash\n \\\n @-@-@ <-- upstream/master\n\nHere, A, B, and C are your commits (I'll assume you've made 3), all on branch master. The i-w hanging off commit C is your stash, which is not on the branch, but is still a two-commit \"git stash bag\" and is actually attached to your latest commit (C). The @ commits (there might be just one) are the new upstream commits.\n(If you have made no commits, your stash-bag hangs off commit *, and your current branch points to commit *, so that git rebase has no work to do other than move your current branch pointer forward. Everything works out the same, in this case, but I'll assume there are some commits.)\nNow you run git rebase upstream/master. This copies your commits to new commits, with new IDs and new parent IDs, so that they sit atop the last @. The stash-bag does not move, so the result looks like this:\n... - o - * - A - B - C [abandoned, except for the stash]\n \\ |\\\n \\ i-w <-- stash\n \\\n @-@-@ <-- upstream/master\n \\\n A'-B'-C' <-- HEAD=master\n\nYou now use git stash pop, which restores the i/w stuff as work-tree changes, erasing the stash label (more precisely, popping it so that stash@{1}, if it exists, is now stash, and so on). That releases the last references to the original A - B - C chain, and means we don't need the i-w bit either, which lets us redraw this as the much simpler:\n... - @ <-- upstream/master\n \\\n A'-B'-C' <-- HEAD=master plus work tree changes\n\nNow let's draw what happens if, instead of git stash save, you just do a git commit -a (or git add and git commit without -a) to create an actual commit D. You start with:\n... - o-*-A-B-C-D <-- HEAD=master\n \\\n @-@-@ <-- upstream/master\n\nNow you git rebase upstream/master, which copies A through D to place them at the end of the last @, and you have this:\n... - o-*-@-@-@ <-- upstream/master\n \\\n A'-B'-C'-D' <-- HEAD=master\n\nThe only problem is that you have this one unwanted extra commit D (well, D' now), instead of uncommitted work-tree changes. But this is trivially undone with git reset to step back one commit. We can use a --mixed reset—the default—to get the index (staging area) re-set too, so as to \"un-add\" all the files, or if you want them to stay git add-ed, a --soft reset. (Neither affects the resulting commit graph, only the index state is different.)\ngit reset --mixed HEAD^ # or leave out `--mixed` since it's the default\n\nHere's what that looks like:\n... - o-*-@-@-@ <-- upstream/master\n \\\n A'-B'-C' <-- HEAD=master\n \\\n D' [abandoned]\n\nYou might think this is inefficient, but when you use git stash you're actually making at least two commits, which you then abandon later when you git stash pop them. The real difference is that by making temporary, not-for-publication commits, you get those automatically rebased.\nDon't be afraid of temporary commits\nThere's a general rule with git: make lots of temporary commits, to save your work as you go. You can always rebase them away later. That is, instead of this:\n... - * - A - B - C <-- mybranch\n\nwhere A, B, and C are perfect and final commits atop commit * (from someone else or earlier published stuff), make this:\n... - * - a1 - a2 - b1 - a3 - b2 - a4 - b3 - c1 - b4 - c2 - c3\n\nwhere a1 is an initial stab at A, a2 fixes a bug in a1, b1 is an initial attempt to make b work, a3 is from realizing that b1 requires A to be different after all, b2 fixes a bug in b1, a4 fixes a bug in a3's change to a2, and b3 is what b1 should have done; then c1 is an initial attempt at C, b4 is another fix to b1, c2 is a refinement, and so on.\nLet's say that after c3 you think it's mostly ready. Now you run git rebase -i origin/master or whatever, shuffle the pick lines to get a1 through a4 into order, b1 through b4 into order, and c1 through c3 into order, and let the rebase run. Then you fix any conflicts and make sure stuff is still right, then you run another git rebase -i to collapse all four a versions into A, and so on.\nWhen you're all done, it looks like you created a perfect A the first time (or maybe with a4 or some other one depending on which commits you keep and which ones you drop and whether you re-set any time stamps in things). Other people may not want or need to see your intermediate work—though you can retain it, not combining commits, if that's useful. Meanwhile you never need to have uncommitted stuff that you have to rebase, because you just have commits of partial stuff.\nIt does help to give these commits names, in the one-line commit text, that will guide your later rebase work:\ngit commit -m 'temp commit: work to enable frabulator, incomplete'\n\nand so on."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-diff - Show changes between commits, commit and working tree, etc --name-only"}, {"role": "assistant", "content": "Show only names of changed files. The file names are often encoded in UTF-8.\nFor more information see the discussion about encoding in the git-log manual page."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-show - Show various types of objects %gD"}, {"role": "assistant", "content": "reflog selector, e.g., refs/stash@{1} or refs/stash@{2\nminutes ago} ; the format follows the rules described for the -g option. The portion before the @ is the refname as\ngiven on the command line (so git log -g refs/heads/master would yield refs/heads/master@{0} )."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How to exclude certain directories/files from git grep search\nIs there a way to exclude certain paths/directories/files when searching a git repository using git grep? Something similar to the --exclude option in the normal grep command?\nI need to use git grep because using grep directly runs too slowly on large git repositories."}, {"role": "assistant", "content": "In git 1.9.0 the \"magic word\" exclude was added to pathspecs. So if you want to search for foobar in every file except for those matching *.java you can do:\ngit grep foobar -- ':(exclude)*.java'\n\nOr using the ! \"short form\" for exclude:\ngit grep foobar -- ':!*.java'\n\nNote that in git versions up to v2.12, when using an exclude pathspec, you must have at least one \"inclusive\" pathspec. In the above examples you'd want to add ./* (recursively include everything under the current directory) somewhere after the -- as well. In git v2.13 this restriction was lifted and git grep foobar -- ':!*.java' works without the ./*.\nThere's a good reference for all the \"magic words\" allowed in a pathspec at git-scm.com (or just git help glossary)."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Importing private repo to other private repo Git\n\nI have a private repo on git that I would love to import in another private repo. When I try to import it, I log in with my account and then this message Your old project requires credentials for read-only access. We will only temporarily store them for importing.\ncontinue to pop up and I cannot import the repo. Someone could help?"}, {"role": "assistant", "content": "I had the same problem and was able to resolve it by using the Personal Access Token (token access to Private Repositories) instead of the password. Take a look at this from the github community which gives a bit more detail (the answer from hobojoe1848): https://github.community/t/import-repository-not-working/2044/4"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-show - Show various types of objects --show-notes-by-default"}, {"role": "assistant", "content": "Show the default notes unless options for displaying specific\nnotes are given."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Git removing upstream from local repository\nI am working with a ruby on rails application and I am trying to sync a fork. It is worth mentioning that I am also on a Mac. I committed the following action:\n$ git remote -v\n\nto get a view of my local repository. I messed up when trying to go upstream:\n$ git remote add upstream https://github.com/foo/repo.git\n\nWhen I should have capitalized Foo:\n$ git remote add upstream https://github.com/Foo/repos.git\n\nThe question is how do I remove the upstream because every time I try and change this it comes back with creating a fatal error?"}, {"role": "assistant", "content": "Using git version 1.7.9.5 there is no \"remove\" command for remote. Use \"rm\" instead.\n$ git remote rm upstream\n$ git remote add upstream https://github.com/Foo/repos.git\n\nor, as noted in the previous answer, set-url works.\nI don't know when the command changed, but Ubuntu 12.04 shipped with 1.7.9.5.\nedit: a few people seem to have run into a situation where they do not have an \"upstream\" remote. execute cat .git/config and look at the name of the remote(s). (if on windows and not using powershell you can use type .git/config.)\nthe output will show the remotes configured for your git repo, e.g.,\n[remote \"origin\"]\n\nsubstitute the name of the remote you wish to remove as:\n$ git remote rm origin\n\nif you don't have the \"upstream\" remote, you can't remove it."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-am - Apply a series of patches from a mailbox (|)…​"}, {"role": "assistant", "content": "The list of mailbox files to read patches from. If you do not\nsupply this argument, the command reads from the standard input.\nIf you supply directories, they will be treated as Maildirs."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Accidentally branched off of the wrong branch, and when I want to merge into the master I have to merge both branches\nSo I created a branch off of another branch I was already creating, and now when I try to merge the branches into master, I have run into the situation where I have to merge both branches.\nHere is a diagram\n\nMaster->\n \n\n ->Branch 1 -> Branch 2\n\n\n\nI want to be able to merge just the changes on branch 2 onto master without having to merge the changes on Branch 1 if that makes sense. I looked into reset and revert, but it seems like these things will delete all the changes I made with branch 2. Any ideas?\nThanks"}, {"role": "assistant", "content": "Try git rebase --onto with the following syntax:\nTo put branch2's changes on to the master without including branch1's\ngit rebase --onto master branch1 branch2\n\nRelevant output from git help rebase:\n\nHere is how you would transplant a topic branch based on one branch to another, to\n pretend that you forked the topic branch from the latter branch, using rebase --onto.\nFirst let’s assume your topic is based on branch next. For example, a feature \n developed in topic depends on some functionality which is found in next.\n o---o---o---o---o master\n \\\n o---o---o---o---o next\n \\\n o---o---o topic\n\nWe want to make topic forked from branch master; for example, because the functionality\n on which topic depends was merged into the more stable master branch. \n We want our tree to look like this:\n o---o---o---o---o master\n | \\\n | o'--o'--o' topic\n \\\n o---o---o---o---o next\n\nWe can get this using the following command:\ngit rebase --onto master next topic\n\n\nKeep in mind the risks and pitfalls of rebasing, mentioned here:\n http://git-scm.com/book/en/Git-Branching-Rebasing"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Find files in git repo over x megabytes, that don't exist in HEAD\nI have a Git repository I store random things in. Mostly random scripts, text files, websites I've designed and so on.\nThere are some large binary files I have deleted over time (generally 1-5MB), which are sitting around increasing the size of the repository, which I don't need in the revision history.\nBasically I want to be able to do..\nme@host:~$ [magic command or script]\naad29819a908cc1c05c3b1102862746ba29bafc0 : example/blah.psd : 3.8MB : 130 days old\n6e73ca29c379b71b4ff8c6b6a5df9c7f0f1f5627 : another/big.file : 1.12MB : 214 days old\n\n..then be able to go though each result, checking if it's no longer required then removing it (probably using filter-branch)"}, {"role": "assistant", "content": "This is an adaptation of the git-find-blob script I posted previously:\n#!/usr/bin/perl\nuse 5.008;\nuse strict;\nuse Memoize;\n\nsub usage { die \"usage: git-large-blob []\\n\" }\n\n@ARGV or usage();\nmy ( $max_size, $unit ) = ( shift =~ /^(\\d+)([bkm]?)\\z/ ) ? ( $1, $2 ) : usage();\n\nmy $exp = 10 * ( $unit eq 'b' ? 0 : $unit eq 'k' ? 1 : 2 );\nmy $cutoff = $max_size * 2**$exp; \n\nsub walk_tree {\n my ( $tree, @path ) = @_;\n my @subtree;\n my @r;\n\n {\n open my $ls_tree, '-|', git => 'ls-tree' => -l => $tree\n or die \"Couldn't open pipe to git-ls-tree: $!\\n\";\n\n while ( <$ls_tree> ) {\n my ( $type, $sha1, $size, $name ) = /\\A[0-7]{6} (\\S+) (\\S+) +(\\S+)\\t(.*)/;\n if ( $type eq 'tree' ) {\n push @subtree, [ $sha1, $name ];\n }\n elsif ( $type eq 'blob' and $size >= $cutoff ) {\n push @r, [ $size, @path, $name ];\n }\n }\n }\n\n push @r, walk_tree( $_->[0], @path, $_->[1] )\n for @subtree;\n\n return @r;\n}\n\nmemoize 'walk_tree';\n\nopen my $log, '-|', git => log => @ARGV, '--pretty=format:%T %h %cr'\n or die \"Couldn't open pipe to git-log: $!\\n\";\n\nmy %seen;\nwhile ( <$log> ) {\n chomp;\n my ( $tree, $commit, $age ) = split \" \", $_, 3;\n my $is_header_printed;\n for ( walk_tree( $tree ) ) {\n my ( $size, @path ) = @$_;\n my $path = join '/', @path;\n next if $seen{ $path }++;\n print \"$commit $age\\n\" if not $is_header_printed++;\n print \"\\t$size\\t$path\\n\";\n }\n}"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git - the stupid content tracker git-count-objects"}, {"role": "assistant", "content": "Count unpacked number of objects and their disk consumption"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-rev-list - Lists commit objects in reverse chronological order --graph"}, {"role": "assistant", "content": "Draw a text-based graphical representation of the commit history\non the left hand side of the output. This may cause extra lines\nto be printed in between commits, in order for the graph history\nto be drawn properly.\nCannot be combined with --no-walk . This enables parent rewriting, see History Simplification above. This implies the --topo-order option by default, but the --date-order option may also be specified."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-am - Apply a series of patches from a mailbox --quoted-cr="}, {"role": "assistant", "content": "This flag will be passed down to git mailinfo (see git-mailinfo )."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How to avoid merge commits from Git pull when pushing to remote\nI have a repository and some local changes to commit.\nBefore committing, I pulled the changes onto my local using Egit in Eclipse.\nIt creates a merge commit and I submit my commit over it.\nNow when I am trying to push to origin, it is showing that it will push my commit as well as merge commit.\nBut ideally, merge commit should not be a part of remote repository.\nHow to avoid this?"}, {"role": "assistant", "content": "Use rebase option whenever you pull from remote repository. Please follow the below steps,\n\nCommit your changes - It will create a new commit in your local.\nNow do git pull --rebase .\nBasically the rebase take out your commits that you committed on the current branch HEAD as a patch. Then it will apply all the remote commits on top of HEAD and then applies your commits on top of it.\nSo best practice is to commit changes then pull remote commits by using rebase option."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Rebasing remote branches in Git\nI am using an intermediate Git repository to mirror a remote SVN repository, from which people can clone and work on. The intermediate repository has its master branch rebased nightly from the upstream SVN, and we are working on feature branches. For example:\nremote:\n master\n\nlocal:\n master\n feature\n\nI can successfully push my feature branch back to the remote, and end up with what I expect:\nremote:\n master\n feature\n\nlocal:\n master\n feature\n\nI then re-setup the branch to track the remote:\nremote:\n master\n feature\n\nlocal:\n master\n feature -> origin/feature\n\nAnd all is well. What I would like to do from here is to rebase the feature branch to the master branch on the remote, but I would like to do this from my local machine. I'd like to be able to do:\ngit checkout master\ngit pull\ngit checkout feature\ngit rebase master\ngit push origin feature\n\nTo keep the remote feature branch up-to-date with the remote master. However, this method causes Git to complain:\nTo \n ! [rejected] feature -> feature (non-fast-forward)\nerror: failed to push some refs to ''\nTo prevent you from losing history, non-fast-forward updates were rejected\nMerge the remote changes (e.g. 'git pull') before pushing again. See the\n'Note about fast-forwards' section of 'git push --help' for details.\n\ngit pull does the trick but causes a merge commit that I'd like to avoid. I'm concerned that the message states feature -> feature rather than feature -> origin/feature but this may just be a presentation thing.\nAm I missing something, or going about this in completely the wrong way? It's not critical to avoid doing the rebase on the remote server, but it makes fixing any merge conflicts from the rebase much harder."}, {"role": "assistant", "content": "It comes down to whether the feature is used by one person or if others are working off of it.\nYou can force the push after the rebase if it's just you:\ngit push origin feature -f\n\nHowever, if others are working on it, you should merge and not rebase off of master.\ngit merge master\ngit push origin feature\n\nThis will ensure that you have a common history with the people you are collaborating with.\nOn a different level, you should not be doing back-merges. What you are doing is polluting your feature branch's history with other commits that don't belong to the feature, making subsequent work with that branch more difficult - rebasing or not.\nThis is my article on the subject called branch per feature."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-revert - Revert some existing commits -n --no-commit"}, {"role": "assistant", "content": "Usually the command automatically creates some commits with\ncommit log messages stating which commits were\nreverted. This flag applies the changes necessary\nto revert the named commits to your working tree\nand the index, but does not make the commits. In addition,\nwhen this option is used, your index does not have to match\nthe HEAD commit. The revert is done against the\nbeginning state of your index. This is useful when reverting more than one commits'\neffect to your index in a row."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Using git, how do I ignore a file in one branch but have it committed in another branch?\nI've got a project that I'm deploying to Heroku. The source code tree includes a bunch of mp3 files (the website will be for a recording project I was heavily involved with). \nI'd like to put the source code for it up on GitHub, but GitHub has a 300 MB limit on their free accounts. I don't want to use 50 MB of my limit on a bunch of mp3 files. Obviously, I could add them to the .gitignore file to keep them out of my repo.\nHowever, I deploy to Heroku using git push heroku. The mp3 files must be present in the branch I push to Heroku so that they get get deployed.\nIdeally, I'd like to .gitignore the mp3 files in my local master branch so that when I push that to GitHub, the mp3s are not included. Then I'd keep a local production branch that has the mp3s committed rather than ignored. To deploy, I would merge master into production, and then push the production branch to Heroku.\nI can't get this to work right.\nHere's an example of what I'm trying to do...\n$ git init git-ignore-test\n$ cd git-ignore-test\n$ echo \"*.ignored\" >> .gitignore\n$ git add .gitignore && git commit -m \"Ignore .ignored files\"\n$ touch Foo.ignored\n\nAt this point, Foo.ignored is ignored in my master branch, but it's still present, so my project can use it.\n$ git checkout -b unignored\n$ cat /dev/null > .gitignore\n$ git add Foo.ignored .gitignore && git commit -m \"Unignore .ignored files\"\n\nNow I've got a branch with these files committed, as I want. However, when I switch back to my master branch, Foo.ignored is gone.\nAnyone got any suggestions for a better way to set this up?\nEdit: just to clarify, I want the mp3 files to be present in both branches so that when I run the site locally (using either branch) the site works. I just want the files ignored in one branch so when I push to GitHub they are not pushed as well. Usually .gitignore works well for this kind of thing (i.e. keeping a local copy of a file that does not get included in a push to a remote), but when I switch to the branch with the files checked in, and then back to the branch with the files ignored, the files vanish."}, {"role": "assistant", "content": "This solution appears to work only for certain, patched versions of git. See a new answer pointing to workarounds and another answer and subsequent comments for a hint which versions may work.\n\nI wrote a blog post on how to effectively use the excludesfile for different branches, like one for public github and one for heroku deployment.\nHere's the quick and dirty:\n$ git branch public_viewing\n$ cd .git/\n$ touch info/exclude_from_public_viewing\n$ echo \"path/to/secret/file\" > info/exclude_from_public_viewing \n\nthen in the .git/config file add these lines:\n[core]\nexcludesfile = +info/exclude\n\n \n[branch \"public_viewing\"]\nexcludesfile = +info/exclude_from_public_viewing\n\nNow all the global ignore stuff is in the info/exclude file and the branch specific is in the info/exclude_from_public_viewing\nhttp://cogniton-mind.tumblr.com/post/1423976659/howto-gitignore-for-different-branches"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-diff - Show changes between commits, commit and working tree, etc -p -u --patch"}, {"role": "assistant", "content": "Generate patch (see Generating patch text with -p ).\nThis is the default."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Calculate RSA key fingerprint\n\nI need to do the SSH key audit for GitHub, but I am not sure how do find my RSA key fingerprint. I originally followed a guide to generate an SSH key on Linux.\nWhat is the command I need to enter to find my current RSA key fingerprint?"}, {"role": "assistant", "content": "Run the following command to retrieve the SHA256 fingerprint of your SSH key (-l means \"list\" instead of create a new key, -f means \"filename\"):\n$ ssh-keygen -lf /path/to/ssh/key\n\nSo for example, on my machine the command I ran was (using RSA public key):\n$ ssh-keygen -lf ~/.ssh/id_rsa.pub\n2048 00:11:22:33:44:55:66:77:88:99:aa:bb:cc:dd:ee:ff /Users/username/.ssh/id_rsa.pub (RSA)\n\nTo get the GitHub (MD5) fingerprint format with newer versions of ssh-keygen, run:\n$ ssh-keygen -E md5 -lf \n\nBonus information:\nssh-keygen -lf also works on known_hosts and authorized_keys files.\nTo find most public keys on Linux/Unix/OS X systems, run\n$ find /etc/ssh /home/*/.ssh /Users/*/.ssh -name '*.pub' -o -name 'authorized_keys' -o -name 'known_hosts'\n\n(If you want to see inside other users' homedirs, you'll have to be root or sudo.)\nThe ssh-add -l is very similar, but lists the fingerprints of keys added to your agent. (OS X users take note that magic passwordless SSH via Keychain is not the same as using ssh-agent.)"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Git ignore local file changes\nI've tried both\ngit update-index --assume-unchanged config/myconfig\n\nand \nediting .git/info/exclude and adding config/myconfig\nhowever when I do git pull I always get:\n\nUpdating 0156abc..1cfd6a5\n error: Your local changes to the following files would be overwritten by merge:\n config/myconfig\n Please, commit your changes or stash them before you can merge.\n Aborting\n\nWhat am I missing?"}, {"role": "assistant", "content": "git pull wants you to either remove or save your current work so that the merge it triggers doesn't cause conflicts with your uncommitted work. Note that you should only need to remove/save untracked files if the changes you're pulling create files in the same locations as your local uncommitted files.\nRemove your uncommitted changes\nTracked files\ngit checkout -f\n\nUntracked files\ngit clean -fd\n\nSave your changes for later\nTracked files\ngit stash\n\nTracked files and untracked files\ngit stash -u\n\nReapply your latest stash after git pull:\ngit stash pop"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "GitLab CI get last artifact\n\nI'm trying to get the latest build artifact using curl. Here's what I've tried. \nFirst, get last pipeline id:\ncurl -v -H \"Content-Type: application/json\" -H \"PRIVATE-TOKEN: \" https:///api/v4/projects//pipelines?per_page=1&page=1\n\nNext, get job id based on pipeline id just obtained before:\ncurl -sS --header \"PRIVATE-TOKEN: \" \"https://[redacted,host]/api/v4/projects/[redacted,project]/pipelines//jobs\" | jq '.[] | select(.name == \"build-assets\" and .status == \"success\" and .artifacts_file != null) | .id'\n\nFinally, get the artifacts to build.zip based on job id:\ncurl -sS --header \"PRIVATE-TOKEN: \" \"https://[redacted,host]/api/v4/projects/[redacted, project]/jobs//artifacts\" > build.zip\n\nThese steps above do work, but I have to hit three endpoints (and process the JSON response for each step).\nI also read in GitLab's documentation, that there's a single endpoint available for this. So I also tried this:\ncurl -sS --header \"PRIVATE-TOKEN: \" \"https://///-/jobs/artifacts//download?job=\"\n\nbut this always redirects me to the login page, saying this:\nYou are being /users/sign_in\">redirected.\n\nIs there any simpler way to do this task? Or how to use the endpoint that is described on the documentation above propeprly?"}, {"role": "assistant", "content": "Scripting artifacts download\nTwo methods. The second one is the solution in your use case.\nFrom a Public project\ncurl -sS \"https://///-/jobs/artifacts//download?job=\"\n\nNote : I gess you can't use your personal token here, it's reserved to API usage bellow.\nGitlab doc : downloading the latest artifacts\nFrom a Private project\ncurl -L --header \"PRIVATE-TOKEN: 123456abcdef\" \"https://gitlab.com/api/v4/projects/awesome-organization%2Fawesome-group%2Fowesome-project/jobs/artifacts/master/download?job=publish-release\"\n\nNote1 : the -l tells curl to follow the redirection since gitlab will move you to its google storage location.\nNote2 : the %2F value is the url-encoded replacement for the slash if your project is part or a group or subgroup in gitlab.\nGitlab api doc : downloading the latest artifacts"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Are Git's pack files deltas rather than snapshots?\nOne of the key differences between Git and most other version control systems is that the others tend to store commits as a series of deltas - changesets between one commit and the next. This seems logical, since it's the smallest possible amount of information to store about a commit. But the longer the commit history gets, the more calculation it takes to compare ranges of revisions.\nBy contrast, Git stores a complete snapshot of the whole project in each revision. The reason this doesn't make the repo size grow dramatically with each commit is each file in the project is stored as a file in the Git subdirectory, named for the hash of its contents. So if the contents haven't changed, the hash hasn't changed, and the commit just points to the same file. And there are other optimizations as well.\nAll this made sense to me until I stumbled on this information about pack files, into which Git puts data periodically to save space:\n\nIn order to save that space, Git\n utilizes the packfile. This is a\n format where Git will only save the\n part that has changed in the second\n file, with a pointer to the file it is\n similar to.\n\nIsn't this basically going back to storing deltas? If not, how is it different? How does this avoid subjecting Git to the same problems other version controls systems have?\nFor example, Subversion uses deltas, and rolling back 50 versions means undoing 50 diffs, whereas with Git you can just grab the appropriate snapshot. Unless git also stores 50 diffs in the packfiles... is there some mechanism that says \"after some small number of deltas, we'll store a whole new snapshot\" so that we don't pile up too large a changeset? How else might Git avoid the disadvantages of deltas?"}, {"role": "assistant", "content": "Summary:\nGit’s pack files are carefully constructed to effectively use disk caches and\nprovide “nice” access patterns for common commands and for reading recently referenced\nobjects.\n\nGit’s pack file\nformat is quite flexible (see Documentation/technical/pack-format.txt,\nor The Packfile in The Git Community Book).\nThe pack files store objects in two main\nways: “undeltified” (take the raw object data and deflate-compress\nit), or “deltified” (form a delta against some other object then\ndeflate-compress the resulting delta data). The objects stored in\na pack can be in any order (they do not (necessarily) have to be\nsorted by object type, object name, or any other attribute) and\ndeltified objects can be made against any other suitable object of the same type.\nGit’s pack-objects command uses several heuristics to\nprovide excellent locality of reference for common\ncommands. These heuristics control both the selection of base\nobjects for deltified objects and the order of the objects. Each\nmechanism is mostly independent, but they share some goals.\nGit does form long chains of delta compressed objects, but the\nheuristics try to make sure that only “old” objects are at the ends of \nthe long chains. The delta base cache (whose size is controlled by the\ncore.deltaBaseCacheLimit configuration variable) is automatically\nused and can greatly reduce the number of “rebuilds” required for\ncommands that need to read a large number of objects (e.g. git log\n-p).\nDelta Compression Heuristic\nA typical Git repository stores a very large number of objects, so\nit can not reasonably compare them all to find the pairs (and\nchains) that will yield the smallest delta representations.\nThe delta base selection heuristic is based on the idea that the\ngood delta bases will be found among objects with similar filenames\nand sizes. Each type of object is processed separately (i.e. an\nobject of one type will never be used as the delta base for an\nobject of another type).\nFor the purposes of delta base selection, the objects are sorted (primarily) by\nfilename and then size. A window into this sorted list is used to limit\nthe number of objects that are considered as potential delta bases.\nIf a “good enough”1 delta representation is not found for an object\namong the objects in its window, then the object will not be delta\ncompressed.\nThe size of the window is controlled by the --window= option of\ngit pack-objects, or the pack.window configuration variable. The\nmaximum depth of a delta chain is controlled by the --depth=\noption of git pack-objects, or the pack.depth configuration\nvariable. The --aggressive option of git gc greatly enlarges\nboth the window size and the maximum depth to attempt to create\na smaller pack file.\nThe filename sort clumps together the objects for entries with with\nidentical names (or at least similar endings (e.g. .c)). The size\nsort is from largest to smallest so that deltas that remove data are\npreferred to deltas that add data (since removal deltas have shorter\nrepresentations) and so that the earlier, larger objects (usually\nnewer) tend to be represented with plain compression.\n1\nWhat qualifies as “good enough” depends on the size of the object in question and its potential delta base as well as how deep its resulting delta chain would be.\nObject Ordering Heuristic\nObjects are stored in the pack files in a “most recently referenced”\norder. The objects needed to reconstruct the most recent history are\nplaced earlier in the pack and they will be close together. This\nusually works well for OS disk caches.\nAll the commit objects are sorted by commit date (most recent first)\nand stored together. This placement and ordering optimizes the disk\naccesses needed to walk the history graph and extract basic commit\ninformation (e.g. git log).\nThe tree and blob objects are stored starting with the tree from the\nfirst stored (most recent) commit. Each tree is processed in a depth\nfirst fashion, storing any objects that have not already been\nstored. This puts all the trees and blobs required to reconstruct\nthe most recent commit together in one place. Any trees and blobs that\nhave not yet been saved but that are required for later commits are\nstored next, in the sorted commit order.\nThe final object ordering is slightly affected by the delta base selection\nin that if an object is selected for delta representation and its base object\nhas not been stored yet, then its base object is stored immediately before the\ndeltified object itself. This prevents likely disk cache misses due to the\nnon-linear access required to read a base object that would have “naturally” been\nstored later in the pack file."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-log - Show commit logs --skip="}, {"role": "assistant", "content": "Skip number commits before starting to show the commit output."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Github Markdown Same Page Link\n\nLet's say I have two points within the same git hub wiki page, which for this we'll call place 1 and place 2. \n##Title\n\n###Place 1\n\nHello, this is some text to fill in this, [here](place2), is a link to the second place.\n\n###Place 2\n\nPlace one has the fun times of linking here, but I can also link back [here](place1).\n\nAn alternative is a ToC.\n##Title\n[ToC]\n###Place 1\n###Place 2\n\nIs there any way to do this? Note - seen this so I'll assume it's on topic. Also, that deals with going between files, this one deals with going between the same file."}, {"role": "assistant", "content": "This works on Github:\n## Title\n\n### Place 1\n\nHello, this is some text to fill in this, [here](#place-2), is a link to the second place.\n\n### Place 2\n\nPlace one has the fun times of linking here, but I can also link back [here](#place-1).\n\n### Place's 3: other example\n\nPlace one has the fun times of linking here, but I can also link back [here](#places-3-other-example).\n\nSummary of the conversion rules:\n\npunctuation marks will be dropped\nleading white spaces will be dropped \nupper case will be converted to lower \nspaces between letters will be converted to -\n\nA good example document with plenty of links and formatting is LivingSocial API Design Guide"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git pull without remotely compressing objects\nI have a repository full of zip files, re-compressing theses files will be a waste of time.\nI've tried to set core.compression = 0 on the remote and the local copy without success\ngit config core.compression 0\ngit config core.loosecompression 0\n\ngit pull still do\nremote: Counting objects: 23, done.\nremote: Compressing objects: ..."}, {"role": "assistant", "content": "The time problem I had was caused by delta compression.\nThe solution for me was\necho '*.zip -delta' > .gitattributes\ngit gc\n\nI will quote this excellent response\nfrom Re: serious performance issues with images, audio files, and other \"non-code\" data:\n\nGit does spend a fair bit of time in zlib for some workloads, but it\nshould not create problems on the order of minutes.\nFor pushing and pulling, you're probably seeing delta compression,\nwhich can be slow for large files\n core.compression 0 # Didn't seem to work.\n\nThat should disable zlib compression of loose objects and objects\nwithin packfiles. It can save a little time for objects which won't\ncompress, but you will lose the size benefits for any text files.\nBut it won't turn off delta compression, which is what the\n\"compressing...\" phase during push and pull is doing. And which is\nmuch more likely the cause of slowness.\n pack.window 0\n\nIt sets the number of other objects git will consider when doing delta\ncompression. Setting it low should improve your push/pull times. But\nyou will lose the substantial benefit of delta-compression of your\nnon-image files (and git's meta objects). So the \"-delta\" option above\nfor specific files is a much better solution.\n echo '*.jpg -delta' >> .gitattributes\n\nAlso, consider repacking your repository, which will generate a\npackfile that will be re-used during push and pull.\n\nNote that the settings have to be made on the repo you are fetching/pulling from, not the one you are fetching/pulling to."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-filter-branch - Rewrite branches"}, {"role": "assistant", "content": "EXAMPLES Suppose you want to remove a file (containing confidential information\nor copyright violation) from all commits: git filter-branch --tree-filter 'rm filename' HEAD However, if the file is absent from the tree of some commit,\na simple rm filename will fail for that tree and commit.\nThus you may instead want to use rm -f filename as the script. Using --index-filter with git rm yields a significantly faster\nversion. Like with using rm filename , git rm --cached filename will fail if the file is absent from the tree of a commit. If you\nwant to \"completely forget\" a file, it does not matter when it entered\nhistory, so we also add --ignore-unmatch : git filter-branch --index-filter 'git rm --cached --ignore-unmatch filename' HEAD Now, you will get the rewritten history saved in HEAD. To rewrite the repository to look as if foodir/ had been its project\nroot, and discard all other history: git filter-branch --subdirectory-filter foodir -- --all Thus you can, e.g., turn a library subdirectory into a repository of\nits own. Note the -- that separates filter-branch options from\nrevision options, and the --all to rewrite all branches and tags. To set a commit (which typically is at the tip of another\nhistory) to be the parent of the current initial commit, in\norder to paste the other history behind the current history: git filter-branch --parent-filter 'sed \"s/^\\$/-p /\"' HEAD (if the parent string is empty - which happens when we are dealing with\nthe initial commit - add graftcommit as a parent). Note that this assumes\nhistory with a single root (that is, no merge without common ancestors\nhappened). If this is not the case, use: git filter-branch --parent-filter \\\n\t'test $GIT_COMMIT = && echo \"-p \" || cat' HEAD or even simpler: git replace --graft $commit-id $graft-id\ngit filter-branch $graft-id..HEAD To remove commits authored by \"Darl McBribe\" from the history: git filter-branch --commit-filter '\n\tif [ \"$GIT_AUTHOR_NAME\" = \"Darl McBribe\" ];\n\tthen\n\t\tskip_commit \"$@\";\n\telse\n\t\tgit commit-tree \"$@\";\n\tfi' HEAD The function skip_commit is defined as follows: skip_commit()\n{\n\tshift;\n\twhile [ -n \"$1\" ];\n\tdo\n\t\tshift;\n\t\tmap \"$1\";\n\t\tshift;\n\tdone;\n} The shift magic first throws away the tree id and then the -p\nparameters. Note that this handles merges properly! In case Darl\ncommitted a merge between P1 and P2, it will be propagated properly\nand all children of the merge will become merge commits with P1,P2\nas their parents instead of the merge commit. NOTE the changes introduced by the commits, and which are not reverted\nby subsequent commits, will still be in the rewritten branch. If you want\nto throw out changes together with the commits, you should use the\ninteractive mode of git rebase . You can rewrite the commit log messages using --msg-filter . For\nexample, git svn-id strings in a repository created by git svn can\nbe removed this way: git filter-branch --msg-filter '\n\tsed -e \"/^git-svn-id:/d\"\n' If you need to add Acked-by lines to, say, the last 10 commits (none\nof which is a merge), use this command: git filter-branch --msg-filter '\n\tcat &&\n\techo \"Acked-by: Bugs Bunny \"\n' HEAD~10..HEAD The --env-filter option can be used to modify committer and/or author\nidentity. For example, if you found out that your commits have the wrong\nidentity due to a misconfigured user.email, you can make a correction,\nbefore publishing the project, like this: git filter-branch --env-filter '\n\tif test \"$GIT_AUTHOR_EMAIL\" = \"root@localhost\"\n\tthen\n\t\tGIT_AUTHOR_EMAIL=john@example.com\n\tfi\n\tif test \"$GIT_COMMITTER_EMAIL\" = \"root@localhost\"\n\tthen\n\t\tGIT_COMMITTER_EMAIL=john@example.com\n\tfi\n' -- --all To restrict rewriting to only part of the history, specify a revision\nrange in addition to the new branch name. The new branch name will\npoint to the top-most revision that a git rev-list of this range\nwill print. Consider this history: D--E--F--G--H\n / /\nA--B-----C To rewrite only commits D,E,F,G,H, but leave A, B and C alone, use: git filter-branch ... C..H To rewrite commits E,F,G,H, use one of these: git filter-branch ... C..H --not D\ngit filter-branch ... D..H --not C To move the whole tree into a subdirectory, or remove it from there: git filter-branch --index-filter \\\n\t'git ls-files -s | sed \"s-\\t\\\"*-&newsubdir/-\" |\n\t\tGIT_INDEX_FILE=$GIT_INDEX_FILE.new \\\n\t\t\tgit update-index --index-info &&\n\t mv \"$GIT_INDEX_FILE.new\" \"$GIT_INDEX_FILE\"' HEAD"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-notes - Add or inspect object notes append"}, {"role": "assistant", "content": "Append new message(s) given by -m or -F options to an\nexisting note, or add them as a new note if one does not\nexist, for the object (defaults to HEAD). When appending to\nan existing note, a blank line is added before each new\nmessage as an inter-paragraph separator. The separator can\nbe customized with the --separator option."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "gitrevisions - Specifying revisions and ranges for Git , e.g. master , heads/master , refs/heads/master"}, {"role": "assistant", "content": "A symbolic ref name. E.g. master typically means the commit\nobject referenced by refs/heads/master . If you\nhappen to have both heads/master and tags/master , you can\nexplicitly say heads/master to tell Git which one you mean.\nWhen ambiguous, a is disambiguated by taking the\nfirst match in the following rules: If $GIT_DIR/ exists, that is what you mean (this is usually\nuseful only for HEAD , FETCH_HEAD , ORIG_HEAD , MERGE_HEAD , REBASE_HEAD , REVERT_HEAD , CHERRY_PICK_HEAD , BISECT_HEAD and AUTO_MERGE ); otherwise, refs/ if it exists; otherwise, refs/tags/ if it exists; otherwise, refs/heads/ if it exists; otherwise, refs/remotes/ if it exists; otherwise, refs/remotes//HEAD if it exists. HEAD names the commit on which you based the changes in the working tree. FETCH_HEAD records the branch which you fetched from a remote repository with\nyour last git fetch invocation. ORIG_HEAD is created by commands that move your HEAD in a drastic way ( git\nam , git merge , git rebase , git reset ), to record the position\nof the HEAD before their operation, so that you can easily change\nthe tip of the branch back to the state before you ran them. MERGE_HEAD records the commit(s) which you are merging into your branch when you\nrun git merge . REBASE_HEAD during a rebase, records the commit at which the operation is\ncurrently stopped, either because of conflicts or an edit command in\nan interactive rebase. REVERT_HEAD records the commit which you are reverting when you run git revert . CHERRY_PICK_HEAD records the commit which you are cherry-picking when you run git\ncherry-pick . BISECT_HEAD records the current commit to be tested when you run git bisect\n--no-checkout . AUTO_MERGE records a tree object corresponding to the state the ort merge strategy wrote to the working tree when a merge operation\nresulted in conflicts. Note that any of the refs/* cases above may come either from\nthe $GIT_DIR/refs directory or from the $GIT_DIR/packed-refs file.\nWhile the ref name encoding is unspecified, UTF-8 is preferred as\nsome output processing may assume ref names in UTF-8."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-pull - Fetch from and integrate with another repository or a local branch --signoff --no-signoff"}, {"role": "assistant", "content": "Add a Signed-off-by trailer by the committer at the end of the commit\nlog message. The meaning of a signoff depends on the project\nto which you’re committing. For example, it may certify that\nthe committer has the rights to submit the work under the\nproject’s license or agrees to some contributor representation,\nsuch as a Developer Certificate of Origin.\n(See https://developercertificate.org for the one used by the\nLinux kernel and Git projects.) Consult the documentation or\nleadership of the project to which you’re contributing to\nunderstand how the signoffs are used in that project. The --no-signoff option can be used to countermand an earlier --signoff\noption on the command line."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-branch - List, create, or delete branches Start development from a known tag"}, {"role": "assistant", "content": "$ git clone git://git.kernel.org/pub/scm/.../linux-2.6 my2.6\n$ cd my2.6\n$ git branch my2.6.14 v2.6.14 (1) $ git switch my2.6.14 This step and the next one could be combined into a single step with\n\"checkout -b my2.6.14 v2.6.14\"."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Eclipse and EGit: How to easily review changes to ALL modified files before committing to *local* repository\nI'm using Eclipse Indigo SR2 with the (built-in) EGit plugin v.1.3.0.201202151440-r and haven't been able to find any way to easily review all my changes before making a commit.\nI used Eclipse with SVN for years, and this was always very easy to do. I would typically right-click on my project, select Team->Synchronize, double-click on the first changed file (in the Team Sync perspective), then hit Ctrl-. repeatedly to review all changes in one file, and then proceed to the next file, as I wrote a summary of my changes for the commit message.\nBut of course, git is very different from Subversion, and so my workflow must change. With EGit, \"Team Sync\" only appears to be useful for reviewing changes between my local files and the remote repository (i.e. before a push to the remote). I need a way to review changes since my last commit to my local repository. I generally don't even care to (re)review changes before a push to remote (and if I did, I'd prefer a simple equivalent of git log to see what commits I'm about to push).\nIf I right-click on my project and select Team->Commit, I am presented with a window that does almost everything I need to do (select files to stage, commit, write a commit message, amend a previous commit, etc.). What it doesn't allow me to do is quickly and easily review all my changes in a compare editor. I can't believe this capability doesn't exist! It seems I am required to double-click on each individual file, review the changes, close the compare editor, and double-click on the next file. That's ridiculous!\nTL/DR - I am looking for a simple GUI equivalent (in Eclipse) to do what I am easily able to do from the command line using git vimdiff (where vimdiff is a git alias that uses vimdiff as the \"difftool\" to cycle through all modified files) followed by git commit (with perhaps a git add or two in between).\nIf no one has a good solution, I am curious about how others handle their commit workflow with EGit. I've been getting along fine committing from the command line (not that Eclipse is happy about that) but I can't believe that EGit is as near-useless as it seems to me. Perhaps my google-fu is not as strong as it once was?"}, {"role": "assistant", "content": "Says here that you can see the diffs between the working tree and any given reference. Perhaps you should try out the latest version (Juno) of Eclipse/EGit and see if it's gotten any better?\nUpdate: I've tried this out in the latest Eclipse, and as far as I can see it works fine. Here's how:\nIn the moment of writing this, Eclipse Juno 4.2 is the version you should go for. On the download page, you can pick between several packages according to your needs. The 'Eclipse IDE for Java Developers' comes bundled with EGit, but you can also install EGit into any distribution using the Eclipse Marketplace (under the Help menu).\n\nOnce you've imported your project into Eclipse, make sure the project is \"shared\":\n\nRight-click project -> Team -> Share Project.. -> Git\nNow do the following:\n\nSwitch to the Team Synchronizing Perspective.\nClick the little synchronize button in the Synchronize View.\nChoose Git\nPick a suitable branch to sync against, like refs/remotes/origin/master\nMake sure to check the \"Include local uncommitted changes in comparison\" box\nClick Finish\n\nNow, change some files and watch them appear in the Synchronize View. Double-click the changed files to see the diff (like in the screenshot below)."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "SSL certificate rejected trying to access GitHub over HTTPS behind firewall\n\nI'm stuck behind a firewall, so I have to use HTTPS to access my GitHub repository. I'm using Cygwin 1.7.7 on Windows XP.\nI've tried setting the remote to https://[email protected]/username/ExcelANT.git, but pushing prompts for a password, but it doesn't do anything once I've entered it.\nhttps://username:github.com/username/ExcelANT.git and cloning the empty repository from scratch, but each time it gives me the same error:\n\nerror: SSL certificate problem, verify that the CA cert is OK. Details:\nerror:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed while accessing https://github.com/username/ExcelANT.git/info/refs\n\nTurning on GIT_CURL_VERBOSE=1 gives me\n\n* About to connect() to github.com port 443 (#0)\n* Trying 207.97.227.239... * successfully set certificate verify locations:\n* CAfile: none\nCApath: /usr/ssl/certs\n* SSL certificate problem, verify that the CA cert is OK. Details:\nerror:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed\n* Expire cleared\n* Closing connection #0\n* About to connect() to github.com port 443 (#0)\n* Trying 207.97.227.239... * successfully set certificate verify locations:\n* CAfile: none\nCApath: /usr/ssl/certs\n* SSL certificate problem, verify that the CA cert is OK. Details:\nerror:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed\n* Expire cleared\n* Closing connection #0\nerror: SSL certificate problem, verify that the CA cert is OK. Details:\nerror:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed while accessing https://github.com/username/ExcelANT.git/info/refs\n\nfatal: HTTP request failed\n\nIs this a problem with my firewall, Cygwin or what?\nI hadn't set the HTTP proxy in the Git configuration. However, it's an ISA server that needs NTLM authentication, not basic, so unless anyone knows how to force Git to use NTLM, I'm scuppered."}, {"role": "assistant", "content": "The problem is that you do not have any of certificate authority (CA) certificates installed on your system. And these certificates cannot be installed with Cygwin's setup.exe.\nInstall Net/ca-certificates package in Cygwin (thanks dirkjot)\nThere are two solutions:\n\nActually install root certificates. The curl guys extracted the certificates from Mozilla for you.\n\ncacert.pem file is what you are looking for. This file contains more than 250 CA certificates (don't know how to trust this number of people). You need to download this file, split it to individual certificates put them to /usr/ssl/certs (your CApath) and index them.\nHere is how to do it. With Cygwin setup.exe install the curl and OpenSSL packages.\nExecute:\n\n\n $ cd /usr/ssl/certs\n $ curl http://curl.haxx.se/ca/cacert.pem |\n awk '{print > \"cert\" (1+n) \".pem\"} /-----END CERTIFICATE-----/ {n++}'\n $ c_rehash\n\nImportant: In order to use c_rehash you have to install openssl-perl too.\n\nIgnore SSL certificate verification.\nWARNING: Disabling SSL certificate verification has security implications. Without verification of the authenticity of SSL/HTTPS connections, a malicious attacker can impersonate a trusted endpoint (such as GitHub or some other remote Git host), and you'll be vulnerable to a man-in-the-middle attack. Be sure you fully understand the security issues and your threat model before using this as a solution.\nenv GIT_SSL_NO_VERIFY=true git clone https://github..."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-config - Get and set repository or global options histogram"}, {"role": "assistant", "content": "This algorithm extends the patience algorithm to \"support\nlow-occurrence common elements\"."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How to fix the error `found no layout file for \"HTML\" for \"page\"` in Hugo CMS?\n\nI recently imported content from my WordPress page into Hugo. When I run hugo serve I get following error messages:\nWARN 2020/02/17 20:51:06 found no layout file for \"HTML\" for \"page\": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.\n\nThe page in question starts like this:\n---\nlinktitle: \"The Title of the Post\"\ntitle: \"The Title of the Post\"\nauthor: \"Franz Drollig\"\ntype: post\ndate: 2020-01-09T14:41:55+00:00\nurl: /the-title-of-post/\ncategories:\n - Uncategorized\nweight: 10\n\n---\n\n\nThis is the content of the post. This is the second sentence of the post. \n\nIt is located in mysite/content/posts/YYYY-MM-DD-title.md.\nThe layouts directory is empty. However, the themes directory contains the book theme. This theme is also configured in the config.toml.\nAnother post, starting like shown below, is rendered correctly.\n---\nauthor: \"Michael Henderson\"\ndate: 2014-09-28\nlinktitle: Creating a New Theme\nmenu:\n main:\n parent: tutorials\nnext: /tutorials/github-pages-blog\nprev: /tutorials/automated-deployments\ntitle: Creating a New Theme\nweight: 10\n---\n\n\n## Introduction\n\nWhy is my post not rendered properly? How can I fix it?"}, {"role": "assistant", "content": "Okay so here is what is likely happening:\nYou have a theme you added as a git submodule and you recently re-cloned your project. Guess what? Your submodule needs to be re-downloaded as well.\nYou can do this with:\ngit submodule init\ngit submodule update\n\nThen your project will load without errors."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Self-hosted Gitlab registry: Connection refused for localhost:5000\n\nI'm using traefik as a reverse proxy (and for management for the letsencrypt certificates) and I'm running a self hosted gitlab instance. GitLab image is a monolithic with all the services into it, both of the services (Registry and Git) need to be served in the same container.\nWith the configuration shown below gitlab is running well.\ndocker login registry.domain.com is also working.\nBut navigating to the registry in the gitlab frontend gives me a 500 error.\nThe gitlab logs:\nErrno::EADDRNOTAVAIL (Failed to open TCP connection to localhost:5000 (Cannot assign requested address - connect(2) for \"localhost\" port 5000)):\n\nIn the docs I read, that the port 5000 is default for gitlab registry.\nSo I went into the gitlab container and tried to call for localhost:5000:\n$ docker exec -it gitlab /bin/bash\n\nroot@gitlab:/# curl -v http://localhost:5000\n* Rebuilt URL to: http://localhost:5000/\n* Trying 127.0.0.1...\n* TCP_NODELAY set\n* connect to 127.0.0.1 port 5000 failed: Connection refused\n* Trying ::1...\n* TCP_NODELAY set\n* Immediate connect fail for ::1: Cannot assign requested address\n* Trying ::1...\n* TCP_NODELAY set\n* Immediate connect fail for ::1: Cannot assign requested address\n* Failed to connect to localhost port 5000: Connection refused\n* Closing connection 0\ncurl: (7) Failed to connect to localhost port 5000: Connection refused\n\nFurthermore there is no 5000...\nroot@gitlab:/# netstat -tanpu | grep -i listen\ntcp 0 0 127.0.0.1:9093 0.0.0.0:* LISTEN - \ntcp 0 0 127.0.0.11:33383 0.0.0.0:* LISTEN - \ntcp 0 0 127.0.0.1:9100 0.0.0.0:* LISTEN - \ntcp 0 0 127.0.0.1:9229 0.0.0.0:* LISTEN - \ntcp 0 0 127.0.0.1:8080 0.0.0.0:* LISTEN - \ntcp 0 0 127.0.0.1:9168 0.0.0.0:* LISTEN - \ntcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 638/nginx \ntcp 0 0 127.0.0.1:8082 0.0.0.0:* LISTEN - \ntcp 0 0 127.0.0.1:9236 0.0.0.0:* LISTEN - \ntcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 21/sshd \ntcp 0 0 0.0.0.0:8060 0.0.0.0:* LISTEN 638/nginx \ntcp 0 0 127.0.0.1:9121 0.0.0.0:* LISTEN - \ntcp 0 0 127.0.0.1:9090 0.0.0.0:* LISTEN - \ntcp 0 0 127.0.0.1:9187 0.0.0.0:* LISTEN - \ntcp6 0 0 :::9094 :::* LISTEN - \ntcp6 0 0 :::22 :::* LISTEN 21/sshd \n\nSo what am I missing in my configuration? How do I have to handle the 5000 port in traefik?\ndocker-compose.yml\nversion: '3.3'\n\nservices:\n gitlab:\n image: gitlab/gitlab-ce:latest\n container_name: gitlab\n environment:\n GITLAB_OMNIBUS_CONFIG: |\n external_url = 'https://gitlab.domain.com'\n registry_external_url = 'https://registry.domain.com'\n gitlab_rails['gitlab_shell_ssh_port'] = 2222\n gitlab_rails['registry_enabled'] = true\n ports:\n - '2222:22'\n networks:\n - proxy\n labels:\n - traefik.enable=true\n - traefik.gitlab.frontend.rule=Host:gitlab.domain.com\n - traefik.gitlab.port=80\n - traefik.reg.frontend.rule=Host:registry.domain.com\n - traefik.reg.port=80\n - traefik.docker.network=proxy\n traefik:\n image: traefik:1.7.3-alpine\n restart: always\n ports:\n - 80:80\n - 443:443\n networks:\n - proxy\n volumes:\n - /var/run/docker.sock:/var/run/docker.sock\n - /opt/traefik/traefik.toml:/traefik.toml\n - /opt/traefik/acme.json:/acme.json\n labels:\n - traefik.frontend.rule=Host:monitor.domain.com\n - traefik.port=8080\n container_name: traefik\n\nnetworks:\n proxy:\n external: true\n\ntraefik.toml\ndefaultEntryPoints = [\"https\",\"http\"]\n\n[entryPoints]\n [entryPoints.dashboard]\n address = \":8080\"\n [entryPoints.dashboard.auth]\n [entryPoints.dashboard.auth.basic]\n users = [\"admin:password\"]\n [entryPoints.http]\n address = \":80\"\n [entryPoints.http.redirect]\n entryPoint = \"https\"\n [entryPoints.https]\n address = \":443\"\n [entryPoints.https.tls]\n\n[api]\nentrypoint=\"dashboard\"\n\n[docker]\ndomain = \"domain.com\"\nwatch = true\nnetwork = \"proxy\"\n\n[acme]\nemail = \"[email protected]\"\nstorage = \"acme.json\"\nentryPoint = \"https\"\nOnHostRule = true\n [acme.httpChallenge]\n entryPoint = \"http\""}, {"role": "assistant", "content": "First: reading \"GitLab Container Registry administration \", make sure that:\n\ngitlab registry is activated in your Omnibus image: your gitlab.rb, by default, does not declare a registry.\nyou are using https, not http as an URL. \n\n\nThe container registry works under HTTPS by default. Using HTTP is possible but not recommended and out of the scope of this document. Read Test an insecure registry.\n\nSecond, regarding traefik, you can see an example in docker-gitlab issue 1688, which does declare a traefik front to the registry part of GitLab.\n\n- traefik.enable=true\n- traefik.backend=registry.demo.com\n- traefik.frontend.rule=Host:registry.demo.com\n- traefik.docker.network=traefik-00\n- traefik.port=5000\n\n\nIf you really need to expose your internal \"https port 5000\" registry through an external http URL with traefik, you have an example in this thread."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-switch - Switch branches"}, {"role": "assistant", "content": "DESCRIPTION Switch to a specified branch. The working tree and the index are\nupdated to match the branch. All new commits will be added to the tip\nof this branch. Optionally a new branch could be created with either -c , -C ,\nautomatically from a remote branch of same name (see --guess ), or\ndetach the working tree from any branch with --detach , along with\nswitching. Switching branches does not require a clean index and working tree\n(i.e. no differences compared to HEAD ). The operation is aborted\nhowever if the operation leads to loss of local changes, unless told\notherwise with --discard-changes or --merge . THIS COMMAND IS EXPERIMENTAL. THE BEHAVIOR MAY CHANGE."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git: How to ignore all present untracked files?\nIs there a handy way to ignore all untracked files and folders in a git repository?\n(I know about the .gitignore.)\nSo git status would provide a clean result again."}, {"role": "assistant", "content": "As already been said, to exclude from status just use:\ngit status -uno # must be \"-uno\" , not \"-u no\"\n\nIf you instead want to permanently ignore currently untracked files you can, from the root of your project, launch:\ngit status --porcelain | grep '^??' | cut -c4- >> .gitignore\n\nEvery subsequent call to git status will explicitly ignore those files.\nUPDATE: the above command has a minor drawback: if you don't have a .gitignore file yet your gitignore will ignore itself! This happens because the file .gitignore gets created before the git status --porcelain is executed. So if you don't have a .gitignore file yet I recommend using:\necho \"$(git status --porcelain | grep '^??' | cut -c4-)\" > .gitignore\n\nThis creates a subshell which completes before the .gitignore file is created.\nCOMMAND EXPLANATION I'll explain the command:\n\ngit status --porcelain is used instead of git status --short because manual states \"Give the output in an easy-to-parse format for scripts. This is similar to the short output, but will remain stable across git versions and regardless of user configuration.\" So we have both the parseability and stability;\ngrep '^??' filters only the lines starting with ??, which, according to the git status manual, correspond to the untracked files;\ncut -c4- removes the first 3 characters of every line, which gives us just the relative path to the untracked file;\nthe | symbols are pipes, which pass the output of the previous command to the input of the following command;\nthe >> and > symbols are redirect operators, which append the output of the previous command to a file or overwrites/creates a new file, respectively.\n\nANOTHER VARIANT for those who prefer using sed instead of grep and cut, here's another way:\ngit status --porcelain | sed -n -e 's/^?? //p' >> .gitignore"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git: Why doesn't git diff show any differences?\nIf I run 'git status' on my repo it gives:\n# On branch master\n# Changes to be committed:\n# (use \"git reset HEAD ...\" to unstage)\n#\n# modified: myfile\n\nHowever, if I do a 'git diff myfile' it shows no differences. Is this because I have made a change and removed it so it is back to the original?\nShould I run 'git checkout myfile' to clear it?"}, {"role": "assistant", "content": "Your file is already staged to be committed. You can show it's diff using the --cached option of git.\ngit diff --cached myfile\n\nTo unstage it, just do what git status suggests in it's output ;)\nYou can check The Git Index For more info."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-for-each-ref - Output information on each ref tags="}, {"role": "assistant", "content": "Instead of only considering annotated tags, consider\nlightweight tags as well; see the corresponding option in git-describe for details."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-fetch - Download objects and refs from another repository --recurse-submodules[=(yes|on-demand|no)]"}, {"role": "assistant", "content": "This option controls if and under what conditions new commits of\nsubmodules should be fetched too. When recursing through submodules, git fetch always attempts to fetch \"changed\" submodules, that is, a\nsubmodule that has commits that are referenced by a newly fetched\nsuperproject commit but are missing in the local submodule clone. A\nchanged submodule can be fetched as long as it is present locally e.g.\nin $GIT_DIR/modules/ (see gitsubmodules ); if the upstream\nadds a new submodule, that submodule cannot be fetched until it is\ncloned e.g. by git submodule update . When set to on-demand , only changed submodules are fetched. When set\nto yes , all populated submodules are fetched and submodules that are\nboth unpopulated and changed are fetched. When set to no , submodules\nare never fetched. When unspecified, this uses the value of fetch.recurseSubmodules if it\nis set (see git-config ), defaulting to on-demand if unset.\nWhen this option is used without any value, it defaults to yes ."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Proper Way To Use Git/GitHub - PHP System with Dev/Testing/Production servers\n\nI apologize if this is obvious or easy, I have looked at a good number of git/github tutorials and read other articles, but I want to make sure what I'm doing is right.\nI want to incorporate VC (for obvious reasons) into my development team and process.\nCurrent development process (using Dreamweaver):\n * Receive a ticket (or work order)\n * Download file on Development server\n * Make changes to the file\n * Upload file back to development server\n * Changes tested/verified\n * Send to production server \n\nI'm trying to figure out how to make our new development process with using Git.\nI am switching over to PHPStorm (which is an actual PHP IDE with direct integration with Git).\nWould it be something like\n\nReceive a ticket (or work order) \nCheckout/Update/Download file(s) \nChange Files \nUpload file (which I assume is also the current working directory...?) \nAt the end of the day, do a commit \nHave build script send data to testing server (nightly build) \n\nOr would it be better to do something like \n\nReceive a ticket (or work order) \nCheckout/Update/Download file(s) \nChange Files \nUpload file/commit\nHave build script send data to testing server (nightly build) \n\nOr is there another way? Having a bit of trouble understanding what would be the optimal flow?\nAny help would be greatly appreciated.\n\nEdit\nI'm trying see if it is best to have a version of the server locally (every developer), and if so, how does that work if you have 7 or so branches?\nIf not, how do you deal with 7 or so branches with them on the web? Do you FTP files up or use Git Hooks to make them auto update?\nUpdate 07/26/2012 \nAfter working successfully with Git for quite a while now I've been following this branching model with great success:\nA Successful Git Branching Model\nThe answer to the above was yes -- should definitely have a local version of the server."}, {"role": "assistant", "content": "Assuming you have a live server and a development server I would do something along these lines.\nBefore even starting with a development cycle I would at least have two branches:\n\nMaster - the development server runs on this branch\nStable - the live server runs on this branch.\n\nSo if a developer gets a ticket or a work order he/she will perform the following actions:\n\ngit pull origin master\ngit branch featureBranch (named as the ticket id or as a good description for the work order)\ngit checkout featureBranch\nMake changes which will accomplish the desired change. Commit as often as is necessary. Do this because you will create valuable history. For instance you can try an approach to a problem and if it doesn't work, abandon it. If a day later you see the light and want to re-apply the solution, it is in your history!\nWhen the feature is fully developed and tested locally, checkout master.\ngit merge featureBranch\ngit push origin master\nTest the pushed changes on your development server. This is the moment to run every test you can think of.\nIf all is working out, merge the feature or fix into the stable branch. Now the change is live for your customers.\n\nGetting the code on the server\nThe updating of servers shouldn't be a problem. Basically I would set them up as users just like you're developers are. At my company we've setup the servers as read-only users. Basically that means the servers can never push anything but can always pull. Setting this up isn't trivial though, so you could just as well build a simple webinterface which simply only allows a git pull. If you can keep your developers from doing stuff on live implementations you're safe :)\n[EDIT]\nIn response to the last questions asked in the comments of this reaction:\nI don't know if I understand your question correctly, but basically (simplified a bit) this is how I would do this, were I in you shoes.\n\nThe testing machine (or the webroot which acts as testing implementation) has it source code based in a git repository with the master branch checked out. While creating this repository you could even remove all other references to all other branches so you'll be sure no can checkout a wrong branch in this repository. So basically the testing machine has a Git repository with only a master branch which is checked out.\nFor the live servers I would do exactly the same, but this time with the stable branch checked out. Developer should have a local repository cloned in which all branches exist. And a local implementation of the software you guys build. This software gets its source from a the local git repository. In other words: from the currently checked out branch in this repository.\nActual coding\nWhen a new feature is wanted, a local feature branch can be made based on the current master. When the branch is checked out the changes can be made and checked locally by the developer (since the software is now running on the source of the feature branch).\nIf everything seems to be in order, the changes get merged from feature branch to master and pushed to your \"git machine\". \"your github\" so to speak. Testing can now pull the changes in so every test necessary can be done by QA. If they decide everything is ok, the developer can merge the changes from master to stable and push again.\nAll thats left now is pulling form your live machines."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-format-patch - Prepare patches for e-mail submission patience"}, {"role": "assistant", "content": "Use \"patience diff\" algorithm when generating patches."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git - the stupid content tracker git-range-diff"}, {"role": "assistant", "content": "Compare two commit ranges (e.g. two versions of a branch)"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git - the stupid content tracker git-check-mailmap"}, {"role": "assistant", "content": "Show canonical names and email addresses of contacts"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "(git) diff output relative path?\nI need to get some diffs in my repo that are not relative to the base of the repo, but instead relative to a given base or given path.\nBy default I get:\ngit diff\ndiff --git a/path/to/file b/path/to/file\nindex 0cc125e..9bf911e 100644\n--- a/path/to/file\n+++ b/path/to/file\n\nBut what I want is something like:\ngit diff --prefix=/new/path/to\ndiff --git a/new/path/to/file b/new/path/to/file\nindex 0cc125e..9bf911e 100644\n--- a/new/path/to/file\n+++ b/new/path/to/file\n\nI have looked over the --relative option (not what I am looking for), the --src/dst-prefix (these can only change the \"a\" or \"b\" parts. Am I missing something basic?"}, {"role": "assistant", "content": "git diff prints paths (of changed files) from the root of the repo - no matter where you are when executing the command.\ngit diff --relative will print paths from the dir you are in. \nSo if you need paths not starting from the repo-root move down (cd) to the directory (within your repo tree) where you with your paths to start from."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git - the stupid content tracker git-show-ref"}, {"role": "assistant", "content": "List references in a local repository"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Unable to modify git bash Windows shortcut\nUnder Windows 7 I'd like to change the settings for the Git Bash Here shell extension command window, e.g. width, height and font. But when I do this, I get an error \"Unable to modify the shortcut\".\nI can modify the shortcut for Git Bash in the Start menu by using \"Run as administrator...\" This works, but only for Bash windows opened from the Start menu. It doesn't work for the \"Git Bash Here\" shell extension and there's no \"Run as administrator...\" option on right-click context menu.\nHow do you do it?"}, {"role": "assistant", "content": "2020 Update\nKVN posted an update for Windows 10\n\nThis one seems to be simplier and works well for me on the latest Git.\n\n\nRight-click C:\\Program Files\\Git\\git-bash.exe (Git for Windows)\nClick Properties\nClick the Compatibility tab in the Properties dialog\nCheck the \"Run This Program As An Administrator\" check box\nClick OK button\n\nOlder\nIf you run git bash as administrator by right clicking on its icon and selecting \"Run As Administrator\" you will be able to change your settings and have them persist.\nYou can verify this by closing the admin session then reopening as a normal user.\nI did this to set the defaults then just used git as a normal user from then on.\nEdit: My answer is outdated if you're using the most recent msysgit version and sebastien.b posted the updated solution with - https://stackoverflow.com/a/7216120/104783\nIt states\n\nThe fix is to edit the Git Bash.vbs script and have it execute the link again, instead of sh.exe. Look for this line:\n\nDim bash : bash = fso.BuildPath(gitdir, \"bin\\sh.exe\")\n\n\n\nand replace it with this line:\n\n\nDim bash : bash = fso.BuildPath(gitdir, \"Git Bash.lnk\")\n\nandrej351 also has a good reminder\n\nAlso, don't forget to select \"Defaults\" instead of \"Properties\" from the drop down menu in order to have the settings persisted"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-rebase - Reapply commits on top of another base tip --show-current-patch"}, {"role": "assistant", "content": "Show the current patch in an interactive rebase or when rebase\nis stopped because of conflicts. This is the equivalent of git show REBASE_HEAD ."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Is \"refs/heads/master\" same as \"refs/remotes/origin/master\" in Git?\nThe question is simple: is refs/heads/master the same thing as refs/remotes/origin/master? If it is not in some cases, how can I know when it is not and what it is then?"}, {"role": "assistant", "content": "They are two different symbolic names that can point to different things. refs/heads/master is a branch in your working copy named master. Frequently that is a tracking branch of refs/remotes/origin/master because origin is the default name for the remote created by git clone and its primary branch is usually also named master.\nYou can see the difference between them with git rev-list refs/heads/master..refs/remotes/origin/master which will be empty if they are the same and will otherwise list the commits between them."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-show - Show various types of objects no"}, {"role": "assistant", "content": "Do not ignore whitespace when performing move detection."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-config - Get and set repository or global options gui.encoding"}, {"role": "assistant", "content": "Specifies the default character encoding to use for displaying of\nfile contents in git-gui and gitk .\nIt can be overridden by setting the encoding attribute\nfor relevant files (see gitattributes ).\nIf this option is not set, the tools default to the\nlocale encoding."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git - the stupid content tracker "}, {"role": "assistant", "content": "a valid tag name (i.e. a refs/tags/ reference)."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git - the stupid content tracker --no-lazy-fetch"}, {"role": "assistant", "content": "Do not fetch missing objects from the promisor remote on\ndemand. Useful together with git cat-file -e to\nsee if the object is locally available.\nThis is equivalent to setting the GIT_NO_LAZY_FETCH environment variable to 1 ."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-switch - Switch branches --orphan "}, {"role": "assistant", "content": "Create a new unborn branch, named . All\ntracked files are removed."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "how do I correctly paste multi-line xml snippet to github wiki when using markdown\n\nI am trying to create a github wiki for my project. But I am unable to format a snippet from a Spring beans xml file, into this wiki. What is the proper way to do it? I tried using pre tag, code tag, the multiline code tag etc. But either it is not getting displayed at all or It displays everything in the same line."}, {"role": "assistant", "content": "not 100% sure if this is the same thing or not, but I just setup some xml snippets in my readme.md and used the\n\n \n\n\nnotation."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Gitlab: Sorry, we cannot cherry-pick this merge request automatically\n\nI got following error in the Gitlab:\nSorry, we cannot cherry-pick this merge request automatically. This merge request may already have been cherry picked, or a more recent commit may have updated some of its content.\n\nI have branch X from which I have to cherry pick commits to the branch Y. Maybe I have already done cherry pick, which is after this failed cherry pick. I have about 10 cherry picks to do.\nWhat I should to do?\nI was thinking if I create new branch Z (before Y) and try add cherry picks in the right order. Maybe that would be solution? What you think?"}, {"role": "assistant", "content": "I did the cherry picks so that I picked up the merge request commits with commands like this:\ngit cherry-pick -m 1 \ngit cherry-pick -m 1 \n...\ngit cherry-pick -m 1 \n\nThe -m 1 parameter is a little bit cryptical in the documentation, but I have done a lot of cherry picks and this is working."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How to convert files in GitHub repository to a Gist\n\nWhat I would like to do is the inverse of this question. I have a folder within a GitHub repo that contains a d3 visualization that I would like to continue making changes to. It would be nice to have a \"gist\" version of this repo to display the visualization on bl.ocks.org that I could push changes to when from the primary repo after I am happy with them.\nAnother similar question is here, but the answers describe the step gist -> bl.ocks.org. I am unsure of the step githup repo -> gist. What is the best way to accomplish this?"}, {"role": "assistant", "content": "First of all, note that Gist doesn't support directories. To import a repository into a gist follow the next steps:\n\nCreate a new gist and clone it locally (replace the dummy id with your Gist id):\ngit clone [email protected]:792bxxxxxxxxxxxxxxx9.git\n\ncd to that gist directory\nPull and merge from your GitHub repository:\ngit pull [email protected]:/.git\n\nPush your changes\ngit push\n\n\nAgain, note that if you have directories, you have to delete and commit them:\nrm -rf some-directory\ngit commit -m 'Removed some-directory' .\n\nUsing the steps above, the project history will be kept. If you don't care about history, you can always push files in your Gist. Let's say you have a repository containing multiple folders and you want for each folder to create a Gist. You will repeat the next steps (or a script could do that):\ngit clone [email protected]:.git\ncd \ncp ../path/to/your/github/repository/and/some/folder/* .\ngit add .\ngit commit -m 'Added the Gist files' .\ngit push\n\n\nGist is different than how GitHub works:\n\nGist is a simple way to share snippets and pastes with others. All gists are Git repositories, so they are automatically versioned, forkable and usable from Git.\n\nHowever, if you try to push directories in Gists you will get errors from remote:\n$ git push\nCounting objects: 32, done.\nDelta compression using up to 8 threads.\nCompressing objects: 100% (21/21), done.\nWriting objects: 100% (32/32), 7.35 KiB | 0 bytes/s, done.\nTotal 32 (delta 10), reused 0 (delta 0)\nremote: Gist does not support directories.\nremote: These are the directories that are causing problems:\nremote: foo\nTo [email protected]:792.....0b79.git\n ! [remote rejected] master -> master (pre-receive hook declined)\nerror: failed to push some refs to '[email protected]:79.......9.git'"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Create pull request with github action\n\nI'm trying to make it work this action, but I'm confused also whats it's missing in between, before triggering the peter-evans PR.\nThe scenario is pretty simple, I like on push, on any feature/* branch, to create automatically PR, but instead I'm getting weird scenario, where develop changes are applied on top of the feature/* branch. Can someone give me hints on this?\nname: Pull Request Action\non:\n push:\n branches:\n - feature/*\n\njobs:\n create-pull-request:\n runs-on: ubuntu-latest\n steps:\n - name: Check out repository code\n uses: actions/checkout@v2\n with:\n fetch-depth: 0\n ref: develop\n \n - name: Create Pull Request\n uses: peter-evans/[email protected]\n with:\n token: ${{ secrets.GITHUB_TOKEN }}\n commit-message: Simple demo\n title: '[Example] Simple demo'\n body: >\n This PR is auto-generated by \n [create-pull-request](https://github.com/peter-evans/create-pull-request).\n labels: feature, automated pr\n branch: feature/workflow-demo"}, {"role": "assistant", "content": "I know this question is a year old now and asking about the create-pull-request action, but for those that would rather not use third-party actions, Github actions now support Github command line natively, if you use Github hosted runners. See: Using Github CLI in Workflows\nThis makes it super easy to create a pull request using the gh pr create command\nSomething like this:\n steps:\n - name: create pull request\n run: gh pr create -B base_branch -H branch_to_merge --title 'Merge branch_to_merge into base_branch' --body 'Created by Github action'\n env:\n GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How to share a bit bucket repository with another user?\nI am using Bit bucket and I have a friend that I would like to share my repository with. I am using the free individual account. There seems to be an option of creating a team in bit bucket but it says it will convert my account from individual to team account. I do not want that. How can I give another user access to this repository?"}, {"role": "assistant", "content": "There is an option of share link, if you click on that, a popup will be appeared on that you can give your friends username or his email to share the repository. This popup says something like\n\"Existing users are granted access to this repository immediately. New users will be sent an invitation.\"\nUPDATE: Looks like the interface is slightly changed. You can share a repo via Settings / Access management."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-diff - Show changes between commits, commit and working tree, etc -W --function-context"}, {"role": "assistant", "content": "Show whole function as context lines for each change.\nThe function names are determined in the same way as git diff works out patch hunk headers (see Defining a\ncustom hunk-header in gitattributes )."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-show - Show various types of objects %ar"}, {"role": "assistant", "content": "author date, relative"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-init - Create an empty Git repository or reinitialize an existing one --object-format= "}, {"role": "assistant", "content": "Specify the given object (hash algorithm) for the repository. The valid\nvalues are sha1 and (if enabled) sha256 . sha1 is the default. Note: At present, there is no interoperability between SHA-256\nrepositories and SHA-1 repositories."}]} {"messages": [{"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": "See git-config"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How to shallow clone a specific commit with depth 1?\nIs it possible to shallow clone a specific commit in a repository, i.e. with depth 1? Something like\ngit clone http://myrepo.git 728a4d --depth 1\n\nto get the repository state as it is at the commit with SHA 728a4d...?\nThe motivation is to avoid having to clone the whole repository, then check out that specific commit, when we're only interested in the state of the repository at that specific commit."}, {"role": "assistant", "content": "Starting with Git 2.5.0 (which needs to be available at both the client and server side) you can set uploadpack.allowReachableSHA1InWant=true on the server side to enable fetching of specific SHA1s (must be the full SHA1, not an abbreviation):\ngit init\ngit remote add origin \ngit fetch --depth 1 origin \ngit checkout FETCH_HEAD\n\nNote that I did not find a syntax to do this with git clone directly."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-rev-list - Lists commit objects in reverse chronological order %al"}, {"role": "assistant", "content": "author email local-part (the part before the @ sign)"}]} {"messages": [{"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 --eol"}, {"role": "assistant", "content": "Show and of files.\n is the file content identification used by Git when\nthe \"text\" attribute is \"auto\" (or not set and core.autocrlf is not false).\n is either \"-text\", \"none\", \"lf\", \"crlf\", \"mixed\" or \"\". \"\" means the file is not a regular file, it is not in the index or\nnot accessible in the working tree. is the attribute that is used when checking out or committing,\nit is either \"\", \"-text\", \"text\", \"text=auto\", \"text eol=lf\", \"text eol=crlf\".\nSince Git 2.10 \"text=auto eol=lf\" and \"text=auto eol=crlf\" are supported. Both the in the index (\"i/\")\nand in the working tree (\"w/\") are shown for regular files,\nfollowed by the (\"attr/\")."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Can you delete multiple branches in one command with Git?\nI'd like to clean up my local repository, which has a ton of old branches: for example 3.2, 3.2.1, 3.2.2, etc.\nI was hoping for a sneaky way to remove a lot of them at once. Since they mostly follow a dot release convention, I thought maybe there was a shortcut to say:\ngit branch -D 3.2.*\n\nand kill all 3.2.x branches.\nI tried that command and it, of course, didn't work."}, {"role": "assistant", "content": "Not with that syntax. But you can do it like this:\ngit branch -D 3.2 3.2.1 3.2.2\n\nBasically, git branch will delete multiple branch for you with a single invocation. Unfortunately it doesn't do branch name completion. Although, in bash, you can do:\ngit branch -D `git branch | grep -E '^3\\.2\\..*'`"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-show - Show various types of objects --no-indent-heuristic"}, {"role": "assistant", "content": "Disable the indent heuristic."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-log - Show commit logs %(trailers[:])"}, {"role": "assistant", "content": "display the trailers of the body as interpreted by git-interpret-trailers . The trailers string may be followed by\na colon and zero or more comma-separated options. If any option is provided\nmultiple times, the last occurrence wins. key= : only show trailers with specified . Matching is done\ncase-insensitively and trailing colon is optional. If option is\ngiven multiple times trailer lines matching any of the keys are\nshown. This option automatically enables the only option so that\nnon-trailer lines in the trailer block are hidden. If that is not\ndesired it can be disabled with only=false . E.g., %(trailers:key=Reviewed-by) shows trailer lines with key Reviewed-by . only[=] : select whether non-trailer lines from the trailer\nblock should be included. separator= : specify the separator inserted between trailer\nlines. Defaults to a line feed character. The string may contain\nthe literal formatting codes described above. To use comma as\nseparator one must use %x2C as it would otherwise be parsed as\nnext option. E.g., %(trailers:key=Ticket,separator=%x2C ) shows all trailer lines whose key is \"Ticket\" separated by a comma\nand a space. unfold[=] : make it behave as if interpret-trailer’s --unfold option was given. E.g., %(trailers:only,unfold=true) unfolds and shows all trailer lines. keyonly[=] : only show the key part of the trailer. valueonly[=] : only show the value part of the trailer. key_value_separator= : specify the separator inserted between\nthe key and value of each trailer. Defaults to \": \". Otherwise it\nshares the same semantics as separator= above."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git - the stupid content tracker git-citool"}, {"role": "assistant", "content": "Graphical alternative to git-commit"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-config - Get and set repository or global options imap.tunnel"}, {"role": "assistant", "content": "Command used to set up a tunnel to the IMAP server through which\ncommands will be piped instead of using a direct network connection\nto the server. Required when imap.host is not set."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-log - Show commit logs log.mailmap"}, {"role": "assistant", "content": "If true, makes git-log , git-show , and git-whatchanged assume --use-mailmap , otherwise\nassume --no-use-mailmap . True by default."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-pull - Fetch from and integrate with another repository or a local branch --[no-]recurse-submodules[=(yes|on-demand|no)]"}, {"role": "assistant", "content": "This option controls if new commits of populated submodules should\nbe fetched, and if the working trees of active submodules should be\nupdated, too (see git-fetch , git-config and gitmodules ). If the checkout is done via rebase, local submodule commits are rebased as well. If the update is done via merge, the submodule conflicts are resolved and checked out."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-add - Add file contents to the index added content"}, {"role": "assistant", "content": "Added content is represented by lines beginning with \"+\". You can\nprevent staging any addition lines by deleting them."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-tag - Create, list, delete or verify a tag object signed with GPG "}, {"role": "assistant", "content": "The object that the new tag will refer to, usually a commit.\nDefaults to HEAD."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-fetch - Download objects and refs from another repository fetch.showForcedUpdates"}, {"role": "assistant", "content": "Set to false to enable --no-show-forced-updates in git-fetch and git-pull commands.\nDefaults to true."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-diff - Show changes between commits, commit and working tree, etc --shortstat"}, {"role": "assistant", "content": "Output only the last line of the --stat format containing total\nnumber of modified files, as well as number of added and deleted\nlines."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How do I provide a username and password when running \"git clone [email protected]\"?\nI know how to include a username and password in an HTTPS Git URL like this:\ngit clone https://username:password@host\n\nBut I'd like to know how to provide a username and password to an SSH remote like this:\ngit clone [email protected]\n\nI've tried like this:\ngit clone username:password@[email protected]\ngit clone git@username:[email protected]\ngit clone [email protected]@username:password\n\nBut they haven't worked."}, {"role": "assistant", "content": "Based on Michael Scharf's comment:\nYou can leave out the password, so that it won't be logged in your Bash history file:\ngit clone https://[email protected]/username/repository.git\n\nIt will prompt you for your password.\nAlternatively, you may use:\ngit clone https://username:[email protected]/username/repository.git\n\nThis way worked for me from a GitHub repository."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Firebase: Should I add GoogleService-Info.plist to .gitignore?\n\nI'm using Firebase for an iOS project that I want to open source.\nShould I add GoogleService-Info.plist to .gitignore before I upload I share the project on Github?\nI know it contains my API key, client id, etc., which might not be safe to expose?"}, {"role": "assistant", "content": "While it's not the end of the world if you commit GoogleService-Info.plist (similarly, on Android, google-services.json), you're better off leaving it out for one big reason: You're making it clear that others who build your code that they should be setting up their own Firebase project to host its configuration and data (because your project simply won't build with that file missing). Furthermore, if your project has world-writable resources in it, you can expect that people who get a hold of your app and config so easily will inadvertently start writing data into it, which is probably not what you want.\nOpen source projects that require a Firebase setup should ideally have it stated in the readme that anyone who wants to work with this app needs to go through the process of setting up Firebase.\nThe data in these config files is not exactly private - they can be extracted fairly easily from an IPA or Android APK. It's just probably not in your best interest to share them as part of your app's code."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Nested Git repositories?\nCan I nest Git repositories? I have:\n /project_root/\n /project_root/my_project\n /project_root/third_party_git_repository_used_by_my_project\n\nDoes it make sense to git init/add the /project_root to ease management of everything locally or do I have to manage my_project and the 3rd party one separately?"}, {"role": "assistant", "content": "You may be looking for the Git feature called submodules. This feature helps you manage dependent repositories that are nested inside your main repository."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Github: Import upstream branch into fork\n\nI have a fork (origin) from a project (upstream) on github. Now the upstream project has added a new branch, I want to import into my fork. How do I do that?\nI tried checking out the remote and creating a branch on top of that, but that configures the branch the way that git push is trying to push to the upstream:\ngit checkout upstream/branch\ngit checkout -b branch\n\nedit\nMaybe that wasn't clear, but I want to add the branch to my local repository, so I can push it to origin (my fork) via git push. Because upstream repositories are usually read-only and you fork it to contribute.\nSo I basically want to checkout a non-existent branch on origin whose contents will be pulled in from upstream."}, {"role": "assistant", "content": "Make sure you've pulled the new upstream branch into your local repo: \n\nFirst, ensure your working tree is clean (commit/stash/revert any changes) \nThen, git fetch upstream to retrieve the new upstream branch\n\nCreate and switch to a local version of the new upstream branch (newbranch): \n\ngit checkout -b newbranch upstream/newbranch\n\nWhen you're ready to push the new branch to origin: \n\ngit push -u origin newbranch \n\n\nThe -u switch sets up tracking to the specified remote (in this example, origin)"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-fetch - Download objects and refs from another repository --refmap="}, {"role": "assistant", "content": "When fetching refs listed on the command line, use the\nspecified refspec (can be given more than once) to map the\nrefs to remote-tracking branches, instead of the values of remote.*.fetch configuration variables for the remote\nrepository. Providing an empty to the --refmap option causes Git to ignore the configured\nrefspecs and rely entirely on the refspecs supplied as\ncommand-line arguments. See section on \"Configured Remote-tracking\nBranches\" for details."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-config - Get and set repository or global options submodule..active"}, {"role": "assistant", "content": "Boolean value indicating if the submodule is of interest to git\ncommands. This config option takes precedence over the\nsubmodule.active config option. See gitsubmodules for\ndetails."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-pull - Fetch from and integrate with another repository or a local branch --shallow-since="}, {"role": "assistant", "content": "Deepen or shorten the history of a shallow repository to\ninclude all reachable commits after ."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-diff-index - Compare a tree to the working tree or index --no-renames"}, {"role": "assistant", "content": "Turn off rename detection, even when the configuration\nfile gives the default to do so."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How to extract a git subdirectory and make a submodule out of it?\nI started a project some months ago and stored everything within a main directory.\nIn my main directory \"Project\" there are several subdirectories containing different things:\nProject/paper contains a document written in LaTeX\nProject/sourcecode/RailsApp contains my rails app. \n\"Project\" is GITified and there have been a lot of commits in both \"paper\" and \"RailsApp\" directory. Now, as I'd like to use cruisecontrol.rb for my \"RailsApp\" I wonder if there is a way to make a submodule out of \"RailsApp\" without losing the history."}, {"role": "assistant", "content": "Nowadays there's a much easier way to do it than manually using git filter-branch: git subtree\nInstallation\nNOTE git-subtree is now part of git (if you install contrib) as of 1.7.11, so you might already have it installed. You may check by executing git subtree.\n\nTo install git-subtree from source (for older versions of git):\ngit clone https://github.com/apenwarr/git-subtree.git\n\ncd git-subtree\nsudo rsync -a ./git-subtree.sh /usr/local/bin/git-subtree\n\nOr if you want the man pages and all\nmake doc\nmake install\n\nUsage\nSplit a larger into smaller chunks:\n# Go into the project root\ncd ~/my-project\n\n# Create a branch which only contains commits for the children of 'foo'\ngit subtree split --prefix=foo --branch=foo-only\n\n# Remove 'foo' from the project\ngit rm -rf ./foo\n\n# Create a git repo for 'foo' (assuming we already created it on github)\nmkdir foo\npushd foo\ngit init\ngit remote add origin [email protected]:my-user/new-project.git\ngit pull ../ foo-only\ngit push origin -u master\npopd\n\n# Add 'foo' as a git submodule to `my-project`\ngit submodule add [email protected]:my-user/new-project.git foo\n\nFor detailed documentation (man page), please read git-subtree.txt."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How to emulate git log --decorate's different colors per branch-type\nIn making my favorite git log view I've created this alias:\ngraph = log --pretty=format:'%Cgreen%ad%Creset %C(yellow)%h%Creset%C(yellow)%d%Creset %s %C(cyan)[%an]%Creset %Cgreen(%ar)%Creset' --date=short --graph\nThis creates an output like:\n\nWhat I'm missing here is the different coloring of branch types like in log --oneline --decorate --graph.\n\nThe --decorate (which uses =short by default) gives the different recognized branches a different color. The branch types (HEAD, origin/master, origin/HEAD, master) are colored cyan, red, red, green. Mine however are uncolored; colored only with the yellow of the whole branches part.\nIs there a way to give different colors to the different kind of branches with an own alias?"}, {"role": "assistant", "content": "Per https://stackoverflow.com/a/16844346/55948\n\nAs of git 1.8.3 (May 24, 2013), you can use %C(auto) to decorate\n %d in the format string of git log.\nFrom the release\n notes:\n * \"git log --format\" specifier learned %C(auto) token that tells Git\n to use color when interpolating %d (decoration), %h (short commit\n object name), etc. for terminal output.)"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-checkout - Switch branches or restore working tree files "}, {"role": "assistant", "content": "Name for the new branch."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "What does Bump Version stand for?\nI saw this comment in git many times.\nWhat does it mean actually?"}, {"role": "assistant", "content": "It means to increment the version number to a new, unique value."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-rev-list - Lists commit objects in reverse chronological order %e"}, {"role": "assistant", "content": "encoding"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Adding to someone else’s pull request on a GitHub project that I do not own\n\nIs it possible for me to add commits to someone else’s pull request on a repository where I am not the owner?\ne.g.\nUser A owns Project X.\nUser B forks Project X, creates a feature branch, makes some changes, and submits a pull request.\nUser C likes the pull request, but would like to make some modifications to it. (FWIW User C already has a fork of Project X, so is unable to easily fork User B’s fork).\nCan User C add commits to User B’s PR?"}, {"role": "assistant", "content": "You can check out the branch and re-submit a modified PR (giving credit to the original, preferably).\nYou can also issue a PR to the PR author:\ngit remote add userb https://github.com/userb/name.git\ngit fetch userb\ngit checkout featurebranch\n[change and commit]\ngit push userc featurebranch\n\nWhen you create a PR, GitHub lets you choose the base branch - so you can choose the fork and - if you want to - request changes to the PR."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-submodule - Initialize, update or inspect submodules --remote"}, {"role": "assistant", "content": "This option is only valid for the update command. Instead of using\nthe superproject’s recorded SHA-1 to update the submodule, use the\nstatus of the submodule’s remote-tracking branch. The remote used\nis branch’s remote ( branch..remote ), defaulting to origin .\nThe remote branch used defaults to the remote HEAD , but the branch\nname may be overridden by setting the submodule..branch option in either .gitmodules or .git/config (with .git/config taking precedence). This works for any of the supported update procedures ( --checkout , --rebase , etc.). The only change is the source of the target SHA-1.\nFor example, submodule update --remote --merge will merge upstream\nsubmodule changes into the submodules, while submodule update\n--merge will merge superproject gitlink changes into the submodules. In order to ensure a current tracking branch state, update --remote fetches the submodule’s remote repository before calculating the\nSHA-1. If you don’t want to fetch, you should use submodule update\n--remote --no-fetch . Use this option to integrate changes from the upstream subproject with\nyour submodule’s current HEAD. Alternatively, you can run git pull from the submodule, which is equivalent except for the remote branch\nname: update --remote uses the default upstream repository and submodule..branch , while git pull uses the submodule’s branch..merge . Prefer submodule..branch if you want\nto distribute the default upstream branch with the superproject and branch..merge if you want a more native feel while working in\nthe submodule itself."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How do I get my 'Detached HEAD' commits back into master [duplicate]\nThis question already has answers here:\n \n \n\n\n\n\nHow can I reconcile detached HEAD with master/origin?\n\n (29 answers)\n \n\nClosed 8 years ago.\n\n\n\nLooks like a few days ago I created a branch called detached HEAD and have been committing to it. My normal process is to commit to master and then push that to origin. But I can't push detached HEAD.\nMy next stop screwed me. I selected git checkout master - and my detached HEAD branch disappeared. Going back to my project all of my changes in the past few days have been wiped.\nIs there anyway I can get those changes back?"}, {"role": "assistant", "content": "If checkout master was the last thing you did, then the reflog entry HEAD@{1} will contain your commits (otherwise use git reflog or git log -p to find them). Use git merge HEAD@{1} to fast forward them into master.\nAs noted in the comments, Git Ready has a great article on this.\ngit reflog and git reflog --all will give you the commit hashes of the mis-placed commits.\n\nSource: http://gitready.com/intermediate/2009/02/09/reflog-your-safety-net.html"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-diff - Show changes between commits, commit and working tree, etc --line-prefix="}, {"role": "assistant", "content": "Prepend an additional prefix to every line of output."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-log - Show commit logs %aE"}, {"role": "assistant", "content": "author email (respecting .mailmap, see git-shortlog or git-blame )"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-rebase - Reapply commits on top of another base tip --skip"}, {"role": "assistant", "content": "Restart the rebasing process by skipping the current patch."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-log - Show commit logs --date-order"}, {"role": "assistant", "content": "Show no parents before all of its children are shown, but\notherwise show commits in the commit timestamp order."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-config - Get and set repository or global options mergetool.keepBackup"}, {"role": "assistant", "content": "After performing a merge, the original file with conflict markers\ncan be saved as a file with a .orig extension. If this variable\nis set to false then this file is not preserved. Defaults to true (i.e. keep the backup files)."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-init - Create an empty Git repository or reinitialize an existing one --bare"}, {"role": "assistant", "content": "Create a bare repository. If GIT_DIR environment is not set, it is set to the\ncurrent working directory."}]} {"messages": [{"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."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-config - Get and set repository or global options --rename-section"}, {"role": "assistant", "content": "Rename the given section to a new name."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-grep - Print lines matching a pattern -e"}, {"role": "assistant", "content": "The next parameter is the pattern. This option has to be\nused for patterns starting with - and should be used in\nscripts passing user input to grep. Multiple patterns are\ncombined by or ."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "What are the pros and cons of git-flow vs github-flow? [closed]\n\nClosed. This question is opinion-based. It is not currently accepting answers.\n \n \n\n\n\n\n\n\n\n\n\n\n\nWant to improve this question? Update the question so it can be answered with facts and citations by editing this post.\n\n\nClosed 4 years ago.\n\n\n\n\n\n\n\n Improve this question\n \n\n\n\nWe have recently started to use GitLab.\nCurrently using a \"centralized\" workflow.\nWe are considering moving to the github-flow but I want to make sure.\nWhat are the pros and cons of git-flow vs github-flow?"}, {"role": "assistant", "content": "As discussed in GitMinutes episode 17, by Nicholas Zakas in his article on \"GitHub workflows inside of a company\":\n\nGit-flow is a process for managing changes in Git that was created by Vincent Driessen and accompanied by some Git extensions for managing that flow.\n The general idea behind git-flow is to have several separate branches that always exist, each for a different purpose: master, develop, feature, release, and hotfix.\n The process of feature or bug development flows from one branch into another before it’s finally released.\nSome of the respondents indicated that they use git-flow in general.\n Some started out with git-flow and moved away from it. \nThe primary reason for moving away is that the git-flow process is hard to deal with in a continuous (or near-continuous) deployment model.\nThe general feeling is that git-flow works well for products in a more traditional release model, where releases are done once every few weeks, but that this process breaks down considerably when you’re releasing once a day or more.\n\nIn short:\nStart with a model as simple as possible (like GitHub flow tends to be), and move towards a more complex model if you need to.\n\nYou can see an interesting illustration of a simple workflow, based on GitHub-Flow at:\n\"A simple git branching model\", with the main elements being:\n\n\nmaster must always be deployable.\nall changes made through feature branches (pull-request + merge)\nrebase to avoid/resolve conflicts; merge in to master\n\n\n\n\nFor an actual more complete and robust workflow, see gitworkflow (one word)."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-fetch - Download objects and refs from another repository --stdin"}, {"role": "assistant", "content": "Read refspecs, one per line, from stdin in addition to those provided\nas arguments. The \"tag \" format is not supported."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Git: How to revert 2 files that are stubbornly stuck at \"Changed but not committed\"?\nI have a repo that has two files that supposedly I changed locally.\nSo I'm stuck with this:\n$ git status\n# On branch master\n# Changed but not updated:\n# (use \"git add ...\" to update what will be committed)\n# (use \"git checkout -- ...\" to discard changes in working directory)\n#\n# modified: dir1/foo.aspx\n# modified: dir2/foo.aspx\n#\nno changes added to commit (use \"git add\" and/or \"git commit -a\")\n\nDoing git diff says that the entire file contents have changed, even though from eyeballing it that seems untrue (there seem to be common line ranges that diff seems to be failing to see).\nInterestingly I don't remember changing these files locally. This repo is used with one remote repo (private, at GitHub.com, FWIW).\nNo matter what I've tried, I can't discard these local changes. I have tried all of:\n$ git checkout -- .\n$ git checkout -f\n$ git checkout -- dir1/checkout_receipt.aspx\n$ git reset --hard HEAD\n$ git stash save --keep-index && git stash drop\n$ git checkout-index -a -f\n\nIn other words I've tried everything described in How do I discard unstaged changes in Git? plus more. But the 2 files remain stuck as \"changed but not committed\".\nWhat the heck would cause two files to be stuck like this and seemingly \"un-revert-table\"??\nP.S. In the list above showing commands I'd already tried, I mistakenly wrote git revert when I meant git checkout. I'm sorry and thank you to those of you who answered that I should try checkout. I edited the question to correct it. I definitely did already try checkout."}, {"role": "assistant", "content": "I spent hours trying to solve a similar issue - a remote branch that I had checked out, which stubbornly showed four files as 'Changed but not updated', even when deleting all files and running git checkout -f again (or other variations from this post)!\nThese four files were necessary, but certainly hadn't been modified by me. My final solution - persuade Git that they had not been changed. The following works for all checked out files, showing 'modified' status - make sure you have already committed/stashed any that have really been modified!:\ngit ls-files -m | xargs -i git update-index --assume-unchanged \"{}\"\n\nOn Mac OSX, however xargs operates a little bit different (thx Daniel for the comment):\ngit ls-files -m | xargs -I {} git update-index --assume-unchanged {}\n\nI've added this as a placeholder for myself for next time."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "What is the preferred way to manage schema.rb in git?\nI don't want to add schema.rb to .gitignore, because I want to be able to load a new database schema from that file. However, keeping it checked in is causing all sorts of spurious conflicts that are easily resolved by a fresh db:migrate:reset.\nBasically I want a way to:\n\nKeep schema.rb in the repository for deploy-time database setup\nKeep schema.rb in '.gitignore' for general development\n\nThere would be one or two people responsible for updating schema.rb and knowing that it was correct.\nIs there a way I can have my cake and eat it, too?"}, {"role": "assistant", "content": "I'm afraid the magic solution you're looking for does not exist. This file is normally managed in version control, then for any conflicts on the version line just choose the later of the two dates. As long as you're also running all of the associated migrations nothing should get out of sync this way. If two developers have caused modifications to a similar area of schema.rb and you get conflicts in addition to the version then you are faced with a normal merge conflict resolution, but in my opinion these are normally easy to understand and resolve. I hope this helps some!"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-config - Get and set repository or global options gitweb.category gitweb.description gitweb.owner gitweb.url"}, {"role": "assistant", "content": "See gitweb for description."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Jenkins fails to build when I use a parameterised branch: fatal: Couldn't find remote ref refs/heads/${BUILD_BRANCH}\n\nAs soon as I attempted to upgrade my Jenkins job to use a parameter for the branch rather than a hard coded value it no longer works.\n\nHave tried many other names than BUILD_BRANCH\n\nHere I've tried ${env.BUILD_BRANCH}, refs/heads${BUILD_BRANCH} and absolutely none of them work\n\nWhen I did this initially I did check lightweight checkout, I removed it after reading many online answers from those having the same problem. Still nothing!. I just added the 'wipe' command to see if that would help but it didn't\nerror:\n > git rev-list --no-walk 97428a402f3304a21ccc8df435a40468ebf406c1 # timeout=10\nRunning in Durability level: MAX_SURVIVABILITY\n[Pipeline] Start of Pipeline\n[Pipeline] readTrusted\n[Pipeline] End of Pipeline\nhudson.plugins.git.GitException: Command \"git fetch --tags --progress --prune -- origin +refs/heads/${BUILD_BRANCH}:refs/remotes/origin/${BUILD_BRANCH}\" returned status code 128:\nstdout: \nstderr: fatal: Couldn't find remote ref refs/heads/${BUILD_BRANCH}\nfatal: The remote end hung up unexpectedly\n\n at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2429)\n\nThank you for reading even if you couldn't help"}, {"role": "assistant", "content": "Do you have lightweight checkout selected in the Pipeline SCM section? Unchecking lightweight checkout fixed this issue for me."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-rebase - Reapply commits on top of another base tip -X --strategy-option="}, {"role": "assistant", "content": "Pass the through to the merge strategy.\nThis implies --merge and, if no strategy has been\nspecified, -s ort . Note the reversal of ours and theirs as noted above for the -m option. See also INCOMPATIBLE OPTIONS below."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-merge - Join two or more development histories together merge.autoStash"}, {"role": "assistant", "content": "When set to true, automatically create a temporary stash entry\nbefore the operation begins, and apply it after the operation\nends. This means that you can run merge on a dirty worktree.\nHowever, use with care: the final stash application after a\nsuccessful merge might result in non-trivial conflicts.\nThis option can be overridden by the --no-autostash and --autostash options of git-merge .\nDefaults to false."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Git pretty format colors\nI'm trying to set up pretty format colors for Git. From what I can tell version 1.6.0 only recognizes red, green and blue.\n$ git log --pretty=format:\"%Credred%Creset %Cgreengreen%Creset %Cyellowyellow%Creset %Cblueblue%Creset %Cmagentamagenta%Creset %Ccyancyan%Creset %Cwhitewhite%Creset\"\nred green %Cyellowyellow%Creset blue %Cmagentamagenta %Ccyancyan %Cwhitewhite\n\nIn addition none of the colors work with the parenthesized color format.\nIs there a way to list the available pretty format colors for Git?\nUnfortunately this is on a legacy SCO OpenServer 5.0.7 machine and the last version of Git released by SCO Skunkworks was 1.6.0.3."}, {"role": "assistant", "content": "I do not have an old version of git to verify that the colors other than red, blue and green are supported.\nAlthough, one thing I noticed even with the recent versions of git (like 1.7.10 I used) is that colors other than red, green and blue need to be within parentheses (). For red, green and blue, the parentheses are optional.\nSo give this a try:\ngit log --pretty=format:\"%Credred%Creset %Cgreengreen%Creset %C(Yellow)yellow%Creset %Cblueblue%Creset %C(magenta)magenta%Creset %C(cyan)cyan%Creset %C(white)white%Creset\"\n\nThe list of colors I'm aware of at least are:\nnormal\nblack\nred\ngreen\nyellow\nblue\nmagenta\ncyan\nwhite\n\nIt can be combined with one or more of these attributes:\nbold\ndim\nul\nblink\nreverse\nitalic\nstrike\nbright # (Git 2.26, Q1 2020, example: brightred)\n\nIf you're trying to change colors using .gitconfig you should be able to specify two colors - foreground and background and you can combine it with an attribute."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-rm - Remove files from the working tree and from the index --ignore-unmatch"}, {"role": "assistant", "content": "Exit with a zero status even if no files matched."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "AzureDevOps - Link git commit or branch to work item via command line\nI've worked on projects with a Jira integration where I simply had to include the ticket number in the commit or branch name and that work would automatically link with the ticket in Jira. Exe:\n\ngit commit -am '123 some commit'\n\nAnd on the ticket you'd see a link to the commit.\nHow can I do that with Azure Dev Ops?\nI know how to manually do it via Visual Studio or in the ticket itself, but I want to do it through the command line only."}, {"role": "assistant", "content": "You can link a work item in Azure Boards to a commit in Azure Repos by specifying the work item ID after a pound sign. Eg, to update work item #3, you need to mention #3 in the commit message. (The pound sign - # is required, it won't parse bare numbers and try to link work items.)\nFor example:\ngit commit -m\"Update bug #3\"\n\nProduces a bidirectional link between the commit and the work item. You can see this in the commit details, in the work item tab:\n\nAnd you can see this in the work item details, in the \"Development\" section:"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-diff-index - Compare a tree to the working tree or index --ws-error-highlight="}, {"role": "assistant", "content": "Highlight whitespace errors in the context , old or new lines of the diff. Multiple values are separated by comma, none resets previous values, default reset the list to new and all is a shorthand for old,new,context . When\nthis option is not given, and the configuration variable diff.wsErrorHighlight is not set, only whitespace errors in new lines are highlighted. The whitespace errors are colored\nwith color.diff.whitespace ."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "My diff contains trailing whitespace - how to get rid of it?\nI've tried editing a php file in TextWrangler with line endings set to Unix, in NetBeans, and in vim. When I save the diff to a patch and then try to apply it, it gives whitespace errors. When I type git diff I can see ^M at the ends of my lines, but if I manually remove these in vim, it says my patch file is corrupted, and then the patch doesn't apply at all.\nI create a patch with the following command:\ngit diff > patchname.patch \nAnd I apply it by checking out a clean version of the file to be patched and typing\ngit apply patchname.patch\nHow can I create this patch without whitespace errors? I've created patches before and never run into this issue."}, {"role": "assistant", "content": "git apply --reject --whitespace=fix mychanges.path\nDarian Lewin commented:\n\nUseful to automatically fix whitespace errors. --whitespace=fix ensures whitespace errors are fixed before path is applied, and --reject ensures atomicity so no working directory files are modified if patch will not apply.\nSource: git-scm.com/docs/git-apply"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "GitHub wiki directories\n\nDoes the wiki that installs with a GitHub repo support directories? Our wiki is cluttered with pages, and we are looking for a way to organize them better.\nWe tried pulling the repo, creating local directories, and moving things around, but when committed back, the wiki didn't pick up the changes."}, {"role": "assistant", "content": "I was having the exact same issue and tried variants of what you tried. Nothing stuck. Asked GitHub support about it and received a reply that essentially said \"No, but we'll let the developers know that people are interested in this feature.\"\nSo the short answer is \"No\", and the long answer is \"No, but maybe in the future.\""}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-apply - Apply a patch to files and/or to the index --recount"}, {"role": "assistant", "content": "Do not trust the line counts in the hunk headers, but infer them\nby inspecting the patch (e.g. after editing the patch without\nadjusting the hunk headers appropriately)."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Using Git, how could I search for a string across all branches?\nUsing Git, how could I search within all files in all local branches for a given string?\nGitHub specific: is it possible to perform the above search across all GitHub branches? (There are several remote branches on my remote GitHub repository that ideally I wouldn't have to bring down for this search...)"}, {"role": "assistant", "content": "You can do this on a Git repository:\ngit grep \"string/regexp\" $(git rev-list --all)\n\nGitHub advanced search has code search capability:\nThe code search will look through all of the code publicly hosted on GitHub. You can also filter by:\n\nthe language: language:\nthe repository name (including the username): repo:\nthe file path: path:"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How to compare files from two different branches\nI have a script that works fine in one branch and is broken in another. I want to look at the two versions side-by-side and see what's different. Is there a way to do this?\nTo be clear I'm not looking for a compare tool (I use Beyond Compare). I'm looking for a Git diff command that will allow me to compare the master version to my current branch version to see what has changed. I'm not in the middle of a merge or anything. I just want to say something like\ngit diff mybranch/myfile.cs master/myfile.cs"}, {"role": "assistant", "content": "git diff can show you the difference between two commits:\ngit diff mybranch master -- myfile.cs\n\nOr, equivalently:\ngit diff mybranch..master -- myfile.cs\n\nNote you must specify the relative path to the file. So if the file were in the src directory, you'd say src/myfile.cs instead of myfile.cs.\nUsing the latter syntax, if either side is HEAD it may be omitted (e.g., master.. compares master to HEAD).\nYou may also be interested in mybranch...master (from git diff documentation):\n\nThis form is to view the changes on the branch containing and up to the second , starting at a common ancestor of both . git diff A...B is equivalent to git diff $(git-merge-base A B) B.\n\nIn other words, this will give a diff of changes in master since it diverged from mybranch (but without new changes since then in mybranch).\n\nIn all cases, the -- separator before the file name indicates the end of command line flags (mind the space between the separator and the filename). This is optional unless Git will get confused if the argument refers to a commit or a file, but including it is not a bad habit to get into. See Dietrich Epp's answer to Meaning of Git checkout double dashes for a few examples.\n\nThe same arguments can be passed to git difftool if you have one configured."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git revert back to certain commit [duplicate]\nThis question already has answers here:\n \n \n\n\n\n\nHow do I revert a Git repository to a previous commit?\n\n (41 answers)\n \n\nClosed 9 years ago.\n\n\n\nhow do i revert all my files on my local copy back to a certain commit?\ncommit 4a155e5b3b4548f5f8139b5210b9bb477fa549de\nAuthor: John Doe <[email protected]>\nDate: Thu Jul 21 20:51:38 2011 -0500\n\nThis is the commit i'd like to revert back to. any help would be a lifesaver!"}, {"role": "assistant", "content": "git reset --hard 4a155e5 Will move the HEAD back to where you want to be. There may be other references ahead of that time that you would need to remove if you don't want anything to point to the history you just deleted."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Should you commit .gitignore into the Git repos?\nDo you think it is a good practice to commit .gitignore into a Git repo?\nSome people don't like it, but I think it is good as you can track the file's history. Isn't it?"}, {"role": "assistant", "content": "Normally yes, .gitignore is useful for everyone who wants to work with the repository. On occasion you'll want to ignore more private things (maybe you often create LOG or something. In those cases you probably don't want to force that on anyone else."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-diff - Show changes between commits, commit and working tree, etc --patience"}, {"role": "assistant", "content": "Generate a diff using the \"patience diff\" algorithm."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How do I edit an incorrect commit message in git ( that I've pushed )?\nI want to modify a commit message deeper in history and I've pushed many new commits. \nHow do I change the commit message? Is it possible?"}, {"role": "assistant", "content": "The message from Linus Torvalds may answer your question:\nModify/edit old commit messages\nShort answer: you can not (if pushed).\n\nextract (Linus refers to BitKeeper as BK):\n\nSide note, just out of historical interest: in BK you could.\nAnd if you're used to it (like I was) it was really quite practical. I \n would apply a patch-bomb from Andrew, notice something was wrong, and just \n edit it before pushing it out.\nI could have done the same with git. It would have been easy enough to \n make just the commit message not be part of the name, and still guarantee \n that the history was untouched, and allow the \"fix up comments later\" \n thing.\nBut I didn't.\nPart of it is purely \"internal consistency\". Git is simply a cleaner \n system thanks to everything being SHA1-protected, and all objects being \n treated the same, regardless of object type. Yeah, there are four \n different kinds of objects, and they are all really different, and they \n can't be used in the same way, but at the same time, even if their \n encoding might be different on disk, conceptually they all work exactly \n the same.\nBut internal consistency isn't really an excuse for being inflexible, and \n clearly it would be very flexible if we could just fix up mistakes after \n they happen. So that's not a really strong argument.\nThe real reason git doesn't allow you to change the commit message ends \n up being very simple: that way, you can trust the messages. If you allowed \n people to change them afterwards, the messages are inherently not very \n trustworthy.\n\n\nTo be complete, you could rewrite your local commit history in order to reflect what you want, as suggested by sykora (with some rebase and reset --hard, gasp!)\nHowever, once you publish your revised history again (with a git push origin +master:master, the + sign forcing the push to occur, even if it doesn't result in a \"fast-forward\" commit)... you might get into some trouble.\nExtract from this other SO question:\n\nI actually once pushed with --force to git.git repository and got scolded by Linus BIG TIME. It will create a lot of problems for other people. A simple answer is \"don't do it\"."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-diff - Show changes between commits, commit and working tree, etc diff.srcPrefix"}, {"role": "assistant", "content": "If set, git diff uses this source prefix. Defaults to \"a/\"."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git - the stupid content tracker git-p4"}, {"role": "assistant", "content": "Import from and submit to Perforce repositories"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Version control of Mathematica notebooks\nMathematica notebooks are, of course, plaintext files -- it seems reasonable to expect that they should play nice with a version-control system (git in my case, although I doubt the specific system matters). But the fact is that any .nb file is full of cache information, timestamps, and other assorted metadata. Scads of it.\nWhich means that limited version control is possible -- commits and rollbacks work fine. Merging, though, is a disaster. Mathematica won't open a file with merge markers in it, and a text editor is no way to go through a .nb file.\nHas anyone had any luck putting a notebook under version control? How?"}, {"role": "assistant", "content": "It's recommended to disable the file outline cache, which is the metadata you're referring to when you look at the notebook with a text editor. As you discovered, it can cause merge conflicts if multiple parties are editing the same notebook.\nThis is easily disabled with the Option Inspector. In the Mathematica menu, go to Format → Option Inspector..., in the top-left set the scope dropdown to Selected Notebook and search for FileOutlineCache in the search field. Set the option to False and save your notebook, and you should be all set.\nNote that this can make opening notebooks a little slower, but unless the notebook is rather large, you probably won't notice the difference."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How to use terminal commands with Github?\nI have forked a private repository (an iPhone project) as follows:\ncd nameofdirectory\ngit init\ngit clone forkedURL\n\nNow I want to push the changes done by me to my forked repository so that the main admin can review my written code and merge it with the main repository.\nHow can I push the changes done by me to my forked repository using terminal on MacOS?"}, {"role": "assistant", "content": "You can't push into other people's repositories. This is because push permanently gets code into their repository, which is not cool.\nWhat you should do, is to ask them to pull from your repository. This is done in GitHub by going to the other repository and sending a \"pull request\".\nThere is a very informative article on the GitHub's help itself: https://help.github.com/articles/using-pull-requests\n\nTo interact with your own repository, you have the following commands. I suggest you start reading on Git a bit more for these instructions (lots of materials online).\nTo add new files to the repository or add changed files to staged area:\n$ git add \n\nTo commit them:\n$ git commit\n\nTo commit unstaged but changed files:\n$ git commit -a\n\nTo push to a repository (say origin):\n$ git push origin\n\nTo push only one of your branches (say master):\n$ git push origin master\n\nTo fetch the contents of another repository (say origin):\n$ git fetch origin\n\nTo fetch only one of the branches (say master):\n$ git fetch origin master\n\nTo merge a branch with the current branch (say other_branch):\n$ git merge other_branch\n\nNote that origin/master is the name of the branch you fetched in the previous step from origin. Therefore, updating your master branch from origin is done by:\n$ git fetch origin master\n$ git merge origin/master\n\nYou can read about all of these commands in their manual pages (either on your linux or online), or follow the GitHub helps:\n\nhttps://help.github.com/articles/create-a-repo for commit and push\nhttps://help.github.com/articles/fork-a-repo for fetch and merge"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-hash-object - Compute object ID and optionally create an object from a file"}, {"role": "assistant", "content": "SYNOPSIS git hash-object [-t ] [-w] [--path= | --no-filters]\n\t\t[--stdin [--literally]] [--] …​ git hash-object [-t ] [-w] --stdin-paths [--no-filters]"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-log - Show commit logs --abbrev[=]"}, {"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 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= ."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-rebase - Reapply commits on top of another base tip --onto "}, {"role": "assistant", "content": "Starting point at which to create the new commits. If the --onto option is not specified, the starting point is . May be any valid commit, and not just an\nexisting branch name. As a special case, you may use \"A...B\" as a shortcut for the\nmerge base of A and B if there is exactly one merge base. You can\nleave out at most one of A and B, in which case it defaults to HEAD."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How to remove all git origin and local tags?\nHow do you remove a git tag that has already been pushed?\nDelete all git remote (origin) tags and Delete all git local tags."}, {"role": "assistant", "content": "Delete All local tags. (Optional Recommended)\n# Clears out all your local \ngit tag -d $(git tag -l)\n\n\nFetch remote All tags. (Optional Recommended)\n# All remote tags give you a complete list of remote tags locally\ngit fetch\n\n\nDelete All remote tags.\n# Note: pushing once should be faster than multiple times\n# Deletes the remote tags concerning the local\ngit push origin --delete $(git tag -l) \n\n\nDelete All local tags.\n# Deletes the local tags after fetch \ngit tag -d $(git tag -l)"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How do I re-run Github Actions?\n\nI see this on the Github web UI:\n\nbut it's not clear to me whether the disabled re-runs are a result of my .github/main.workflow configuration, or inherited from the Github Actions service.\nSample workflow below - I don't see anything obvious there that would disable re-runs.\nworkflow \"Test, Lint\" {\n on = \"push\"\n resolves = [\n \"Test\",\n \"Lint\",\n \"Lint Format\"\n ]\n}\n\naction \"Install\" {\n uses = \"actions/npm@master\"\n args = \"install\"\n secrets = [\"SECRET_TOKEN\"]\n}\n\naction \"Test\" {\n needs = \"Install\"\n uses = \"actions/npm@master\"\n args = \"test\"\n secrets = [\"SECRET_TOKEN\"]\n}\n\naction \"Lint\" {\n needs = \"Install\"\n uses = \"actions/npm@master\"\n args = \"run lint\"\n secrets = [\"SECRET_TOKEN\"]\n}\n\naction \"Lint Format\" {\n needs = \"Install\"\n uses = \"actions/npm@master\"\n args = \"run lint:format\"\n secrets = [\"SECRET_TOKEN\"]\n}"}, {"role": "assistant", "content": "There are two situations:\n\nOn a failed build, from the docs\n\n\nOptionally, if the run failed, to re-run the workflow, in the upper-right corner of the workflow, use the Re-run checks drop-down menu, and select Re-run all checks.\n\n\n\nIf your run did not fail, you have to trigger the event which your workflow runs on: .\nIn the most usual case of on: push, you can add an empty commit to poke GitHub actions:\ngit commit --allow-empty -m \"trigger GitHub actions\"\ngit push\n\nThis will add an empty commit (no files changed), and will trigger another push event on GitHub, and therefore trigger another workflow run.\nThis does, however, muck up the commit history.\nYou can later squash/remove these if you like, but it's perhaps not ideal.\n\n\n\nThis is an update to my original answer, which referred to GitHub Actions HCL-based v1, prior to the August 2019 YAML-based re-release.\n@tuff got this right first, with @instantepiphany‘s caveat."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-log - Show commit logs none"}, {"role": "assistant", "content": "Disable word diff again."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Reopen merge request in gitlab\n\nIs there a way to reopen a merge request within Gitlab once it's been merged like there is with an issue?\nIn this example a merge request was merged before a code review and has been reverted, but it would be great to reopen the original merge request to keep the original history/discussions"}, {"role": "assistant", "content": "There's Reopen merge request button in Gitlab (Checked with 10.3.4-ce, but appeared earlier). However it does absolutely nothing when pressed, even with commits added to the branch the merge request is tied with."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-config - Get and set repository or global options --type "}, {"role": "assistant", "content": "git config will ensure that any input or output is valid under the given\ntype constraint(s), and will canonicalize outgoing values in 's\ncanonical form. Valid 's include: bool : canonicalize values as either \"true\" or \"false\". int : canonicalize values as simple decimal numbers. An optional suffix of k , m , or g will cause the value to be multiplied by 1024, 1048576, or\n1073741824 upon input. bool-or-int : canonicalize according to either bool or int , as described\nabove. path : canonicalize by expanding a leading ~ to the value of $HOME and ~user to the home directory for the specified user. This specifier has no\neffect when setting the value (but you can use git config section.variable\n~/ from the command line to let your shell do the expansion.) expiry-date : canonicalize by converting from a fixed or relative date-string\nto a timestamp. This specifier has no effect when setting the value. color : When getting a value, canonicalize by converting to an ANSI color\nescape sequence. When setting a value, a sanity-check is performed to ensure\nthat the given value is canonicalize-able as an ANSI color, but it is written\nas-is."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Is it possible to git-checkout a single line instead of the entire file?\nIf I have modified several lines of a versioned file, is it possible to undo the changes of a line by command-line?\nJust like I would do for an entire file with:\ngit checkout /path/to/file.extension\n\nbut doing something like, say\ngit checkout /path/to/file.extension --line 10\n\nis this possible?"}, {"role": "assistant", "content": "You can use git checkout -p to see each hunk individually and decide whether to check them out or leave them as is (and that takes an optional path argument as well if you'd like to narrow it down further)."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-merge - Join two or more development histories together merge.renames"}, {"role": "assistant", "content": "Whether Git detects renames. If set to \"false\", rename detection\nis disabled. If set to \"true\", basic rename detection is enabled.\nDefaults to the value of diff.renames."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How to create development branch from master on GitHub\n\nI created a repo on GitHub and only have a master branch so far. My local working copy is completely up to date with the remote/origin master on GitHub.\nI now want to create a development branch on GitHub so that other people on my team can start pushing changes to development (instead of directly to master) and submit PRs, request code reviews, etc.\nSo I tried creating a new development branch locally and pushing it:\ngit checkout -b development\ngit push origin development:master\n\nBut git just says Everything up-to-date. So I ask:\nIf I'm current with master, how do I just create a remote development branch that contains an exact copy of master?"}, {"role": "assistant", "content": "Creating a git develop branch\nYou can list all of your current branches like this:\ngit branch -a\n\nThis shows all of the local and remote branches. Assuming you only have a single master branch, you'd see the following:\n* master\n remotes/origin/master\n\nThe * means the current branch.\nTo create a new branch named develop, use the following command:\ngit checkout -b develop\n\nThe -b flag creates the branch. Listing the branches now should show:\n* develop\n master\n remotes/origin/master\n\nChanging branches\nYou shouldn't commit anything directly to the master branch. Instead do all your work on the develop branch and then merge develop into master whenever you have a new public release.\nYou are already in your develop branch, but if you weren't, the way to switch is as follows:\ngit checkout develop\n\nThat's the same way you create a branch but without the -b.\nMaking changes on develop\nWhen making changes, add and commit as usual:\ngit add .\ngit commit -m \"whatever\"\n\nThe first time you push to your remote do it like so:\ngit push -u origin develop\n\nThe -u flag stands for --set-upstream. After the first time you only need to do it like this:\ngit push\n\nMerging develop to master\nOnce your develop is ready to merge into master you can do it like so:\nFirst switch to your local master branch:\ngit checkout master\n\nTo merge develop into master do the following:\ngit merge develop\n\nThen push the changes in local master to the remote master:\ngit push\n\nDone.\nDeleting a branch\nIf you don't need the develop branch anymore, or you just want to delete it and start over, you can do the following:\nDelete the remote develop branch:\ngit push -d origin develop\n\nThen delete the local branch:\ngit branch -d develop\n\nThe -d means delete."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How do I refresh branches (local/remote) in Visual Studio when using Git?\nUpdate\nUpgrading to Visual Studio 2019 16.8.X has a new git workflow. This also includes a fetch button.\n\nSummary\nI am learning how to use Git with Visual Studio. I recently did a pull request where the feature branch was deleted after the merge. The feature branch still shows up in my local and remote branches in Visual Studio. I know how to right click and delete the branch, this is a workaround as others on the team may complete a pull request on a branch that I have without me knowing it. If they delete the branch afterwards I would not know they did so.\nQuestion\nHow do you refresh Visual Studio branches with what is on Git?\nWhat I expect\nI would expect a button, link, or right click feature that on click checks for differences, if any are found it asks, \"This branch no longer exists, would you like to remove it from Visual Studio?\".\nTech Specs\nI am using Visual Studio 2015 Enterprise (still seems to be a symptom of VS 2019 for versions lower than 16.8)\nAdditional Example\nThis could be another question, but it fits so well here. I just noticed that if I create a branch (say in one VM and look at the same repo with another), Visual Studio does not have a git fetch option to update the branch list. The refresh button at the top does not seem to do anything. As soon as I run git fetch in a bash, visual studio has the new branch. I would expect the refresh to take care of this."}, {"role": "assistant", "content": "If the branch has been deleted on the server side, try in command line (since such a \"button\" doesn't seem to exist directly in Visual Studio):\ngit remote prune origin --dry-run\n\n(remove the --dry-run option to actually delete the local branches)\nDelete the corresponding local branch as well git branch -d aBranch.\nThen restart your Visual Studio, and check it picks up the updated branch list. (comments mention you don't have to restart/refresh VS)\nNote: I mentioned before in 2013 the configuration\ngit config remote.origin.prune true\n\nThat would automate that process, and seems to be supported by Visual Studio, as mentioned below by yaniv.\n\nOn VSCode, try also to activate the setting \"Git: Prune on Fetch\"\n\"git.pruneOnFetch\": true"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-rebase - Reapply commits on top of another base tip renormalize"}, {"role": "assistant", "content": "This runs a virtual check-out and check-in of all three stages\nof a file when resolving a three-way merge. This option is\nmeant to be used when merging branches with different clean\nfilters or end-of-line normalization rules. See \"Merging\nbranches with differing checkin/checkout attributes\" in gitattributes for details."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Github (SSH) via public WIFI, port 22 blocked\nI'm currently on a public WIFI spot and I'm unable to use SSH (they probably blocked that port). However, I need that connection to do a git push.\n➜ ssh -T [email protected]\nssh: connect to host github.com port 22: Connection refused\n\nIs it possible to bypass this restriction by setting up a SSH tunnel via port 80 and tell github push to use that connection? How to do that? I'm on OSX (lion). This must be a common problem?"}, {"role": "assistant", "content": "Try this:\n$ vim ~/.ssh/config\n\nAdd\nHost github.com\n Hostname ssh.github.com\n Port 443\n\nSource: https://help.github.com/articles/using-ssh-over-the-https-port"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How do I ignore file extensions in git regardless of case?\nI want to tell git to ignore e.g. jpg files regardless of how the extension is written.\ne.g.\n\n*.jpg\n\nshould ignore\n\n.jpg, .JPG., .Jpg\n\netc.\nIs that possible without telling git to ignore case altogether?"}, {"role": "assistant", "content": "Git ignore understands glob pattern, so you can use this\n*.[jJ][pP][gG]"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-config - Get and set repository or global options instaweb.port"}, {"role": "assistant", "content": "The port number to bind the gitweb httpd to. See git-instaweb ."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-log - Show commit logs zebra"}, {"role": "assistant", "content": "Blocks of moved text are detected as in blocks mode. The blocks\nare painted using either the color.diff.{old,new}Moved color or color.diff.{old,new}MovedAlternative . The change between\nthe two colors indicates that a new block was detected."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Move a repository from Github to Gitlab\n\nIs there a way to move an entire repository from Github to GitLab?\nFor the code itself, this would be a simple matter of creating a new repo on GitLab and pushing to it.\nWiki pages live in a separate branch on Github and are managed with Git mechanisms; AFAIK the same goes for GitLab. Same story for pages.\nThat leaves issues and merge requests as the main open points. Is there a way to copy those from Github to GitLab, at least in the state they were in at the time of the migration?\nGithub offers an export ferature, and GitLab has an import feature which can import a Github repository—do any of these help with the above?"}, {"role": "assistant", "content": "GitLab’s import feature has worked quite nicely.\n\nOn https://gitlab.com (make sure you are logged in), you will get a list of your projects. Click New Project.\nOpen the Import Project tab, and click Github.\nIf you have not granted Gitlab authorization to access your Github account, you will be prompted to do so now.\nA list of your Github repos will appear. For each repo you wish to import, choose the namespace (your personal one or that of any of your organizations, if any) and change the project name if you wish. (Default is to import to your personal namespace and use the same repo name as on Github.) Then click Import next to the repo you wish to import.\n\nImport will take a couple of minutes. When it finishes, you will get your entire repo, including wiki, issues and merge requests. Issues and merge requests will retain ticket numbers as on Github, and labels also seem to get migrated.\nGithub Pages do not seem to get migrated automatically. This requires some manual steps. For purely static content (no SSG), with content stored in the gh-pages branch, the process is as follows:\n\nSwitch to your gh-pages branch.\nCreate a new folder public and move all content there.\nCommit your changes.\nSwitch back to master and merge gh-pages (so that your content now resides on a separate folder in master rather than its own branch).\nOn your project’s main page, click Add CI/CD. This will create a new .gitlab-ci.yml file; add the following content and commit:\n\nimage: alpine:latest\n\npages:\n stage: deploy\n script:\n - echo 'Nothing to do...'\n artifacts:\n paths:\n - public\n only:\n - master\n\nThis will take another few minutes. Navigate to Settings > Pages and click the link to your pages.\nGithub has multiple options for storing web content; the above may also work for others with slight modifications."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Vim for Windows - What do I type to save and exit from a file?\nUsing Windows XP I accidentally typed git commit -a instead of git commit -am \"My commit message\", and now I'm viewing my CMD prompt filled with the file version of my commit message (\"Please enter the commit message for your...\"). I've added my message to the top, but now I can't figure out how to save and leave. I tried to press Ctrl + W + Q, but it doesn't do anything, but add ^ where the cursor is.\nI also tried Esc first, and then Ctrl + W + Q, but it says No write since last change (add ! to override)."}, {"role": "assistant", "content": "Press ESC to make sure you are out of the edit mode and then type:\n:wq"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-log - Show commit logs %ge"}, {"role": "assistant", "content": "reflog identity email"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-diff - Show changes between commits, commit and working tree, etc diff.context"}, {"role": "assistant", "content": "Generate diffs with lines of context instead of the default\nof 3. This value is overridden by the -U option."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "gitsubmodules - Mounting one repository inside another"}, {"role": "assistant", "content": "The configuration of submodules Submodule operations can be configured using the following mechanisms\n(from highest to lowest precedence): The command line for those commands that support taking submodules\nas part of their pathspecs. Most commands have a boolean flag --recurse-submodules which specifies whether to recurse into submodules.\nExamples are grep and checkout .\nSome commands take enums, such as fetch and push , where you can\nspecify how submodules are affected. The configuration inside the submodule. This includes $GIT_DIR/config in the submodule, but also settings in the tree such as a .gitattributes or .gitignore files that specify behavior of commands inside the\nsubmodule. For example an effect from the submodule’s .gitignore file\nwould be observed when you run git status --ignore-submodules=none in\nthe superproject. This collects information from the submodule’s working\ndirectory by running status in the submodule while paying attention\nto the .gitignore file of the submodule. The submodule’s $GIT_DIR/config file would come into play when running git push --recurse-submodules=check in the superproject, as this would\ncheck if the submodule has any changes not published to any remote. The\nremotes are configured in the submodule as usual in the $GIT_DIR/config file. The configuration file $GIT_DIR/config in the superproject.\nGit only recurses into active submodules (see \"ACTIVE SUBMODULES\"\nsection below). If the submodule is not yet initialized, then the configuration\ninside the submodule does not exist yet, so where to\nobtain the submodule from is configured here for example. The .gitmodules file inside the superproject. A project usually\nuses this file to suggest defaults for the upstream collection\nof repositories for the mapping that is required between a\nsubmodule’s name and its path. This file mainly serves as the mapping between the name and path of submodules\nin the superproject, such that the submodule’s Git directory can be\nlocated. If the submodule has never been initialized, this is the only place\nwhere submodule configuration is found. It serves as the last fallback\nto specify where to obtain the submodule from."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-config - Get and set repository or global options GIT_CONFIG"}, {"role": "assistant", "content": "If no --file option is provided to git config , use the file\ngiven by GIT_CONFIG as if it were provided via --file . This\nvariable has no effect on other Git commands, and is mostly for\nhistorical compatibility; there is generally no reason to use it\ninstead of the --file option."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-diff - Show changes between commits, commit and working tree, etc --submodule[=]"}, {"role": "assistant", "content": "Specify how differences in submodules are shown. When specifying --submodule=short the short format is used. This format just\nshows the names of the commits at the beginning and end of the range.\nWhen --submodule or --submodule=log is specified, the log format is used. This format lists the commits in the range like git-submodule summary does. When --submodule=diff is specified, the diff format is used. This format shows an\ninline diff of the changes in the submodule contents between the\ncommit range. Defaults to diff.submodule or the short format\nif the config option is unset."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-log - Show commit logs --not"}, {"role": "assistant", "content": "Reverses the meaning of the ^ prefix (or lack thereof)\nfor all following revision specifiers, up to the next --not .\nWhen used on the command line before --stdin, the revisions passed\nthrough stdin will not be affected by it. Conversely, when passed\nvia standard input, the revisions passed on the command line will\nnot be affected by it."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How to disable Create Project permission for users by default in GitLab?\n\nI am using the Omnibus GitLab CE system with LDAP authentication.\nBecause of LDAP authentication, anyone in my company can sign in to GitLab and a new GitLab user account associated with this user is created (according to my understanding).\nI want to modify it so that by default this new user (who can automatically sign in based on his LDAP credentials) cannot create new projects.\nThen, I as the admin, will probably handle most new project creation.\nI might give the Create Project permission to a few special users."}, {"role": "assistant", "content": "In newer versions of GitLab >= v7.8 …\nThis is not a setting in config/gitlab.yml but rather in the GUI for admins.\nSimply navigate to https://___[your GitLab URL]___/admin/application_settings/general#js-account-settings, and set Default projects limit to 0.\nYou can then access individual users's project limit at https://___[your GitLab URL]___/admin/users.\n\nSee GitLab's update docs for more settings changed between v7.7 and v7.8.\ngit diff origin/7-7-stable:config/gitlab.yml.example origin/7-8-stable:config/gitlab.yml.example"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-rebase - Reapply commits on top of another base tip ours"}, {"role": "assistant", "content": "This option forces conflicting hunks to be auto-resolved cleanly by\nfavoring our version. Changes from the other tree that do not\nconflict with our side are reflected in the merge result.\nFor a binary file, the entire contents are taken from our side. This should not be confused with the ours merge strategy, which does not\neven look at what the other tree contains at all. It discards everything\nthe other tree did, declaring our history contains all that happened in it."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-branch - List, create, or delete branches "}, {"role": "assistant", "content": "The new branch head will point to this commit. It may be\ngiven as a branch name, a commit-id, or a tag. If this\noption is omitted, the current HEAD will be used instead."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-config - Get and set repository or global options format.signatureFile"}, {"role": "assistant", "content": "Works just like format.signature except the contents of the\nfile specified by this variable will be used as the signature."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "GitLab: extend `!reference` with extra values in `variables`\n\nHow can one use !reference in variables block and then extend the list of entries?\nFor example, I want to be able to do something like\nvariables:\n !reference [.common_variables, variables]\n FOO: \"bar\"\n\nAt the moment I get an error in the GitLab linter:\n\nThis GitLab CI configuration is invalid: (): did not find expected key while parsing a block mapping at line 1 column 1\n\nP.S. Note that this question is specifically about !reference.\n\nYaml anchors are out of scope of this question, as I want to place .common_variables into a separate file that I include in my pipeline.\nextends: mechanism is out of scope of this question. It does work, but it has a weird behaviour that one also gets an extends variable in the environment, see GitLab: use `extends` in `variables`"}, {"role": "assistant", "content": "variables: !reference [.common_variables, variables]\n\nIs the correct way to reference, however gitlab yml structure will not support additional definitions after the !reference keyword.\nMy advice would be to have a more specific definition in your variables file that uses anchors to share the common varaibles.\ne.g:\nin 'variables.gitlab-ci.yml':\n.common_variables: &common_variables\n COMMON_VAR: value\n\n.variables:Example-job\n variables:\n <<: *common_variables\n FOO: \"bar\"\n\nin '.gitlab.ci.yml':\nExample-job:\n variables: !reference [\".variables:Example-job\", \"variables\"]\n script:\n ..."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Git push failed with error: “GitLab: Author not member of team”\n\ngit push failed with the following message:\nremote: GitLab: Author '`[email protected]`' is not a member of team\n\nMy #git config user.name and #git config user.email are set as:\n#git config user.name\nSam Logan \n\n#git config user.email\n[email protected]\n\nMy hostname is logath-T460.\nI am not sure why git push uses my localhostname with the Author. Any clue how to resolve this issue?"}, {"role": "assistant", "content": "It's not git push that's using your username + hostname, it's git commit.\nBy default, if you did not set user.name and user.email BEFORE making a commit, git will get it from your computer name and hostname. It would also have shown you a warning like this:\nCommitter: user1234 <[email protected]>\nYour name and email address were configured automatically based\non your username and hostname. Please check that they are accurate.\nYou can suppress this message by setting them explicitly:\n\n git config --global user.name \"Your Name\"\n git config --global user.email [email protected]\n\nAfter doing this, you may fix the identity used for this commit with:\n\n git commit --amend --reset-author\n\n 1 file changed, 0 insertions(+), 0 deletions(-)\n create mode 100644 file1.txt\n\nWhen you do git push, it would just use whatever was set as the commit author and push it to the remote repo.\nWhat I think happened, is that you already committed BEFORE you set the correct user.name and user.email settings. So those commits you're trying to push already has that invalid user details \"[email protected]\" saved as the commit author.\nWhat you need to do then is to update the author of the previous commits.\nFirst, make sure to properly set the user.name and user.email config (--global or --local to the repo), otherwise known as your Git identity.\ngit config --global user.name \"yourname\"\ngit config --global user.email \"[email protected]\"\n\nSet it now to the correct identity that matches the user account of your Gitlab repo.\nThen use --reset-author on those commits.\n\nTo modify the author of only the most recent commit:\ngit commit --amend --reset-author --no-edit\n\n\nTo modify the author of multiple past commits:\n(reference: How to amend several commits in Git to change author)\ngit rebase -i HEAD~N -x \"git commit --amend --reset-author --no-edit\"\n\nwhere N is the number of previous commits you need to update. The rebase -i will show a command line editor to show you the changes, and --reset-author will use your current user.* settings. Just save and quit to apply to changes.\n\nAfter that, git push should now work."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-gc - Cleanup unnecessary files and optimize the local repository"}, {"role": "assistant", "content": "NAME git-gc - Cleanup unnecessary files and optimize the local repository"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-config - Get and set repository or global options remote..partialclonefilter"}, {"role": "assistant", "content": "The filter that will be applied when fetching from this\tpromisor remote.\nChanging or clearing this value will only affect fetches for new commits.\nTo fetch associated objects for commits already present in the local object\ndatabase, use the --refetch option of git-fetch ."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "GitHub Error Message - Permission denied (publickey)\nAnybody seen this error and know what to do?\nI'm using the terminal, I'm in the root, the GitHub repository exists and I don't know what to do now.\n> git push -u origin master\nPermission denied (publickey).\nfatal: Could not read from remote repository.\n\nPlease make sure you have the correct access rights\nand the repository exists."}, {"role": "assistant", "content": "GitHub isn't able to authenticate you. So, either you aren't setup with an SSH key, because you haven't set one up on your machine, or your key isn't associated with your GitHub account.\nYou can also use the HTTPS URL instead of the SSH/git URL to avoid having to deal with SSH keys. This is GitHub's recommended method.\nFurther, GitHub has a help page specifically for that error message, and explains in more detail everything you could check.\nTo solve it:\n\nYou should have a public key in your home directory, thus print the content of your public key, in Linux distro run for example cat ~/.ssh/id_rsa.pub (if the prior doesn't work, check the keys inside ~/.ssh/ with .pub extension)\n\nAdd the content of such a public key to your Github account: click your profile photo -> Settings-> SSH and GPG keys -> New SSH key or Add SSH key"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "gitrevisions - Specifying revisions and ranges for Git AUTO_MERGE"}, {"role": "assistant", "content": "records a tree object corresponding to the state the ort merge strategy wrote to the working tree when a merge operation\nresulted in conflicts."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Differences between git branches using Visual Studio\nI'm trying to understand how to compare branches or commits using VS 2015.\nUsing other Git programs, I can easily compare versions, but I can't see how it's done in VS.\nCan anyone help?"}, {"role": "assistant", "content": "To compare a specific object (solution, project, source file,...) in Microsoft Visual Studio (using MVS2015):\n\nLocate the object in the Solution Explorer, and bring up the context menu (right-click): select \"View History...\". This brings up the History window for this object, with all the commits where the object changed (from any branch).\nMulti-select the two commits that you want to compare (left-click on the first one, Ctrl-left-click on the second one).\nNow bring up the context menu on either of the selected commits (right_click): select \"Compare...\". This brings up the Diff window for the object in the respective commits (with the differences highlighted in red -lines removed from first commit- or green -lines added in second commit). You can use the scroll bar in the Diff window, or the \"Previous Difference\" and \"Next Difference\" button in the ribbon to go between the differences of the object.\n\nI am not sure that there is a way to compare ALL the items in two different commits (I just invoke GitKraken -free for non-commercial purposes- or any other GUI for git on my local repo). Gitkraken is amazingly simple though: select any two commits, and all the differences between those commits are available at your fingertips."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Is there a way to limit the amount of memory that \"git gc\" uses?\nI'm hosting a git repo on a shared host. My repo necessarily has a couple of very large files in it, and every time I try to run \"git gc\" on the repo now, my process gets killed by the shared hosting provider for using too much memory. Is there a way to limit the amount of memory that git gc can consume? My hope would be that it can trade memory usage for speed and just take a little longer to do its work."}, {"role": "assistant", "content": "I used instructions from this link. Same idea as Charles Baileys suggested.\nA copy of the commands is here:\ngit config --global pack.windowMemory \"100m\"\ngit config --global pack.packSizeLimit \"100m\"\ngit config --global pack.threads \"1\"\n\nThis worked for me on hostgator with shared hosting account."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Github: Mirroring gh-pages to master\nI'm developing a jQuery plugin that's being hosting on GitHub. It has a demo included of which I'm manually copying and pushing to the branch gh-pages, what I'd like to do is have it so when I push a change to master it is automatically pushed to gh-pages, or at least a setup where they are mirrored.\nI've already seen this question but not sure if it really answers my question with regard to these requirements:\n\nI use Tower, I don't mind using the terminal (Mac) to make changes to config, so long as the solution works with this GUI.\nI only want this 'mirroring' on certain repos, not on all of them on my machine.\n\nCheers"}, {"role": "assistant", "content": "Add the following 2 lines to the [remote \"origin\"] section of .git/config:\npush = +refs/heads/master:refs/heads/gh-pages\npush = +refs/heads/master:refs/heads/master\n\nEvery time you push it will automatically push master to gh-pages as well.\nI'm using this for the jQuery Lifestream project."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-show - Show various types of objects %d"}, {"role": "assistant", "content": "ref names, like the --decorate option of git-log"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Git: copy all files in a directory from another branch\nHow do I copy all files in a directory from another branch? I can list all of the files in that directory by doing \ngit ls-tree master:dirname\n\nI can then copy all of the files individually by doing\ngit checkout master -- dirname/filename\n\nHowever, using wildcards has so far been a total fail. This does nothing: \ngit checkout master -- dirname/*.png\n\nThough I guess I can use a bash script to do that, there has to be an easier way, right?"}, {"role": "assistant", "content": "As you are not trying to move the files around in the tree, you should be able to just checkout the directory:\ngit checkout master -- dirname"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Git: How to commit a manually deleted file? [duplicate]\n\nThis question already has answers here:\n \n \n\n\n\n\nDelete files from git index when they are already deleted from fs\n\n (7 answers)\n \n\n\nStaging Deleted files\n\n (10 answers)\n \n\nClosed 11 years ago.\n\n\n\nIn my git repository I manually deleted a file(rm) after moving it to another folder. I than committed all the changes to my repo but now when I do git status .\nronnie@ronnie:/home/github/Vimfiles/Vim$ git status .\n# On branch master\n# Changes not staged for commit:\n# (use \"git add/rm ...\" to update what will be committed)\n# (use \"git checkout -- ...\" to discard changes in working directory)\n#\n# deleted: plugin/dwm.vim\n#\nno changes added to commit (use \"git add\" and/or \"git commit -a\")\n\nNow, how should I commit so that dwm.vim is deleted from the plugin folder in my remote repo. I know that I have to use git add && git commit but I have no file to commit/add because /plugin/dwm.vim is already deleted."}, {"role": "assistant", "content": "The answer's here, I think.\nIt's better if you do git rm , though."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How to solve git merge error \"Swap file .MERGE_MSG.swp already exists\"\nWhen I pull:\nE325: ATTENTION\nFound a swap file by the name \"~/Documents/Sites/recipegenerator/.git/.MERGE_MSG.swp\"\n owned by: username dated: Wed Dec 14 12:28:45 2016\n file name: ~username/Documents/Sites/recipegenerator/.git/MERGE_MSG\n modified: YES\n user name: username host name: Users-MacBook-Pro.local\n process ID: 33747\nWhile opening file \"/Users/larsvanurk/Documents/Sites/recipegenerator/.git/MERGE_MSG\"\n dated: Thu Dec 22 14:06:17 2016\n NEWER than swap file!\n\n(1) Another program may be editing the same file.\n If this is the case, be careful not to end up with two\n different instances of the same file when making changes.\n Quit, or continue with caution.\n\n(2) An edit session for this file crashed.\n If this is the case, use \":recover\" or \"vim -r /Users/username/Documents/Sites/recipegenerator/.git/MERGE_MSG\"\n to recover the changes (see \":help recovery\").\n If you did this already, delete the swap file \"/Users/username/Documents/Sites/recipegenerator/.git/.MERGE_MSG.swp\"\n to avoid this message.\n\nSwap file \"~/Documents/Sites/recipegenerator/.git/.MERGE_MSG.swp\" already exists!\n\nWhen I push:\nTo https://github.com/nickname/recipegenerator.git\n ! [rejected] master -> master (fetch first)\nerror: failed to push some refs to 'https://github.com/nickname/recipegenerator.git'\nhint: Updates were rejected because the remote contains work that you do\nhint: not have locally. This is usually caused by another repository pushing\nhint: to the same ref. You may want to first integrate the remote changes\nhint: (e.g., 'git pull ...') before pushing again.\nhint: See the 'Note about fast-forwards' in 'git push --help' for details.\n\nPlease help :C Idk what to do. I can't push or pull. I tried pretty much everything I could think of. I also tried: git merge --abort. The thing is when I do that, I can't seem to find my conflict that I should resolve."}, {"role": "assistant", "content": "It's a message from VIM which apparently you are using as the text editor in git. Have you tried reading and following these two (1) (2) points? One of them will be probably true, and will let you solve this issue.\nFirst of all, check that MERGE_MSG file (not MERGE_MSG.swp), and see if it exists and what's inside. Most likely it's trash or a temporary file that can be safely deleted. Judging from the name, it's probably the file name used as a temporary text editing area for merge commit messages.\nThen, since you use VIM, when VIM starts, it tries to create a swap file for its own internal needs. The error message says it's ~/Documents/Sites/recipegenerator/.git/.MERGE_MSG.swp. Often, you can simply delete such swap files, especially if they are old or unexpected. However, if recently some merge-commit-message-editing session has crashed and if you had a lot of creative text you don't want to lose - then don't delete it and recover that swap instead, as described in (2) in the error message.\nHowever, since you don't know what is going on and you haven't said anything about losing some text you wrote, and since it's probably just a MERGE_MSG that was auto-generated anyways, I suppose you can:\ngit merge --abort\nrm ~/Documents/Sites/recipegenerator/.git/.MERGE_MSG.swp\n\nand try what you were doing once again.\nAlso, it's good to check the hint mentioned in (1) in error message. Check with ps or whatever else for any open VIM sessions that could be currently editing that MERGE_MSG. If you spot any, then, well, get to them and either finish editing, or make them quit (escape, :q!, enter) (vim will cleanup swaps on quitting), or terminate them (kill them, but then you need to remove swap files manually)."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-format-patch - Prepare patches for e-mail submission --dst-prefix="}, {"role": "assistant", "content": "Show the given destination prefix instead of \"b/\"."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How can I push my existing Git repository to Team Foundation Service\nMicrosoft now has support for Git repositories on their Team Foundation Service. I have an account on Team Foundation Service, and I'd like to push my existing Git repository to a project there.\nWhenever I try to do searches, I keep finding things like TFS-GIT, or GIT-TF. I'm pretty sure I don't want those, as I think those change to the Team Foundation Server model for code repositories, and that's not what I want.\nSpecifically, I have an existing Git repository that I want to push to TFService."}, {"role": "assistant", "content": "Okay, I was apparently overcomplicating this. Here's what I did.\n\nCreated a new project in TFService\nConnected to that project in Visual Studio\nCloned that project in Visual Studio\ngit pull c:\\source\\oldGitProject\n\nThat was it, it pulled all of the changes from the old location, and I could push that up to TFService easily."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-fetch - Download objects and refs from another repository"}, {"role": "assistant", "content": "BUGS Using --recurse-submodules can only fetch new commits in submodules that are\npresent locally e.g. in $GIT_DIR/modules/ . If the upstream adds a new\nsubmodule, that submodule cannot be fetched until it is cloned e.g. by git\nsubmodule update . This is expected to be fixed in a future Git version."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Your repository has no remotes configured to push to\nI am using Visual Studio Code and running into the message below while trying to check in.\nYour repository has no remotes configured to push to.\n\nThis is right after I upgrade from the April version on the Macintosh to the May version. I upgraded since I was getting an infinite progress bar during a git update. Does anybody have any ideas how to fix this? I have used the command line to verify that I do indeed have remotes configured. Can't post them here since it will show inter company info :(. Please help."}, {"role": "assistant", "content": "Check the Github adding a remote article official doc which have better code highlighting and infos\nbut if you are an experienced user, just check out below commands and note that only the first command is required and second one is just for verifying and will return related repo details.\ngit remote add origin https://github.com/user/repo.git\n \ngit remote -v\n\nGit Remote add Command dissection\n\nparams:\n\nremote name: origin (a default name for a remote Repo in Git )\nremote url: https://github.com/user/repo.git (in this example)"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-fsck - Verifies the connectivity and validity of the objects in the database gitmodulesMissing"}, {"role": "assistant", "content": "(ERROR) Unable to read .gitmodules blob."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": ".gitignore exclude files in directory but not certain directories\napplication/cache/*\napplication/cache/folder/*\napplication/cache/folder/onemorefolder/*\n\nThis doesn't seem to be working. When I clone the project, there is no \"application/cache\" folder or \"application/cache/folder\" folder, etc...\nI'd like if files in the cache folders weren't cached but folders were, so that the folders permissions transfer and exist."}, {"role": "assistant", "content": "Git doesn't track folders, only files, so if you ignore everything in a folder, Git won't have anything to track. You can add a .gitignore file to each directory (application/cache, application/cache/folder, application/cache/folder/onemorefolder/) with the following contents:\n*\n!.gitignore\n\nThen, you can add those directories, and only the .gitignore file in each directory will get added -- but this means the directories will now be tracked (i.e., created when cloning)."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How can I graph the Lines of Code history for git repo?\nBasically I want to get the number of lines-of-code in the repository after each commit.\nThe only (really crappy) ways I have found is to use git filter-branch to run wc -l *, and a script that runs git reset --hard on each commit, then runs wc -l\nTo make it a bit clearer, when the tool is run, it would output the lines of code of the very first commit, then the second and so on. This is what I want the tool to output (as an example):\nme@something:~/$ gitsloc --branch master\n10\n48\n153\n450\n1734\n1542\n\nI've played around with the ruby 'git' library, but the closest I found was using the .lines() method on a diff, which seems like it should give the added lines (but does not: it returns 0 when you delete lines for example)\nrequire 'rubygems'\nrequire 'git'\n\ntotal = 0\ng = Git.open(working_dir = '/Users/dbr/Desktop/code_projects/tvdb_api') \n\nlast = nil\ng.log.each do |cur|\n diff = g.diff(last, cur)\n total = total + diff.lines\n puts total\n last = cur\nend"}, {"role": "assistant", "content": "You might also consider gitstats, which generates this graph as an html file."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How to review a pull request in IntelliJ IDEA?\nWe are using git, Bitbucket, and IntelliJ IDEA. The project is mainly written in Java and Groovy.\nIs there a good way to review pull requests right from IntelliJ?"}, {"role": "assistant", "content": "Most up-to-date information (March 2021)\nNow, IntelliJ 2020.2 fully supports reviewing Pull Requests.\n\nAccessing the feature\nYou can either navigate to: Main menu > VCS > Git > View Pull Requests.\n\nOr it might be in your left \"side-menu\" (here the third option from the top):\n\nFurther information\nIt seems to be mostly an integration for GitHub (source):\n\nNow the entire GitHub pull request workflow can be done directly from IntelliJ IDEA. It’s possible to browse, assign, manage, and even merge pull requests, view the timeline and inline comments, submit comments and reviews, and accept changes.\n\nA more in-depth description of all the VCS-related features introduced can be found here:\n\nFull GitHub Pull Requests support\nWe are excited to announce that IntelliJ IDEA 2020.2 will come with full support for GitHub Pull Requests!\nWe introduced initial support for GitHub Pull Requests with v2018.3, and we’ve been enhancing this functionality ever since. Previously, the IDE had some useful features, such as the GitHub tool window with a list of all pull requests associated with the repository, the Timeline view for a pull request, which opens in the editor, and the ability to view comments in diffs and create comments of your own. But those features were mostly for viewing pull requests and not for interacting with them.\nWith the upcoming IntelliJ IDEA 2020.2, you’ll be able to browse, assign, manage, and even merge pull requests, view the timeline and in-line comments, submit comments and reviews, and accept changes.\nYou no longer need to switch between the browser and your IDE. The entire Pull Request workflow can now be completed from within IntelliJ IDEA!\n\nMore previews\nAnd two more sneak-peaks for the Review and Merge:\n\n\n\nCreating PRs\nMoreover, as of 2021.1, you can create Pull Requests, too:"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-blame - Show what revision and author last modified each line of a file --encoding="}, {"role": "assistant", "content": "Specifies the encoding used to output author names\nand commit summaries. Setting it to none makes blame\noutput unconverted data. For more information see the\ndiscussion about encoding in the git-log manual page."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Git: how to get all the files changed and new files in a folder or zip?\nAs my question says, after changing files and adding new files in my repository, I normally commit files with git, but sometimes I need all the modified / changed files copied to a folder for organizing-myself reasons.\nAny option?"}, {"role": "assistant", "content": "Assuming you mean you haven't yet committed, and want to package up all of the files that currently have local modifications (but not completely new files), you can get the list of modified files with git ls-files --modified. If you want the files which were changed by the last commit, you could use git diff --name-only HEAD^. Where you go from there is up to you. Examples:\nzip modified-files.zip $(git ls-files --modified)\ncp --parents $(git ls-files --modified) ../modified-files # Linux\nrsync -R $(git ls-files --modified) ../modified-files # macOS\n\nNote that this is using the versions of files in the working tree currently.\nIf you have spaces in filenames, you'll have to go to a little more trouble.\n(Of course, depending on what you're really trying to do, you might be looking for git stash, which stashes away all modified files and leaves you with a clean working tree, or you could simply want to make a temporary branch to commit to.)"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "why I have HTTP 403 from repo spring?\n\nI have a jhipster project which deploy on heroku with gitlab since several months\nSince yesterday, I can not deploy new version because I have this error\nFAILURE: Build failed with an exception.\n32 * What went wrong:\n33 A problem occurred configuring root project 'yvidya'.\n34 > Could not resolve all artifacts for configuration ':classpath'.\n35 > Could not resolve io.spring.gradle:propdeps-plugin:0.0.10.RELEASE.\n36 Required by:\n37 project :\n38 > Could not resolve io.spring.gradle:propdeps-plugin:0.0.10.RELEASE.\n39 > Could not get resource 'http://repo.spring.io/plugins- release/io/spring/gradle/propdeps-plugin/0.0.10.RELEASE/propdeps-plugin-0.0.10.RELEASE.pom'.\n40 > Could not GET 'http://repo.spring.io/plugins-release/io/spring/gradle/propdeps-plugin/0.0.10.RELEASE/propdeps-plugin-0.0.10.RELEASE.pom'. Received status code 403 from server: Forbidden\n\nAnyone know why this error? and how solve it?"}, {"role": "assistant", "content": "Open your build.gradle file and replace the spring maven repository URL from http with https"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git - the stupid content tracker GIT_DEFAULT_REF_FORMAT"}, {"role": "assistant", "content": "If this variable is set, the default reference backend format for new\nrepositories will be set to this value. The default is \"files\".\nSee --ref-format in git-init ."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Git: Pull from other remote\nI have created a fork from a project on GitHub.\nHow can I now pull changes from the project that I forked from?"}, {"role": "assistant", "content": "git pull is really just a shorthand for git pull , in most cases it's equivalent to git pull origin master. You will need to add another remote and pull explicitly from it. This page describes it in detail:\nhttp://help.github.com/forking/"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How to verify ssh key on Gitlab.com\n\nI'm setting up a SSH key for the first time on Gitlab.com. I'm stuck at verifying that you can connect: ssh -T [email protected].\nThe gitlab.example.com you are supposed to replace with your Gitlab instance url but I keep getting \"ssh: Could not resolve hostname : Name or service not known\".\nI'm using the Gitlab SaaS solution and have tried various formats, such as:\nssh -T [email protected]/my-workspace-name\nssh -T [email protected]:my-workspace-name\nssh -T [email protected]/my-workspace-name/project-name\n\nWhat is the correct format that should work?"}, {"role": "assistant", "content": "Correct format is ssh -T [email protected].\nmy-workspace-name is not part of the instance url."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-log - Show commit logs %m"}, {"role": "assistant", "content": "left ( < ), right ( > ) or boundary ( - ) mark"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git - the stupid content tracker git-format-patch"}, {"role": "assistant", "content": "Prepare patches for e-mail submission"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How to register a local git package in Bower?\nHow can I register a local git package in bower?\nMy current component.json is as follows\n{\n \"name\": \"myproject\",\n \"version\": \"1.0.0\",\n \"dependencies\": {\n \"jquery\": \"1.8.0\",\n \"twitter/bootstrap\": \"2.1.1\"\n }\n}\n\nHowever I also would like to add a package I have created at C:/mypackage which is a git repository with versions tagged.\nWhen I do bower install --save C:/mypackage it properly adds it to project but it doesn't add it to my component.json.\nI am trying bower register mypackage C:/mypackage but it keeps giving me \nbower error Incorrect format\n\nWhat am I doing wrong?"}, {"role": "assistant", "content": "Option 1: Public Bower registration\nBower is built mostly to share public (client-side) code in a \"non-opinionated\" manner. The primary use case, then, is to have a publicly accessible repository (on GitHub) that is registerd with a name and git repository url. I just did this myself:\nbower register linksoup git://github.com/automatonic/linksoup\n\nThis is just telling the bower server that when you install linksoup to go and grab the code at the git://github.com/automatonic/linksoup repository, and put it in the local project's component directory.\nIf this is what you want to do, then just set up a repository on github/etc., push your code there, and then register with the resulting repository info.\nOption 2: Private dependency\nThere are many reasons not to post your code at a publicly accessible repository. It may not be open source, etc. if your mypackage code is not meant to be public, then you should probably not be registering it on the public bower server... Further, even if you could register a local directory, it would only work on your machine...which defeats the purpose of sharing the code via bower.\nIf you just want to have bower manage a local, private dependency, then I am going to riff off of blockhead's solution:\n{\n \"name\": \"myproject\",\n \"version\": \"1.0.0\",\n \"dependencies\": {\n \"jquery\": \"1.8.0\",\n \"twitter/bootstrap\": \"2.1.1\",\n \"mypackage\": \"file:///path/to/mypackage/.git\"\n }\n}\n\nThis is just saying that myproject needs mypackage, and to use git clone to retrieve it. My guess is that this can use anything git can understand (including local repositories). But you should note that this may run into problems for anyone else working on this code that cannot access your local path.\nBest Guess\nIt looks to me as if you may have assumed that bower register was a local operation (telling bower how to find a dependency via some sort of local registry). As far as I can tell, this is only a remote and public registration, which is why this is unsupported.\nYou may also be looking for a way to do something like a link operation with npm. That is, work on a dependency module without always having your dev cycle include a publish.\nA little detail about how many people are involved and what you were trying to accomplish would facilitate a more targeted answer."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-rebase - Reapply commits on top of another base tip rebase.missingCommitsCheck"}, {"role": "assistant", "content": "If set to \"warn\", git rebase -i will print a warning if some\ncommits are removed (e.g. a line was deleted), however the\nrebase will still proceed. If set to \"error\", it will print\nthe previous warning and stop the rebase, git rebase\n--edit-todo can then be used to correct the error. If set to\n\"ignore\", no checking is done.\nTo drop a commit without warning or error, use the drop command in the todo list.\nDefaults to \"ignore\"."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How to deal with Git \"Could not read\" error\nI am getting this error in my git repository:\n22:09:15 $ git status\n# On branch master\nerror: Could not read 8124cc15c63be92d534e4cdfa33c38d54deee122\nerror: unable to read tree object HEAD\nnothing to commit (working directory clean)\n\nA Google search for error: unable to read tree object HEAD doesn't result in much help, this error seems to be very rare. I am not sure how to deal with it. Could it be a hard drive failure?\nEdit:\nThe output of git fsck is the following:\nbroken link from commit 607328dc80e4901a55b95c683d4fbf43e6df28bf\n to tree 8124cc15c63be92d534e4cdfa33c38d54deee122\nmissing tree 8124cc15c63be92d534e4cdfa33c38d54deee122\ndangling tree 56b5d4a5e429d251582ec927bca7ef1225510c41\ndangling tree 0259d2d38b18b6136bb6070fb41faf3624453cc6"}, {"role": "assistant", "content": "On a \"broken link\" message, you could follow the GitFaq recommendations:\n\n\nback up all your state so that anything you do is re-doable if you corrupt things more!\nexplode any corrupt pack-files\n \n \nSee \"man git-unpack-objects\", and in particular the \"-r\" flag.\n Also, please realize that it only unpacks objects that aren't already available, so you need to move the pack-file away from its normal location first (otherwise git-unpack-objects will find all objects that are in the pack-file in the pack-file itself, and not unpack anything at all) \n\nreplace any broken and/or missing objects\n \n \nThis is the challenging part.\n Sometimes (hopefully often!) you can find the missing objects in other copies of the repositories.\n At other times, you may need to try to find the data some other way (for example, maybe your checked-out copy contains the file content that when hashed will be the missing object?). \n\nmake sure everything is happy with \"git fsck --full\"\nrepack everything to get back to an efficient state again\n\n\n\nNotes: \n\nmissing objects can also be related to alternate (when you share objects between repositories) with git alternates (even though that can be risky).\nThe JGit/Egit eclipse plugin is also known to have a few issues.\n(Update February 2012: those plugins have come a long way and are now quite stable)\n\nUpdate July 2016 (7 years laters), with Git 2.10 soon to be released, you now have:\ngit fsck --name-objects\n\nIt helps naming the origin of those broken links\nSee \"How to fix git error broken link from tree to tree?\" for more."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-log - Show commit logs log.graphColors"}, {"role": "assistant", "content": "A list of colors, separated by commas, that can be used to draw\nhistory lines in git log --graph ."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Performing VCS Refresh... (Takes too long or never finishes)\nWhat is the fix for the issue when trying to commit from IntelliJ:\n\nThis windows either takes too long or does not finished at all. What is the work around so I can commit again from IntelliJ"}, {"role": "assistant", "content": "In IntelliJ navigate to: \n\nFile > Invalidate Caches / Restart... \n\nand select the highlighted:\n\nInvalidate and Restart"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Is there a tool to have git show \"detached heads\" in a graph?\nI often refer to git log --graph --decorate --oneline --all --full-history to see the current state of my branches, but it does not show detached heads/anonymous branches. Is there a way to get detached heads to appear in this graph?\nI know that git reflog exists, but that is pretty hard to read since there is no structure - all you have to go on is the commit message, which still may be WIP if I haven't finished the commit yet.\nSome background (this is not necessary to answer the question, but will help explain the motivation for it): I'm a Mercurial user and my workflow involves a lot of anonymous branching. I tend to make use of hg heads a lot to check out these heads, and often hg rebase to separate or combine series of commits based on what makes sense for the purpose of an easy to understand code review.\nWhile I'm getting used to using git I often find myself with detached heads when, for example, I rebase some commits from a branch to make a new branch. Finding these detached heads is annoying with git reflog, and to be honest it's a little scary that they just disappear from the usual git log. I've even forgotten about old commits this way, and have had to dig them out of git reflog a day or two later. In Mercurial those commits would remain as an anonymous head, and I would be reminded that I need to finish them off."}, {"role": "assistant", "content": "It sounds like you're trying to use a workflow that doesn't quite match the way git works.\nFirst of all, a \"detached head\" in git isn't the same as Mercurial's concept of a \"head\". Git has exactly one HEAD, which is just the currently checked-out commit. \"Detached\" just means that you don't currently have a branch checked out. So when you create a commit, it won't be associated with a branch, and it'll be lost when you checkout a different commit.\nIn Git, every commit that you care about should be reachable from some branch. There's no such thing as an \"anonymous branch\", which is why git warns you when committing on a detached head. Committing on a detached head is like allocating an object and then throwing away the pointer; it's possible, but almost never what you want to do. Remember, branches in git are lightweight and can be ephemeral. Just create a branch before committing so that you can find your commits again.\nAll that being said, if you really want to see the structure of your repository, including commits that are only referenced from reflogs, you can use:\ngit log --graph --decorate $(git rev-list -g --all)"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Understanding Gitlab CI tags\n\nI've read documentation, some articles and you might call me dumb, but this is my first time working with a concept like this.\n\nI've registered runner with tag \"testing\"\ncreated tag \"testing\" in gitlab\nbinded this runner, with particular project \nI've also added the same tag e.g. \"testing\"in my local repo. \n\nBUT how exactly is running my jobs dependent on those tags? Are all these operations necessary? If I push new code to repo, *.yml file is executed anyway as far as I tested.\nSo what if I want to run build only when I define a version in a commit?\nIDK...\n git commit --tags \"v. 2.0\" -m \"this is version 2.0\" (probably not right)\n\nBut of course it should be universal, so I don't have to always tell, which tag to use to trigger the runner, but for example let him recognize numeric values.\nAs you can see, I'm fairly confused... If you could elaborate how exactly tags work, so I would be able to understand the concept, I would be really grateful."}, {"role": "assistant", "content": "Tags for GitLab CI and tags for Git are two different concepts.\nWhen you write your .gitlab-ci.yml, you can specify some jobs with the tag testing. If a runner with this tag associated is available, it will pickup the job.\nIn Git, within your repository, tags are used to mark a specific commit. It is often used to tag a version.\nThe two concepts can be mixed up when you use tags (in Git) to start your pipeline in GitLab CI. In your .gitlab-ci.yml, you can specify the section only with tags.\nRefer to GitLab documentation for tags and only.\nAn example is when you push a tag with git:\n$ git tag -a 1.0.0 -m \"1.0.0\"\n$ git push origin 1.0.0\n\nAnd a job in .gitlab-ci.yml like this:\ncompile:\n stage: build\n only: [tags]\n script:\n - echo Working...\n tags: [testing] \n\nwould start using a runner with the testing tag.\nBy my understanding, what is missing in your steps is to specify the tag testing to your runner. To do this, go in GitLab into your project. Next to\nWiki, click on Settings. Go to CI/CD Pipelines and there you have your runner(s). Next to its Guid, click on the pen icon. On next page the tags can be modified."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-grep - Print lines matching a pattern --color[=]"}, {"role": "assistant", "content": "Show colored matches.\nThe value must be always (the default), never, or auto."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "fetch from origin with deleted remote branches?\nWhen I do git fetch origin and origin has a deleted branch, it doesn't seem to update it in my repository. When I do git branch -r it still shows origin/DELETED_BRANCH.\nHow can I fix this?"}, {"role": "assistant", "content": "You need to do the following\ngit fetch -p\n\nThe -p or --prune argument will update the local database of remote branches."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-grep - Print lines matching a pattern --recurse-submodules"}, {"role": "assistant", "content": "Recursively search in each submodule that is active and\nchecked out in the repository. When used in combination with the option the prefix of all submodule output will be the name of\nthe parent project’s object. This option cannot be used together\nwith --untracked , and it has no effect if --no-index is specified."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Migrate or export Github wiki to Gitlab\n\nCurrently we are working with github and we are actually quiet happy with it. But the costs will grow more and more in near future. Now we've started evaluating other git solutions and stumbled over gitlab, and i've to say, it looks very interesting for us. I've seen that there is as well a wiki feature similar to github. But one important thing is nowhere described... \nThe only thing i've found is this two year old entry https://groups.google.com/forum/#!msg/gitlabhq/YSM_Il9yk04/_-ybpN4BekYJ\nDoes anybody know if there are any news in that matter? it looks like it is possible, but how? is there any manual or howto that could help me?\nThanks a lot!"}, {"role": "assistant", "content": "Github wikis and GitLab wikis are both just Git repositories containing text files, so you can just pull from one and push to the other.\nGo to any page on your Github wiki and click the Clone URL button. You'll get a URL like https://github.com/Homebrew/homebrew.wiki.git. Clone it to your computer:\ngit clone https://github.com/Homebrew/homebrew.wiki.git\ncd homebrew.wiki\n\nThen, on your GitLab wiki, click the Git Access tab, find the URL in the instructions (in the first line under the Clone Your Wiki heading), and push to that URL:\ngit push https://gitlab.com/adambrenecki/test-project.wiki.git\n\nIf you can't find the URLs, they should be roughly the same as on this page, with the usernames/repo names changed as appropriate."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-notes - Add or inspect object notes --stdin"}, {"role": "assistant", "content": "Also read the object names to remove notes from the standard\ninput (there is no reason you cannot combine this with object\nnames from the command line)."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-checkout-index - Copy files from the index to the working tree Export files with a prefix"}, {"role": "assistant", "content": "$ git checkout-index --prefix=.merged- Makefile This will check out the currently cached copy of Makefile into the file .merged-Makefile ."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-show - Show various types of objects %B"}, {"role": "assistant", "content": "raw body (unwrapped subject and body)"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How to store a git config as part of the repository?\nI'm using filters to mangle files during checkout like described here.\nNow the problem is that filter definition is only stored in my local configuration file:\n$ cat .git/config\n....\n[filter \"dater\"]\n smudge = /home/.../expand_date\n clean = perl -pe \\\"s/\\\\\\\\\\\\$Date[^\\\\\\\\\\\\$]*\\\\\\\\\\\\$/\\\\\\\\\\\\$Date\\\\\\\\\\\\$/\\\"\n\nIf my coworkers want to benefit from this Date expansion, they need to copy my filter definition. And if I change it, I need to notify them, etc..\nSo can I store this filter definition part of .git/config in repository and make git use it?"}, {"role": "assistant", "content": "There are 3 supported scopes of .gitconfig file: --system, --global, --local. You can also create a custom configuration file, and include it in one of the supported files.\nFor your needs custom - is the right choice. Instead of writing your filter in .git/config you should save it in .gitconfig file in your repository root:\nyour-repo/\n│\n├── .git/\n│ ├── config\n│\n├── .gitconfig\n│\n\nCreate the .gitconfig with your filter and commit the changes. Then your colleagues will always keep it updated -- but they will have to include it manually. It is not possible to automatically include your custom configuration file through git alone, because it creates a security vulnerability.\nTo apply this configuration for a single repository, each user will need to run the following command in your-repo/:\ngit config --local include.path ../.gitconfig\n\nReference: https://git-scm.com/docs/git-config#_includes\nBe careful not to store personal data in the custom .gitconfig, like user.*, keep those in your global .gitconfig."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Fast-forward merge is not possible. To merge this request, first rebase locally\nRecently, I have created newbranch and created a merge request to Master branch. Before TeamLead accept merge request into Master branch another team member was committed another fix to the same branch(newbranch). After that I committed my local changes and pulled the changes in newbranch to local branch. And I pushed my local commit to newbranch\n\nMy TeamLead told me to rebase my branch to an earlier version.\nAnd resolve conflicts.\nI don't know what to do now. Any idea?"}, {"role": "assistant", "content": "Starting on your newBranch:\ngit checkout master to get back on the master branch\ngit pull origin master to get the most up-to-date version of the master branch\ngit checkout newBranch to get back on your newBranch\ngit rebase origin/master -i to perform an interactive rebase. The command will take you through and let you pick commits, rename them, squash them, etc. Assuming you will want to keep them all, it will pause when there are merge conflicts and then you'll have to resolve them in your text editor, it will tell you where (in your text editor) that the conflicts occur. You will have to add those files after fixing them then do git rebase --continue to proceed with the rebase.\nWhen you're done with the rebase your newBranch will be synced up with master and have any commits in master that weren't there when you started your work, and all merge conflicts will be resolved so that you can easily merge your newBranch."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How to delete a Gitlab repository\n\nI have googled a while now and could not find a solution that fits the current UI of Gitlab. I am trying to remove a repository I previously created on Gitlab. I navigate to edit project by clicking the settings cog on the right. After scrolling down to the bottom I can not find a section called remove project. Instead, I only see rename project. I should have the proper rights because I am the master of the project.\nAny ideas?"}, {"role": "assistant", "content": "Go to Settings > Expand Advanced Settings > Remove Project"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Creating folders inside a GitHub repository without using Git\nI want to add a new folder to my newly created GitHub repository without installing the Git setup for (Mac, Linux, and Windows). Is it possible to do so?\nI can't have Git all the time with me when I work on different systems/machines. I know how to add files directly in a repository on github.com/[USER]/[REPO]. Can we create a folder as well?"}, {"role": "assistant", "content": "After searching a lot I find out that it is possible to create a new folder from the web interface, but it would require you to have at least one file within the folder when creating it.\nWhen using the normal way of creating new files through the web interface, you can type in the folder into the file name to create the file within that new directory.\nFor example, if I would like to create the file filename.md in a series of sub-folders, I can do this (taken from the GitHub blog):"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Git hook to send email notification on repo changes\nHow do I configure the appropriate Git hook to send a summary email whenever a set of changes is pushed to the upstream repository?"}, {"role": "assistant", "content": "Another, more modern way to do this is with git-multimail, as suggested by Chords below.\n\nThis is how you did it in 2009.\nYou could add something like this to your post-receive hook in $GITDIR/hooks, or use the script in the contrib directory of the source (Available here)"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Variable inside variable gitlab ci\n\nIs there a way to use predefined variable inside custom variable in gitlab ci like this:\nbefore_script:\n - cat \"${$CI_COMMIT_REF_NAME}\" >> .env\n\nto extract the name of branch from $CI_COMMIT_REF_NAME and use it as a name of custom variable\nUpdate:"}, {"role": "assistant", "content": "Check out GitLab 14.3 (September 2021)\n\nUse variables in other variables\nCI/CD pipeline execution scenarios can depend on expanding variables declared in a pipeline or using GitLab predefined variables within another variable declaration.\nIn 14.3, we are enabling the “variables inside other variables” feature on GitLab SaaS.\nNow you can define a variable and use it in another variable definition within the same pipeline.\nYou can also use GitLab predefined variables inside of another variable declaration.\nThis feature simplifies your pipeline definition and eliminates pipeline management issues caused by the duplicating of variable data.\nNote - for GitLab self-managed users the feature is disabled by default.\nTo use this feature, your GitLab administrator will need to enable the feature flag.\n(demo -- video)\n\nSee [Documentation]https://gitlab.com/gitlab-org/gitlab/-/blob/ee8cb300efb6f917eab6d865c9d430eb62077b44/doc/ci/variables/index.md#use-variables-in-other-variables) and Issue.\n\nQ4 2023: the documentation now refers to Use CI/CD variables in other variables\n\nUse CI/CD variables in other variables\nYou can use variables inside other variables:\njob:\n variables:\n FLAGS: '-al'\n LS_CMD: 'ls \"$FLAGS\"'\n script:\n - 'eval \"$LS_CMD\"' # Executes 'ls -al'\n\nUse the $ character in CI/CD variables.\nIf you do not want the $ character interpreted as the start of another variable, use $$ instead:\njob:\n variables:\n FLAGS: '-al'\n LS_CMD: 'ls \"$FLAGS\" $$TMP_DIR'\n script:\n - 'eval \"$LS_CMD\"' # Executes 'ls -al $TMP_DIR'\n\nPrevent CI/CD variable expansion\nIntroduced in GitLab 15.7.\nExpanded variables treat values with the $ character as a reference to another variable.\nCI/CD variables are expanded by default. To treat variables with a $ character as raw strings, disable variable expansion for the variable\n\n\ndba asks in the comments:\n\nDoes this include or exclude using globally defined variables?\n\ndba's own answer:\n\nGlobal variables can be reused, but they need the local_var: ${global_var} syntax with recursive expansion (independent of the shell)."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Can I checkout github wikis like a git repository?\n\nI want to modify and view github wikis with local editor like Emacs, and Google Code wikis can be checked out just like code. Is there any way to checkout github wikis? Or is there any other git repository provider offers such feature?"}, {"role": "assistant", "content": "You can now!\ngit clone https://github.com/user/project.wiki.git\n\nor if you use ssh\ngit clone [email protected]:username/project.wiki.git"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Git error on commit after merge - fatal: cannot do a partial commit during a merge\nI ran a git pull that ended in a conflict. I resolved the conflict and everything is fine now (I used mergetool also).\nWhen I commit the resolved file with git commit file.php -m \"message\" I get the error:\nfatal: cannot do a partial commit during a merge.\n\nI had the same issue before and using -a in commit worked perfectly. I think it's not the perfect way because I don't want to commit all changes. I want to commit files separately with separate comments. How can I do that? Why doesn't git allow users to commit files separately after a merge? I could not find a satisfactory answer to this problem."}, {"role": "assistant", "content": "I found that adding \"-i\" to the commit command fixes this problem for me. The -i basically tells it to stage additional files before committing.\nThat is:\ngit commit -i myfile.php"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-for-each-ref - Output information on each ref contents:signature"}, {"role": "assistant", "content": "The optional GPG signature of the tag."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Git and Team Foundation Server\nUpdate: I don't use TFS anymore. But from the comments I can see that git-tfs is obviously the way to go nowadays.\nHas anybody experience using Git as an offline solution for Team Foundation Server?\nFor Subversion you could use git-svn to keep a private repository with a svn backend.\nI tried to use SvnBridge and git-svn to work with TFS. At first it looked promising but Visual Studio recognizes the solution as being under TFS version control and interferes during commit.\nAre there other ways to combine those two?"}, {"role": "assistant", "content": "I've started working on a tool called git-tfs, similar in some ways to git-svn.\nhttps://github.com/git-tfs/git-tfs"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Remote origin already exists on 'git push' to a new repository\n\nI have my project on GitHub at some location, [email protected]:myname/oldrep.git.\nNow I want to push all my code to a new repository at some other location, [email protected]:newname/newrep.git.\nI used the command:\ngit remote add origin [email protected]:myname/oldrep.git\n\nbut I am receiving this:\n\nfatal: remote origin already exists."}, {"role": "assistant", "content": "You are getting this error because \"origin\" is not available. \"origin\" is a convention not part of the command. \"origin\" is the local name of the remote repository.\nFor example you could also write:\ngit remote add myorigin [email protected]:myname/oldrep.git \ngit remote add testtest [email protected]:myname/oldrep.git\n\nSee the manual: \nhttp://www.kernel.org/pub/software/scm/git/docs/git-remote.html\nTo remove a remote repository you enter:\ngit remote rm origin\n\nAgain \"origin\" is the name of the remote repository if you want to\nremove the \"upstream\" remote:\ngit remote rm upstream"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git - the stupid content tracker git-stripspace"}, {"role": "assistant", "content": "Remove unnecessary whitespace"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Github - unexpected disconnect while reading sideband packet\n\nI've got quite interesting problem.\nI tried to send some projects via bash to repo and recently there was a problem with sending it.\nEnumerating objects: 27, done.\nCounting objects: 100% (27/27), done.\nDelta compression using up to 16 threads\nCompressing objects: 100% (24/24), done.\nWriting objects: 100% (25/25), 187.79 KiB | 9.39 MiB/s, done.\nTotal 25 (delta 1), reused 0 (delta 0), pack-reused 0\nsend-pack: unexpected disconnect while reading sideband packet\nfatal: the remote end hung up unexpectedly\n\nThe funny part is that 10 min earlier I can send it without any problems.\nI tried with getting new repo, creating new file, reinstalling git, git config --global http.postBuffer 524288000 with bigger numbers as well, also https.postBuffer and so on. Also install desktop version the same issue come in.\nI've got problems mostly with React apps.\nAnyone know the solution ? What could go wrong ?"}, {"role": "assistant", "content": "First of all, check your network connection stability.\nIf there is no problem with network connection try another solution; it may work:\nOn Linux\nExecute the following in the command line before executing the Git command:\nexport GIT_TRACE_PACKET=1\nexport GIT_TRACE=1\nexport GIT_CURL_VERBOSE=1\n\nOn Windows\nExecute the following in the command line before executing the Git command:\nset GIT_TRACE_PACKET=1\nset GIT_TRACE=1\nset GIT_CURL_VERBOSE=1\n\nIn addition:\ngit config --global core.compression 0\ngit clone --depth 1 \n# cd to your newly created directory\ngit fetch --unshallow \ngit pull --all\n\nFor PowerShell users:\nAs kodybrown said in comments:\n$env:GIT_TRACE_PACKET=1\n$env:GIT_TRACE=1\n$env:GIT_CURL_VERBOSE=1"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-for-each-ref - Output information on each ref …​"}, {"role": "assistant", "content": "If one or more patterns are given, only refs are shown that\nmatch against at least one pattern, either using fnmatch(3) or\nliterally, in the latter case matching completely or from the\nbeginning up to a slash."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Git: Pull from other remote\n\nI have created a fork from a project on GitHub.\nHow can I now pull changes from the project that I forked from?"}, {"role": "assistant", "content": "git pull is really just a shorthand for git pull , in most cases it's equivalent to git pull origin master. You will need to add another remote and pull explicitly from it. This page describes it in detail:\nhttp://help.github.com/forking/"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Make the current commit the only (initial) commit in a Git repository?\nI currently have a local Git repository, which I push to a Github repository.\nThe local repository has ~10 commits, and the Github repository is a synchronised duplicate of this.\nWhat I'd like to do is remove ALL the version history from the local Git repository, so the current contents of the repository appear as the only commit (and therefore older versions of files within the repository are not stored). \nI'd then like to push these changes to Github.\nI have investigated Git rebase, but this appears to be more suited to removing specific versions.\nAnother potential solution is to delete the local repo, and create a new one - though this would probably create a lot of work!\nETA: There are specific directories / files that are untracked - if possible I would like to maintain the untracking of these files."}, {"role": "assistant", "content": "Here's the brute-force approach. It also removes the configuration of the repository.\nNote: This does NOT work if the repository has submodules! If you are using submodules, you should use e.g. interactive rebase\nStep 1: remove all history (Make sure you have a backup, this cannot be reverted)\ncat .git/config # save your somewhere\nrm -rf .git\n\nStep 2: reconstruct the Git repo with only the current content\nBefore step 2 if you have not set up init.defaultBranch configuration then, please do it via git config --global init.defaultBranch you may choose main as in the current example\ngit init\ngit add .\ngit commit -m \"Initial commit\"\n\nStep 3: push to GitHub.\ngit remote add origin \ngit push -u --force origin main"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-config - Get and set repository or global options log.graphColors"}, {"role": "assistant", "content": "A list of colors, separated by commas, that can be used to draw\nhistory lines in git log --graph ."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Run git commands from a C# function\nHow can my C# code run git commands when it detects changes in tracked file? I am writing a VisualStudio/C# console project for this purpose. \nI am new to the the .NET environment and currently working on integrating automated GIT commits to a folder. I need to automatically commit any change/add/delete on a known folder and push that to a git remote. Any guidance appreciated. Thank you.\nHere is what I have and the last one is the one I need some guidance with:\n\nGit repository initially set up on folder with proper ignore file (done).\nI am using C# FileSystemWatcher to catch any changes on said folder (done).\nOnce my project detects a change it needs to commit and push those changes (pending).\n\nTentative commands the project needs to run: \ngit add -A\ngit commit \"explanations_of_changes\"\ngit push our_remote\n\nNOTE: This code (with no user interaction) will be the only entity committing to this repo so I am not worried about conflicts and believe this flow will work."}, {"role": "assistant", "content": "I realize this is an old question but I wanted to add the solution I recently came across to help those in the future.\nThe PowerShell class provides an easy way to interact with git. This is part of the System.Management.Automation namespace in .NET. Note that System.Management.Automation.dll is available via NuGet.\nstring directory = \"\"; // directory of the git repository\n\nusing (PowerShell powershell = PowerShell.Create()) {\n // this changes from the user folder that PowerShell starts up with to your git repository\n powershell.AddScript($\"cd {directory}\");\n\n powershell.AddScript(@\"git init\");\n powershell.AddScript(@\"git add *\");\n powershell.AddScript(@\"git commit -m 'git commit from PowerShell in C#'\");\n powershell.AddScript(@\"git push\");\n\n Collection results = powershell.Invoke();\n}\n\nIn my opinion this is cleaner and nicer than using the Process.Start() approach. You can modify this to your specfic needs by editing the scripts that are added to the powershell object.\nAs commented by @ArtemIllarionov, powershell.Invoke() does not return errors but the Streams property has output information. Specifically powerShell.Streams.Error for errors."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Can you issue pull requests from the command line on GitHub?\nIt seems like you have to interact with github.com to initiate a pull request. Is this so?"}, {"role": "assistant", "content": "UPDATE: The hub command is now an official github project and also supports creating pull requests\nORIGINAL:\nSeems like a particularly useful thing to add to the hub command: http://github.com/defunkt/hub or the github gem: http://github.com/defunkt/github-gem\nI suggest filing an issue with those projects asking for it. The github guys are pretty responsive."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-svn - Bidirectional operation between a Subversion repository and Git -l --find-copies-harder"}, {"role": "assistant", "content": "Only used with the dcommit , set-tree and commit-diff commands. They are both passed directly to git diff-tree ; see git-diff-tree for more information. config key: svn.l\nconfig key: svn.findcopiesharder"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git - the stupid content tracker -c ="}, {"role": "assistant", "content": "Pass a configuration parameter to the command. The value\ngiven will override values from configuration files.\nThe is expected in the same format as listed by git config (subkeys separated by dots). Note that omitting the = in git -c foo.bar ... is allowed and sets foo.bar to the boolean true value (just like [foo]bar would in a\nconfig file). Including the equals but with an empty value (like git -c\nfoo.bar= ... ) sets foo.bar to the empty string which git config\n--type=bool will convert to false ."}]} {"messages": [{"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 stage"}, {"role": "assistant", "content": "The stage of the file which is recorded in the index."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-gc - Cleanup unnecessary files and optimize the local repository gc.reflogExpire gc..reflogExpire"}, {"role": "assistant", "content": "git reflog expire removes reflog entries older than\nthis time; defaults to 90 days. The value \"now\" expires all\nentries immediately, and \"never\" suppresses expiration\naltogether. With \"\" (e.g.\n\"refs/stash\") in the middle the setting applies only to\nthe refs that match the ."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Add newly created specific folder to .gitignore in Git\nI had a clean working directory and brought in a clone from a Git repo last night. \nBut now my local server created and contains a stats folder which I want to ignore. \nI can't seem to get Git to ignore this folder when I run a git status.\nOn branch master\nYour branch is ahead of 'origin/master' by 1 commit.\n\nChanges to be committed:\n (use \"git reset HEAD ...\" to unstage)\n\n new file: app_public/views/pages/privacy.php\n new file: app_public/views/pages/terms.php\n new file: public_html/stats/ctry_usage_200908.png\n new file: public_html/stats/daily_usage_200908.png\n new file: public_html/stats/dns_cache.db\n new file: public_html/stats/hourly_usage_200908.png\n new file: public_html/stats/index.html\n new file: public_html/stats/usage.png\n new file: public_html/stats/usage_200908.html\n new file: public_html/stats/webalizer.current\n new file: public_html/stats/webalizer.hist\n\nChanged but not updated:\n modified: .gitignore\n\nI added in my .gitignore a few different lines but it still trying to add them:\npublic_html/stats\npublic_html/stats/**\npublic_html/stats/**/*\npublic_html/stats/*"}, {"role": "assistant", "content": "For this there are two cases\nCase 1: File already added to git repo.\nCase 2: File newly created and its status still showing as untracked file when using \ngit status\n\nIf you have case 1: \nSTEP 1:\nThen run \ngit rm --cached filename \n\nto remove it from git repo cache\nif it is a directory then use \ngit rm -r --cached directory_name\n\nSTEP 2: If Case 1 is over then create new file named .gitignore in your git repo\nSTEP 3: Use following to tell git to ignore / assume file is unchanged\ngit update-index --assume-unchanged path/to/file.txt\n\nSTEP 4: Now, check status using git status open .gitignore in your editor nano, vim, geany etc... any one, add the path of the file / folder to ignore. If it is a folder then user folder_name/* to ignore all file.\nIf you still do not understand read the article git ignore file link."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-log - Show commit logs -s --no-patch"}, {"role": "assistant", "content": "Suppress all output from the diff machinery. Useful for\ncommands like git show that show the patch by default to\nsquelch their output, or to cancel the effect of options like --patch , --stat earlier on the command line in an alias."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git - the stupid content tracker git-merge-tree"}, {"role": "assistant", "content": "Perform merge without touching index or working tree"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-restore - Restore working tree files -s --source="}, {"role": "assistant", "content": "Restore the working tree files with the content from the given\ntree. It is common to specify the source tree by naming a\ncommit, branch or tag associated with it. If not specified, the contents are restored from HEAD if --staged is\ngiven, otherwise from the index. As a special case, you may use \"A...B\" as a shortcut for the\nmerge base of A and B if there is exactly one merge base. You can\nleave out at most one of A and B , in which case it defaults to HEAD ."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How to remove unreferenced blobs from my Git repository\nI have a GitHub repository that had two branches - master and release.\nThe release branch contained binary distribution files that were contributing to a very large repository size (more than 250 MB), so I decided to clean things up.\nFirst I deleted the remote release branch, via git push origin :release.\nThen I deleted the local release branch. First I tried git branch -d release, but Git said \"error: The branch 'release' is not an ancestor of your current HEAD.\" which is true, so then I did git branch -D release to force it to be deleted.\nBut my repository size, both locally and on GitHub, was still huge. So then I ran through the usual list of Git commands, like git gc --prune=today --aggressive, without any luck.\nBy following Charles Bailey's instructions at SO 1029969 I was able to get a list of SHA-1 hashes for the biggest blobs. I then used the script from SO 460331 to find the blobs...and the five biggest don't exist, though smaller blobs are found, so I know the script is working.\nI think these blogs are the binaries from the release branch, and they somehow got left around after the delete of that branch. What's the right way to get rid of them?"}, {"role": "assistant", "content": "I present to you this useful command, \"git-gc-all\", guaranteed to remove all your Git garbage until they might come up extra configuration variables:\ngit -c gc.reflogExpire=0 -c gc.reflogExpireUnreachable=0 -c gc.rerereresolved=0 \\\n -c gc.rerereunresolved=0 -c gc.pruneExpire=now gc\n\nYou might also need to run something like these first:\ngit remote rm origin\nrm -rf .git/refs/original/ .git/refs/remotes/ .git/*_HEAD .git/logs/\ngit for-each-ref --format=\"%(refname)\" refs/original/ |\n xargs -n1 --no-run-if-empty git update-ref -d\n\nYou might also need to remove some tags:\ngit tag | xargs git tag -d"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git - the stupid content tracker GIT_SSL_NO_VERIFY"}, {"role": "assistant", "content": "Setting and exporting this environment variable to any value\ntells Git not to verify the SSL certificate when fetching or\npushing over HTTPS."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Can't publish private npm package on Gitlab - E404 Not found PUT\n\nI've tried many different docs and tutorials to publish a scoped npm package on a private gitlab instance.\nSo far I've:\nCreated a deploy token with package write & read permissions:\n\nSetup a .npmrc file with the following contents:\n@:registry=https:///api/v4/packages/npm/\n\n///api/v4/projects//packages/npm/:_authToken=\n\n///api/v4/packages/npm/:_authToken=\n\nAdded \"publishConfig\" to \"package.json\":\n{\n \"name\": \"@/\",\n \"version\": \"1.0.0\",\n \"main\": \"dist/index.js\",\n \"license\": \"MIT\",\n \"publishConfig\": {\n \"@:registry\": \"https:///api/v4/projects//packages/npm\"\n },\n \"scripts\": {\n \"build\": \"tsc\",\n \"prepublish\": \"tsc\"\n },\n \"devDependencies\": {\n \"ts-node\": \"^9.1.1\"\n }\n}\n\nVerified that the repo allows packages to be stored:\n\nBut everytime I try and run either npm publish or yarn publish, it builds, packages but fails to publish:\n\nThe log file verbosily repeats the error log above.\nI'm trying to release a private SDK for an internal service and would need a way to publish it so only those with the correct credentials can install it on their projects.\nThe link provided (Not Found - PUT https:// ) redirects to npmjs.com, which I believe wasn't supposed to happen, since I'm trying to store it on Gitlab instead of purchasing an organization on npmjs.\nI've tried this process both on the private domain (running gitlab 13.9.1) and on https://gitlab.com, both with the same result on the same repository configuration disclosed above.\nAm I missing some step? Thanks in advance!"}, {"role": "assistant", "content": "Your .npmrc file has both instance and project level endpoints, but if you're using a project deploy token, the authentication of the token you're providing is scoped to the project, so you should only have the project endpoint.\n@:registry=https:///api/v4/projects//packages/npm/\n\n///api/v4/projects//packages/npm/:_authToken="}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git - the stupid content tracker git-write-tree"}, {"role": "assistant", "content": "Create a tree object from the current index"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-config - Get and set repository or global options core.pager"}, {"role": "assistant", "content": "Text viewer for use by Git commands (e.g., less ). The value\nis meant to be interpreted by the shell. The order of preference\nis the $GIT_PAGER environment variable, then core.pager configuration, then $PAGER , and then the default chosen at\ncompile time (usually less ). When the LESS environment variable is unset, Git sets it to FRX (if LESS environment variable is set, Git does not change it at\nall). If you want to selectively override Git’s default setting\nfor LESS , you can set core.pager to e.g. less -S . This will\nbe passed to the shell by Git, which will translate the final\ncommand to LESS=FRX less -S . The environment does not set the S option but the command line does, instructing less to truncate\nlong lines. Similarly, setting core.pager to less -+F will\ndeactivate the F option specified by the environment from the\ncommand-line, deactivating the \"quit if one screen\" behavior of less . One can specifically activate some flags for particular\ncommands: for example, setting pager.blame to less -S enables\nline truncation only for git blame . Likewise, when the LV environment variable is unset, Git sets it\nto -c . You can override this setting by exporting LV with\nanother value or setting core.pager to lv +c ."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How to fetch entire repository with GitLab CI/CD?\n\nI'm currently setting up GitLab CI/CD. We use GitVersion in our project, which throws the following error:\n/root/.nuget/packages/gitversiontask/5.3.7/build/GitVersionTask.targets(46,9): error : InvalidOperationException: Could not find a 'develop' or 'master' branch, neither locally nor remotely.\nAccording to this blog this happens, when the CI-server does not fetch the full repository (we have both a develop and a master branch, but I'm working on a different one). For Jenkins we solved this problem by expanding the checkout stage:\nstage(\"Checkout\") { gitlabCommitStatus(name: \"Checkout\") {\n \n // These are the normal checkout instructions\n cleanWs()\n checkout scm\n \n // This is the additional checkout to get all branches\n checkout([\n $class: 'GitSCM',\n branches: [[name: 'refs/heads/'+env.BRANCH_NAME]],\n extensions: [[$class: 'CloneOption', noTags: false, shallow: false, depth: 0, reference: '']],\n userRemoteConfigs: scm.userRemoteConfigs,\n ])\n\n sh \"git checkout ${env.BRANCH_NAME}\"\n sh \"git reset --hard origin/${env.BRANCH_NAME}\"\n}}\n\nI'm essentially looking for something equivalent to this for the .gitlab-ci.yml file."}, {"role": "assistant", "content": "By default, runners download your code with a 'fetch' rather than a 'clone' for speed's sake, but it can be configured a number of ways. If you want all jobs in your project's pipeline to be cloned rather than fetched, you can change the default in your CI Settings:\n\n\nIf you don't want all your jobs to clone since it's slower, you can change it in your .gitlab-ci.yml for your job:\nmy_job:\n stage: deploy\n variables:\n GIT_STRATEGY: clone\n script:\n - ./deploy\n\nYou can read more about the GIT_STRATEGY variable here: https://docs.gitlab.com/ee/ci/runners/configure_runners.html#git-strategy\nNote: You can also set this variable to none, which is useful if you don't need the code but maybe an artifact created by a previous job. Using this, it won't checkout any code, but skip straight to your script."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Why can't I push this up-to-date Git subtree?\nI am using Git subtree with a couple of projects that I am working on, in order to share some base code between them. The base code gets updated often, and the upgrades can happen in anyone of the projects, with all of them getting updated, eventually.\nI have ran into a problem where git reports that my subtree is up to date, but pushing gets rejected. For example:\n#! git subtree pull --prefix=public/shared project-shared master\nFrom github.com:****\n* branch master -> FETCH_HEAD\nAlready up-to-date.\n\nIf I push, I should get a message that there is nothing to push... Right? RIGHT? :(\n#! git subtree push --prefix=public/shared project-shared master\ngit push using: project-shared master\nTo [email protected]:***\n! [rejected] 72a6157733c4e0bf22f72b443e4ad3be0bc555ce -> master (non-fast-forward)\nerror: failed to push some refs to '[email protected]:***'\nhint: Updates were rejected because the tip of your current branch is behind\nhint: its remote counterpart. Merge the remote changes (e.g. 'git pull')\nhint: before pushing again.\nhint: See the 'Note about fast-forwards' in 'git push --help' for details.\n\nWhat could be the reason for this? Why is pushing failing?"}, {"role": "assistant", "content": "I found the answer on this blog comment https://coderwall.com/p/ssxp5q\n\nIf you come across the \"Updates were rejected because the tip of your current branch is\n behind. Merge the remote changes (e.g. 'git pull')\" problem when you're pushing (due to\n whatever reason, esp screwing about with git history) then you'll need to nest git\n commands so that you can force a push to heroku. e.g, given the above example:\n\ngit push heroku `git subtree split --prefix pythonapp master`:master --force"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-config - Get and set repository or global options column.ui"}, {"role": "assistant", "content": "Specify whether supported commands should output in columns.\nThis variable consists of a list of tokens separated by spaces\nor commas: These options control when the feature should be enabled\n(defaults to never ): always always show in columns never never show in columns auto show in columns if the output is to the terminal These options control layout (defaults to column ). Setting any\nof these implies always if none of always , never , or auto are\nspecified. column fill columns before rows row fill rows before columns plain show in one column Finally, these options can be combined with a layout option (defaults\nto nodense ): dense make unequal size columns to utilize more space nodense make equal size columns"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-log - Show commit logs "}, {"role": "assistant", "content": "Commits modifying the given are selected."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Git: cancel an interactive rebase\nI like to git rebase -i HEAD~5 to squash my commits down. Sometimes I think I need to go back 5 commits but then realize I need 7. However git has already brought up the rebase editor .git/rebase-merge/git-rebase-todo in vim. \nIf I quit that buffer (vim) then git says: \nSuccessfully rebased and updated refs/heads/my-branchname\n\nIs there a way to stop the rebase from w/in the editor? I suppose I could git rebase --abort from another shell but not sure what that would do to the git-rebase-todo file that I'd be in the middle of editing in another buffer."}, {"role": "assistant", "content": "You can make vim exit with a non-zero exit code to cancel the rebase by typing :cq. The result of this is:\n$ git rebase -i HEAD~4\n# enter vim, then type :cq\nCould not execute editor\n\nFrom the vim help page we see that cq is short for cquit:\n *:cq* *:cquit*\n:cq[uit][!] Quit Vim with an error code, so that the compiler\n will not compile the same file again.\n WARNING: All changes in files are lost! Also when the\n [!] is not used. It works like \":qall!\" |:qall|,\n except that Vim returns a non-zero exit code."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-diff - Show changes between commits, commit and working tree, etc diff..cachetextconv"}, {"role": "assistant", "content": "Set this option to true to make the diff driver cache the text\nconversion outputs. See gitattributes for details. araxis bc codecompare deltawalker diffmerge diffuse ecmerge emerge examdiff guiffy gvimdiff kdiff3 kompare meld nvimdiff opendiff p4merge smerge tkdiff vimdiff winmerge xxdiff"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-log - Show commit logs %GT"}, {"role": "assistant", "content": "show the trust level for the key used to sign a signed commit"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-cat-file - Provide contents or details of repository objects "}, {"role": "assistant", "content": "The name of the object to show.\nFor a more complete list of ways to spell object names, see\nthe \"SPECIFYING REVISIONS\" section in gitrevisions ."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Pull latest changes for all git submodules\nWe're using git submodules to manage a couple of large projects that have dependencies on many other libraries we've developed. Each library is a separate repo brought into the dependent project as a submodule. During development, we often want to just go grab the latest version of every dependent submodule.\nHow do I pull the latest changes for all git submodules?"}, {"role": "assistant", "content": "If it's the first time you check-out a repo you need to use --init first:\ngit submodule update --init --recursive\n\nFor git 1.8.2 or above, the option --remote was added to support updating to latest tips of remote branches:\ngit submodule update --recursive --remote\n\nThis has the added benefit of respecting any \"non default\" branches specified in the .gitmodules or .git/config files (if you happen to have any, default is origin/master, in which case some of the other answers here would work as well).\nFor git 1.7.3 or above you can use (but the below gotchas around what update does still apply):\ngit submodule update --recursive\n\nor:\ngit pull --recurse-submodules\n\nif you want to pull your submodules to latest commits instead of the current commit the repo points to.\nSee git-submodule(1) for details"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Local git config not overriding global user for project\nI have a global git user configured, but want to use a different user for a single git project.\nWithin that project, I've used git config --local user.name \"localuser\" and git config --local user.email \"[email protected]\" to set the local project's user and email.\nHowever, when I try to push to my remote on github, I get this error:\nremote: Permission to localuser/repo.git denied to globaluser.\nfatal: unable to access 'https://github.com/localuser/repo.git/': The requested URL returned error: 403\n\nHere's some output that might help with diagnosis:\ngit remote -v:\ngithub https://github.com/localuser/repo.git (fetch)\ngithub https://github.com/localuser/repo.git (push)\n\ngit config --list:\nuser.name=globaluser\n[email protected]\n...\n\ngit config --local --list:\nuser.name=localuser\n[email protected]\n...\n\ngit config user.name:\nlocaluser"}, {"role": "assistant", "content": "I had committed my changes and received a permission denied with my global user. Subsequently setting the local user did nothing, though git config user.name reported the correct local user.\nWhat worked was (courtesy of this google groups thread):\ngit commit --amend --reset-author\nI presume the committed changes had the original author attached."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-submodule - Initialize, update or inspect submodules"}, {"role": "assistant", "content": "SYNOPSIS git submodule [--quiet] [--cached] git submodule [--quiet] add [] [--] [] git submodule [--quiet] status [--cached] [--recursive] [--] […​] git submodule [--quiet] init [--] […​] git submodule [--quiet] deinit [-f|--force] (--all|[--] …​) git submodule [--quiet] update [] [--] […​] git submodule [--quiet] set-branch [] [--] git submodule [--quiet] set-url [--] git submodule [--quiet] summary [] [--] […​] git submodule [--quiet] foreach [--recursive] git submodule [--quiet] sync [--recursive] [--] […​] git submodule [--quiet] absorbgitdirs [--] […​]"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-branch - List, create, or delete branches Delete an unneeded branch"}, {"role": "assistant", "content": "$ git clone git://git.kernel.org/.../git.git my.git\n$ cd my.git\n$ git branch -d -r origin/todo origin/html origin/man (1) $ git branch -D test (2) Delete the remote-tracking branches \"todo\", \"html\" and \"man\". The next fetch or pull will create them again unless you configure them not to.\nSee git-fetch . Delete the \"test\" branch even if the \"master\" branch (or whichever branch\nis currently checked out) does not have all commits from the test branch."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-log - Show commit logs --log-size"}, {"role": "assistant", "content": "Include a line “log size ” in the output for each commit,\nwhere is the length of that commit’s message in bytes.\nIntended to speed up tools that read log messages from git log output by allowing them to allocate space in advance."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How to see the file size history of a single file in a git repository?\nIs there anyway to see how a file's size has changed through time in a git repository? I want to see how my main.js file (which is the combination of several files and minified) has grown and shrunk over time."}, {"role": "assistant", "content": "You can use either git ls-tree -r -l to get the blob size at given revision, e.g.\n\n$ git ls-tree -r -l v1.6.0 gitweb/README\n100644 blob 825162a0b6dce8c354de67a30abfbad94d29fdde 16067 gitweb/README\n\nFrom the docs:\n -r recurse into subtrees\n -l, --long include object size\n\nThe blob size in this example is '16067'. The disadvantage of this solution is that git ls-tree can process only one revision at once.\nYou can use instead git cat-file --batch-check < instead, feeding it blob identifiers. If location of file didn't change through history (file was not moved), you can use git rev-list -- to get list of revisions touching given path, translate them into names of blobs using : extended SHA-1 syntax (see git-rev-parse manpage), and feed it to git cat-file. Example:\n\n$ git rev-list -5 v1.6.0 -- gitweb/README | \n sed -e 's/$/:gitweb\\/README/g' |\n git cat-file --batch-check\n825162a0b6dce8c354de67a30abfbad94d29fdde blob 16067\n6908036402ffe56c8b0cdcebdfb3dfacf84fb6f1 blob 16011\n356ab7b327eb0df99c0773d68375e155dbcea0be blob 14248\n8f7ea367bae72ea3ce25b10b968554f9b842fffe blob 13853\n8dfe335f73c223fa0da8cd21db6227283adb95ba blob 13801"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-log - Show commit logs --exclude-hidden=[fetch|receive|uploadpack]"}, {"role": "assistant", "content": "Do not include refs that would be hidden by git-fetch , git-receive-pack or git-upload-pack by consulting the appropriate fetch.hideRefs , receive.hideRefs or uploadpack.hideRefs configuration along with transfer.hideRefs (see git-config ). This option affects the next pseudo-ref option --all or --glob and is cleared after processing them."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How do I exclude files from git ls-files?\nHow do I list everything except markdown files? I have tried to run ls-files with the --exclude flag, but the excluded files are still shown in the output.\nMy git version is 2.6.4 (Apple Git-63)\n$ git ls-files\nChromeExt/read-coffee\nNode/README.md\nNode/web-scraping\nREADME.md\n\n$ git ls-files --exclude *.md\nChromeExt/read-coffee\nNode/README.md\nNode/web-scraping\nREADME.md"}, {"role": "assistant", "content": "Git has its own way to extend glob patterns, and that includes a way to exclude files that match one pattern but not another. For example, the following will list all paths not ending in .md:\ngit ls-files -- . ':!:*.md'\n\nIt's important to quote the pattern, because you want git to parse it, not the shell.\nAnd to match all files ending with .js, except the ones ending with .min.js:\ngit ls-files -- '*.js' ':!:*.min.js'\n\nYou can also use this with other commands, such as git grep:\ngit grep -w funcname -- '*.js' ':!:*.min.js'\n\nThis syntax is explained under pathspec in gitglossary (or git help glossary or man gitglossary)"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-for-each-ref - Output information on each ref deltabase"}, {"role": "assistant", "content": "This expands to the object name of the delta base for the\ngiven object, if it is stored as a delta. Otherwise it\nexpands to the null object name (all zeroes)."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-log - Show commit logs --output="}, {"role": "assistant", "content": "Output to a specific file instead of stdout."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-rev-parse - Pick out and massage parameters ^{} , e.g. v0.99.8^{commit}"}, {"role": "assistant", "content": "A suffix ^ followed by an object type name enclosed in\nbrace pair means dereference the object at recursively until\nan object of type is found or the object cannot be\ndereferenced anymore (in which case, barf).\nFor example, if is a commit-ish, ^{commit} describes the corresponding commit object.\nSimilarly, if is a tree-ish, ^{tree} describes the corresponding tree object. ^0 is a short-hand for ^{commit} . ^{object} can be used to make sure names an\nobject that exists, without requiring to be a tag, and\nwithout dereferencing ; because a tag is already an object,\nit does not have to be dereferenced even once to get to an object. ^{tag} can be used to ensure that identifies an\nexisting tag object."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Git Remove unwanted commits from a Pull Request\nI have started working on a project and I made some unwanted commits which I pushed to origin master. Now, when I try to do a pull request, Github wants to commit all of the previous commits. \nMy question is, how do I remove the unwanted commits and commit the changes that I want to commit so that I am up to date with master?"}, {"role": "assistant", "content": "I assume your origin is your own fork of some project that you want to do a pull request too?\nSince you will be changing history (by resetting the head) you will need to push with --force flag. Locate the hash of your last good commit using git log.\nNow run\ngit reset SHA\n\nThis will change your head to that sha and preserve the changes in the files since that last good commit, your index will also be reset.\nNow you can change your code and do the commits you want. But you have to do git push --force since you changed the history of the repository. This means that anyone who forked your repository won't be able to pull changes from you anymore. But you will be able to do a pull request to your upstream."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git: 'credential-cache' is not a git command\nI followed these instructions to the letter, including the part about password caching. It seems like the instructions are wrong, because every time I git push origin master I get this error:\ngit: 'credential-cache' is not a git command. See 'get --help'.\n\n... at which point I am forced to enter my username and password. After doing so, I am presented with the same error message again, followed by the output from git push.\nHere is the contents of my .gitconfig file:\n[user]\n name = myusername\n email = [email protected]\n[credential]\n helper = cache\n\nTo be clear, after I installed Git and ran Git Bash, here is exactly what I typed:\ngit config --global user.name \"myusername\"\ngit config --global user.email \"[email protected]\"\ngit config --global credential.helper cache\n\nPlease help. This is so frustrating!"}, {"role": "assistant", "content": "From a blog I found:\n\nThis [git-credential-cache] doesn’t work for Windows systems as git-credential-cache communicates through a Unix socket.\n\nGit for Windows\nSince msysgit has been superseded by Git for Windows, using Git for Windows is now the easiest option. Some versions of the Git for Windows installer (e.g. 2.7.4) have a checkbox during the install to enable the Git Credential Manager. Here is a screenshot:\n\nStill using msysgit? For msysgit versions 1.8.1 and above\nThe wincred helper was added in msysgit 1.8.1. Use it as follows:\ngit config --global credential.helper wincred\n\nFor msysgit versions older than 1.8.1\nFirst, download git-credential-winstore and install it in your git bin directory.\nNext, make sure that the directory containing git.cmd is in your Path environment variable. The default directory for this is C:\\Program Files (x86)\\Git\\cmd on a 64-bit system or C:\\Program Files\\Git\\cmd on a 32-bit system. An easy way to test this is to launch a command prompt and type git. If you don't get a list of git commands, then it's not set up correctly.\nFinally, launch a command prompt and type:\ngit config --global credential.helper winstore\n\nOr you can edit your .gitconfig file manually:\n[credential]\n helper = winstore\n\nOnce you've done this, you can manage your git credentials through Windows Credential Manager which you can pull up via the Windows Control Panel."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-config - Get and set repository or global options core.maxTreeDepth"}, {"role": "assistant", "content": "The maximum depth Git is willing to recurse while traversing a\ntree (e.g., \"a/b/cde/f\" has a depth of 4). This is a fail-safe\nto allow Git to abort cleanly, and should not generally need to\nbe adjusted. The default is 4096."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-config - Get and set repository or global options gui.diffContext"}, {"role": "assistant", "content": "Specifies how many context lines should be used in calls to diff\nmade by the git-gui . The default is \"5\"."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git - the stupid content tracker git-checkout-index"}, {"role": "assistant", "content": "Copy files from the index to the working tree"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Git push won't do anything (everything up-to-date)\nI'm trying to update a Git repository on GitHub. I made a bunch of changes, added them, committed then attempted to do a git push. The response tells me that everything is up to date, but clearly it's not.\ngit remote show origin\n\nresponds with the repository I'd expect.\nWhy is Git telling me the repository is up to date when there are local commits that aren't visible on the repository?\n [searchgraph] git status\n# On branch develop\n# Untracked files:\n# (use \"git add ...\" to include in what will be committed)\n#\n# Capfile\n# config/deploy.rb\nnothing added to commit but untracked files present (use \"git add\" to track)\n\n [searchgraph] git add .\n\n [searchgraph] git status\n# On branch develop\n# Changes to be committed:\n# (use \"git reset HEAD ...\" to unstage)\n#\n# new file: Capfile\n# new file: config/deploy.rb\n#\n\n [searchgraph] git commit -m \"Added Capistrano deployment\"\n[develop 12e8af7] Added Capistrano deployment\n 2 files changed, 26 insertions(+), 0 deletions(-)\n create mode 100644 Capfile\n create mode 100644 config/deploy.rb\n\n [searchgraph] git push\nEverything up-to-date\n\n [searchgraph] git status\n# On branch develop\nnothing to commit (working directory clean)"}, {"role": "assistant", "content": "git push doesn't push all of your local branches: how would it know which remote branches to push them to? It only pushes local branches which have been configured to push to a particular remote branch.\nOn my version of Git (1.6.5.3), when I run git remote show origin it actually prints out which branches are configured for push:\nLocal refs configured for 'git push':\n master pushes to master (up to date)\n quux pushes to quux (fast forwardable)\n\nQ. But I could push to master without worrying about all this!\nWhen you git clone, by default it sets up your local master branch to push to the remote's master branch (locally referred to as origin/master), so if you only commit on master, then a simple git push will always push your changes back.\nHowever, from the output snippet you posted, you're on a branch called develop, which I'm guessing hasn't been set up to push to anything. So git push without arguments won't push commits on that branch.\nWhen it says \"Everything up-to-date\", it means \"all the branches you've told me how to push are up to date\".\nQ. So how can I push my commits?\nIf what you want to do is put your changes from develop into origin/master, then you should probably merge them into your local master then push that:\ngit checkout master\ngit merge develop\ngit push # will push 'master'\n\nIf what you want is to create a develop branch on the remote, separate from master, then supply arguments to git push:\ngit push origin develop\n\nThat will: create a new branch on the remote called develop; and bring that branch up to date with your local develop branch; and set develop to push to origin/develop so that in future, git push without arguments will push develop automatically.\nIf you want to push your local develop to a remote branch called something other than develop, then you can say:\ngit push origin develop:something-else\n\nHowever, that form won't set up develop to always push to origin/something-else in future; it's a one-shot operation."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git ls-files: howto identify new files (added, not committed)?\nAfter I called git add the command git status will show me something like:\n...\nnew file: \n\nSomehow I can't manage it to get the same information by using ls-files, it (ls-files -tc in this case) will show me:\nH \nH \nH \n\nThere seems no commandline switch to exist for new files. The file is reported as cached, which is ok, but how do I find out that it is not committed at this time?\nIs this possible with ls-files or some similar command (where I do not have to parse a lot of output like in the case of git status)?"}, {"role": "assistant", "content": "You want to use git diff --cached. With --name-only it'll list all the files you've changed in the index relative to HEAD. With --name-status you can get the status symbol too, with --diff-filter you can specify which set of files you want to show ('A' for newly added files, for instance). Use -M to turn on move detection and -C for copy detection if you want them.\nFor the strictest reading of what you wrote, git diff --cached --name-only --diff-filter=A will list all the files you've added since HEAD which don't exist in HEAD."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "github: No supported authentication methods available\ni use github and have successfully added and synched files on my laptop in the past. \nas of recent i started getting \"PuTTY Fatal Error: Disconnected: No supported authentication methods available\" after running:\ngit pull origin master (or push)\nhowever\nssh [email protected] returns the correct response:\nERROR: Hi username! You've successfully authenticated, but GitHub does not provide shell access\nConnection to github.com closed.\nafter digging around on github i found this morcel:\nNo supported authentication methods available\nYou should be aware of the environment variable GIT_SSH, which is used by git to find your ssh-speaking client, if ssh doesn’t work for you. The git install may be using plink.exe (via GIT_SSH) to perform the authentication. If so, make sure you have pageant.exe running, and the key you created for github loaded into it. This provides the key to plink.exe; without it, the above error will occur.\nnot sure what plink.exe or peagant.exe is.. and the fact that ssh [email protected] seems to authenticate correctly makes me wonder what the best solution here is.. i certainly don't want to overcomplicate my setup if not necessary."}, {"role": "assistant", "content": "You can create a file named \".profile\" in your home directory, for me that's C:\\Users\\[user]\nInside that file, put the following line of code:\nGIT_SSH=\"/usr/bin/ssh.exe\"\n\nThis will set the GIT_SSH environment variable to use the ssh client included with git.\nThe .profile script gets executed when you start your Git Bash command line.\nEdit:\nThis is my .profile. It will ask you for your password the first time you start the git command prompt, then will remember it from then on, until you reboot your computer. Very handy so you don't have to keep entering your password each time you want to do something.\nSSH_ENV=\"$HOME/.ssh/environment\"\nGIT_SSH=\"/usr/bin/ssh.exe\"\n\nfunction start_agent {\necho \"Initializing new SSH agent...\"\n/usr/bin/ssh-agent | sed 's/^echo/#echo/' > \"${SSH_ENV}\"\necho succeeded\nchmod 600 \"${SSH_ENV}\"\n. \"${SSH_ENV}\" > /dev/null\n/usr/bin/ssh-add;\n}\n\n# Source SSH settings, if applicable\nif [ -f \"${SSH_ENV}\" ]; then\n. \"${SSH_ENV}\" > /dev/null\n#ps ${SSH_AGENT_PID} doesn't work under cygwin\nps -ef | grep ${SSH_AGENT_PID} | grep ssh-agent$ > /dev/null || {\nstart_agent;\n}\nelse\nstart_agent;\nfi"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Haskell Stack install package dependency from github\n\nIs it possible to install a version of a package from github using Haskell stack?\ne.g. in a .cabal or a stack.yaml file, how can I point a dependency at a git repo/branch/revision?"}, {"role": "assistant", "content": "For stack <1.11:\nThe documentation for the stack.yaml packages section gives examples of referring to more complex package locations.\n\npackages:\n- location: .\n- location: dir1/dir2\n- location: https://example.com/foo/bar/baz-0.0.2.tar.gz\n- location: http://github.com/yesodweb/wai/archive/2f8a8e1b771829f4a8a77c0111352ce45a14c30f.zip\n- location:\n git: [email protected]:commercialhaskell/stack.git\n commit: 6a86ee32e5b869a877151f74064572225e1a0398\n- location:\n hg: https://example.com/hg/repo\n commit: da39a3ee5e6b4b0d3255bfef95601890afd80709\n\n\nThen add extra-dep: true to the package entry just to tell stack not to treat the code it pulls in as something you're developing on (e.g., don't load it in GHCi)."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Create a branch in Git from another branch\nI have two branches: master and dev\nI want to create a \"feature branch\" from the dev branch.\nCurrently on the branch dev, I do:\ngit checkout -b myfeature dev\n\n... (some work)\ngit commit -am \"blablabla\"\ngit push origin myfeature\n\nBut, after visualizing my branches, I got:\n--**master**\n------0-----0-----0-----0-----0\n------------------------**dev**----**myfeature**\n\nI mean that the branch seems fast-forward merged, and I don't understand why...\nWhat am I doing wrong?\nHow can you branch off from another branch and push back to the remote repository for the feature branch?\nAll that in a branching model like the one described here."}, {"role": "assistant", "content": "If you like the method in the link you've posted, have a look at Git Flow.\nIt's a set of scripts he created for that workflow.\nBut to answer your question:\ngit checkout -b myFeature dev\n\nCreates the MyFeature branch off dev. Do your work and then\ngit commit -am \"Your message\"\n\nNow merge your changes to dev without a fast-forward\ngit checkout dev\ngit merge --no-ff myFeature\n\nNow push the changes to the server\ngit push origin dev\ngit push origin myFeature\n\nAnd you'll see it how you want it."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How can I overwrite or replace a commit with new one once I have pushed to remote?\n\nSo I'm working on a sensitive project with a group and all our sources are on Github. I recently pushed a commit and later realized there were lot of mistakes in my push. I've since fixed all those mistakes on my local copy and am about to push again. However is there any way I can push and overwrite my last commit? My reason being, I don't want the others to look up my initial commit and the changes it had...\nBasically I want to overwrite the old commit with my new one.. so no information about the old commit remains for other group members to see."}, {"role": "assistant", "content": "Usually, once something is out on Github (or a public repo), there's no way to make sure no one else has the bad commit.\nIf you simply want cleaner code history though, the way to do what you ask requires you to overwrite history both locally and on the remote project.\nWhat you want is to either do a git commit --amend to modify your old commit if you've not already created a fresh commit with your changes.\nIf you've already created a fresh commit, you'll want to use git rebase -i to squash your commit on top of the old one.\nAfter you've made this change locally, and verified your commit looks the way you want it to, you'll have to git push --force to overwrite history on the Github remote.\nHere's a tutorial on how to re-write history in git, it explains both the approaches listed in this answer."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Github commit message links\nIs it possible to create a commit message with link to other repository commit?\nEg. something like [Username\\Repo\\commitHash]\nUsage example: if some bc break would happen in some framework's commit, I'd like to link to this very commit in my own commits updating my code which uses this framework."}, {"role": "assistant", "content": "I was searching for something like this myself. Found it on:\nhttps://help.github.com/articles/autolinked-references-and-urls/#commit-shas\n<>/<>@<>\n\nWithout the angle brackets of course :)"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Update shared forked repository using git\n\nConsider repository A a github repository that is managed via Gerrit.\nI cloned repository A and I created a new branch starting from the master branch of repository A. I pushed this new branch on a new gitlab repository B. I am admin on repository B and I shared it with other developers. Developers cannot push on this branch, but I can merge theirs pull requests. \nI merged some pull requests on the master branch of repository B. So, repository B has the initial commits of repository A and new commits of the pull request: B commits on top of A commits (b a). \nThen, I want to update the repository B with new commits of repository A. Call these commits a+.\nI see two options:\n\nIf I merge A on B, the result is: a+ b a. \nIf I rebase B on A+, the results is: b a+ a.\n\nOption 1: the developments commits are mixed with external ones. Difficult to debug and to highlight differences.\nOption 2: I have to push force the changes on the the remote B. The consequences, if I am not mistaken, may be:\n 1. if developers pull B and they have commits on local master of B, they will lose their local changes;\n 2. developers may face big troubles during rebase their local branches after the forced update of branch B.\nHow should I proceed to avoid any problems?"}, {"role": "assistant", "content": "If I understand it correctly, you have a single (local) repository which looks somewhat like this:\n A/master\n ↓\n* -- * -- * -- a\n \\\n * -- * -- b\n ↑\n B/mybranch\n\nNow, A is updated, so it looks like this:\n A/master\n ↓\n* -- * -- * -- a -- * -- * -- a+\n \\\n * -- * -- b\n ↑\n B/mybranch\n\nNote here that you have two diverged branches that are not in a straight line. So saying that you would get a+ b a when you merge A onto B is not correct. You do get a merge, but that keeps the history as it is:\n A/master\n ↓\n* -- * -- * -- a -- * -- * -- a+\n \\ \\\n * -- * -- b --- M\n ↑\n B/mybranch\n\nAs you can see, you still have the information where the commits came from: The ones between a and a+ came from one branch, and the other ones between a and b came from another. And M combines those tro branches. Usually, this is exactly the proper way to solve this.\nThe benefit of this over rebasing—as you noticed yourself—is that the commits stay the way they are. All users who have interacted with either repository can simply pull those changes in without any problems. If you rebased any of those commits, they would have to manually fix that (chances are that they don’t even realize it, so they will just pull and actually create an even messier history with duplicate commits).\nSo a merge is definitely better to work with here. Yes, the history will not look as perfect as a straight line, but it properly conveys what has happened: There is a diverged development line which is independent and that has then been updated with the changes from the upstream repository A. This information can be useful and as such it makes sense to keep them in. And especially if you have users interacting with both those remotes, they will definitely prefer to keep their repository compatible with both remotes.\nIf you don’t want the history to look like this, and don’t care about compatibility with A, you could also squash all the changes from A onto your B:\n A/master\n ↓\n* -- * -- * -- a -- * -- * -- a+\n \\\n * -- * -- b -- [A]\n ↑\n B/mybranch\n\nHere, [A] is a squashed commit that contains all the changes between a and a+ in a single commit. You could get this result by rebasing A onto B while squashing all commits. In this case, you should clearly state where those changes come from in the commit message though."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-pull - Fetch from and integrate with another repository or a local branch -j --jobs="}, {"role": "assistant", "content": "Number of parallel children to be used for all forms of fetching. If the --multiple option was specified, the different remotes will be fetched\nin parallel. If multiple submodules are fetched, they will be fetched in\nparallel. To control them independently, use the config settings fetch.parallel and submodule.fetchJobs (see git-config ). Typically, parallel recursive and multi-remote fetches will be faster. By\ndefault fetches are performed sequentially, not in parallel."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How can I have linked dependencies in a git repo?\nIn my scripts, I often use libraries (mine or others') that have their own repos. I don't want to duplicate those in my repo and get stuck with updating them every time a new version comes out. \nHowever, when somebody clones the repo, it should still work locally and not have broken links.\nAny ideas about what I could do?"}, {"role": "assistant", "content": "You can do this with submodules in git. In your repository, do:\ngit submodule add path_to_repo path_where_you_want_it\n\nSo, if the library's repository had a URL of git://github.com/example/some_lib.git and you wanted it at lib/some_lib in your project, you'd enter:\ngit submodule add git://github.com/example/some_lib.git lib/some_lib\n\nNote that this needs to be done from the top-level directory in your repository. So don't cd into the directory where you're putting it first.\nAfter you add a submodule, or whenever someone does a fresh checkout of your repository, you'll need to do:\ngit submodule init\ngit submodule update\n\nAnd then all submodules you've added will be checked out at the same revision you have.\nWhen you want to update to a newer version of one of the libraries, cd into the submodule and pull:\ncd lib/some_lib\ngit pull\n\nThen, when you do a git status you should see lib/somelib listed in the modified section. Add that file, commit, and you're up to date. When a collaborator pulls that commit into their repository, they'll see lib/somelib as modified until they run git submodule update again."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Multiple ssh keys are not working\n\nOS Description: Ubuntu 14.04.3 LTS\nssh: OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.3, OpenSSL 1.0.1f 6 Jan 2014\n\nI am unable to use multiple ssh key for gitlab. The error I am getting is\nGitLab: The project you were looking for could not be found.\nfatal: Could not read from remote repository.\n\nPlease make sure you have the correct access rights\nand the repository exists. \n\nI am pretty much sure that I did everything right \nThis is my config file \nHost work gitlab.com\n Hostname gitlab.com\n IdentityFile ~/.ssh/ida_rsa\n User git\n\nHost integrate gitlab.com\n Hostname gitlab.com\n IdentityFile ~/.ssh/ida_rsa_personal\n User git\n\nThe keys are added automatically in ssh-agent, but to make sure I also added the key manually\n$ ssh-add -l\n2048 e7:08:d6:8c:00:28:31:f9:3f:21:4a:0f:4e:1e:ee:20 id_rsa (RSA)\n2048 ff:22:f6:90:2b:7c:9f:ed:45:41:df:79:06:de:fe:81 id_rsa_personal (RSA)\n\nMy ssh-agent is also running\n$ ssh-agent\nSSH_AUTH_SOCK=/tmp/ssh-uTC6tA5HMt1x/agent.4899; export SSH_AUTH_SOCK;\nSSH_AGENT_PID=4900; export SSH_AGENT_PID;\necho Agent pid 4900;\n\nPermissions of ssh key\n-rw------- 1 yogi yogi 1679 jun 25 15:38 id_rsa\n-rw------- 1 yogi yogi 1679 ago 25 10:53 id_rsa_personal\n-rw-r--r-- 1 yogi yogi 404 ago 25 10:53 id_rsa_personal.pub\n-rw-r--r-- 1 yogi yogi 391 jun 25 15:41 id_rsa.pub\n\nI added my ssh public key on gitlab.\nCould any one please tell me what I am missing ?\nNote :- \nI noticed that out of my two ssh keys, the ssh key which is on top( id_rsa - e7:08....) works fine. \n$ ssh-add -l\n**2048 e7:08:d6:8c:00:28:31:f9:3f:21:4a:0f:4e:1e:ee:20 id_rsa (RSA)**\n2048 ff:22:f6:90:2b:7c:9f:ed:45:41:df:79:06:de:fe:81 id_rsa_personal (RSA)\n\nIf I add id_rsa_personal(ff:22..) after id_rsa, than id_rsa_personal starts working fine and id_rsa stops working.\n$ ssh-add -l\n**2048 ff:22:f6:90:2b:7c:9f:ed:45:41:df:79:06:de:fe:81 id_rsa_personal (RSA)**\n2048 e7:08:d6:8c:00:28:31:f9:3f:21:4a:0f:4e:1e:ee:20 id_rsa (RSA)\n\nI think , ssh-agent is unable to iterate through keys. It only reads first key and stops. \nIs this a bug in openssh ? If yes, any workaround ? \nThanks"}, {"role": "assistant", "content": "You need to have ~/.ssh/config file \nInside file \n# Default GitHub user\nHost github.com\n HostName github.com\n PreferredAuthentications publickey\n IdentityFile ~/.ssh/personalid\n\n# Work user account\nHost bitbucket.org\n HostName bitbucket.org\n PreferredAuthentications publickey\n IdentityFile ~/.ssh/workid\n\nDetails can be found in the link below \nhttps://confluence.atlassian.com/bitbucket/configure-multiple-ssh-identities-for-gitbash-mac-osx-linux-271943168.html\nIf the domain is same, use different Host \nHost work.gitlab.com\n HostName gitlab.com\n PreferredAuthentications publickey\n IdentityFile ~/.ssh/id_rsa.work\n\nHost home.gitlab.com\n HostName gitlab.com\n PreferredAuthentications publickey\n IdentityFile ~/.ssh/id_rsa.home\n\nClear the cache\nssh-add -D\n\nAdd all ssh keys\nssh-add ~/.ssh/id_rsa.work\nssh-add ~/.ssh/id_rsa.home\n\nAlso set your repos' url in (.git/config) accordingly as given:\nurl = [email protected]:xxxxxxxxxx.git\nurl = [email protected]:yyyyyyyyy.git \n\nIf your ssh config file is as what I suggested."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Golang, importing packages from Github requests me to remember the Github URL?\n\nI'm very new to Golang. I see that in Golang you can import packages directly from Github like:\nimport \"github.com/MakeNowJust/heredoc\"\n\nDoes that mean I have to remember this URL in order to use this package? IMHO this is not cool. What if later the author of the package removed it or changed the URL? Any ideas?"}, {"role": "assistant", "content": "I would recommend you to read the How to Write Go Code documentation and this blog post.\nThe path you're seeing in your import line is not a url, but only the path the package is located in (normally relative to $GOROOT/src/pkg or $GOPATH/src). So your package heredoc is most probably located in the directory $GOPATH/src/github.com/MakeNowJust/heredoc.\nThe recommended way to use external packages is by downloading and installing them via go get. You might want to check out the documentation of go get by go get --help."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "What is the difference between GitHub Flow and GitLab Flow?\nRecently I've found three concepts of a workflow in Git:\n\nGitFlow\nGitHub Flow\nGitLab Flow\n\nI've read the nice articles about it but I don't understand GitLab Flow very well.\nBriefly.\nGitFlow\n\nWe've a master branch as a production branch. Also we have a develop branch where every developer merges his features. Sometimes we create a release branch to deploy our features in production. If we have a bug in the release branch, fix it and pull changes into the develop branch. If we have a critical bug in production, create new hotfix-branch, fix the bug and merge branch with production (master) and develop branches.\nThis approach works well if we seldom publish results of our work. (Maybe once every 2 weeks).\nGitHub Flow\n\nWe have a master branch as a production branch. And we (as developers) can create branches for adding new features or fixing bugs and merge them with production (master) branch. It sounds very simple. This approach fits for extreme programming where the production branch is deployed several times in a day.\nGitLab Flow\n\n\n\nI've seen new terms like a pre-production, a production, a release (stable) branch and a staging environment, a pre-production environment, a production environment. What relationships do they have between them?\nI understand it this way: If we need to add a new feature we deploy a pre-production branch from the master branch. When we have finished the feature, we deploy a production branch from the pre-production branch. A pre-production branch is the intermediate stage. And then the master branch pulls all changes from the production branch.\nThe approach is good if we want to see each separate feature; we just checkout in the branch what we need to look at.\nBut if we need to show our work we create a release branch with a tag as late as possible. If later we fix bugs in the master branch we need to cherry-pick them to the last release branch. At the end we have the release branch with tags that can help us to move between versions.\nIs my understanding correct?\nWhat is the difference between pull and cherry-pick?"}, {"role": "assistant", "content": "It has been a year now since this post was raised, but considering future readers and the fact things have changed a bit I think it's worth refreshing.\nGitHub Flow as originally depicted by Scott Chacon in 2011 assumed each change once reviewed on a feature branch and merged into master should be deployed to production immediately. While this worked at the time and conformed to the only GitHub Flow rule, which is anything in the master branch is deployable, it was quickly discovered that in order to keep master a true record of known working production code the actual deployment to production should happen from the feature branch before merging it into master. Deploying from the feature branch makes perfect sense as in the case of any issue production can be instantaneously reverted by deploying master to it. Please take a look at a short visual introduction to GitHub Flow.\nGitLab Flow is kind of an extension to GitHub Flow accompanied by a set of guidelines and best practices that aim to further standardize the process. Aside from promoting ready to deploy master branch and feature branches (same as GitHub Flow) it introduces three other kinds of branches:\n\nProduction branch\nEnvironment branches: uat, pre-production, production\nRelease branches: 1-5-stable, 1-6-stable\n\nI believe above names and examples are self-descriptive, thus I won't elaborate further."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "List all modified files in git merge commit - even the fast forwarded\nI'm thinking if there is a way that when I merge a branch into another branch that ALL changed files are listed in my commit message and not just the ones which were modified in both branches.\nThis would give me a better overview of what was changed in the branch just by seeing the merge commit.\nIs there a way to do this?"}, {"role": "assistant", "content": "I don't know how to do that in the commit message. But after the merge, this will give the names of all the files affected by the merge commit:\ngit log -m --name-only\n\nFor only a list of filenames of the commit:\ngit log -m -1 --name-only --pretty=\"format:\" \n\nThere is some white space due to the merge having two parents but that can be easily removed."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How to programmatically determine whether the Git checkout is a tag and if so, what is the tag name\nIn a Unix or GNU scripting environment (e.g. a Linux distro, Cygwin, OSX), what is the best way to determine whether the current checkout is a Git tag. If it is a tag, how can I determine the tag name?\nOne use of this technique would be automatically labeling a release (like svnversion would do with Subversion).\nSee my related question about programmatically detecting the Git branch."}, {"role": "assistant", "content": "The solution to your question is to use\ngit describe --exact-match HEAD\n\n(which would consider only annotated tags, but you should use annotated and probably even signed tags for tagging releases).\nIf you want to consider all tags, also lightweight tags (which are usually used for local tagging), you can use --tags option:\ngit describe --exact-match --tags HEAD\n\n\nBut I think you have \"XY problem\" here, in that you are asking question about possible solution to the problem, rather than asking question about a problem... which can have better solution.\nThe solution to your problem is to take a look how Git does it in GIT-VERSION-GEN script, and how it uses it in its Makefile."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How to get rid of ESC[ characters when using git diff on Mac OS X Mavericks?\nSince I installed OS X Mavericks, the result of the command git diff is rendering ESC[xxx characters like this:\nESC[1mdiff --git a/console/org.linkedin.glu.console-webapp/decorate-grails-methods-plugin/plugin.xml b/console/org.linkedin.glu.console-webapp/decorate-grails-methods-plugin/plugin.xmlESC[m\nESC[1mindex 3b65cf1..0ca5d7e 100644ESC[m\nESC[1m--- a/console/org.linkedin.glu.console-webapp/decorate-grails-methods-plugin/plugin.xmlESC[m\nESC[1m+++ b/console/org.linkedin.glu.console-webapp/decorate-grails-methods-plugin/plugin.xmlESC[m\nESC[36m@@ -15,14 +15,14 @@ESC[m ESC[mThe purpose of this plugin is to decorate various grails methods.ESC[m\n\nThis used to render properly prior to installing Mavericks. I have no clue what is different so any help in troubleshooting would be much appreciated.\nNote that the pager used is less since when I hit h I get the following:\n SUMMARY OF LESS COMMANDS\n\nCommands marked with * may be preceded by a number, N.\nNotes in parentheses indicate the behavior if N is given."}, {"role": "assistant", "content": "Do you have a LESS environment variable set? You can check using:\nenv | grep LESS\n\nor:\necho $LESS\n\nIf so, you want to make sure the R option is in there. That allows the ANSI escape sequences to pass through unscathed, and they'll be rendered as colors in the terminal.\nJust for reference, I use this:\nexport LESS=eFRX"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-range-diff - Compare two commit ranges (e.g. two versions of a branch)"}, {"role": "assistant", "content": "OUTPUT STABILITY The output of the range-diff command is subject to change. It is\nintended to be human-readable porcelain output, not something that can\nbe used across versions of Git to get a textually stable range-diff (as opposed to something like the --stable option to git-patch-id ). There’s also no equivalent of git-apply for range-diff , the output is not intended to\nbe machine-readable. This is particularly true when passing in diff options. Currently some\noptions like --stat can, as an emergent effect, produce output\nthat’s quite useless in the context of range-diff . Future versions\nof range-diff may learn to interpret such options in a manner\nspecific to range-diff (e.g. for --stat producing human-readable\noutput which summarizes how the diffstat changed)."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How to use multiple ssh keys for multiple gitlab accounts with the same host [duplicate]\n\nThis question already has answers here:\n \n \n\n\n\n\nGitHub: Multiple account setup\n\n (4 answers)\n \n\nClosed 8 years ago.\n\n\n\nI want to use 2 accounts in Gitlab website, every account with a different ssh key\nI generated the keys successfully and add them in ~/.ssh folder\nI created ~/.ssh/config file and use one of them , it's works good\nI can also make swapping between the two keys by editing the ~/.ssh/config file\nThe problem is : I want to use them in the same time , but all the tutorials i found taking about different hosts :/ \nactually my two accounts are in the same host\nhow can i edit the ~/.ssh/config file to accept two accounts for the same host\nNote: I read this question but i can't get help from it\nMy two accounts are username1 and username2\nrepo URL looks like : [email protected]:username1/test-project.git\nMy current ~/.ssh/config file:\nHost gitlab.com-username1\n HostName gitlab.com\n User git\n IdentityFile ~/.ssh/id_rsa\n\nHost gitlab.com-username2\n HostName gitlab.com\n User git\n IdentityFile ~/.ssh/id_rsa_username2\n\nUpdate 1: \n1) When I use one key in the ~/.ssh/config file , everything works perfect (but it's very boring to update it every time i want to change the user i use)\n2) When i use this lines\nssh -T [email protected]\nssh -T [email protected]\nits works good and return a welcoming message\nFrom 1) and 2) , i think the problem is definitely from the ~/.ssh/config file , specifically in Host variable \nUpdate 2: (the solving) \nthe solving was to edit the .git/config file from \n[remote \"origin\"]\n url = [email protected]:username1/test-project.git \nto \n[remote \"origin\"]\n url = [email protected]:username1/test-project.git\nand do the same for the username2"}, {"role": "assistant", "content": "You have got complete ssh configuration. First of all, check if it works:\nssh -T [email protected]\nssh -T [email protected]\n\nshould succeed in both cases. If not, the keys are not set up correctly. Verify that the keys are on gitlab for respective users.\nIf it works, move on to your git repository and open .git/config. It will have some part like:\n[remote \"origin\"]\n url = [email protected]:username1/test-project.git\n\nReplace it with \n[remote \"origin\"]\n url = [email protected]:username1/test-project.git\n\n(or username1 if you want to connect using this username). Then it should allow you to push."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Git : fatal: Ambiguous object name: 'origin/release_2.6'\nI am getting this error when trying to create a remote tracking branch\ngit co -b release_2.6 origin/release_2.6\nwarning: refname 'origin/release_2.6' is ambiguous.\nwarning: refname 'origin/release_2.6' is ambiguous.\nfatal: Ambiguous object name: 'origin/release_2.6'.\n\nI only have these two refs defined with release_2.6\ngit show-ref | grep \"release_2.6\"\na71b2da1526f73862464a23aceaa1939a8b1ace2 refs/heads/origin/release_2.6\ned1399936a8cc4cd2feed1851123af861b0ff093 refs/remotes/origin/release_2.6\n\nDoes anyone know what this error means?\nCheers"}, {"role": "assistant", "content": "If something can be found in both refs/heads/ and refs/remotes/ then this is ambiguous. \nYou have local branch origin/release_2.6 and remote tracking branch release_2.6 for remote origin. Don't think you are supposed to have a refs/heads/origin/release_2.6 branch though. Anyway, you can specify full reference name to resolve ambiguity:\ngit co -b release_2.6 refs/remotes/origin/release_2.6"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How to list commits since certain commit?\nIs there anyway to get a list of commits from a given commit number to HEAD?\nI know this is possible by the commit date, but I need it by the commit number and I can't seem to find any documentation, or even if this is possible."}, {"role": "assistant", "content": "git rev-list ..HEAD\n\nor to include the commit:\ngit rev-list ^..HEAD\n\nYou can use git log instead of git rev-list as well to get additional details."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How to cache \"poetry install\" for Gitlab CI?\n\nIs there a way to cache poetry install command in Gitlab CI (.gitlab-ci.yml)?\nFor example, in node yarn there is a way to cache yarn install (https://classic.yarnpkg.com/lang/en/docs/install-ci/ Gitlab section) this makes stages a lot faster."}, {"role": "assistant", "content": "GitLab can only cache things in the working directory and Poetry stores packages elsewhere by default:\n\nDirectory where virtual environments will be created. Defaults to {cache-dir}/virtualenvs ({cache-dir}\\virtualenvs on Windows).\n\nOn my machine, cache-dir is /home/chris/.cache/pypoetry.\nYou can use the virtualenvs.in-project option to change this behaviour:\n\nIf set to true, the virtualenv wil be created and expected in a folder named .venv within the root directory of the project.\n\nSo, something like this should work in your gitlab-ci.yml:\nbefore_script:\n - poetry config virtualenvs.in-project true\n\ncache:\n paths:\n - .venv"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-grep - Print lines matching a pattern -O[] --open-files-in-pager[=]"}, {"role": "assistant", "content": "Open the matching files in the pager (not the output of grep ).\nIf the pager happens to be \"less\" or \"vi\", and the user\nspecified only one pattern, the first file is positioned at\nthe first match automatically. The pager argument is\noptional; if specified, it must be stuck to the option\nwithout a space. If pager is unspecified, the default pager\nwill be used (see core.pager in git-config )."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-stash vs. git-branch\nIn a previous Git question, Daniel Benamy was talking about a workflow in Git:\n\nI was working on master and committed some stuff and then decided I wanted to put that work on hold. I backed up a few commits and then branched from before I started my crap work.\n\nHe wanted to restore his working state to a previous point in time without losing his current changes. All of the answers revolved around, in various ways, something like\ngit branch -m master crap_work\ngit branch -m previous_master master\n\nHow does this compare to git stash? I'm a bit confused trying to see what the different use case here when it seems like everything git stash does is already handled by branching…\n\n@Jordi Bunster: Thanks, that clears things up. I guess I'd kind of consider \"stashing\" to be like a lightweight, nameless, branch. So anything stash can do, branch can as well but with more words. Nice!"}, {"role": "assistant", "content": "'stash' takes the uncommitted, \"dirty\" stuff on your working copy, and stashes it away, leaving you with a clean working copy.\nIt doesn't really branch at all. You can then apply the stash on top of any other branch. Or, as of Git 1.6, you can do:\ngit stash branch []\n\nto apply the stash on top of a new branch, all in one command.\nSo, stash works great if you have not committed to the \"wrong\" branch yet.\nIf you've already committed, then the workflow you describe in your question is a better alternative. And by the way, you're right: Git is very flexible, and with that flexibility comes overlapping functionality."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-fsck - Verifies the connectivity and validity of the objects in the database missingTaggerEntry"}, {"role": "assistant", "content": "(INFO) Missing tagger line in a tag object."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How can I change the commit author for a single commit?\nI want to change the author of one specific commit in the history. It's not the latest commit.\nRelated: How do I change the author and committer name/email for multiple commits?"}, {"role": "assistant", "content": "Interactive rebase off of a point earlier in the history than the commit you need to modify (git rebase -i ). In the list of commits being rebased, change the text from pick to edit next to the hash of the one you want to modify. Then when git prompts you to change the commit, use this:\ngit commit --amend --author=\"Author Name <[email protected]>\" --no-edit\n\n\nFor example, if your commit history is A-B-C-D-E-F with F as HEAD, and you want to change the author of C and D, then you would...\n\nSpecify git rebase -i B (here is an example of what you will see after executing the git rebase -i B command)\n\n\nif you need to edit A, use git rebase -i --root\n\nChange the lines for both C and D from pick to edit\nExit the editor (for vim, this would be pressing Esc and then typing :wq).\nOnce the rebase started, it would first pause at C\nYou would git commit --amend --author=\"Author Name <[email protected]>\"\nThen git rebase --continue\nIt would pause again at D\nThen you would git commit --amend --author=\"Author Name <[email protected]>\" again\ngit rebase --continue\nThe rebase would complete.\nUse git push -f to update your origin with the updated commits."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-config - Get and set repository or global options tag.sort"}, {"role": "assistant", "content": "This variable controls the sort ordering of tags when displayed by git-tag . Without the \"--sort=\" option provided, the\nvalue of this variable will be used as the default."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How to add my current project to an already existing GitHub repository\nI'm very new to Git. I've been searching for an answer, but I couldn't find one.\nIn my computer I have a project folder like this:\nproject_a\n--some_folder\n--another_folder\n--.git\n\nAnd I have a repository on GitHub, let’s say https://github.com/company/our_repo.git. Under this repository I have some folders. So my goal is to put my project_a under trunk/bin. How do I achieve this? (Again, I'm very very very new.)"}, {"role": "assistant", "content": "Open your Terminal, access to this folder and write:\ngit init\ngit add .\ngit commit -m \"my commit\"\ngit remote set-url origin [email protected]:username/repo.git\ngit push origin master"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git - the stupid content tracker git-config"}, {"role": "assistant", "content": "Get and set repository or global options"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-show - Show various types of objects --dst-prefix="}, {"role": "assistant", "content": "Show the given destination prefix instead of \"b/\"."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How to check the validity of a remote git repository URL?\nWithin a bash script, what would be the simplest way to verify that a git URL points to a valid git repo and that the script has access to read from it?\nProtocols that should be supported are git@, https://, and git://. Curl fails on the git:// protocol.\n[email protected]:UserName/Example.git\nhttps://[email protected]/UserName/Example.git\ngit://github.com/UserName/Example.git\n\nNote: I'm not asking to check to see if a URL is syntactically correct, I need to verify that a repo exists at the URL location entered from within a bash script."}, {"role": "assistant", "content": "As seen in this issue, you can use git ls-remote to test your address.\n\nIf you need to debug the git calls set GIT_TRACE=1. eg:\n\nenv GIT_PROXY_COMMAND=myproxy.sh GIT_TRACE=1 git ls-remote https://...\n\n\n\"git ls-remote\" is the quickest way I know to test communications with a\nremote repository without actually cloning it. Hence its utility as a test for this\nissue.\n\nYou can see it used for detecting an address issue in \"git ls-remote returns 128 on any repo\"."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-merge - Join two or more development histories together resolve"}, {"role": "assistant", "content": "This can only resolve two heads (i.e. the current branch\nand another branch you pulled from) using a 3-way merge\nalgorithm. It tries to carefully detect criss-cross\nmerge ambiguities. It does not handle renames."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How can I use Git locally?\n\nI'm working on a project at the moment, which I'd like to eventually make public on github, but, for the moment, needs to remain private.\nGithub needs users to pay in order to host a private repository, which I'm unwilling to do, so just creating a private github repository is not an option for me.\nHowever, I would still like to use git for version tracking etc. whilst I'm working on the project locally, so that when I do eventually put the project on github, all of this information, the project's changes start-to-finish, will be available.\nBut, I have no clue how to use git without a remote server. I'm wondering now if it just exactly the same, simply without the need for git push.\nThe perfect answer for me would be a step-by-step walkthrough, telling me exactly what I should type into the terminal to set up and maintain a local git repository."}, {"role": "assistant", "content": "You only need to push if you want to use a remote server.\nWhen working locally, you still need to git init to set up the repository, but after that you only need to do the steps\ngit add\ngit commit -m \"new commit\"\n\nto save (\"commit\") your changes.\nDon't git push at all, and don't git pull — there's no remote to sync changes with (git push and git pull just push and pull changes from the remote/online repository).\nType:\ngit log\n\nTo see that your changes have been recorded."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-merge - Join two or more development histories together octopus"}, {"role": "assistant", "content": "This resolves cases with more than two heads, but refuses to do\na complex merge that needs manual resolution. It is\nprimarily meant to be used for bundling topic branch\nheads together. This is the default merge strategy when\npulling or merging more than one branch."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git - the stupid content tracker git-difftool"}, {"role": "assistant", "content": "Show changes using common diff tools"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How do I create a remote Git branch?\nI created a local branch. How do I push it to the remote server?\nUPDATE: I have written a simpler answer for Git 2.0 here."}, {"role": "assistant", "content": "First, create a new local branch and check it out:\ngit checkout -b \n\nThe remote branch is automatically created when you push it to the remote server:\ngit push \n\n is typically origin, which is the name which git gives to the remote you cloned from. Your colleagues may then simply pull that branch.\nNote however that formally, the format is:\ngit push :\n\nBut when you omit one, it assumes both branch names are the same. Having said this, as a word of caution, do not make the critical mistake of specifying only : (with the colon), or the remote branch will be deleted!\n\nSo that a subsequent git pull will know what to do, you might instead want to use:\ngit push --set-upstream \n\nAs described below, the --set-upstream option sets up an upstream branch:\n\nFor every branch that is up to date or\nsuccessfully pushed, add upstream\n(tracking) reference, used by\nargument-less git-pull(1) and other\ncommands."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-send-email - Send a collection of patches as emails --annotate"}, {"role": "assistant", "content": "Review and edit each patch you’re about to send. Default is the value\nof sendemail.annotate . See the CONFIGURATION section for sendemail.multiEdit ."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-config - Get and set repository or global options receive.updateServerInfo"}, {"role": "assistant", "content": "If set to true, git-receive-pack will run git-update-server-info\nafter receiving data from git-push and updating refs."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Can you change a file content during git commit?\nOne of the things I keep in my open novel in GitHub is a list of words I would like to set automatically the first line, which is the number of words in the dictionary. My first option is to write a pre-commit hook that reads the file, counts the words, rewrites the first line and writes it back again. Here's the code\nPRE_COMMIT {\n my ($git) = @_;\n my $branch = $git->command(qw/rev-parse --abbrev-ref HEAD/);\n say \"Pre-commit hook in $branch\";\n if ( $branch =~ /master/ ) {\n my $changed = $git->command(qw/show --name-status/);\n my @changed_files = ($changed =~ /\\s\\w\\s+(\\S+)/g);\n if ( $words ~~ @changed_files ) {\n my @words_content = read_file( $words );\n say \"I have $#words_content words\";\n $words_content[0] = \"$#words_content\\n\";\n write_file( $words, @words_content );\n }\n }\n};\n\nHowever, since the file has already been staged, I get this error\n\nerror: Your local changes to the following files would be overwritten\n by checkout: \n text/words.dic \n Please, commit your changes or stash them\n before you can switch branches. \n Aborting\n\nMight it be better to do it as a post-commit hook and have it changed for the next commit? Or do something completely different altogether? The general question is: if you want to process and change the contents of a file during commit, what's the proper way of doing it?"}, {"role": "assistant", "content": "The actual commit stuck in by git commit is whatever is in the index once the pre-commit hook finishes. This means that you can change files in the pre-commit hook, as long as you git add them too.\nHere's my example pre-commit hook, modified from the .sample:\n#!/bin/sh\n#\n# An example hook script to verify what is about to be committed.\n# [snipped much of what used to be in it, added this --\n# make sure you take out the exec of git diff-index!]\n\nnum=$(cat zorg)\nnum=$(expr 0$num + 1)\necho $num > zorg\ngit add zorg\necho \"updated zorg to $num\"\nexit 0\n\nand then:\n$ git commit -m dink\nupdated zorg to 3\n[master 76eeefc] dink\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\nBut note a minor flaw (won't apply to your case):\n$ git commit\ngit commit\nupdated zorg to 4\n# On branch master\n# Untracked files:\n[snip]\nnothing added to commit but untracked files present (use \"git add\" to track)\n$ git commit\nupdated zorg to 5\n# Please enter the commit message for your changes. Lines starting\n[snip - I quit editor without changing anything]\nAborting commit due to empty commit message.\n$ git commit\nupdated zorg to 6\n# Please enter the commit message for your changes. Lines starting\n\nBasically, because the pre-commit hook updates and git adds, the file keeps incrementing even though I'm not actually doing the commit, here.\n[Edit Aug 2021: I need to emphasize that I do not recommend this approach. Note that there are some oddball cases that can come up when using git commit -a, git commit --include, and git commit --only, including the implied --only that is inserted if you name files on the command line. This is due to the fact that this kind of git commit creates a second, and sometimes even a third, internal Git index. Any git add operations you do inside a hook can only affect one of these two or three index files.]"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How much of a git sha is *generally* considered necessary to uniquely identify a change in a given codebase?\n\nIf you're going to build, say, a directory structure where a directory is named for a commit in a Git repository, and you want it to be short enough to make your eyes not bleed, but long enough that the chance of it colliding would be negligible, how much of the SHA substring is generally required?\nLet's say I want to uniquely identify this change: https://github.com/wycats/handlebars.js/commit/e62999f9ece7d9218b9768a908f8df9c11d7e920\nI can use as little as the first four characters:\nhttps://github.com/wycats/handlebars.js/commit/e629\nBut I feel like that would be risky. But assuming a codebase that, over a couple of years, might have—say—30k changes, what are the chances of collision if I use 8 characters? 12? Is there a number that's generally considered acceptable for this sort of thing?"}, {"role": "assistant", "content": "This question is actually answered in Chapter 7 of the Pro Git book:\n\nGenerally, eight to ten characters are more than enough to be unique\nwithin a project. One of the largest Git projects, the Linux kernel,\nis beginning to need 12 characters out of the possible 40 to stay\nunique.\n\n7 digits are the Git default for a short SHA, so that's fine for most projects. The Kernel team has increased theirs several times, as mentioned because they have several hundred thousand commits. So for your ~30k commits, 8 or 10 digits should be perfectly fine."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "GitHub MarkDown: Are Macros and Variables possible?\n\nI've been learning github markdown, I had a question about variables and macros.\nis it possible to define a variable or macro to prevent repeated printing of a block of text? \nThe use case is that I have a table producing a big grid of hyperlinks - the links look like the below. \nhttp://www.a-big-long-big-big-long-hyperlink/more-long-stuff?id=1234\n\nit would be nice if I could do something like the below once:\n$link=http://www.a-big-long-big-big-long-hyperlink/more-long-stuff?id\n\nand then in each cell in the table, I can say something like\n$link=1234\n\nSome other cell\n$link=2345\n\nthe idea being that:\n\nThe table (which has ~10 columns and ~10 rows) is a bit easier to see on a normal screen, at the moment with the prefix to the links being so long, it looks really ugly as the links wrap to the next line\nIf I want to change the root link, I can change it in one place (yes, I know I could do search and replace in an editor!)\n\nCheers."}, {"role": "assistant", "content": "Below are a few ways to write Reference-Links\n[I'm an inline-style link](https://www.somewebsite.com)\n\n[I'm an inline-style link with title](https://www.somewebsite.com \"somewebsite's Homepage\")\n\n[I'm a reference-style link][Arbitrary case-insensitive reference text]\n\n[I'm a relative reference to a repository file](../blob/master/LICENSE)\n\n[You can use numbers for reference-style link definitions][1]\n\nOr leave it empty and use the [link text itself]\n\nSome text to show that the reference links can follow later.\n\n[arbitrary case-insensitive reference text]: https://www.somewebsite.org\n[1]: http://somewebsite.org\n[link text itself]: http://www.somewebsite.com"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-mergetool - Run merge conflict resolution tools to resolve merge conflicts mergetool.meld.hasOutput"}, {"role": "assistant", "content": "Older versions of meld do not support the --output option.\nGit will attempt to detect whether meld supports --output by inspecting the output of meld --help . Configuring mergetool.meld.hasOutput will make Git skip these checks and\nuse the configured value instead. Setting mergetool.meld.hasOutput to true tells Git to unconditionally use the --output option,\nand false avoids using --output ."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How to sparsely checkout only one single file from a git repository?\nHow do I checkout just one file from a git repo?"}, {"role": "assistant", "content": "Originally, I mentioned in 2012 git archive (see Jared Forsyth's answer and Robert Knight's answer), since git1.7.9.5 (March 2012), Paul Brannan's answer:\ngit archive --format=tar --remote=origin HEAD:path/to/directory -- filename | tar -O -xf -\n\nBut: in 2013, that was no longer possible for remote https://github.com URLs.\nSee the old page \"Can I archive a repository?\"\nThe current (2018) page \"About archiving content and data on GitHub\" recommends using third-party services like GHTorrent or GH Archive.\n\nSo you can also deal with local copies/clone:\nYou could alternatively do the following if you have a local copy of the bare repository as mentioned in this answer,\ngit --no-pager --git-dir /path/to/bar/repo.git show branch:path/to/file >file\n\n\nOr you must clone first the repo, meaning you get the full history:\n\nin the .git repo\n\nin the working tree.\n\nBut then you can do a sparse checkout (if you are using Git1.7+),:\n\nenable the sparse checkout option (git config core.sparsecheckout true)\nadding what you want to see in the .git/info/sparse-checkout file\nre-reading the working tree to only display what you need\n\n\n\nTo re-read the working tree:\n$ git read-tree -m -u HEAD\n\nThat way, you end up with a working tree including precisely what you want (even if it is only one file)\n\nRichard Gomes points (in the comments) to \"How do I clone, fetch or sparse checkout a single directory or a list of directories from git repository?\"\n\nA bash function which avoids downloading the history, which retrieves a single branch and which retrieves a list of files or directories you need.\n\n\nWith Git 2.40 (Q1 2023), the logic to see if we are using the \"cone\" mode by checking the sparsity patterns has been tightened to avoid mistaking a pattern that names a single file as specifying a cone.\nSee commit 5842710 (03 Jan 2023) by William Sprent (williams-unity).\n(Merged by Junio C Hamano -- gitster -- in commit ab85a7d, 16 Jan 2023)\n\ndir: check for single file cone patterns\nSigned-off-by: William Sprent\nAcked-by: Victoria Dye\n\n\nThe sparse checkout documentation states that the cone mode pattern set is limited to patterns that either recursively include directories or patterns that match all files in a directory.\nIn the sparse checkout file, the former manifest in the form:\n/A/B/C/\n\nwhile the latter become a pair of patterns either in the form:\n/A/B/\n!/A/B/*/\n\nor in the special case of matching the toplevel files:\n/*\n!/*/\n\nThe 'add_pattern_to_hashsets()' function contains checks which serve to disable cone-mode when non-cone patterns are encountered.\nHowever, these do not catch when the pattern list attempts to match a single file or directory, e.g. a pattern in the form:\n/A/B/C\n\nThis causes sparse-checkout to exhibit unexpected behaviour when such a pattern is in the sparse-checkout file and cone mode is enabled.\nConcretely, with the pattern like the above, sparse-checkout, in non-cone mode, will only include the directory or file located at '/A/B/C'.\nHowever, with cone mode enabled, sparse-checkout will instead just manifest the toplevel files but not any file located at '/A/B/C'.\nRelatedly, issues occur when supplying the same kind of filter when partial cloning with '--filter=sparse:oid='.\n'upload-pack' will correctly just include the objects that match the non-cone pattern matching.\nWhich means that checking out the newly cloned repo with the same filter, but with cone mode enabled, fails due to missing objects.\nTo fix these issues, add a cone mode pattern check that asserts that every pattern is either a directory match or the pattern '/*'.\nAdd a test to verify the new pattern check and modify another to reflect that non-directory patterns are caught earlier."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How to get complete git commit hash from short hash? [duplicate]\nThis question already has answers here:\n \n \n\n\n\n\nWhat does git rev-parse do?\n\n (4 answers)\n \n\nClosed 7 years ago.\n\n\n\nI have a short git commit hash of length 8 characters. I want to get a complete hash from remote server. I tried getting the branch name from the commit hash and then getting the full commit hash from branch name but it only works for the latest commit. What could be the best possible way to achieve what I want?"}, {"role": "assistant", "content": "git rev-parse will give you what you want.\n$ git rev-parse 3cdd5d\n3cdd5d19178a54d2e51b5098d43b57571241d0ab"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-commit - Record changes to the repository -n --[no-]verify"}, {"role": "assistant", "content": "By default, the pre-commit and commit-msg hooks are run.\nWhen any of --no-verify or -n is given, these are bypassed.\nSee also githooks ."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-send-email - Send a collection of patches as emails sendemail.aliasesFile"}, {"role": "assistant", "content": "To avoid typing long email addresses, point this to one or more\nemail aliases files. You must also supply sendemail.aliasFileType ."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Where is my remote git repository password stored on the local machine?\nI have a git repository set up on bitbucket\n$ git remote -v\norigin https://[email protected]/myusername/my_repository_name.git (fetch)\norigin https://[email protected]/myusername/my_repository_name.git (push)\n\nI pull and push to the repository from my office workstation and home PC.\nWhen I push or pull from my office workstation, it prompts me for the password.\nHowever when I push or pull from my home PC it doesn't prompt for a password.\nI don't specifically remember what I did on my home PC to remember the password.\nrunning $ git config credential.helper returns manager\n$ git config credential.helper\nmanager\n\nContents .gitconfig file in my user folder at root level\n[user]\nname = myusername\nemail = [email protected]\n\nWhere is the password stored on the local disk?\nWhat is the command to check the status of current credentials?\nHow do I similarly remember the password on my office workstation?\nNote: I am using Windows 7"}, {"role": "assistant", "content": "if $ git config credential.helper returns manager, the password is stored in the windows credential manager, if it returns store, password is stored in a .git-credentials file in the user folder."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How to checkout in Git by date?\nI am working on a regression in the source code. I'd like to tell Git: \"checkout the source based on a parameterized date/time\". Is this possible? \nI also have staged changes in my current view that I don't want to lose. Ideally, I would like to toggle back and forth between the current source, and some version I'm interested in based on a previous date."}, {"role": "assistant", "content": "To keep your current changes\nYou can keep your work stashed away, without commiting it, with git stash. You\nwould than use git stash pop to get it back. Or you can (as carleeto said) git commit it to a separate branch.\nCheckout by date using rev-parse\nYou can checkout a commit by a specific date using rev-parse like this:\ngit checkout 'master@{1979-02-26 18:30:00}'\n\nMore details on the available options can be found in the git-rev-parse.\nAs noted in the comments this method uses the reflog to find the commit in your history. By default these entries expire after 90 days. Although the syntax for using the reflog is less verbose you can only go back 90 days.\nCheckout out by date using rev-list\nThe other option, which doesn't use the reflog, is to use rev-list to get the commit at a particular point in time with:\ngit checkout `git rev-list -n 1 --first-parent --before=\"2009-07-27 13:37\" master`\n\nNote the --first-parent if you want only your history and not versions brought in by a merge. That's what you usually want."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "gitglossary - A Git Glossary pack"}, {"role": "assistant", "content": "A set of objects which have been compressed into one file (to save space\nor to transmit them efficiently)."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-push - Update remote refs along with associated objects git push mothership master:satellite/master dev:satellite/dev"}, {"role": "assistant", "content": "Use the source ref that matches master (e.g. refs/heads/master )\nto update the ref that matches satellite/master (most probably refs/remotes/satellite/master ) in the mothership repository;\ndo the same for dev and satellite/dev . See the section describing ... above for a discussion of\nthe matching semantics. This is to emulate git fetch run on the mothership using git\npush that is run in the opposite direction in order to integrate\nthe work done on satellite , and is often necessary when you can\nonly make connection in one way (i.e. satellite can ssh into\nmothership but mothership cannot initiate connection to satellite\nbecause the latter is behind a firewall or does not run sshd). After running this git push on the satellite machine, you would\nssh into the mothership and run git merge there to complete the\nemulation of git pull that were run on mothership to pull changes\nmade on satellite ."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Unable to determine upstream SVN information from HEAD history\nWhy do I get this error message?"}, {"role": "assistant", "content": "i got this message because of cloning the svn repo with --no-metadata option. Maybe that's the case with Your problem too. \nWhen cloning it without that option everything is fine.\nThe --no-metadata option is meant to clone an SVN repository when the new git clone is to be come the canonical source in the future. It lacks the capacity to commit back to the SVN upstream, because it has no way to track differences between the git clone and the SVN upstream."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-add - Add file contents to the index add.interactive.useBuiltin"}, {"role": "assistant", "content": "Unused configuration variable. Used in Git versions v2.25.0 to\nv2.36.0 to enable the built-in version of git-add 's\ninteractive mode, which then became the default in Git\nversions v2.37.0 to v2.39.0."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-log - Show commit logs %H"}, {"role": "assistant", "content": "commit hash"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Undo delete in GIT\nI made something very stupid.\nI made a commit using git commit (file edits + new files) (C).\nThen I made amend last commit.\nThen I deleted all files recursively (!) using git rm -r\nThen I made another git commit (C).\n\nA-B-C\n ↑\n master\n\nIs there any way to undelete the files but keep the changes I had in my first commit? (C)\nI'd rather do not go back to (B).\nI tried git reset --soft head^, so then the git status lists files I deleted, then I did git checkout, but still no luck. I don't even know if it's possible."}, {"role": "assistant", "content": "Do yourself a favour and do not do git checkout like the other answer suggests and go into more problems.\nIF you have deleted file from your working directory and not committed the changes yet, do:\ngit checkout -f\n\nCAUTION: commit uncommitted files before executing this command, otherwise you're going to lose them all\nThe deleted files should be back again.\nIf not and if you can find the commit that you want ( C, etc. - your question is not clear ) from git reflog, just do git reset --hard and you should be all set."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How can I list the git subtrees on the root?\nFor example, you can do a git remote --verbose and git will show all the remotes you have on your project, git branch will show all the branches and signal the current branch, but how to list all subtrees, without any destructive command? git subtree will give the usage examples, but won't list anything. subtree only have add,pull,push,split,merge."}, {"role": "assistant", "content": "There isn't any explicit way to do that (at least, for now), the only available commands are listed here (as you noted yourself, but here's a reference for future seekers):\nhttps://github.com/git/git/blob/master/contrib/subtree/git-subtree.txt\nI went through the code (basically all this mechanism is a big shell script file), all of the tracking is done through commit messages, so all the functions use git log mechanism with lots of grep-ing to locate it's own data.\nSince subtree must have a folder with the same name in the root folder of the repository, you can run this to get the info you want (in Bash shell):\ngit log | grep git-subtree-dir | tr -d ' ' | cut -d \":\" -f2 | sort | uniq\n\nNow, this doesn't check whether the folder exist or not (you may delete it and the subtree mechanism won't know), so here's how you can list only the existing subtrees, this will work in any folder in the repository:\n git log | grep git-subtree-dir | tr -d ' ' | cut -d \":\" -f2 | sort | uniq | xargs -I {} bash -c 'if [ -d $(git rev-parse --show-toplevel)/{} ] ; then echo {}; fi'\n\nIf you're really up to it, propose it to Git guys to include in next versions:)"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How to disable pre-commit code analysis for Git-backed projects using IntelliJ IDEA\n\nI have a project in IntelliJ IDEA, and I'm using Git/GitHub as source control. Each time I try to commit changes, IntelliJ IDEA runs a lengthy code analysis and searches for TODOs. When it finds \"problems,\" it prompts me whether or not I want to review or commit.\nI don't want the pre-commit code analysis to run, and I don't want IntelliJ IDEA to ask me about the results. I can't seem to find any setting in the regular IntelliJ IDEA project/IDE settings to disable this. How can I disable this?"}, {"role": "assistant", "content": "As of 2022-3 there is a cog next to the 'Amend' checkbox that allows you to turn off checks."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git push heroku master permission denied\nI am following the ruby.railstutorial. I run the command \"git push heroku master\" and it spits out this error.\nPermission denied (publickey).\nfatal: Could not read from remote repository.\nPlease make sure you have the correct access rights\nand the repository exists.\n\nI am inside my rails app \"/Users/lexi87/rails_projects/first_app\". Any solutions?"}, {"role": "assistant", "content": "The best way to avoid such errors is to use one public/private key pair and not an extra key for heroku. This way you (or your system) can't choose a wrong key to login in heroku.\nIf you get this error, you have done something wrong. Check this site: https://devcenter.heroku.com/articles/keys\nIf you geht this error, the best way is to remove unnecessary keys and use only one.\nIf you need more than one key pair on your system, you can set one key for heroku. This is done through the following command:\nheroku keys:add"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Remove large .pack file created by git\nI checked a load of files in to a branch and merged and then had to remove them and now I'm left with a large .pack file that I don't know how to get rid of.\nI deleted all the files using git rm -rf xxxxxx, and I also ran the --cached option as well.\nHow can I remove a large .pack file that is currently in the following directory?\n.git/objects/pack/pack-xxxxxxxxxxxxxxxxx.pack\nDo I just need to remove the branch that I still have, but I am no longer using? Or is there something else I need to run?\nI'm not sure how much difference it makes but it shows a padlock against the file.\n\nHere are some excerpts from my bash_history file that should give an idea how I managed to get into this state (assume at this point I'm working on a git branch called 'my-branch' and I've got a folder containing more folders/files):\ngit add .\ngit commit -m \"Adding my branch changes to master\"\ngit checkout master\ngit merge my-branch\ngit rm -rf unwanted_folder/\nrm -rf unwanted_folder/ (not sure why I ran this as well but I did)\n\nI thought I also ran the following, but it doesn't appear in the bash_history with the others:\ngit rm -rf --cached unwanted_folder/\n\nI also thought I ran some git commands (like git gc) to try to tidy up the pack file, but they don't appear in the .bash_history file either."}, {"role": "assistant", "content": "The issue is that, even though you removed the files, they are still present in previous revisions. That's the whole point of git, is that even if you delete something, you can still get it back by accessing the history.\nWhat you are looking to do is called rewriting history, and it involved the git filter-branch command.\nGitHub has a good explanation of the issue on their site. https://help.github.com/articles/remove-sensitive-data\nTo answer your question more directly, what you basically need to run is this command with unwanted_filename_or_folder replaced accordingly:\ngit filter-branch --index-filter 'git rm -r --cached --ignore-unmatch unwanted_filename_or_folder' --prune-empty\n\nThis will remove all references to the files from the active history of the repo.\nNext step, to perform a GC cycle to force all references to the file to be expired and purged from the packfile. Nothing needs to be replaced in these commands.\ngit for-each-ref --format='delete %(refname)' refs/original | git update-ref --stdin\n# or, for older git versions (e.g. 1.8.3.1) which don't support --stdin\n# git update-ref $(git for-each-ref --format='delete %(refname)' refs/original)\ngit reflog expire --expire=now --all\ngit gc --aggressive --prune=now"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-log - Show commit logs git log --follow builtin/rev-list.c"}, {"role": "assistant", "content": "Shows the commits that changed builtin/rev-list.c , including\nthose commits that occurred before the file was given its\npresent name."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-rebase - Reapply commits on top of another base tip --stat"}, {"role": "assistant", "content": "Show a diffstat of what changed upstream since the last rebase. The\ndiffstat is also controlled by the configuration option rebase.stat."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git SSL certificate- Invalid certificate chain while accessing\nI'm fairly new to github and git, but I do have git setup on my Mac (using Mavericks) and have added a repo on github. I'm using MAMP and working on a Drupal site, and when I try my first push to the repo, using git push origin master I get an error:\nerror: SSL certificate problem: Invalid certificate chain while accessing\n https://githib.com/...git/info/refs?service=git-receive-pack\nfatal: HTTP request failed\n\nI've looked around to try and make sense of this error without any luck. I'd greatly appreciate any help."}, {"role": "assistant", "content": "if you use self generated ssl key, you can try this.\ngit config --global http.sslVerify false\n\nRefer\nhttps://confluence.atlassian.com/display/FISHKB/Unable+to+clone+Git+repository+due+to+self+signed+certificate"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Break up multiple changes into separate commits with git?\nIf I have made multiple sets of changes to a large file, is it possible to split those into separate commits using git?"}, {"role": "assistant", "content": "You want git add --patch (documentation), which will allow you to select which changes to stage."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "What does 'git commit' mean when it says 'create mode ...' on stdout?\nEDIT:\nSee Danny Lin's git-store-meta as a proposed solution to the versioning-metadata problem described below. I have yet to test it as of 2015-05-13.\nORIGINAL QUESTION:\nDo the create|delete mode ... lines in the git commit output (example below) represent some sort of metadata control? (And/or, what do these lines represent in general?) These appear to be unix-like file-permission codes/representations, although I'm not sure -exactly- the mapping, but the bigger question is: what if anything does git do with these codes/settings/values? Does git attempt to leverage these saved codes in any way to prove helpful to solve metadata problems my per superuser.com question \"How to reuse/extend etckeeper's metadata engine for git control of non-/etc filesystems, or extend git natively with said capability?\"? I'm aware that git doesn't control all filesystem metadata.\n[Git does apparently, already control the \"executeable attribute/perm\" of a file (apparently portable for most OSes) and some other things like filesystem links. I'm seeking a more Unix/Linux/BSD/DarwinMacOSX-specific control mechanism for more/all metadata, namely all permissions and user/group ownership. ACLs and other metadata control optional. Trying to see if the stuff git is currently storing might prove useful to solve this problem.]\nroot@node1 Dec 15 09:40:45 ~/.../sandbox-1# git status\n# On branch master\n# Changes to be committed:\n# (use \"git reset HEAD ...\" to unstage)\n#\n# modified: README\n# new file: dummy-file-will-be-removed\n# deleted: ownerfile\n#\nroot@node1 Dec 15 09:40:45 ~/.../sandbox-1# git commit -m \"testing git\"\n[master c5b0201] testing git\n 2 files changed, 1 insertions(+), 2 deletions(-)\n create mode 100644 dummy-file-will-be-removed\n delete mode 100644 ownerfile\nroot@node1 Dec 15 09:41:55 ~/.../sandbox-1# \n[...]\nroot@node1 Dec 15 11:33:11 ~# git --version\ngit version 1.7.4.1\nroot@node1 Dec 15 11:33:14 ~#"}, {"role": "assistant", "content": "For more information about Git's mode, see this answer.\nGit's ability to store file metadata is limited to a simple subset of information to allow Git to track some basic file system changes allowing Git to track relevant changes for source code management; such as whether a file has been modified and whether a file is a regular file or an executable file.\nGit does not try to implement any notion of a file system, leaving file system routines to an actual file system implementation. This makes good sense to allow Git to work equally whether on a FAT32, NTFS, EXT3, XFS, NFS, etc. file system running on Linux, MacOS, Windows, etc."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-config - Get and set repository or global options core.alternateRefsCommand"}, {"role": "assistant", "content": "When advertising tips of available history from an alternate, use the shell to\nexecute the specified command instead of git-for-each-ref . The\nfirst argument is the absolute path of the alternate. Output must contain one\nhex object id per line (i.e., the same as produced by git for-each-ref\n--format='%(objectname)' ). Note that you cannot generally put git for-each-ref directly into the config\nvalue, as it does not take a repository path as an argument (but you can wrap\nthe command above in a shell script)."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-log - Show commit logs --skip="}, {"role": "assistant", "content": "Skip number commits before starting to show the commit output."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How to resolve git stash conflict without commit?\nAs asked in this question, I also want to know how to resolve a conflicting git stash pop without adding all modifications to a commit (just like \"git stash pop\" without a conflict does).\nMy current approach is very uncool because I do it this way:\ngit stash pop # -> CONFLICT\ngit stash drop\n# [resolve conflict]\n# [add conflict files]\ngit reset HEAD # \n\n\nHow to reproduce:\nmkdir foo; cd foo; git init\necho \"1\" > one\necho \"2\" > two\ngit add -A; git commit -m \"first\"\necho \"1.1\" > one\necho \"2.1\" > two\ngit stash\necho \"2.2\" > two\ngit commit -a -m \"second\"\necho \"Only this file would stay in HEAD without the conflict\" > third\ngit add third\ngit stash pop\ngit status\n\n2016-06-27: Added a new file called 'third' to the example to show that workarounds like the solution from scy only work for empty HEADs but don't fix the initial problem that the HEAD doesn't have the same content like for a git stash pop without a conflict."}, {"role": "assistant", "content": "Clean solution\nThe following solution seems to be much cleaner to me and it's also suggested by the Git itself — try to execute git status in the repository with a conflict:\nUnmerged paths:\n (use \"git restore --staged ...\" to unstage)\n (use \"git add ...\" to mark resolution)\n\nNote: The restore command has been introduced in Git version 2.23.0. Older versions of Git suggested to use the command git reset HEAD ... instead of git restore --staged .... You could also use git reset to unstage any and all files in the staging area (called the index). Restore command's equivalent is git restore --staged . (the dot is necessary and it specifies any file). Currently, any of those commands may be used and the outcome is the same. If you want to learn about the differences between those commands, check the documentation.\nSo let's do what Git suggests (without making and reverting any pointless commits):\n\nManually (or ideally using some merge tool, see below) resolve the conflict(s).\nUse git restore --staged . to mark conflict(s) as resolved and unstage all files in the staging area. If you want to unstage only specific files, use the command git restore --staged instead. You don't have to execute git add before.\nFinally, remove the stash with git stash drop, because Git doesn't do that automatically on conflict.\n\nTranslated to the command-line commands:\n$ git stash pop\n\n# ...resolve conflict(s)\n\n$ git restore --staged .\n\n$ git stash drop\n\nExplanation of the default behavior\nThere are two ways of marking conflicts as resolved: git add and git restore --staged .... While git restore --staged ... marks the conflicts as resolved and removes files from the index, git add also marks the conflicts as resolved, but keeps files in the index.\nAdding files to the index after a conflict is resolved is on purpose. This way you can differentiate the changes from the previous stash and changes you made after the conflict was resolved. If you don't like it, you can always use git restore --staged . to remove everything from the index.\nMerge tools\nI highly recommend using any of 3-way merge tools for resolving conflicts, e.g. KDiff3, Meld, etc., instead of doing it manually. It usually solves all or the majority of conflicts automatically itself. It's huge time-saver!"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-config - Get and set repository or global options pack.compression"}, {"role": "assistant", "content": "An integer -1..9, indicating the compression level for objects\nin a pack file. -1 is the zlib default. 0 means no\ncompression, and 1..9 are various speed/size tradeoffs, 9 being\nslowest. If not set, defaults to core.compression. If that is\nnot set, defaults to -1, the zlib default, which is \"a default\ncompromise between speed and compression (currently equivalent\nto level 6).\" Note that changing the compression level will not automatically recompress\nall existing objects. You can force recompression by passing the -F option\nto git-repack ."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-fetch - Download objects and refs from another repository --progress"}, {"role": "assistant", "content": "Progress status is reported on the standard error stream\nby default when it is attached to a terminal, unless -q\nis specified. This flag forces progress status even if the\nstandard error stream is not directed to a terminal."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How do I \"undo\" a --single-branch clone?\n\nI cloned a repo using the\ngit clone -b --single-branch \nThis cloned ONLY this branch, but now I want to switch to the master and other branches. Is there any way besides clearing it out and starting over to clone the rest of the repo that I can undo the --single-branch preference?"}, {"role": "assistant", "content": "You can tell Git to pull all branches like this:\ngit config remote.origin.fetch \"+refs/heads/*:refs/remotes/origin/*\"\ngit fetch origin\n\nIf you look in .git/config, it'll look something like this:\n[core]\n repositoryformatversion = 0\n filemode = true\n bare = false\n logallrefupdates = true\n ignorecase = true\n precomposeunicode = false\n[remote \"origin\"]\n url = https://github.com/owner/repo.git\n fetch = +refs/heads/*:refs/remotes/origin/*\n[branch \"master\"]\n remote = origin\n merge = refs/heads/master\n rebase = true\n\nI compared this to a full clone, and saw that the only difference was the \"fetch\" under [remote \"origin\"].\nNote: I'm running Git version 1.8.2. The config options may have changed if you're running an older version of Git. If my commands don't work, then I'd recommend looking through .git/config to see if you can see something similar."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-notes - Add or inspect object notes edit"}, {"role": "assistant", "content": "Edit the notes for a given object (defaults to HEAD)."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-config - Get and set repository or global options core.gitProxy"}, {"role": "assistant", "content": "A \"proxy command\" to execute (as command host port ) instead\nof establishing direct connection to the remote server when\nusing the Git protocol for fetching. If the variable value is\nin the \"COMMAND for DOMAIN\" format, the command is applied only\non hostnames ending with the specified domain string. This variable\nmay be set multiple times and is matched in the given order;\nthe first match wins. Can be overridden by the GIT_PROXY_COMMAND environment variable\n(which always applies universally, without the special \"for\"\nhandling). The special string none can be used as the proxy command to\nspecify that no proxy be used for a given domain pattern.\nThis is useful for excluding servers inside a firewall from\nproxy use, while defaulting to a common proxy for external domains."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-log - Show commit logs --pretty[=] --format="}, {"role": "assistant", "content": "Pretty-print the contents of the commit logs in a given format,\nwhere can be one of oneline , short , medium , full , fuller , reference , email , raw , format: and tformat: . When is none of the above,\nand has %placeholder in it, it acts as if --pretty=tformat: were given. See the \"PRETTY FORMATS\" section for some additional details for each\nformat. When = part is omitted, it defaults to medium . Note: you can specify the default pretty format in the repository\nconfiguration (see git-config )."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How to resolve ALL conflicts using HEAD, with any mergetool\nSo for some reason I'm getting a lot of conflicts with a new merged hotfix. The file that was actually [manually] changed has no conflict.\nAll the conflicts are in files that were untouched during the fix and apparently its an issue with whitespaces. I'll try to figure that problem later but now I need to merge the hotfix and deploy.\nHow can I resolve ALL conflicts to use the HEAD version? I don't want to go file by file. Yes, I know its a bad practice but the conflicts are all whitespaces and I know HEAD is correct — passing all tests and running fine in production. \nAny ideas? \nI'm using OSX."}, {"role": "assistant", "content": "git merge -Xours origin/master\n\nwill do a merge with origin/master (the same thing that git pull origin master does) and will resolve any conflicts by taking the versions from your local branch.\nIf you're already part-way through the bad merge, you can reset everything to the head first with git reset --hard HEAD.\nIn that case, you should do\ngit reset --hard HEAD\ngit merge -Xours origin/master\n\nAnd that should fix your problem!\n(also worth mentioning, -Xtheirs will do the same thing, but take the upstream version in any conflicts.)\n\nAlso, most likely the conflicts are because the upstream version is using windows-style line endings, and whatever program you edited the files in on your local machine is using mac-style or linux-style line endings.\nThere are options you can set in git to always commit windows-style or linux-style line endings, but always checkout mac-style or linux-style in your working directory.\nSee this link for more info:\nhttps://help.github.com/articles/dealing-with-line-endings"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Count Git commits per period\nis there a way to count the number of commits in certain period (e.g. the last year from 2015-03-01 to 2016-03-01) for git (GitHub) repositories?"}, {"role": "assistant", "content": "To count the commits in a date range in your current branch do this:\n git rev-list --count HEAD --since=\"Dec 3 2015\" --before=\"Jan 3 2016\"\n\nIf you want the count for all branches in one go use --all additionally\ngit rev-list --count --since=\"Dec 3 2015\" --before=\"Jan 3 2016\" --all\n\nif you want to exclude merge-commits, use option --no-merges\ngit rev-list --count --since=\"Dec 3 2015\" --before=\"Jan 3 2016\" --all --no-merges"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Moving from CVS to Git: $Id$ equivalent?\nI read through a bunch of questions asking about simple source code control tools and Git seemed like a reasonable choice. I have it up and running, and it works well so far. One aspect that I like about CVS is the automatic incrementation of a version number.\nI understand that this makes less sense in a distributed repository, but as a developer, I want/need something like this. Let me explain why:\nI use Emacs. Periodically I go through and look for new versions of the Lisp source files for third-party packages. Say I've got a file, foo.el, which, according to the header, is version 1.3; if I look up the latest version and see it's 1.143 or 2.6 or whatever, I know I'm pretty far behind.\nIf instead I see a couple of 40-character hashes, I won't know which is later or get any idea of how much later it is. I would absolutely hate it if I had to manually check ChangeLogs just to get an idea of how out of date I am.\nAs a developer, I want to extend this courtesy, as I see it, to the people that use my output (and maybe I'm kidding myself that anyone is, but let's leave that aside for a moment). I don't want to have to remember to increment the damn number myself every time, or a timestamp or something like that. That's a real PITA, and I know that from experience.\nSo what alternatives do I have? If I can't get an $Id:$ equivalent, how else can I provide what I'm looking for?\nI should mention that my expectation is that the end user will NOT have Git installed and even if they do, will not have a local repository (indeed, I expect not to make it available that way)."}, {"role": "assistant", "content": "The SHA is just one representation of a version (albeit canonical). The git describe command offers others and does so quite well.\nFor example, when I run git describe in my master branch of my Java memcached client source, I get this:\n2.2-16-gc0cd61a\n\nThat says two important things:\n\nThere have been exactly 16 commits in this tree since 2.2\nThe exact source tree can be displayed on anyone else's clone.\n\nLet's say, for example, you packaged a version file with the source (or even rewrote all the content for distribution) to show that number. Let's say that packaged version was 2.2-12-g6c4ae7a (not a release, but a valid version).\nYou can now see exactly how far behind you are (4 commits), and you can see exactly which 4 commits:\n# The RHS of the .. can be origin/master or empty, or whatever you want.\n% git log --pretty=format:\"%h %an %s\" 2.2-12-g6c4ae7a..2.2-16-gc0cd61a\nc0cd61a Dustin Sallings More tries to get a timeout.\n8c489ff Dustin Sallings Made the timeout test run on every protocol on every bui\nfb326d5 Dustin Sallings Added a test for bug 35.\nfba04e9 Valeri Felberg Support passing an expiration date into CAS operations."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Images not displaying in Github Pages?\n\nI added a project site to my Github project. But some photos are not displaying in the site.\nImg code:\n\"\" \n\nfolder structure (img is a folder):\nimg\n Screenshot2.png\nindex.html\n\nI tried with .png and .PNG (some earlier SO answers suggested it) and none of them work\nAny solutions?"}, {"role": "assistant", "content": "Nevermind, I solved it.\nIf anyone has the same problem.\nGitHub Pages are case sensitive. Not only for folders, but also for image names."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-log - Show commit logs Default mode"}, {"role": "assistant", "content": "Simplifies the history to the simplest history explaining the\nfinal state of the tree. Simplest because it prunes some side\nbranches if the end result is the same (i.e. merging branches\nwith the same content)"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "override git from Xcode with homebrew version\nI've installed XCode and therefore git is there as well. Since i want to have a newer version of git I installed using homebrew.\nBut the homebrew version of git is never called since my PATH looks like this\n/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin\n\nwhich means the /usr/bin/git is allways called before /usr/local/bin/git.\nIs there a way to change that without changing the PATH?"}, {"role": "assistant", "content": "Xcode is actually using the GIT that is stored in /Applications/Xcode.app/Contents/Developer/usr/bin. The same version of GIT gets installed in /usr/bin when you installed the command line tools as part of Xcode installation. So, you won't be able to change what Xcode is using (unless you are willing to muck with the contents of the Xcode package). If, from a terminal application, you want to use the homebrew-installed GIT then you have two options:\n\nReference GIT with the full path as /usr/local/bin/git ... For this case you can create an alias like alias mgit=/usr/local/bin/git and then use mgit ... from the terminal\nChange the path as PATH=/usr/local/bin:$PATH either in your .bashrc or .zshrc if you use zsh file (or each time you start a terminal at the command line)."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-diff - Show changes between commits, commit and working tree, etc --inter-hunk-context="}, {"role": "assistant", "content": "Show the context between diff hunks, up to the specified number\nof lines, thereby fusing hunks that are close to each other.\nDefaults to diff.interHunkContext or 0 if the config option\nis unset."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-config - Get and set repository or global options trace2.perfTarget"}, {"role": "assistant", "content": "This variable controls the performance target destination.\nIt may be overridden by the GIT_TRACE2_PERF environment variable.\nThe following table shows possible values."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Should I be adding the Django migration files in the .gitignore file?\nShould I be adding the Django migration files in the .gitignore file? \nI've recently been getting a lot of git issues due to migration conflicts and was wondering if I should be marking migration files as ignore. \nIf so, how would I go about adding all of the migrations that I have in my apps, and adding them to the .gitignore file?"}, {"role": "assistant", "content": "Quoting from the Django migrations documentation:\n\nThe migration files for each app live in a “migrations” directory inside of that app, and are designed to be committed to, and distributed as part of, its codebase. You should be making them once on your development machine and then running the same migrations on your colleagues’ machines, your staging machines, and eventually your production machines.\n\nIf you follow this process, you shouldn't be getting any merge conflicts in the migration files.\nWhen merging version control branches, you still may encounter a situation where you have multiple migrations based on the same parent migration, e.g. if two different developers introduced a migration concurrently. One way of resolving this situation is to introduce a merge_migration. Often this can be done automatically with the command\n./manage.py makemigrations --merge\n\nwhich will introduce a new migration that depends on all current head migrations. Of course this only works when there is no conflict between the head migrations, in which case you will have to resolve the problem manually.\n\nGiven that some people here suggested that you shouldn't commit your migrations to version control, I'd like to expand on the reasons why you actually should do so.\nFirst, you need a record of the migrations applied to your production systems. If you deploy changes to production and want to migrate the database, you need a description of the current state. You can create a separate backup of the migrations applied to each production database, but this seems unnecessarily cumbersome.\nSecond, migrations often contain custom, handwritten code. It's not always possible to automatically generate them with ./manage.py makemigrations.\nThird, migrations should be included in code review. They are significant changes to your production system, and there are lots of things that can go wrong with them.\nSo in short, if you care about your production data, please check your migrations into version control."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How to cleanup garbage in remote git repo\nI recently ran into a size limit with my Bitbucket repo. I followed the countless other questions answering how to clean up your git repo and ended up using BFG to remove some bad commits. \nThis worked great, however, I noticed that after running a git count, there was a large amount of space sitting in garbage. So I ran a simple git gc. However, that did nothing to clean up the garbage. \nAfter some digging I found the following command:\ngit -c gc.reflogExpire=0 -c gc.reflogExpireUnreachable=0 -c gc.rerereresolved=0 \\\n-c gc.rerereunresolved=0 -c gc.pruneExpire=now gc \"$@\"\n\nRunning this led to the garbage being cleaned up locally. However, I still have the issue of the remote repo. Do I now need to get Bitbucket to run this command on my remote repo, or is there a way to push this change to the repository?"}, {"role": "assistant", "content": "We think we had the same problem today and were able to solve it without contacting Bitbucket support, as below. Note that the method discards last commit from the repo - so you probably want to have its backup.\nBitbucket reported that our repo was about 2.1GB, while when cloned, it only took about 250MB locally. From this, we concluded that it's most likely from big files in unreachable commits (thanks to this answer).\nThis is how to see unreachable commits locally, where we don't take into account reachability via reflog:\ngit fsck --unreachable --no-reflog\nLocally, unreachable commits can be cleaned with:\ngit reflog expire --expire-unreachable=\"now\" --all\ngit prune --expire=\"now\" -v\ngit gc --aggressive --prune=\"now\"\n\nWe cannot however run any of these commands remotely on Bitbucket. But, they say on the page about reducing repo size (section Remove the repository limitation) that they run git gc themselves in response to doing git reset --hard HEAD~1 (which discards last commit) followed by git push -f. Also, they say in the section Garbage collecting dead data that one can try the sequence: git reflog expire --expire=now --all, git gc --prune=now, git push --all --force. Given all this, I decided to try the following locally, hoping it'd cut out the reflog and do a prune locally, and then push them to remote Bitbucket repository, on which it'd start a gc:\ngit reflog expire --expire-unreachable=\"30m\" --all\ngit prune --expire=\"30m\" -v\ngit gc --prune=\"30m\"\ngit reset --hard HEAD~1\ngit push -f\n\nThis worked, repo size immediately went from 2.1GB to ca. 250MB. :)\nNote that the time param to expire / expire-unreachable / prune sets the expiration cut-off point measuring from now back. So e.g. \"now\" means expire / prune everything, and \"30m\" means except for changes in last 30 minutes."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "fatal: Could not open file .git/rebase-merge/done for reading: No such file or directory\nI was going to do a rebase to delete my last commit but I didn't want to finish so I exited. (I realize this probably was not the best way to go about it, but it's done) I guess I did it wrong because I am getting the error: fatal: Could not open file .git/rebase-merge/done for reading: No such file or directory every time I run git status. How do I get rid of this error so I can continue making commits? Can I just delete the file? If I can delete it, how would I do that?"}, {"role": "assistant", "content": "Before you try the following, make sure you stash or commit any uncommitted changes first, or you will lose them irrevocably.\nThen try to do a git rebase --abort."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Gitlab runner fails to start. This job is stuck because you don't have any active runners online with any of these tags assigned to them: ios\n\nI have a remote runner: \n\nci$ gitlab-runner --version Version: 12.2.0\n\nThe .gitlab-ci.yml :\nstages:\n - build\n - deploy\n\nvariables:\n LANG: \"en_US.UTF-8\"\n LC_ALL: \"en_US.UTF-8\"\n\nbuild:\n tags:\n - ios\n stage: build\n script:\n - bundle exec fastlane build\n except:\n - develop\n - master\n - /^rc\\/.*$/\n environment:\n name: production\n\ndeploy:\n tags:\n - ios\n stage: deploy\n before_script:\n - 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client git -y )'\n - eval $(ssh-agent -s)\n - echo \"$SSH_PRIVATE_KEY\" | tr -d '\\r' | ssh-add -\n - mkdir -p ~/.ssh\n - chmod 700 ~/.ssh\n - ssh-keyscan gitlab.com >> ~/.ssh/known_hosts\n - chmod 644 ~/.ssh/known_hosts\n - ssh -vv [email protected]\n - git config --global user.email \"[email protected]\"\n - git config --global user.name \"username\"\n - git branch\n - git branch -r\n script:\n - bundle exec fastlane deploy\n only:\n - develop\n - master\n - /^rc\\/.*$/\n environment:\n name: production\n\npost:\n stage: .post\n when: always\n script:\n - bundle exec fastlane clear_data_CI\n\nGitlab CI fails to run, drops this warning first:\n\nThis job is stuck because the project doesn't have any runners online\n assigned to it.\n\nGo to Runners page\nAnd later:\n\nThere has been a timeout failure or the job got stuck. Check your\n timeout limits or try again\n\nSo tags are added, but it stopped running. Remote runner is working properly. Any issues?"}, {"role": "assistant", "content": "You have to make sure that the remote runner you are referring to is:\n\nActually running\nListed as an activated runner in your project's Runners section\nConfigured to follow/listen to the same tags\n\nGo to your repo's Gitlab project settings. Then find the section for CI / CD > Runners. You should see something like the image below:\n\nHere we see that there is a runner (df51f559) configured for the project, and it is running (green). If your repo's .gitlab-ci.yml is using tags, then that runner must also have the same tags. So here, if your job is expecting a runner with ios tag, then this UI should also show the runner to have an ios tag.\nYou can verify the runner token using gitlab-runner verify or list:\nroot@buildpc:~# gitlab-runner verify\n...\nVerifying runner... is alive runner=df51f559\n\nroot@buildpc:~# gitlab-runner list\nmy-runner Executor=docker Token=df51f55995e68cccb3ada8c1458ec7 URL=http://192.168.1.61/\n\nHere my-runner's\n\nToken must match the token displayed in the Runners page\nURL must match the base URL of your Gitlab project\n\nIf you can't see an activated runner, that section has instructions on how to register a new runner for your project. You can also refer to Gitlab's Registering Runners help docs.\nIf you have admin access to your Gitlab instance, you can also go to the Admin dashboard, Runners, select a runner from the available ones, then manually add it to your project. You can also edit the tags.\n\nLastly, as mentioned in the comments, if you originally had no active runners then you successfully added one, you need to restart the job. AFAIK, when a job gets stuck because there is no runner, it does not automatically resume when a runner becomes available. You'll have to manually retry or re-trigger the job."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Rails 3 and Heroku: automatically \"rake db:migrate\" on push?\nI have a slight annoyance with my heroku push/deploy process, which otherwise has been a joy to discover and use. \nIf i add a new migration to my app, the only way i can get it up onto the heroku server is to do a push to the heroku remote. This uploads it and restarts the app. But it doesn't run the migration, so i have to do heroku rake db:migrate --app myapp, then heroku restart --app myapp. In the meantime, the app is broken because it hasn't run the migrations and the code is referring to fields/tables etc in the migration.\nThere must be a way to change the deployment process to run the rake db:migrate automatically as part of the deploy process but i can't work it out. \nIs it something i set in a heroku cpanel? Is it an option i pass to heroku from the command line? Is it a git hook? Can anyone set me straight? thanks, max"}, {"role": "assistant", "content": "Heroku now has the ability to handle this as part of their \"release phase\" feature.\nYou can add a process called release to your Procfile and that will be run during each and every deploy.\nRails >= 5 Example\nrelease: bundle exec rails db:migrate\nRails < 5 example\nrelease: bundle exec rake db:migrate"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-grep - Print lines matching a pattern -E --extended-regexp -G --basic-regexp"}, {"role": "assistant", "content": "Use POSIX extended/basic regexp for patterns. Default\nis to use basic regexp."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git - the stupid content tracker git-diff"}, {"role": "assistant", "content": "Show changes between commits, commit and working tree, etc"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-am - Apply a series of patches from a mailbox -s --signoff"}, {"role": "assistant", "content": "Add a Signed-off-by trailer to the commit message, using\nthe committer identity of yourself.\nSee the signoff option in git-commit for more information."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "What does the caret (^) character mean in Git?\nI saw an answer to a question here that helps restore a deleted file in git.\nThe solution was\ngit checkout ^ -- \n\nWhat does the caret character (^) do? I’ve seen it elsewhere doing very useful things in git. It’s magical. Someone please spoil it for me and tell me what it does?"}, {"role": "assistant", "content": "HEAD^ means the first parent of the tip of the current branch.\nRemember that git commits can have more than one immediate parent. HEAD^ is short for HEAD^1, and you can also address HEAD^2 and so on as appropriate. Any commit with multiple parents is the product of a merge or a merge commit.\nYou can get to parents of any commit, not just HEAD. You can also move back through generations to any reachable ancestor: for example, master~2 means the grandparent of the tip of the master branch, favoring the first parent in cases of ambiguity. These specifiers can be chained arbitrarily. For example:\n\nHEAD^^^, HEAD~~~, or HEAD~3 all refer to the great-grandparent commit, three generations back.\n\nHEAD^3 is different: it means the third immediate parent of a merge commit — and strains the analogy to biology.\n\n\ntopic~3^2 starts at the tag or tip of the branch named topic, goes three generations back, and selects that merge commit’s (the great-grandparent’s) second immediate parent — the great-great-grandfather if you think of git history as being primarily matrilineal.\n\nSee also:\n\nWhat’s the difference between HEAD^ and HEAD~ in Git?\n“Specifying Revisions” in git rev-parse --help"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Automatically delete git branch after merge to master\n\nWe will be attempting a work flow in github where every ticket is a branch off of master.\nAfter the ticket is complete, the work is merged into staging where regression and integration tests are performed before it is merged into master.\nA team lead brought up the issue of the old ticket branches after a merge will start to build up. \nI found this script and want to know if this would work in our environment. We only want to delete branches that have been merged into master."}, {"role": "assistant", "content": "Github has released a feature where anyone with admin permission to the repository can configure branches to get deleted automatically after pull requests are merged. Here are the steps -\n\nNavigate to main page of the repository and click on Settings.\nUnder \"Merge button\", you can select or unselect \"Automatically delete head branches\" option.\n\nThis feature has been released by Github on July 31, 2019."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-config - Get and set repository or global options gitcvs.dbDriver"}, {"role": "assistant", "content": "Used Perl DBI driver. You can specify any available driver\nfor this here, but it might not work. git-cvsserver is tested\nwith DBD::SQLite , reported to work with DBD::Pg , and\nreported not to work with DBD::mysql . Experimental feature.\nMay not contain double colons ( : ). Default: SQLite .\nSee git-cvsserver ."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-pull - Fetch from and integrate with another repository or a local branch --[no-]all"}, {"role": "assistant", "content": "Fetch all remotes. This overrides the configuration variable fetch.all ."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git - the stupid content tracker"}, {"role": "assistant", "content": "SYNOPSIS git [-v | --version] [-h | --help] [-C ] [-c =]\n [--exec-path[=]] [--html-path] [--man-path] [--info-path]\n [-p|--paginate|-P|--no-pager] [--no-replace-objects] [--bare]\n [--git-dir=] [--work-tree=] [--namespace=]\n [--config-env==] []"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-merge-base - Find as good common ancestors as possible for a merge"}, {"role": "assistant", "content": "DESCRIPTION git merge-base finds the best common ancestor(s) between two commits to use\nin a three-way merge. One common ancestor is better than another common\nancestor if the latter is an ancestor of the former. A common ancestor\nthat does not have any better common ancestor is a best common\nancestor , i.e. a merge base . Note that there can be more than one\nmerge base for a pair of commits."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Found a swap file by the name\nWhen I try to merge my branch with a remote branch:\ngit merge feature/remote_branch\n\nI got this message:\nE325: ATTENTION\nFound a swap file by the name \".git/.MERGE_MSG.swp\"\n owned by: xxxxxx dated: Mon Nov 12 23:17:40 2012\n file name: ~xxxxxx/Desktop/My-ios-App/.git/MERGE_MSG\n modified: YES\n user name: xxxxxx host name: unknown-b8-8d-12-22-27-72.lan\n process ID: 1639\nWhile opening file \".git/MERGE_MSG\"\n dated: Tue Nov 13 14:06:48 2012\n NEWER than swap file!\n\n(1) Another program may be editing the same file.\n If this is the case, be careful not to end up with two\n different instances of the same file when making changes.\n Quit, or continue with caution.\n\n(2) An edit session for this file crashed.\n If this is the case, use \":recover\" or \"vim -r .git/MERGE_MSG\"\n to recover the changes (see \":help recovery\").\n If you did this already, delete the swap file \".git/.MERGE_MSG.swp\"\n to avoid this message.\n\nSwap file \".git/.MERGE_MSG.swp\" already exists!\n[O]pen Read-Only, (E)dit anyway, (R)ecover, (D)elete it, (Q)uit, (A)bort:\n\nHow to deal with this?"}, {"role": "assistant", "content": "Looks like you have an open git commit or git merge going on, and an editor is still open editing the commit message.\nTwo choices:\n\nFind the session and finish it (preferable).\nDelete the .swp file (if you're sure the other git session has gone away).\n\nClarification from comments:\n\nThe session is the editing session.\nYou can see what .swp is being used by entering the command :sw within the editing session, but generally it's a hidden file in the same directory as the file you are using, with a .swp file suffix (i.e. ~/myfile.txt would be ~/.myfile.txt.swp)."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git pull keeping local uncommitted changes\nHow can I safely update (pull) a git project, keeping specific files untouched, even if there's upstream changes?\nmyrepo/config/config.php\nIs there a way, of, even if this file was being changed on remote, when I git pull, everything else is updated, but this file is unchanged (not even merged)?\nPS. I need to do what I am asking because I'm only writing git-based deploy scripts. I cannot change config files to templates.\nso, I need way to write update scripts that does not lose what was locally changed. I was hoping for something as simple as:\ngit assume-remote-unchanged file1\ngit assume-remote-unchanged file2\n\nthen git pull"}, {"role": "assistant", "content": "There is a simple solution based on Git stash. Stash everything that you've changed, pull all the new stuff, apply your stash.\ngit stash\ngit pull\ngit stash pop\n\nOn stash pop there may be conflicts. In the case you describe there would in fact be a conflict for config.php. But, resolving the conflict is easy because you know that what you put in the stash is what you want. So do this:\ngit checkout --theirs -- config.php"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "how to close a branch in git\nWhen I know I won't use a branch any more is it possible to close or lock it? Actually I would like to close a branch but I don't think it is possible to close a branch with GIT. what about the delete. What happens to my history when I delete a branch?"}, {"role": "assistant", "content": "Updated Answer\nAs @user3159253 stated in comments of this answer :\n\ngit garbage-collects commits which aren't referenced, directly or indirectly, by a named reference (branch, tag, etc). That is why it is important to leave a reference to a freezed branch.\n\n\nYou can tag the tip of the branch by archiving it, and then delete the branch.\ngit tag archive/ \ngit branch -d \ngit checkout master\n\nThe branch will be deleted, and can be retrieved later by checking out the tag, and recreating the branch.\ngit checkout archive/\ngit checkout -b new_branch_name\n\nOr more simply :\ngit checkout -b new_branch_name archive/"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Why does Git use SHA-1 as version numbers?\nGit uses SHA-1 for the user to refer a commit.\nSubversion (SVN) and Mercurial (hg) use an incremental number.\nWhy did the Git team make that design decision of using SHA-1 instead of something more descriptive?"}, {"role": "assistant", "content": "Mercurial (hg) also uses SHA1 hashes. It just also tries to get revision numbers out of the commit history. However, these revisions are only valid in one repository. If you watch another repo, these revisions are not guaranteed to match.\nAs to why git and mercurial use hashes: both have a non-linear commit history. because both are distributed, people can work on the same code basis in their local repositories without having to synchronize to a central authority (as required by SVN and CVS). Now if people commit their stuff locally and merge them later, you will have a hard time to come up with a consistent schema to form linearly increasing integer revisions. And even if you could, you would still get different result between different repos.\nIn the end, it's all because of the distributed nature. It is a simple way to come up with rather unique identifiers to commits. And as a side-product you can also encode the complete history towards a single commit into the hash. Which means, even if you have the same diff in a commit, you probably will get different SHA1 hashes."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-diff - Show changes between commits, commit and working tree, etc git-diff-tree [-r] […​]"}, {"role": "assistant", "content": "compares the trees named by the two arguments."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "how to include git commit-number into a c++ executable?\ni use git as a version tracker for my c++ project. \nsometimes i need to repeat a calculation and i would like to know which version of the program i used.\nwhat would be a good way to put a # of the commit into the main executable? in other words. i'd like the program to tell me the # of the current commit in an introductory message as i run the program.\none way i can think of is to make the c++ program lunch \"git log\" from shell and extract the commit # but i'm not sure how to do it during make.\n(I use linux)"}, {"role": "assistant", "content": "Probably the easiest way to do this would be to add to your makefile a rule to generate a .c file with the current git commit ID:\ngitversion.c: .git/HEAD .git/index\n echo \"const char *gitversion = \\\"$(shell git rev-parse HEAD)\\\";\" > $@\n\nNow simply add gitversion.c to your build process as normal. Make sure to remove it on make clean, and add it to .gitignore so it's not added to the git repository accidentally. Add an extern const char *gitversion; to a header somewhere, and you can access it like that."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How to copy a file from the repository, into the Docker container used for a job, in gitlab-ci.yml\n\nHow can I add a file from my project into a Docker using in a gitlab-ci job. Suppose I have below job in my .gitlab-ci.yml .\nbuild:master:\n image: ubuntu:latest\n script:\n - cp sample.txt /sample.txt\n stage: build\n only:\n - master\n\nHow to copy a sample.txt inside Ubuntu image? I was thinking as it is already a running container so we can't perform copy command directly but have to run\ndocker cp sample.txt mycontainerID:/sample.txt\n\nbut again how will I get mycontainerID? because it will be running inside a Gitlab runner and any random id will be assigned for every run. Is my assumption is wrong?"}, {"role": "assistant", "content": "The file is already inside the container. If you read carefully through the CI/CD build log, you will see at the very top after pulling the image and starting it, your repository is cloned into the running container.\nYou can find it under /builds//\n(note that these are examples, and you have to adjust to your actual organization and repository name)\nOr with the variable $CI_PROJECT_DIR\nIn fact, that is the directory you are in when starting the job.\nFor example, this .gitlab-ci.yml:\nimage: alpine\n\ntest:\n script:\n - echo \"the project directory is - $CI_PROJECT_DIR\"\n - cat $CI_PROJECT_DIR/README.md ; echo\n - echo \"and where am I? - $PWD\"\n\nreturns this pipeline output:\n\nAs you can see, I could print out the content of the README.md, inside the container."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Converting git repository to shallow?\nHow can I convert an already cloned git repository to a shallow repository?\nThe git repository is downloaded through a script outside of my control so I cannot do a shallow clone.\nThe reason for doing this is to save disk space. (Yes, I'm really short on disk space so even though a shallow repository doesn't save much, it is needed.)\nI already tried \ngit repack -a -d -f -depth=1\n\nBut that actually made the repository larger."}, {"role": "assistant", "content": "First, you may need to remove tags (as they prevent GC of tagged commits), like:\ngit tag -d $(git tag -l)\n\nThen, this worked for me:\ngit pull --depth 1\ngit gc --prune=all\n\nWhich still leaves the reflog laying around, which like the tags references additional commits that can use up space. Note that I would not erase the reflog unless severely needed: it contains local change history used for recovery from mistakes.\nThere are additional commands on how to erase the reflog in the comments below, and a link to a similar question with a longer answer.\nIf you still have a lot of space used, ensure you removed the tags, which you should try first before removing the reflog."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git - the stupid content tracker GIT_WORK_TREE"}, {"role": "assistant", "content": "Set the path to the root of the working tree.\nThis can also be controlled by the --work-tree command-line\noption and the core.worktree configuration variable."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-show - Show various types of objects ignore-space-at-eol"}, {"role": "assistant", "content": "Ignore changes in whitespace at EOL."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-ls-tree - List the contents of a tree object objectname"}, {"role": "assistant", "content": "The name of the object."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Is it possible in Gitlab UI to run a skipped item of the pipeline?\n\nI have a pipeline on Gitlab that have multiple steps. One step in the middle is optional but configured as mandatory and today it started to fail.\nIn Gitlab UI when it fails all next pipeline items are marked as skipped and greyed out.\nIs it possible to run manually in UI a next step after the failed one?"}, {"role": "assistant", "content": "Why it's not directly possible\nCI pipelines are designed with a strong emphasis on dependency management. When a job in a pipeline fails, subsequent jobs are marked as skipped because they may rely on the output or success of the failed job. (Forcing execution could lead to unexpected errors.)\nWorkaround using allow_failure\nYou can mark a job as \"allowed to fail\" in your config. This way, subsequent jobs are not influenced by the status of this job.\nallow_failure: true \n\nImportant: Subsequent jobs should obviously not strictly depend on the job's successful completion and/or have built-in error handling.\nhttps://docs.gitlab.com/ee/ci/yaml/#allow_failure"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Which is the best git hosting sw? - Gitolite vs. Gitlab vs. Gitorius [closed]\n\nClosed. This question is opinion-based. It is not currently accepting answers.\n \n \n\n\n\n\n\n\n\n\n\n\n\nWant to improve this question? Update the question so it can be answered with facts and citations by editing this post.\n\n\nClosed 10 years ago.\n\n\n\n\n\n\n\n Improve this question\n \n\n\n\nI am looking for a git hosting environment for several users. Therefore i've searched for comparisons between Gitolite, Gitlab and Gitorius. But i get nothing what could be useful.\nIs there anybody, who has experiences with different hosting tools and could provide an advice?"}, {"role": "assistant", "content": "Gitolite is not a git hosting environment: it is an authorization layer, which grants or denies access to a git repo.\nIt is the https or ssh layer which allows the authentication of a user, and the git repo hosting itself.\nSee \"How do programs like gitolite work?\"\nGitLab and Gitorious both provide git hosting, with (to my opinion) an easier installation process and more features for GitLab.\n\nWhen comparing GitLab features and Gitorious features, the issue tracker is more complete, the fork and authorization levels are present, GitLab has teams and groups, webhooks, and API.\nThe development is more active (one release every month) on GitLab. \nUpdate: GitLab has acquired Gitorious"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Mercurial <--> git cheat sheet? [closed]\nClosed. This question is off-topic. It is not currently accepting answers.\n \n \n\n\n\n\n\n\n\n\n\n\n\nWant to improve this question? Update the question so it's on-topic for Stack Overflow.\n\n\nClosed 11 years ago.\n\n\n\n\n\n\n\n Improve this question\n \n\n\n\nIs there a cheat sheet or wiki page out there which relates hg commands to git commands, and vise-versa?\nI'd like to know for two reasons: first, I'd like to be able to translate git-speak1 into Mercurial, and second I'd like to be aware of the subtle differences between similar-sounding commands (eg, hg pull and git pull).\n1 case in point: git push origin :refs/heads/foo"}, {"role": "assistant", "content": "Git hg rosetta stone is pretty extensive"}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-reset - Reset current HEAD to the specified state --mixed"}, {"role": "assistant", "content": "Resets the index but not the working tree (i.e., the changed files\nare preserved but not marked for commit) and reports what has not\nbeen updated. This is the default action. If -N is specified, removed paths are marked as intent-to-add (see git-add )."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Why can't eclipse resolve class in same package?\nI hit F5 ~1000 times and restarted eclipse (also with -clean), deleted /bin, but nothing helps. Manually importing DoodleClient does not help. DoodleClient exists and is perfectly fine, everything worked before. Clicking on \"Import 'DoodleClient' ...\" does nothing.\nWhat I did before this problem occured:\n\nI added *.class to .gitignore\ngit rm *.class\nOn the next pull, hunderts of .class files were deleted by git"}, {"role": "assistant", "content": "Alternatively, you can highlight the project :\nChoose Clean ... from Project menu and if you have activated the Build Automatically option (in the same menu), the classes will be generated anew."}]} {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "git-checkout - Switch branches or restore working tree files git checkout [-f|--ours|--theirs|-m|--conflict=