messages
listlengths
3
3
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How can I sync documentation with Github Pages?\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 <section> or <article> 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<link rel='stylesheet' href='stylesheets/stylesheet.css' />\n\nThis needs to be changed to\n\n<link rel='stylesheet' href='{{ site.path }}/stylesheets/stylesheet.css' />\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." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Do git update-index --assume-unchanged rules propagate to clients on pull?\nThere are instances where I can't use a .gitignore file, otherwise, on git push, critical files are purged from the remote. In these cases, I apply git update-index --assume-unchanged <file> to the files that I want to ignore.\nAfter applying the assume-unchanged rules and calling git push, will these rules be attached to the remote branch so that all subsequent pulls (from other clients) will inherit them? Or, must these clients also run the git update-index --assume-unchanged <file> commands individually at their machines?\nIf the commands are not inherited -- has anybody written a server hook for this before? Instead of mandating that all current and future clients safeguard against it?" }, { "role": "assistant", "content": "The index is local to your workstation, any changes you make there do not propagate to other clones of the same remote.\n(updated, after question was updated)\nThe .gitignore file\n\nThere are instances where I can't use a .gitignore file, otherwise, on git push, critical files are purged from the remote.\n\nThis is not true. The git ignore file does not affect files that are already tracked in the repository. If you add a file to .gitignore after it has been committed, it'll stay inside the repository; it will not be purged. In fact, it behaves pretty much as if it weren't ignored at all.\nYou can easily check this in a temporary repository:\n$ mkdir -p /tmp/repo\n$ cd /tmp/repo\n$ git init\nInitialized empty Git repository in /tmp/repo/.git/\n$ echo red > a.txt\n$ git commit -am '1'\n 1 file changed, 1 insertion(+)\n create mode 100644 a.txt\n$ echo a.txt > .gitignore\n$ echo b.txt >> .gitignore\n$ git commit -am '2'\n 1 file changed, 2 insertions(+)\n create mode 100644 .gitignore\n\nThe repository now contains two files: a.txt and .gitignore. Both behave normally, which you can see when you clone it:\n$ cd ..\n$ git clone file://repo repo2\n$ ls -A repo2\n.git .gitignore a.txt\n$ cd repo\n\nIf we modify both ignored files and request git status, we'll see that a.txt is seen as modified, despite having been gitignored. We can add and commit it as normal; in fact, if you add an tracked file to gitignore, it behaves pretty much like it's not in gitignore at all.\n$ echo green > a.txt\n$ echo blue > b.txt\n$ git status --short\n M a.txt\n$ git add a.txt\n\nThe b.txt file is different, because it was ignored before git started tracking it. This file will not normally make it into the repository, but we can force it if we want to.\n$ git add b.txt\nThe following paths are ignored by one of your .gitignore files:\nb.txt\nUse -f if you really want to add them.\nfatal: no files added\n$ git add -f b.txt\n\nIssuing git commit now commits two files that have both been git ignored:\n$ git commit -m '3'\n 2 files changed, 1 insertion(+), 1 deletion(-)\n create mode 100644 b.txt\n\nLong story short, think of git ignore rules as guidelines :-)\nPropagating assume-unchanged\n\nAfter applying the assume-unchanged rules and calling git push, will these rules be attached to the remote branch so that all subsequent pulls (from other clients) will inherit them? Or, must these clients also run the git update-index --assume-unchanged commands individually at their machines?\n\nThe latter. Closest you can get is add a shell script to the repository that makes the changes for you.\nThe server hook?\n\nIf the commands are not inherited -- has anybody written a server hook for this before? Instead of mandating that all current and future clients safeguard against it?\n\nIf your aim is to write a server hook that removes the critical files as if they weren't part of the push at all, that's not possible. Git push deals primarily with commit objects (and refs). Their dependent objects, like trees and blobs, are transferred as needed, subject to reachability from a commit. What it boils down to is that, if it's not committed, you can't push it to a remote (that's an oversimplification, but it holds true for the files in the repository). In addition, git commits are cryptographically guarded. You can't change a commit without changing its commit hash, and if you change the commit hash, you basically have a different, new commit (that may happen to have the same diff as the old one).\nThis means that the server can't rewrite commits; at least not without seriously confusing the client that did the push (which will still have a copy of the old commit objects).\nWhat you can do is write a post-receive hook that refuses the commits if they contain the files you don't want to have updated. This doesn't really solve your problem, because if you have trouble explaining git commit --assume-unchanged to your coworkers, then you'll likely have even more trouble explaining how they can use interactive rebase to recreate their commits without the undesirable files in them.\nLong story short, I think chasing everybody to keep using assume-unchanged (maybe combined with a post-receive hook) is your least bad choice if you're dealing with files that should be committed once and never thereafter, like you have now.\nA possible work-around\nYour life would become a whole lot easier if you can keep these files out of git in their entirety. One of the things I can think of:\n\nmove the files within the repository to a lib directory, where they don't get modified all the time\n.gitignore the files in their definitive location, the one where they have to be but get unwanted changes all the time\nadd an \"init\" script to your repository that people need to run once after cloning and before starting work. This script copies the files into the right location." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to mirror a GitLab repository to GitHub using SSH keys?\n\nGitLab has a mirror feature:\nhttps://docs.gitlab.com/ee/user/project/repository/mirror/\nand GitHub does not support simple password authentication. I tried to follow\nhttps://meesvandongen.nl/posts/mirror-gitlab-github\nUsing the target url\nssh://[email protected]:stefaneidelloth/mirror_demo.git\n\nand SSH public key as authentication method.\nHowever, I get an error\nRemote mirrors url is blocked: URI is invalid \n\nfrom GitLab.\nIf I specify the target url\nhttps://github.com/stefaneidelloth/mirror_demo.git\n\nI am not able to select SSH public key as authentication method.\n=> What are the right settings to mirror a GitLab project to a GitHub project (without PREMIUM edition of GitLab)?\nEdit\nThe second : needs to be replaced with a /.\nSuggested by GitHub:\n\nAdding ssh:// prefix is not enough.\nWrong: ssh://[email protected]:stefaneidelloth/mirror_demo.git\nStill need to replace : after github.com:\nRight: ssh://[email protected]/stefaneidelloth/mirror_demo.git\nThen GitLab generates the SSH key for the connection and one needs to copy it to the GitHub project settings (not the user settings), see https://meesvandongen.nl/posts/mirror-gitlab-github\nNow I get the next error:\n13:get remote references: create git ls-remote: exit status 128, stderr: \"ssh connect to host github.com port 22: Connection timed out\\r\\nfatal: Could not read from remote repository.\\n\\nPlease make sure you have the correct access rights\\nand the repository exists.\\n\".\n\na) Do I need to specify a different port than 22? How? I tried\nssh://[email protected]:443/stefaneidelloth/mirror_demo.git\n\nbut that did not help.\nb) Do I need to use \"Input host keys manually\"? What should be specified? I tried to use\nSHA256:uNiVztksCsDhcc0u9e8BujQXVUpKZIDTMczCvj3tD2s\nfrom\nhttps://docs.github.com/en/authentication/keeping-your-account-and-data-secure/githubs-ssh-key-fingerprints\nbut that did not help.\nc) I also tried to generate a GitHub AccessToken in the user settings and apply it for the password option of the GitLab Mirror settings. I tried both, https:// and git:// urls. No success." }, { "role": "assistant", "content": "I got this to work after all.\n\nYes, you need to manually edit the git SSH URL, as you have shown:\nssh://[email protected]/stefaneidelloth/mirror_demo.git\nSelect SSH public key as authentication method.\nThen click mirror repository button\nCopy the SSH key generated as shown here: https://meesvandongen.nl/posts/mirror-gitlab-github and https://docs.gitlab.com/ee/user/project/repository/mirror/push.html#set-up-a-push-mirror-from-gitlab-to-github\nThe key then needs to be added as a Deploy Key to the GitHub Repo, which is done from Settings > Deploy Keys (see figure below)\nClick refresh on the mirror. Note that when I first did this, nothing happened, no errors, but also no update. I did it four times and still nothing happened. Then about 27 minutes later, the update happened." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "BitBucket - download source as ZIP\nI know I can get the project through git clone command, but is there any way, how to download the project through the web interface from BitBucket.org?\nIn the best way, I am looking for a way to download a project source as ZIP compress file." }, { "role": "assistant", "content": "For the latest version of Bitbucket (2016+), the download link can be found in the Download menu item.\n\n\nPre-2016\nFirst method\nIn the Overview page of the repo, there is a link to download the project. \n\n\nSecond method\nGo to Downloads -> Branches -> Download the branch that you want (as .zip, .gz or .bz2). There you'll find download links for all tags. The links will be in the format:\nhttps://bitbucket.org/owner/repository/get/v0.1.2.tar.gz\n\nBy tweaking it a little bit, you can also have access to any revision by changing the tag to the commit hash:\nhttps://bitbucket.org/owner/repository/get/A0B1C2D.tar.gz" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-rebase - Reapply commits on top of another base tip --empty=(drop|keep|stop)" }, { "role": "assistant", "content": "How to handle commits that are not empty to start and are not\nclean cherry-picks of any upstream commit, but which become\nempty after rebasing (because they contain a subset of already\nupstream changes): drop The commit will be dropped. This is the default behavior. keep The commit will be kept. This option is implied when --exec is\nspecified unless -i / --interactive is also specified. stop ask The rebase will halt when the commit is applied, allowing you to\nchoose whether to drop it, edit files more, or just commit the empty\nchanges. This option is implied when -i / --interactive is\nspecified. ask is a deprecated synonym of stop . Note that commits which start empty are kept (unless --no-keep-empty is specified), and commits which are clean cherry-picks (as determined\nby git log --cherry-mark ... ) are detected and dropped as a\npreliminary step (unless --reapply-cherry-picks or --keep-base is\npassed). See also INCOMPATIBLE OPTIONS below." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-log - Show commit logs -c" }, { "role": "assistant", "content": "Produce combined diff output for merge commits.\nShortcut for --diff-merges=combined -p ." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to modify someone else's Github pull request?\n\nSomeone created a pull request on my Github repo. It mostly looks good, but I had to make a few minor changes to get it to pass my continuous integration server.\nGithub's on-screen instructions to \"review\" the request were to run:\ngit checkout -b otheruser-fix_somebug\ngit pull https://github.com/otheruser/myrepo.git fix_somebug\n\nI then made my changes, and committed locally. However, when I went to run git push, git informed me:\nfatal: The current branch otheruser-fix_somebug has no upstream branch.\nTo push the current branch and set the remote as upstream, use\n\n git push --set-upstream origin otheruser-fix_somebug\n\nwhich I did, but my changes are not showing under the pull request, but instead under a copy of the branch otheruser-fix_somebug mirrored on my Github repo and unconnected to the pull request.\nHow should I have called git push to get the changes to appear on the pull request?" }, { "role": "assistant", "content": "To my knowledge, you can only do this if they grant you permission. In the past this was only possible by them adding you as a contributor on their fork, however, in September 2016, GitHub added a feature for exactly this use case, allowing the person requesting the Pull Request to give permission to the maintainer(s) of the upstream repository simply by marking a checkbox.\nYou can make a comment on the Pull Request, telling them that their are some issues you'd like to fix before merging the Pull Request, and stating that you'd like them to give you permission to commit to their Pull Request branch by checking the \"Allow edits from maintainers\" checkbox on the Pull Request, and giving them a link to the GitHub Help page about the feature, so they can see exactly how to enable it. Once they've done so, you can push to the Pull Request branch of their repository directly.\n\nThings you can do if they haven't/won't give you write access to their pull request branch:\n\nMake comments on their Pull Request:\n\nGo to the Pull Request in your browser\nScroll to the bottom of the \"Conversation\" (default) page\nPost comments describing the changes they need to make before you'll accept the PR.\n\nMake comments on the code in their Pull Request:\n\nGo to the Pull Request in your browser\nClicking the \"Files changed\" link at the top\nHover over a line of code that should be changed\nClicking the little blue \"+\" button that appears next to it\n(NB: these only appear on changed, and nearby lines)\nPost a comment and/or some code to fix what's there\nRepeat 3-5 as needed.\n\nAccept it as is, then fix it in your own repository\n\nMerge their branch as if there was nothing wrong with it\nMake a new commit to your repository that fixes the issues (preferably mentioning the PR by issue id in your commit message so that GitHub can tell it's related and show it in the PR's Conversation page)" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Added pod files and pushed. How to undo? how to use gitignore in Xcode & github?\n\nThis is a two part question:\n1) I have added committed and pushed all pod files to github. Is there a way I can remove them and not push them again to github?\n2) I know gitignore can help, but I don't know how to use it. Can anyone please walk me through the process of using gitignore? \nso I think what I can do is, get the project from github, add gitignore, and then push again. is that correct? \nPlease help, new to github & Xcode." }, { "role": "assistant", "content": "That's correct, you need to add the Pods directory to your .gitignore\n1) Remove your files from your github repository:\ngit rm -r Pods/\n\nand don't forget to commit and push\n2) Create a gitignore file:\n\nOpen terminal and go through your project folder where the .git folder is located\nType touch .gitignore\nType echo \"Pods/\" > .gitignore\n\n3) (Added from Gabriel's comment) Last step, remove them from the remote:\ngit rm -r --cache Pods/\n\nMore informations : here" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-commit - Record changes to the repository -m <msg> --message=<msg>" }, { "role": "assistant", "content": "Use the given <msg> as the commit message.\nIf multiple -m options are given, their values are\nconcatenated as separate paragraphs. The -m option is mutually exclusive with -c , -C , and -F ." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How do I turn off automatic notification subscription for new repositories in a single organization on Github?\n\nWhen I create a new repository in a Github organization, all the organization owners get automatically subscribed to that repository's notification.\nI'm going to be making a lot of repositories for archival purposes. I would like to turn auto subscribe off, not just for me but for everyone in the org. I would also like to avoid sending out the initial \"you have been automatically subscribed\" email. I can't find anything in the Github API or organization settings to do this.\nHey there, we're just writing to let you know that you've been automatically subscribed to a repository on GitHub.\n\n gitpan-test/Acme-LookOfDisapproval created by gitpan-test-account\n Read-only release history for Acme-LookOfDisapproval\n https://github.com/gitpan-test/Acme-LookOfDisapproval\n\nYou'll receive notifications for all issues, pull requests, and comments that happen inside the repository. If you would like to stop watching this repository, you can manage your settings here:\n\n https://github.com/gitpan-test/Acme-LookOfDisapproval/subscription\n\nYou can unwatch this repository immediately by clicking here:\n\n https://github.com/gitpan-test/Acme-LookOfDisapproval/unsubscribe_via_email/blahblahblah\n\nYou were automatically subscribed because you've been given push access to the repository.\n\nThanks!" }, { "role": "assistant", "content": "Go to your profile settings\nClick Notification Center\nUncheck Automatically watch repositories" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Add Image to GitHub Readme.md from Google Drive\n\nI have the image in Drive, How could it be added to the Readme.md so as to display the image in readme.\nI had tried with the shared link, but it isn't working." }, { "role": "assistant", "content": "For example, I have a.jpg on the google drive.\n\nRight click the image and click Share...\nClick Advanced and change the Who can access option to Public on the web - Anyone on the Internet\nCopy the link to share and you will have something like \n\n\nhttps://drive.google.com/file/d/<FILE_ID>/view?usp=sharing\n\nCopy the <FILE_ID> to make a link like this: \n\n\nhttps://drive.google.com/uc?export=view&id=<FILE_ID>\n\nInsert image in Markdown as ususal using the link from step 4. For example: \n![image](https://drive.google.com/uc?export=view&id=<FILE_ID>)\n\nExample: I have this octocat image in google, and its file id is 1913oZeBZPBNiUuk8gu3ZSbLBA2l_VQtG. You can try ![image](https://drive.google.com/uc?export=view&id=1913oZeBZPBNiUuk8gu3ZSbLBA2l_VQtG) in your markdown file or even in this answer.\n\nHope this helps." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-daemon - A really simple server for Git repositories selectively enable/disable services per repository" }, { "role": "assistant", "content": "To enable git archive --remote and disable git fetch against\na repository, have the following in the configuration file in the\nrepository (that is the file config next to HEAD , refs and objects ). [daemon]\n\t\tuploadpack = false\n\t\tuploadarch = true" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Ignoring any 'bin' directory on a git project\nI have a directory structure like this:\n.git/\n.gitignore\nmain/\n ...\ntools/\n ...\n...\n\nInside main and tools, and any other directory, at any level, there can be a 'bin' directory, which I want to ignore (and I want to ignore everything under it too). I've tried each of these patterns in .gitignore but none of them work:\n/**/bin/**/*\n/./**/bin/**/*\n./**/bin/**/*\n**/bin/**/*\n*/bin/**/*\nbin/**/*\n/**/bin/* #and the others with just * at the end too\n\nCan anyone help me out? The first pattern (the one I think should be working) works just fine if I do this:\n/main/**/bin/**/*\n\nBut I don't want to have an entry for every top-level directory and I don't want to have to modify .gitignore every time I add a new one. There are also files and directories that have the substring 'bin' in their names, which I want to keep.\nThis is on Windows using the latest msysgit." }, { "role": "assistant", "content": "Before version 1.8.2, ** didn't have any special meaning in the .gitignore. As of 1.8.2 git supports ** to mean zero or more sub-directories (see release notes).\nThe way to ignore all directories called bin anywhere below the current level in a directory tree is with a .gitignore file with the pattern:\nbin/\n\nIn the man page, there an example of ignoring a directory called foo using an analogous pattern.\nIf you already have any bin folders in your git index which you no longer wish to track then you need to remove them explicitly. Git won't stop tracking paths that are already being tracked just because they now match a new .gitignore pattern. Execute a folder remove (rm) from index only (--cached) recursivelly (-r). Command line example for root bin folder:\ngit rm -r --cached bin" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-status - Show the working tree status --ignore-submodules[=<when>]" }, { "role": "assistant", "content": "Ignore changes to submodules when looking for changes. <when> can be\neither \"none\", \"untracked\", \"dirty\" or \"all\", which is the default.\nUsing \"none\" will consider the submodule modified when it either contains\nuntracked or modified files or its HEAD differs from the commit recorded\nin the superproject and can be used to override any settings of the ignore option in git-config or gitmodules . When\n\"untracked\" is used submodules are not considered dirty when they only\ncontain untracked content (but they are still scanned for modified\ncontent). Using \"dirty\" ignores all changes to the work tree of submodules,\nonly changes to the commits stored in the superproject are shown (this was\nthe behavior before 1.7.0). Using \"all\" hides all changes to submodules\n(and suppresses the output of submodule summaries when the config option status.submoduleSummary is set)." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Dynamically Fill Jenkins Choice Parameter With Git Branches In a Specified Repo\nI have a parameterized Jenkins job which requires the input of a specific Git branch in a specific Git repo. Currently this parameter is a string parameter.\nIs there any way to make this parameter a choice parameter and dynamically fill the drop down list with the Git branches? I don't want to require someone to maintain this choice parameter by manually configuring the drop down every time a new branch is created." }, { "role": "assistant", "content": "I tried a couple of answers mentioned in this link, but couldn't figure out how to tell Jenkins about the user-selected branch. As mentioned in my previous comment in above thread, I had left the branch selector field empty. \nBut, during further investigations, I found another way to do the same thing - https://wiki.jenkins-ci.org/display/JENKINS/Git+Parameter+Plugin\nI found this method was a lot simpler, and had less things to configure!\nHere's what I configured - \n\nInstalled the git parameter plugin\nChecked the 'This build is parameterized' and added a 'Git parameter'\nAdded the following values: \nThen in the git SCM section of the job I added the same value mentioned in the 'Name' section, as if it were an environment variable. (If you read the help for this git parameter plugin carefully, you will realize this)\n\n\nAfter this I just ran the build, chose my branch(Jenkins checks out this branch before building) and it completed the build successfully, AND by choosing the branch that I had specified." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-gc - Cleanup unnecessary files and optimize the local repository gc.auto" }, { "role": "assistant", "content": "When there are approximately more than this many loose\nobjects in the repository, git gc --auto will pack them.\nSome Porcelain commands use this command to perform a\nlight-weight garbage collection from time to time. The\ndefault value is 6700. Setting this to 0 disables not only automatic packing based on the\nnumber of loose objects, but also any other heuristic git gc --auto will\notherwise use to determine if there’s work to do, such as gc.autoPackLimit ." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to sort git tags by version string order of form rc-X.Y.Z.W?\nWhen I enter a command:\ngit tag -l\n\nI get such results:\nrc-0.9.0.0\nrc-0.9.0.1\nrc-0.9.0.10\nrc-0.9.0.11\nrc-0.9.0.12\nrc-0.9.0.2\nrc-0.9.0.3\nrc-0.9.0.4\nrc-0.9.0.5\nrc-0.9.0.6\nrc-0.9.0.7\nrc-0.9.0.8\nrc-0.9.0.9\n\nInstead of this I want:\nrc-0.9.0.0\nrc-0.9.0.1\nrc-0.9.0.2\nrc-0.9.0.3\nrc-0.9.0.4\nrc-0.9.0.5\nrc-0.9.0.6\nrc-0.9.0.7\nrc-0.9.0.8\nrc-0.9.0.9\nrc-0.9.0.10\nrc-0.9.0.11\nrc-0.9.0.12\n\nHow it's possible to sort current list to get such results?" }, { "role": "assistant", "content": "Use version sort\ngit tag -l | sort -V\n\nor for git version >= 2.0\ngit tag -l --sort=v:refname\ngit tag -l --sort=-v:refname # reverse" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-config - Get and set repository or global options tag.gpgSign" }, { "role": "assistant", "content": "A boolean to specify whether all tags should be GPG signed.\nUse of this option when running in an automated script can\nresult in a large number of tags being signed. It is therefore\nconvenient to use an agent to avoid typing your gpg passphrase\nseveral times. Note that this option doesn’t affect tag signing\nbehavior enabled by \"-u <keyid>\" or \"--local-user=<keyid>\" options." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git - the stupid content tracker" }, { "role": "assistant", "content": "FURTHER DOCUMENTATION See the references in the \"description\" section to get started\nusing Git. The following is probably more detail than necessary\nfor a first-time user. The Git concepts chapter of the\nuser-manual and gitcore-tutorial both provide\nintroductions to the underlying Git architecture. See gitworkflows for an overview of recommended workflows. See also the howto documents for some useful\nexamples. The internals are documented in the Git API documentation . Users migrating from CVS may also want to\nread gitcvs-migration ." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-fetch - Download objects and refs from another repository fetch.fsckObjects" }, { "role": "assistant", "content": "If it is set to true, git-fetch-pack will check all fetched\nobjects. See transfer.fsckObjects for what’s\nchecked. Defaults to false. If not set, the value of transfer.fsckObjects is used instead." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to move master to HEAD?\n* [971f835] (HEAD, original_idea) Now working here. Some comment 9\n* [692b673] Some comment 8\n* [3ebff62] Reverted to original idea. Some comment 7\n| * [72ea01d] (master) Decided it wasn't worth the effort. Some comment 6\n| * [985c1ad] Some comment 5\n| * [4d7d491] Some comment 4\n| * [0c697bb] Branched to try an idea. Some comment 3\n|/\n* [7280b1f] Some comment 2\n* [5c2c6d0] Some comment 1\n* [bc7aac6] Initial commit\n\nSo, master got left behind. Not sure how that happened. Once I decided I was done with the branch that didn't work out I checked out [7280b1f] and continued from there.\nHow do I fix this? I this the infamous \"detached head\" issue?\nDoes master have to be aligned with HEAD for optimal health of the repo?\nMy workflow is super-simple. This is just managing a single text file. In the vast majority of cases it's:\ngit add .\ngit commit -am \"Some comment\"\n\nAnd that's it.\nI decided to try an idea and created a branch. When it didn't work out I checked out the root of that branch and went back to the git add/commit routine." }, { "role": "assistant", "content": "If git branch shows that your current branch is original_idea, that wouldn't be a detached HEAD situation.\nBut in any case, if you want your master to reflect your \"current commit\" (which is what HEAD means in Git):\ngit branch -f master HEAD\ngit checkout master\n\nYou would find other alternatives in \"How to I “move” my commits from “no branch” to an actual branch?\".\n\nThe problem with this is that it makes the entire branch currently ending at master disappear.\n\nThen all you need to do is:\n\nmake sure HEAD is referenced by a branch (like original_idea on your schema)\nrebase that branch on top of master:\n\nThat would mean:\ngit checkout original_idea\ngit rebase master\ngit checkout master\ngit merge original_idea" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How do I push a local Git branch to master branch in the remote?\nI have a branch called develop in my local repo, and I want to make sure that when I push it to origin it's merged with the origin/master. Currently, when I push it's added to a remote develop branch. \nHow can I do this?" }, { "role": "assistant", "content": "$ git push origin develop:master\n\nor, more generally\n$ git push <remote> <local branch name>:<remote branch to push into>" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-log - Show commit logs --exclude=<glob-pattern>" }, { "role": "assistant", "content": "Do not include refs matching <glob-pattern> that the next --all , --branches , --tags , --remotes , or --glob would otherwise\nconsider. Repetitions of this option accumulate exclusion patterns\nup to the next --all , --branches , --tags , --remotes , or --glob option (other options or arguments do not clear\naccumulated patterns). The patterns given should not begin with refs/heads , refs/tags , or refs/remotes when applied to --branches , --tags , or --remotes ,\nrespectively, and they must begin with refs/ when applied to --glob or --all . If a trailing /* is intended, it must be given\nexplicitly." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "fatal: unable to access 'https://github.com/xxx': OpenSSL SSL_connect: SSL_ERROR_SYSCALL in connection to github.com:443 [duplicate]\nThis question already has answers here:\n \n \n\n\n\n\nGetting Git to work with a proxy server - fails with \"Request timed out\"\n\n (22 answers)\n \n\nClosed 2 years ago.\n\n\n\nWhen l try to use git push, an error reports: \n\nFatal: fatal: unable to access 'https://github.com/xxx': OpenSSL\n SSL_connect: SSL_ERROR_SYSCALL in connection to github.com:443\n\nMy git version is 2.16.2 for windows\nIt worked well before this day, and reinstalling git seems to not work.\nCan anyone help me with that? Thanks in advance!" }, { "role": "assistant", "content": "If you are behind a proxy, try the following:\ngit config --global --add remote.origin.proxy \"\"" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-for-each-ref - Output information on each ref contents:size" }, { "role": "assistant", "content": "The size in bytes of the commit or tag message." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "gitlab-ci docker-in-docker access to insecure registry\n\nWhen configuring a gitlab-ci for building docker images and pushing them to my gitlab's insecure registry, I encountered several errors. My gitlab-ci.yaml is laid out below:\nstages:\n - build\n - deploy\n\nvariables:\n GIT_SUBMODULE_STRATEGY: recursive\n CONTAINER_IMAGE: XXX:$CI_COMMIT_REF_NAME\n\n# The insecure-registry flag \nservices:\n - docker:dind\n\nbuild_container:\n image: docker:latest\n stage: build\n before_script:\n - echo \"$CI_REGISTRY_PASSWORD\" | docker login -u \"$CI_REGISTRY_USER\" \"$CI_REGISTRY\" --password-stdin\n\n script:\n - docker build --pull -t $CONTAINER_IMAGE .\n - docker push $CONTAINER_IMAGE\n\nThe first error was:\n $ docker login -u gitlab-ci-token -p $CI_JOB_TOKEN myregistry.gitlab.com\n WARNING! Using --password via the CLI is insecure. Use --password-stdin.\n Warning: failed to get default registry endpoint from daemon (Cannot connect \n to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon \n running?). Using system default: https://index.docker.io/v1/\n Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the \n docker daemon running?\n\nThis was resolved by updating the login command to \necho \"$CI_REGISTRY_PASSWORD\" | docker login -u \"$CI_REGISTRY_USER\" myregistry.gitlab.com --password-stdin\n\nUnfortunately after updating, I encountered another error:\n$ echo \"$CI_REGISTRY_PASSWORD\" | docker login -u \"$CI_REGISTRY_USER\" myregistry.gitlab.com --password-stdin\nError response from daemon: Get https://myregistry.gitlab.com/v2/: dial tcp XX.XX.XXX.XXX:443: getsockopt: connection refused\n\nHow Can I resolve this?" }, { "role": "assistant", "content": "Like any other docker installation, it is necessary to instruct the docker daemon to allow connections to insecure registries. In order to do this in the context of the docker-in-docker service, one must pass this configuration to the service. This can be done by updating your gitlab-ci.yaml to specify the service as:\nservices:\n - name: docker:dind\n command: [\"--insecure-registry=myregistry.gitlab.com\"]" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": ".gitignore exclude folder but include specific subfolder\nI have a folder application/, which I add to the .gitignore.\nInside the application/-folder there is a folder application/language/gr.\nHow can I include this folder?\nI've tried this:\napplication/\n!application/language/gr/" }, { "role": "assistant", "content": "If you exclude application/, then everything under it will always be excluded (even if some later negative exclusion pattern (“unignore”) might match something under application/).\nTo do what you want, you have to “unignore” every parent directory of anything that you want to “unignore”. Usually you end up writing rules for this situation in pairs: ignore everything in a directory, but not some certain subdirectory.\n# you can skip this first one if it is not already excluded by prior patterns\n!application/\n\napplication/*\n!application/language/\n\napplication/language/*\n!application/language/gr/\n\nNote\nThe trailing /* is significant: \n\nThe pattern dir/ excludes a directory named dir and (implicitly) everything under it.\nWith dir/, Git will never look at anything under dir, and thus will never apply any of the “un-exclude” patterns to anything under dir.\nThe pattern dir/* says nothing about dir itself; it just excludes everything under dir.\nWith dir/*, Git will process the direct contents of dir, giving other patterns a chance to “un-exclude” some bit of the content (!dir/sub/)." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git - the stupid content tracker --list-cmds=<group>[,<group>…​]" }, { "role": "assistant", "content": "List commands by group. This is an internal/experimental\noption and may change or be removed in the future. Supported\ngroups are: builtins, parseopt (builtin commands that use\nparse-options), main (all commands in libexec directory),\nothers (all other commands in $PATH that have git- prefix),\nlist-<category> (see categories in command-list.txt),\nnohelpers (exclude helper commands), alias and config\n(retrieve command list from config variable completion.commands)" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-show - Show various types of objects %f" }, { "role": "assistant", "content": "sanitized subject line, suitable for a filename" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-merge - Join two or more development histories together merge.verifySignatures" }, { "role": "assistant", "content": "If true, this is equivalent to the --verify-signatures command\nline option. See git-merge for details." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git - the stupid content tracker githooks" }, { "role": "assistant", "content": "Hooks used by Git" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Find a Git branch containing changes to a given file\nI have 57 local branches. I know I made a change to a certain file in one of them, but I'm not sure which one. Is there some kind of command I can run to find which branches contain changes to a certain file?" }, { "role": "assistant", "content": "Find all branches which contain a change to FILENAME (even if before the (non-recorded) branch point)\nFILENAME=\"<filename>\"\ngit log --all --format=%H $FILENAME | while read f; do git branch --contains $f; done | sort -u\n\nManually inspect:\ngitk --all --date-order -- $FILENAME\n\nFind all changes to FILENAME not merged to master:\ngit for-each-ref --format=\"%(refname:short)\" refs/heads | grep -v master | while read br; do git cherry master $br | while read x h; do if [ \"`git log -n 1 --format=%H $h -- $FILENAME`\" = \"$h\" ]; then echo $br; fi; done; done | sort -u" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to download a folder from github?\nI wished to download the mysite folder from this link:\nhttps://github.com/username/repository/master/" }, { "role": "assistant", "content": "You can download a file/folder from github\nSimply use: svn export <repo>/trunk/<folder>\nEx: svn export https://github.com/lodash/lodash/trunk/docs\nNote: You may first list the contents of the folder in terminal using svn ls <repo>/trunk/folder\n(yes, that's svn here. apparently in 2016 you still need svn to simply download some github files)" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git - the stupid content tracker <head>" }, { "role": "assistant", "content": "a valid head name (i.e. a refs/heads/<head> reference)." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-config - Get and set repository or global options receive.keepAlive" }, { "role": "assistant", "content": "After receiving the pack from the client, receive-pack may\nproduce no output (if --quiet was specified) while processing\nthe pack, causing some networks to drop the TCP connection.\nWith this option set, if receive-pack does not transmit\nany data in this phase for receive.keepAlive seconds, it will\nsend a short keepalive packet. The default is 5 seconds; set\nto 0 to disable keepalives entirely." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-svn - Bidirectional operation between a Subversion repository and Git -e --edit" }, { "role": "assistant", "content": "Only used with the dcommit , set-tree and commit-diff commands. Edit the commit message before committing to SVN. This is off by\ndefault for objects that are commits, and forced on when committing\ntree objects. config key: svn.edit" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-format-patch - Prepare patches for e-mail submission -D --irreversible-delete" }, { "role": "assistant", "content": "Omit the preimage for deletes, i.e. print only the header but not\nthe diff between the preimage and /dev/null . The resulting patch\nis not meant to be applied with patch or git apply ; this is\nsolely for people who want to just concentrate on reviewing the\ntext after the change. In addition, the output obviously lacks\nenough information to apply such a patch in reverse, even manually,\nhence the name of the option. When used together with -B , omit also the preimage in the deletion part\nof a delete/create pair." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git - the stupid content tracker git-show-branch" }, { "role": "assistant", "content": "Show branches and their commits" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to revert multiple commits as part of a single commit\nThis is not a major problem, just something I want to know whether or not is possible.\nLet's say we have two commits, abcd123 and wxyz789, that occur at non-adjacent, separate places, far back in a repo's history. Now let's say we want to revert them. Doing\ngit revert abcd123 wxyz789\n\nwould result in two separate commits, one reverting abcd123 and the other reverting wxyz789.\nThis is all fine and well, but what if the mistakes we want to fix in the two commits are logically linked, and for the purposes of self-documentation we'd like to make one single commit containing one single \"I broke something so now I'm reverting files x, y and z\" comment? Is there a git command that does this?\n(I am of course aware that it is possible to create a commit where I just manually fix all the changes and then push. This is painful for all the obbious reasons.)" }, { "role": "assistant", "content": "You can do:\ngit revert abcd123\ngit revert --no-commit wxyz789\ngit commit --amend\n\n... and then write an appropriate commit message describing the combined effect of reverting both commits." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Can't do a git pull\nI'm trying to do a git pull and get the error message:\nerror: The following untracked working tree files would be overwritten by merge:\n<myFileName>\nPlease move or remove them before you can merge.\n\nSo, I try to remove the file using the command git rm --cache which results in the error:\nfatal: pathspec\n<myFileName>\ndid not match any files\n\nAt this point I'm stuck. I can't pull until I remove the file. But, it tells me I can't remove the file. \nWhat can I do to fix this?" }, { "role": "assistant", "content": "This is an opportunity for the 'git clean' command. If you don't care about the untracked files ... git clean -n to see what will be removed, and git clean -f to go ahead and rm untracked files. \nAdd -d to the commands to also operate on directories:\n git clean -dn\n git clean -df" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git - the stupid content tracker git-name-rev" }, { "role": "assistant", "content": "Find symbolic names for given revs" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "gitattributes - Defining attributes per path" }, { "role": "assistant", "content": "NOTES Git does not follow symbolic links when accessing a .gitattributes file in the working tree. This keeps behavior consistent when the file\nis accessed from the index or a tree versus from the filesystem." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Sonarqube quality badges on gitlab\n\nI have a project on gitlab for which I'm trying to display quality badges from sonarqube on. For that I used the \"Get project badges\" button on the bottom right corner of your sonarqube project overview. They give you for each badge a Markdown which you can easily copy & paste to your README.md file on gitlab/github.\n\nMarkdown looks like this: [![Bugs](https://yourprojectonsonarqube/api/project_badges/measure?project=your_project_key&metric=bugs)](https://yourprojectonsonarqube/dashboard?id=your_project_key)\nFor me it looks like this on the README.md file(logged in as maintainer):\n\nFor other users on the project which also have maintainer or developer permissions it looks like this:\n\nIf you click on the missing images, it will redirect you to sonarqube and ask for you to log in. Afterwards the images are visible. How can I change that? I want them to always be visible to every user of my project." }, { "role": "assistant", "content": "If this is for a private project on SonarQube, this is most likely a permissions issue.\nThere is currently an open issue for SonarQube to allow this to work: https://jira.sonarsource.com/browse/MMF-1942\nAs an FYI, this feature has already been implemented for SonarCloud: https://jira.sonarsource.com/browse/MMF-1178." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How do you control the order in which files appear in a GitHub gist\n\nIs there a way to control the order in which files appear in a gist? They don't seem to be alphabetical or chronological. I'd like to have a README.md appear as the first file in a multi-file gist, but no amount of \"deleting\" a file and re-adding it seems to change anything.\nIs there an order to these files that I'm not seeing, or does GitHub maintain an internal filetype priority list?" }, { "role": "assistant", "content": "Since at least 2018, the order is alphabetical, with periods and numbers coming before letters.\nThat is, as mentioned in Andrew D.Bond's answer:\n\n$\n. (dot)\nNumbers\nLeading space (although the space doesn't appear after saving, the sort order is still updated)\n(although bis, in Sept. 2020, IvanaGyro adds in the comments leading spaces will not affect the order any more)\n_ (underscore)\nLetters (case insensitive)\n\nAround 2013-2014 a different order was used. See Andrew D. Bond's answer for more." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "GitLab CI Pipeline: Pipeline cannot be run\n\nI can't find out why the GitLab CI Pipelines for my Repo won't run. I have a .gitlab-ci.yml file and the feature enabled, but the pipeline won't run. Also if I try to trigger the pipeline manually I get the following error back.\nPipeline cannot be run.\nPipeline will not run for the selected trigger. The rules configuration prevented any jobs from being added to the pipeline.\n\n\nThe CI feature is enabled.\n\nHere is my .gitlab-ci.yml file.\nstages:\n - build\n - deploy\n\nnpm-run-build:\n stage: build\n image: node:19\n only: \n - main\n cache:\n key: ${CI_COMMIT_REF_SLUG}-build\n paths:\n - dist/\n script:\n - cp .env.example .env\n - npm ci\n - npm run build-only\ndeploy-dist:\n stage: deploy\n image: fedora:latest\n only: \n - main\n environment:\n name: production\n url: https://example.com\n needs:\n - npm-run-build\n cache:\n key: ${CI_COMMIT_REF_SLUG}-build\n paths:\n - dist/\n \n before_script:\n - dnf install -y openssh-clients\n - mkdir -p ~/.ssh\n - echo \"$SSH_PRIVATE_KEY\" > ~/.ssh/id_rsa\n - chmod 600 ~/.ssh/id_rsa\n - ssh-keyscan -t rsa example.com > ~/.ssh/known_hosts\n script:\n # create remote project dir if not available\n - ssh [email protected] \"mkdir -p /home/thomas/example.com\"\n # upload project files\n - scp -prq . [email protected]:/home/thomas/example.com\n # restart the container\n - ssh [email protected] \"cd /home/thomas/example.com && docker-compose down && docker-compose up -d\"\n\nThank you! 😁" }, { "role": "assistant", "content": "As D Malan pointed out in the comments, I have restricted the runs with only to the main branch. But the branch name is actually master 🤦\nSo I just changed the rule form main to master and now it is running 👌" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-config - Get and set repository or global options transfer.advertiseObjectInfo" }, { "role": "assistant", "content": "When true , the object-info capability is advertised by\nservers. Defaults to false." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Take all my changes on the current branch and move them to a new branch in Git\nI started work on what I thought would be a minor bug fix on my master branch. However, it has spiraled out of control to the point where I wish I had created a separate branch to do the development in the first place.\nSo right now what I'd like to do is:\n\nCreate a new branch called (say) \"edge\"\nMove all the changed / untracked files on master to edge (such that master is unchanged from when I started the bug fix)\nFinish my work on edge, merge back into master\n\nHow can I do this?" }, { "role": "assistant", "content": "If you haven't been committing anything yet, you're already in the right position.\n\nCreate a new branch: git checkout -b edge \nYour files haven't changed. Just git add what needs to and commit as usual.\nWhen you're done committing on edge, switch back to master with git checkout and git merge edge." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Enforce commit message format in git\nHow can I just enforce a commit message format in Git?\nCan this be set at a repository level so that everyone who creates a branch will have this enforcement?" }, { "role": "assistant", "content": "As described in the Git ProBook \"Customizing Git - An Example Git-Enforced Policy\", such enforcement would be set through a hook, more specifically, a server-side hook like an update one:\n\nAll the server-side work will go into the update file in your hooks directory. The update hook runs once per branch being pushed and takes three arguments:\n\nThe name of the reference being pushed to\nThe old revision where that branch was\nThe new revision being pushed\n\n\nThat is preferred to client-side hooks (like a pre-commit one) which:\n\nhave to be set manually by each user\ncan be bypassed\n\nA server-side hook will, for a given repo, enforce any rule you want by rejecting a git push if your policy is not respected.\nThis assumes that you have control over the remote repo hosting server to which your users are pushing.\nIf you don't, you are back to client-side pre-commits hooks, which can be set through a git template, whose template directory can be shared amongst all users (starting with git 2.9, June 2016)." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Is it possible to use pip to install a package over ssh in a self-hosted gitlab?\n\nI have a self-hosted gitlab and I would like to install a package hosted there using ssh.\nI tried:\npip install git+ssh://git@<my_domain>:se7entyse7en/<project_name>.git\n\nHere's the output:\nDownloading/unpacking git+ssh://git@<my_domain>:se7entyse7en/<project_name>.git\nCloning ssh://git@<my_domain>:se7entyse7en/<project_name>.git to /var/folders/3r/v7swlvdn2p7_wyh9wj90td2m0000gn/T/pip-4_JdRU-build\nssh: Could not resolve hostname <my_domain>:se7entyse7en: nodename nor servname provided, or not known\nfatal: Could not read from remote repository.\n\nPlease make sure you have the correct access rights and the repository exists.\n\nUpdate:\nI tried to upload it on gitlab.com and after having uploaded the repo I tried to install it by running:\npip install git+ssh://[email protected]:loumarvincaraig/<project_name>.git\n\nbut the nothing changed. In particular here's the content of pip.log:\n\n/Users/se7entyse7en/Envs/test/bin/pip run on Mon Nov 17 22:14:51 2014\nDownloading/unpacking git+ssh://[email protected]:loumarvincaraig/<project_name>.git\n\nCloning ssh://[email protected]:loumarvincaraig/<project_name>.git to /var/folders/3r/v7swlvdn2p7_wyh9wj90td2m0000gn/T/pip-91JVFi-build\n\nFound command 'git' at '/usr/local/bin/git'\nRunning command /usr/local/bin/git clone -q ssh://[email protected]:loumarvincaraig/<project_name>.git /var/folders/3r/v7swlvdn2p7_wyh9wj90td2m0000gn/T/pip-91JVFi-build\nComplete output from command /usr/local/bin/git clone -q ssh://[email protected]:loumarvincaraig/<project_name>.git /var/folders/3r/v7swlvdn2p7_wyh9wj90td2m0000gn/T/pip-91JVFi-build:\n\n\nCleaning up...\n\nCommand /usr/local/bin/git clone -q ssh://[email protected]:loumarvincaraig/<project_name>.git /var/folders/3r/v7swlvdn2p7_wyh9wj90td2m0000gn/T/pip-91JVFi-build failed with error code 128 in None\n\nException information:\nTraceback (most recent call last):\nFile \"/Users/se7entyse7en/Envs/test/lib/python2.7/site-packages/pip/basecommand.py\", line 134, in main\nstatus = self.run(options, args)\nFile \"/Users/se7entyse7en/Envs/test/lib/python2.7/site-packages/pip/commands/install.py\", line 236, in run\nrequirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)\nFile \"/Users/se7entyse7en/Envs/test/lib/python2.7/site-packages/pip/req.py\", line 1092, in prepare_files\nself.unpack_url(url, location, self.is_download)\nFile \"/Users/se7entyse7en/Envs/test/lib/python2.7/site-packages/pip/req.py\", line 1231, in unpack_url\nreturn unpack_vcs_link(link, loc, only_download)\nFile \"/Users/se7entyse7en/Envs/test/lib/python2.7/site-packages/pip/download.py\", line 410, in unpack_vcs_link\nvcs_backend.unpack(location)\nFile \"/Users/se7entyse7en/Envs/test/lib/python2.7/site-packages/pip/vcs/__init__.py\", line 240, in unpack\nself.obtain(location)\nFile \"/Users/se7entyse7en/Envs/test/lib/python2.7/site-packages/pip/vcs/git.py\", line 111, in obtain\ncall_subprocess([self.cmd, 'clone', '-q', url, dest])\nFile \"/Users/se7entyse7en/Envs/test/lib/python2.7/site-packages/pip/util.py\", line 670, in call_subprocess\n% (command_desc, proc.returncode, cwd))\nInstallationError: Command /usr/local/bin/git clone -q ssh://[email protected]:loumarvincaraig/<project_name>.git /var/folders/3r/v7swlvdn2p7_wyh9wj90td2m0000gn/T/pip-91JVFi-build failed with error code 128 in None" }, { "role": "assistant", "content": "I don't know why, but by running the following command it worked (slash instead of : after <my_domain>):\npip install git+ssh://git@<my_domain>/se7entyse7en/<project_name>.git\n# ^\n# slash instead of :" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to view diff of a forked github project\nI have forked a project on github and need to have a set of changes I made since I forked, in diff format.\nIf you wonder - I've forked Apache httpd and I'm changing some code in core. Currently I'm not commiting any changes, running git diff, and use its output as a patch against vanilla httpd sources in an RPM building process. It is, of course, wrong, but I don't know how to do it properly. All I know is I need a diff in the end." }, { "role": "assistant", "content": "Online solution:\n\nget /repos/{owner}/{repo}/compare/{base}...{head}\n\n\nThe \"compare two commits\" API does support multiple repositories:\n\nBoth :base and :head must be branch names in :repo.\nTo compare branches across other repositories in the same network as :repo, use the format <USERNAME>:branch.\n\nExample:\nhttps://api.github.com/repos/octocat/hello-world/compare/master...abejpn:master\nOr with a GitHub URL:\nhttps://github.com/octocat/Hello-World/compare/master...abejpn:master\n\nOriginal answer 2010:\n\nAdd the original GitHub repo (the one you have forked) as a remote one on your local repo.\n(git remote add mainRepo github_url)\ngit fetch mainRepo to get the latest changes from that original \"mainRepo\".\ngit log HEAD..mainRepo/master will show you all your changes between the latest on mainRepo master branch and your current branch.\ngit diff HEAD..mainRepo/master would display it in diff format.\n\nIn learn.GitHub:\ngit diff mainRepo/master...HEAD\n\nwould list all your changes since you have forked from mainRepo:\n\nThis will not compare the last ‘master’ branch snapshot and the last ‘dev’ snapshot - it will instead compare the common ancestor of both with ‘dev’. That will tell you what changed since the branch point." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Jenkins Git Plugin not pulling latest changes before building job\nI am working with Jenkins CI and am trying to properly configure my jobs to use git.\nI have the git plugin installed and configured for one of my jobs. When I build the job, I expect it to pull the latest changes for the branch I specify and then continue with the rest of the build process (e.g., unit tests, etc.).\nWhen I look at the console output, I see\n> git fetch --tags --progress ssh://gerrit@git-dev/Util +refs/heads/*:refs/remotes/origin/*\n > git rev-parse origin/some_branch^{commit}\nChecking out Revision <latest_SHA1> (origin/some_branch)\n > git config core.sparsecheckout\n > git checkout -f <latest_SHA1>\n > git rev-list <latest_SHA1>\n\nI see that the plugin fetches and checks out the proper commit hash, but when the tests run it seems as though the repo wasn't updated at all.\nIf I go into the repository in Jenkins, I see there that the latest changes were never pulled. \nShouldn't it pull before it tries to build? \nI have git 1.8.5 installed on my Jenkins machine, which is a recommended version.\nhttps://wiki.jenkins-ci.org/display/JENKINS/Git+Plugin\nAfter checking other similar sounding questions on SO, their answers weren't helpful for my problem." }, { "role": "assistant", "content": "Relates me to scenario where workspace wasn't getting cleaned-up, used:\n\nSource Code Management--> Additional Behaviours --> Clean after checkout\n\nOther option is to use Workspace Cleanup Plugin" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to fix committing to the wrong Git branch?\nI just made a perfectly good commit to the wrong branch.\nHow do I undo the last commit in my master branch and then take those same changes and get them into my upgrade branch?" }, { "role": "assistant", "content": "If you haven't yet pushed your changes, you can also do a soft reset:\ngit reset --soft HEAD^\n\nThis will revert the commit, but put the committed changes back into your index. Assuming the branches are relatively up-to-date with regard to each other, git will let you do a checkout into the other branch, whereupon you can simply commit:\ngit checkout branch\ngit commit -c ORIG_HEAD\n\nThe -c ORIG_HEAD part is useful to not type commit message again." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git - the stupid content tracker git-describe" }, { "role": "assistant", "content": "Give an object a human readable name based on an available ref" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How can I blame a deleted file in Git?\nGit blame helps when investigating why code in a file is a certain way. git gui is even better in that it allows you to step backwards in time to see the context of the file when code was added.\nHowever, git blame <file> and git gui blame <file> do not work after a file has been deleted. An error will appear as:\nfatal: cannot stat path 'file': No such file or directory\n\nHow does one blame a deleted file?" }, { "role": "assistant", "content": "git blame\ngit blame works when providing a commit reference that contains the file. Find the most recent one with log:\n$ git log -2 --oneline -- example/path/file.txt\n\n fffffff deleting file.txt\n eeeeeee Last change to file.txt before deleting.\n\nThen blame the parent commit:\n$ git blame eeeeeee -- example/path/file.txt\n\ngit gui blame\ngit gui blame won't work this way, however. A work around is to browse the repository at the last commit that contained the file, then from the GUI select the file and launch the blame viewer:\n$ git gui blame eeeeeee example/path/file.txt\n\n\n(Note: Use log -2 and eeeeeee instead of fffffff^ because git gui blame can not handle fffffff^:example/path/file.txt)" } ]
[ { "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": "A POSIX Extended Regular Expression used to determine what is a \"word\"\nwhen performing word-by-word difference calculations. Character\nsequences that match the regular expression are \"words\", all other\ncharacters are ignorable whitespace." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git - the stupid content tracker git-instaweb" }, { "role": "assistant", "content": "Instantly browse your working repository in gitweb" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git - the stupid content tracker gitglossary" }, { "role": "assistant", "content": "A Git Glossary" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Using a socks proxy with git for the http transport\nHow to make git use a socks proxy for HTTP transport?\nI succeed in configuring git with GIT_PROXY_COMMAND to use a socks proxy for GIT transport.\nAlso, I have configured my .curlrc file to defined the socks proxy and I can fetch information directly with curl command like:\ncurl http://git.kernel.org/pub/scm/git/git.git/info/refs?service=git-upload-pack\n\nBut how to use a socks proxy with git to retrieve data using the HTTP transport protocol like:\ngit clone http://git.kernel.org/pub/scm/git" }, { "role": "assistant", "content": "I tested with Git 1.8.2 and SOCKS v5 proxy, following setting works for me:\ngit config --global http.proxy 'socks5://127.0.0.1:7070'\nUPDATE 2017-3-31:\nAccording to the document, despite the name http.proxy, it should work for both HTTP and HTTPS repository urls. Thanks @user for pointing out this.\nUPDATE 2018-11-27:\nTo disable the proxy, run command:\ngit config --global --unset http.proxy\nEDIT 2019-03-04: \nIf you also want the host name to be resolved using the proxy, use thuzhf's solution below, which uses socks5h instead of socks5" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Difference between patch and diff files\nCould somebody explain me the difference between a .diff file and .patch file." }, { "role": "assistant", "content": "What matters is the content of the file, not the extension. Both of those extensions imply that some sort of diff utility (diff, git diff, git format-patch, svn diff) produced the output. \nMany diff utilities produce output which can be applied by the patch command. You will frequently need to use the -d and -p options to patch in order to get the paths matched up right (strip prefix, name target directory). If you see one of those extensions on a file distributed online, it's almost certainly an indication it's compatible with patch.\nGit's diff output is compatible with patch, but I believe svn's is not. Of course, plain patches generated by git diff are probably best applied by git apply, and patches generated by git format-patch are designed for use with git-am." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How can I make my local repository available for git-pull?\nI have a working copy repository that I've been working in no problem; the origin for this repository is on GitHub. \nI'd like to make my working copy repository available as the origin for my build machine (a VM on another physical host), so that commits I make to my working copy can be built and tested on the build machine without having to go via GitHub first. I already have a build for the GitHub repository going, but I'd like this to be a \"golden\" repository/build; i.e., if something goes in there, the build against GitHub should be guaranteed to pass. \nI've looked at the documentation on Git URLs, and see that there's the option of using a URL in the form git://host.xz[:port]/path/to/repo.git/ (see, e.g., git-clone documentation). I want to do this in the simplest possible way, with the minimum of configuration: I don't want to have to set up an SSH daemon or web server just to publish this to my build machine. \nI'm running Windows 7 x64 RC, I have MSysGit and TortoiseGit installed, and I have opened Git's default port (9814) on the firewall. Please assume working copy repo is at D:\\Visual Studio Projects\\MyGitRepo, and the hostname is devbox. The build machine is Windows Server 2008 x64. I have been trying the following command on the build machine, with the associated output:\nD:\\Integration>git clone \"git://devbox/D:\\Visual Studio Projects\\MyGitRepo\"\nInitialized empty Git repository in D:/Integration/MyGitRepo/.git/\ndevbox[0: 192.168.0.2]: errno=No error\nfatal: unable to connect a socket (No error)\n\nAm I missing something?" }, { "role": "assistant", "content": "Five possibilities exist to set up a repository for pull from:\n\nlocal filesystem: git clone /path/to/repo or git clone file://path/to/repo. Least work if you have networked filesystem, but not very efficient use of network. (This is almost exactly solution proposed by Joakim Elofsson)\nHTTP protocols: git clone http://example.com/repo. You need any web server, and you also need to run (perhaps automatically, from a hook) git-update-server-info to generate information required for fetching/pulling via \"dumb\" protocols.\nSSH: git clone ssh://example.com/srv/git/repo or git clone example.com:/srv/git/repo. You need to setup SSH server (SSH daemon), and have SSH installed on client (e.g. PuTTY on MS Windows).\ngit protocol: git clone git://example.com/repo. You need to run git-daemon on server; see documentation for details (you can run it as standalone process only for fetching, not necessary run as service). git-daemon is a part of git.\nbundle: You generate bundle on server using git-bundle command, transfer it to a client machine in any way (even via USB), and clone using git clone file.bndl (if clone does not work, you can do \"git init\", \"git remote add\" and \"git fetch\").\n\nWhat you are missing in your example is probably running git-daemon on server. That, or misconfiguring git-daemon.\nUnfortunately I cannot help you with running git-daemon as service on MS Windows. There is nothing in announcement for last version of msysGit about git-daemon not working, though." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "GitLab and Jenkins integration\n\nI've read the differences between Gitlab Community and Enterprise in this page: https://about.gitlab.com/features/\nBased on that page I understand the integration with Jenkins is only available in the enterprise version. However, I've seen that using web hooks I can trigger builds in Jenkins when a push happens in Gitlab. \nSo my question is which is the difference between community and enterprise regarding the integration with jenkins?" }, { "role": "assistant", "content": "On the merge request page, there is a state widget that shows the status of tests for that particular merge request, and on your project home page, there is test status badging. These two UI elements only show up if you enable a 'ci service' on the project. In community you can turn it on with Gitlab CI. In enterprise you can set it up to work with jenkins." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "SSH Key asks for password\n\nI stuck here now for like 2 Days a week.\nI've got a CentOs machine with Gitlab4 and gitolite. Everything worked fine for weeks, but suddenly last weekend something strange happend quite all binaries disappeared from the mashine ( like yum, python, ruby, mysql ect. ) i've really no clue how that can happn... After hours of reinstalling and compiling gitlab was working again.\nBut i cant get the ssh keys between the gitlab and git user working.\nI already deleted and recreated the git user, set again all permissions, recreated the ssh keys, reinstalld gitolite ect. But nothing worked i keep getting the same error.\ngit user .ssh folder\n-rwx------ 1 git git 557 Mar 27 16:46 authorized_keys\n\ngitlab user .ssh folder\n-rw------- 1 gitlab gitlab 1671 Mar 27 16:45 id_rsa\n-rw-r--r-- 1 gitlab gitlab 406 Mar 27 16:45 id_rsa.pub\n-rw-r--r-- 1 gitlab gitlab 391 Mar 27 16:50 known_hosts\n\nSSH error:\nssh -vvvT git@localhost\nOpenSSH_4.3p2, OpenSSL 0.9.8e-fips-rhel5 01 Jul 2008\ndebug1: Reading configuration data /etc/ssh/ssh_config\ndebug1: Applying options for *\ndebug2: ssh_connect: needpriv 0\ndebug1: Connecting to localhost [127.0.0.1] port 22.\ndebug1: Connection established.\ndebug1: identity file /home/gitlab/.ssh/identity type -1\ndebug3: Not a RSA1 key file /home/gitlab/.ssh/id_rsa.\ndebug2: key_type_from_name: unknown key type '-----BEGIN'\ndebug3: key_read: missing keytype\ndebug3: key_read: missing whitespace\ndebug3: key_read: missing whitespace\ndebug3: key_read: missing whitespace\ndebug3: key_read: missing whitespace\ndebug3: key_read: missing whitespace\ndebug3: key_read: missing whitespace\ndebug3: key_read: missing whitespace\ndebug3: key_read: missing whitespace\ndebug3: key_read: missing whitespace\ndebug3: key_read: missing whitespace\ndebug3: key_read: missing whitespace\ndebug3: key_read: missing whitespace\ndebug3: key_read: missing whitespace\ndebug3: key_read: missing whitespace\ndebug3: key_read: missing whitespace\ndebug3: key_read: missing whitespace\ndebug3: key_read: missing whitespace\ndebug3: key_read: missing whitespace\ndebug3: key_read: missing whitespace\ndebug3: key_read: missing whitespace\ndebug3: key_read: missing whitespace\ndebug3: key_read: missing whitespace\ndebug3: key_read: missing whitespace\ndebug3: key_read: missing whitespace\ndebug3: key_read: missing whitespace\ndebug2: key_type_from_name: unknown key type '-----END'\ndebug3: key_read: missing keytype\ndebug1: identity file /home/gitlab/.ssh/id_rsa type 1\ndebug1: identity file /home/gitlab/.ssh/id_dsa type -1\ndebug1: Remote protocol version 2.0, remote software version OpenSSH_4.3p2\ndebug1: match: OpenSSH_4.3p2 pat OpenSSH*\ndebug1: Enabling compatibility mode for protocol 2.0\ndebug1: Local version string SSH-2.0-OpenSSH_4.3p2\ndebug1: SSH2_MSG_KEXINIT sent\ndebug1: SSH2_MSG_KEXINIT received\ndebug2: kex_parse_kexinit: diffie-hellman-group-exchange-sha1,diffie-hellman-group1-sha1\ndebug2: kex_parse_kexinit: ssh-rsa,ssh-dss\ndebug2: kex_parse_kexinit: aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour,aes192-cbc,aes256-cbc,[email protected],aes128-ctr,aes192-ctr,aes256-ctr\ndebug2: kex_parse_kexinit: aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour,aes192-cbc,aes256-cbc,[email protected],aes128-ctr,aes192-ctr,aes256-ctr\ndebug2: kex_parse_kexinit: hmac-md5,hmac-sha1,hmac-ripemd160,[email protected],hmac-sha1-96,hmac-md5-96\ndebug2: kex_parse_kexinit: hmac-md5,hmac-sha1,hmac-ripemd160,[email protected],hmac-sha1-96,hmac-md5-96\ndebug2: kex_parse_kexinit: none,zlib\ndebug2: kex_parse_kexinit: none,zlib\ndebug2: kex_parse_kexinit: \ndebug2: kex_parse_kexinit: \ndebug2: kex_parse_kexinit: first_kex_follows 0 \ndebug2: kex_parse_kexinit: reserved 0 \ndebug2: kex_parse_kexinit: diffie-hellman-group-exchange-sha1,diffie-hellman-group1-sha1\ndebug2: kex_parse_kexinit: ssh-rsa,ssh-dss\ndebug2: kex_parse_kexinit: aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour,aes192-cbc,aes256-cbc,[email protected],aes128-ctr,aes192-ctr,aes256-ctr\ndebug2: kex_parse_kexinit: aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour,aes192-cbc,aes256-cbc,[email protected],aes128-ctr,aes192-ctr,aes256-ctr\ndebug2: kex_parse_kexinit: hmac-md5,hmac-sha1,hmac-ripemd160,[email protected],hmac-sha1-96,hmac-md5-96\ndebug2: kex_parse_kexinit: hmac-md5,hmac-sha1,hmac-ripemd160,[email protected],hmac-sha1-96,hmac-md5-96\ndebug2: kex_parse_kexinit: none,zlib\ndebug2: kex_parse_kexinit: none,zlib\ndebug2: kex_parse_kexinit: \ndebug2: kex_parse_kexinit: \ndebug2: kex_parse_kexinit: first_kex_follows 0 \ndebug2: kex_parse_kexinit: reserved 0 \ndebug2: mac_init: found hmac-md5\ndebug1: kex: server->client aes128-cbc hmac-md5 none\ndebug2: mac_init: found hmac-md5\ndebug1: kex: client->server aes128-cbc hmac-md5 none\ndebug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent\ndebug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP\ndebug2: dh_gen_key: priv key bits set: 132/256\ndebug2: bits set: 502/1024\ndebug1: SSH2_MSG_KEX_DH_GEX_INIT sent\ndebug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY\ndebug3: check_host_in_hostfile: filename /home/gitlab/.ssh/known_hosts\ndebug3: check_host_in_hostfile: match line 1\ndebug1: Host 'localhost' is known and matches the RSA host key.\ndebug1: Found key in /home/gitlab/.ssh/known_hosts:1\ndebug2: bits set: 505/1024\ndebug1: ssh_rsa_verify: signature correct\ndebug2: kex_derive_keys\ndebug2: set_newkeys: mode 1\ndebug1: SSH2_MSG_NEWKEYS sent\ndebug1: expecting SSH2_MSG_NEWKEYS\ndebug2: set_newkeys: mode 0\ndebug1: SSH2_MSG_NEWKEYS received\ndebug1: SSH2_MSG_SERVICE_REQUEST sent\ndebug2: service_accept: ssh-userauth\ndebug1: SSH2_MSG_SERVICE_ACCEPT received\ndebug2: key: /home/gitlab/.ssh/identity ((nil))\ndebug2: key: /home/gitlab/.ssh/id_rsa (0x848ba50)\ndebug2: key: /home/gitlab/.ssh/id_dsa ((nil))\ndebug1: Authentications that can continue: publickey,password\ndebug3: start over, passed a different list publickey,password\ndebug3: preferred publickey,keyboard-interactive,password\ndebug3: authmethod_lookup publickey\ndebug3: remaining preferred: keyboard-interactive,password\ndebug3: authmethod_is_enabled publickey\ndebug1: Next authentication method: publickey\ndebug1: Trying private key: /home/gitlab/.ssh/identity\ndebug3: no such identity: /home/gitlab/.ssh/identity\ndebug1: Offering public key: /home/gitlab/.ssh/id_rsa\ndebug3: send_pubkey_test\ndebug2: we sent a publickey packet, wait for reply\ndebug1: Authentications that can continue: publickey,password\ndebug1: Trying private key: /home/gitlab/.ssh/id_dsa\ndebug3: no such identity: /home/gitlab/.ssh/id_dsa\ndebug2: we did not send a packet, disable method\ndebug3: authmethod_lookup password\ndebug3: remaining preferred: ,password\ndebug3: authmethod_is_enabled password\ndebug1: Next authentication method: password\n\nThe auth log gives me:\nApr 2 10:19:13 venus sshd[15693]: User git not allowed because account is locked\nApr 2 10:19:13 venus sshd[15693]: Failed none for illegal user git from ::ffff:127.0.0.1 port 56906 ssh2\n\nThanks for any Help." }, { "role": "assistant", "content": "You mention:\nApr 2 10:19:13 venus shd[15693]: User git not allowed because account is locked \nApr 2 10:19:13 venus sshd[15693]: Failed none for illegal user git from ::ffff:127.0.0.1 port 56906 ssh2\n\nThis article mentions:\n\nOpenSSH now checks for locked accounts by default.\nOn Linux systems, locked accounts are defined as those that have !! in the password field of /etc/shadow.\nThis is the default entry for accounts created with the useradd command.\n Even if you are using GSI authentication and do not need local passwords, sshd won't let the user login with this message:\n\nToo many authentication failures for username\n\n\nIn the sshd debugging info it will indicate that the account is locked:\n\nUser username not allowed because account is locked\n\n\nHere is some additional information from the sshd Manual:\n\nRegardless of the authentication type, the account is checked to ensure that it is accessible.\n An account is not accessible if it is locked, listed in DenyUsers or its group is listed in DenyGroups.\n The definition of a locked account is system dependant.\n Some platforms have their own account database (eg AIX) and some modify the passwd field ( \"*LK*\" on Solaris and UnixWare, \"*\" on HP-UX, containing \"Nologin\" on Tru64, a leading \"*LOCKED*\" on FreeBSD and a leading \"!!\" on Linux).\n If there is a requirement to disable password authentication for the account while allowing still public-key, then the passwd field should be set to something other than these values (eg \"NP\" or \"*NP*\" ).\n\nFix: Replace !! with (for example) NP in /etc/shadow.\n\n\nAs mentioned by jszakmeister (comments) and Yongcan-Frank-Lv (comments):\nsudo passwd -u git\n\nwould be enough to unlock the account." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-switch - Switch branches --progress --no-progress" }, { "role": "assistant", "content": "Progress status is reported on the standard error stream\nby default when it is attached to a terminal, unless --quiet is specified. This flag enables progress reporting even if not\nattached to a terminal, regardless of --quiet ." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Git - remote: Repository not found\n\nI have SourceTree with local working copy. And all operations work good, I can simple fetch, push, pull and etc via SourceTree. I just needed to make force push which does not exist in SourceTree.\nI opened terminal made git push -f\nremote: Repository not found.\nfatal: repository 'https://github.com/MyRepo/project.git/' not found\n\nI am not sure what can be an issue." }, { "role": "assistant", "content": "Remove all the github.com credential details from the system.\nFor mac\nDelete the github.com password from the Keychain Access.\nFor windows\nDelete the credentials from Credential Manager." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-shortlog - Summarize git log output --group=<type>" }, { "role": "assistant", "content": "Group commits based on <type> . If no --group option is\nspecified, the default is author . <type> is one of: author , commits are grouped by author committer , commits are grouped by committer (the same as -c ) trailer:<field> , the <field> is interpreted as a case-insensitive\ncommit message trailer (see git-interpret-trailers ). For\nexample, if your project uses Reviewed-by trailers, you might want\nto see who has been reviewing with git shortlog -ns --group=trailer:reviewed-by . format:<format> , any string accepted by the --format option of git log . (See the \"PRETTY FORMATS\" section of git-log .) Note that commits that do not include the trailer will not be counted.\nLikewise, commits with multiple trailers (e.g., multiple signoffs) may\nbe counted more than once (but only once per unique trailer value in\nthat commit). Shortlog will attempt to parse each trailer value as a name <email> identity. If successful, the mailmap is applied and the email is omitted\nunless the --email option is specified. If the value cannot be parsed\nas an identity, it will be taken literally and completely. If --group is specified multiple times, commits are counted under each\nvalue (but again, only once per unique value in that commit). For\nexample, git shortlog --group=author --group=trailer:co-authored-by counts both authors and co-authors." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-difftool - Show changes using common diff tools git-diff" }, { "role": "assistant", "content": "Show changes between commits, commit and working tree, etc" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-config - Get and set repository or global options 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." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-svn - Bidirectional operation between a Subversion repository and Git --rewrite-uuid=<UUID>" }, { "role": "assistant", "content": "Set the rewriteUUID option in the [svn-remote] config." } ]
[ { "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" }, { "role": "assistant", "content": "SYNOPSIS git describe [--all] [--tags] [--contains] [--abbrev=<n>] [<commit-ish>…​] git describe [--all] [--tags] [--contains] [--abbrev=<n>] --dirty[=<mark>] git describe <blob>" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Git - Automatically fast forward all tracking branches on pull\nI've set up tracking branches with the --track option, and when I do a git pull on master, it fetches all branches to origin/branchname but doesn't merge with the local tracking branches. This is extra annoying, because if I later do a git push on master, it says that non-fast-forward updates were rejected on the tracking branches, since they weren't fast-forwarded on the initial git pull.\nMy question is: How do I make it so that git pull with fetch all branches and automatically fast-forward all the tracking branches?\nNote: git pull used to fast-forward all my tracking branches with my GitHub repos, but now that I've set up my own repos using Gitolite, this problem is cropping up." }, { "role": "assistant", "content": "Shell script that fast-forwards all branches that have their upstream branch set to the matching origin/ branch without doing any checkouts \n\nit doesn't change your current branch at any time, no need to deal with working copy changes and time lost checking out \nit only does fast-forwards, branches that cannot be fast-forwarded will show an error message and will be skipped \n\nMake sure all your branches' upstream branches are set correctly by running git branch -vv. Set the upstream branch with git branch -u origin/yourbanchname\nCopy-paste into a file and chmod 755:\n#!/bin/sh\n\ncurbranch=$(git rev-parse --abbrev-ref HEAD)\n\nfor branch in $(git for-each-ref refs/heads --format=\"%(refname:short)\"); do\n upbranch=$(git config --get branch.$branch.merge | sed 's:refs/heads/::');\n if [ \"$branch\" = \"$upbranch\" ]; then\n if [ \"$branch\" = \"$curbranch\" ]; then\n echo Fast forwarding current branch $curbranch\n git merge --ff-only origin/$upbranch\n else\n echo Fast forwarding $branch with origin/$upbranch\n git fetch . origin/$upbranch:$branch\n fi\n fi\ndone;" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-notes - Add or inspect object notes --commit" }, { "role": "assistant", "content": "Finalize an in-progress git notes merge . Use this option\nwhen you have resolved the conflicts that git notes merge stored in .git/NOTES_MERGE_WORKTREE. This amends the partial\nmerge commit created by git notes merge (stored in\n.git/NOTES_MERGE_PARTIAL) by adding the notes in\n.git/NOTES_MERGE_WORKTREE. The notes ref stored in the\n.git/NOTES_MERGE_REF symref is updated to the resulting commit." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How do I select a merge strategy for a git rebase?\ngit-rebase man page mentions -X<option> can be passed to git-merge. When/how exactly?\nI'd like to rebase by applying patches with recursive strategy and theirs option (apply whatever sticks, rather than skipping entire conflicting commits). I don't want merge, I want to make history linear.\nI've tried:\ngit rebase -Xtheirs\n\nand\ngit rebase -s 'recursive -Xtheirs'\n\nbut git rejects -X in both cases.\n\ngit rebase -Xtheirs works in recent versions, except tree conflicts need to be resolved manually. You need to run git rebase -Xtheirs --continue (with -X repeated) after resolving those conflicts." }, { "role": "assistant", "content": "You can use this with Git v1.7.3 or later versions.\ngit rebase --strategy-option theirs ${branch} # Long option\ngit rebase -X theirs ${branch} # Short option\n\n(which is a short for git rebase --strategy recursive --strategy-option theirs ${branch} as stated by the documentation)\nFrom Git v1.7.3 Release Notes: \ngit rebase --strategy <s> learned the --strategy-option/-X option to pass extra options that are understood by the chosen merge strategy.\nNB: \"Ours\" and \"theirs\" mean the opposite of what they do during a straight merge. In other words, \"theirs\" favors the commits on the current branch." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to get Git Tag in Azure Pipelines\nIn Azure Pipelines, I have enabled git tags to trigger pipelines like so:\ntrigger:\n branches:\n include:\n - '*'\n tags:\n include:\n - '*'\n\nNow I want to know if there is a way to determine programmatically:\n\nWas the pipeline started from a git commit or git tag?\nIf the pipeline was started from a git tag, what is the tag name?" }, { "role": "assistant", "content": "The other answers here cover the first part of the question, so as Alex Kaszynski has already pointed out, you can use a YAML condition:\nstartsWith(variables['Build.SourceBranch'], 'refs/tags/')\n\nGetting the tag name is now a bit easier than it was at the time the question was asked:\nBuild.SourceBranchName\n\nThis variable contains the last git ref path segment, so for example if the tag was refs/tags/1.0.2, this variable will contain 1.0.2: the tag name.\nFull docs are now here." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How do I revert master branch to a tag in git?\nWe have branches origin and develop. \nThe initial state of master was tagged at tag_ABC.\nWe have few changes made to the develop branch and pushed to origin.\nThen we have accidentally merged develop into master and pushed to origin. \nNow we would like to revert master to the checkpoint tag_ABC. How can we do that?" }, { "role": "assistant", "content": "You can do\ngit checkout master\ngit reset --hard tag_ABC\ngit push --force origin master\n\nPlease note that this will overwrite existing history in the upstream repo and may cause problems for other developers who have this repo checked out.\nAs per Luke Wenke's comment, other developers who have got master checked out will have to do the following:\ngit pull\ngit reset --hard origin/master" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Git: First rewinding head to replay\nI am getting this message:\n First, rewinding head to replay your work on top of it...\n\neach time I do a git pull --rebase origin <branch>, however I would like to discard all my work that may be replayed on top of it.. Basically I would like to rebase only the origin branch without my work on top of it.\nHow can I clean those commits that comes up wrongly all times I try to pull rebase?\nAgain, my goal is just pull rebase the exact snapshot of the origin branch without my work on top of it." }, { "role": "assistant", "content": "git fetch origin; git reset --hard origin/<branch>" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Rails which files to ignore for GIT\nI created a GIT repo, locally. I now see a bunch of files i rather ignore for GIT check-in. This brings me to the question: is there any default .gitignore for Rails? Any best practices?\nI think of tmp and log for sure. But are there any other files or folders i should consider?" }, { "role": "assistant", "content": "Github has sample .gitignore files for almost any kind of project known to humanity in their github/gitignore repository.\nThere is one specifically for Rails:\nRails.gitignore" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to install development version of R packages github repository\n\nHow can I install a package that is under development directly from a github repository and once installed how can I switch between development and CRAN versions?\nThe specific package I am interested in installing from git is ggplot2." }, { "role": "assistant", "content": "via Hadley at https://github.com/hadley/ggplot2\n\ninstall.packages(\"devtools\")\n\nlibrary(devtools)\n\ndev_mode(on=T)\n\ninstall_github(\"hadley/ggplot2\")\n\n# use dev ggplot2 now\n\n# when finished do:\n\ndev_mode(on=F) #and you are back to having stable ggplot2" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How do I access my SSH public key?\nI've just generated my RSA key pair, and I wanted to add that key to GitHub.\nI tried cd id_rsa.pub and id_rsa.pub, but no luck. How can I access my SSH public key?" }, { "role": "assistant", "content": "cat ~/.ssh/id_rsa.pub or cat ~/.ssh/id_dsa.pub\nYou can list all the public keys you have by doing:\n$ ls ~/.ssh/*.pub" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-gc - Cleanup unnecessary files and optimize the local repository" }, { "role": "assistant", "content": "AGGRESSIVE When the --aggressive option is supplied, git-repack will\nbe invoked with the -f flag, which in turn will pass --no-reuse-delta to git-pack-objects . This will throw\naway any existing deltas and re-compute them, at the expense of\nspending much more time on the repacking. The effects of this are mostly persistent, e.g. when packs and loose\nobjects are coalesced into one another pack the existing deltas in\nthat pack might get re-used, but there are also various cases where we\nmight pick a sub-optimal delta from a newer pack instead. Furthermore, supplying --aggressive will tweak the --depth and --window options passed to git-repack . See the gc.aggressiveDepth and gc.aggressiveWindow settings below. By\nusing a larger window size we’re more likely to find more optimal\ndeltas. It’s probably not worth it to use this option on a given repository\nwithout running tailored performance benchmarks on it. It takes a lot\nmore time, and the resulting space/delta optimization may or may not\nbe worth it. Not using this at all is the right trade-off for most\nusers and their repositories." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-config - Get and set repository or global options rebase.maxLabelLength" }, { "role": "assistant", "content": "When generating label names from commit subjects, truncate the names to\nthis length. By default, the names are truncated to a little less than NAME_MAX (to allow e.g. .lock files to be written for the\ncorresponding loose refs)." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "gitglossary - A Git Glossary commit-graph file" }, { "role": "assistant", "content": "The \"commit-graph\" (normally hyphenated) file is a supplemental\nrepresentation of the commit graph which accelerates commit graph walks. The \"commit-graph\" file is\nstored either in the .git/objects/info directory or in the info\ndirectory of an alternate object database." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Git and Trac (or similar)\n\nIn the past I have really enjoyed using Trac with subversion repositories hosted on some of my own servers. The integrated ticketing and online code browsing is very convenient.\nI have used github for some of my public projects but I don't have the money to shell out for an extra service, espcially when I am already paying for remote VPS hosting.\nDoes anyone know of or have any experience setting up something like Trac with git version control? Specifically, I can already push to a remote server but I would like some web interface that allows me (and people working with me) to see that commits and current state of the codebase online without making the project public. I am aware of GitPlugin but have not been able to get it up and running successfully. Any other suggestions?\nIntegrated ticketing (and wiki) is desired but not an absolute necessity.\nEdit:\nAfter playing around with GitPlugin and Trac a bit more I have been able to get it up and running. The main problem was that I needed to explicitly enable the plugin for the trac environment by doing something like this in trac.ini:\n[components]\n# for version 0.10\ngitplugin.* = enabled\n# for version 0.11\ntracext.git.* = enabled \n\nI may also try out Redmine and CGit as this seem like other pieces of software that do what I am looking for. Any other suggestions are welcome." }, { "role": "assistant", "content": "You should take a look at Redmine (http://www.redmine.org/). It has all of the features you mention and more. You can host it on your own vps (I do)." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-rev-list - Lists commit objects in reverse chronological order --remove-empty" }, { "role": "assistant", "content": "Stop when a given path disappears from the tree." } ]
[ { "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) --creation-factor=<percent>" }, { "role": "assistant", "content": "Set the creation/deletion cost fudge factor to <percent> .\nDefaults to 60. Try a larger value if git range-diff erroneously\nconsiders a large change a total rewrite (deletion of one commit\nand addition of another), and a smaller one in the reverse case.\nSee the ``Algorithm`` section below for an explanation of why this is\nneeded." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Invalid SSH keys on GitKraken\nI've found GitKraken and it looks cool and I never have an issue with index.lock unlike SourceTree. The only problem is I am unable to push and pull to my server in the other room. I have configured my ssh keys and that. I can push/pull to github/bitbucket account but not next room. If ever you have encountered such problems, or if ever you have a tiny bit of idea on how I maybe able to solve my problem, please let me know. I have already made contact with the support team but response is very scarce." }, { "role": "assistant", "content": "It seems that on my mac if I don't run ssh-add -k ~/.ssh/id_rsa then I get errors about having a bad ssh key.\nThis also seems to work on Ubuntu (18.04)." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-diff - Show changes between commits, commit and working tree, etc --binary" }, { "role": "assistant", "content": "In addition to --full-index , output a binary diff that\ncan be applied with git-apply .\nImplies --patch ." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Github enterprise - remote: Password authentication is not available for Git operations\n\nMy git was working fine, then without changing anything than the following problem started to happen,\nI have tried resetting the cache in \n\ncredentials.helper\n\nand have gone through pretty much every stackoverflow answer I could find \nremote: Password authentication is not available for Git operations.\nremote: You must use a personal access token or SSH key.\nremote: See https://github.ibm.com/settings/tokens or\n'https://github.ibm.com/WBurney/Blockchain_SDO.git/': \nThe requested URL returned error: 403\n\nThanks" }, { "role": "assistant", "content": "If you have registered a public ssh key to your GitHub enterprise account, you could side-step the issue using an ssh url\ncd /path/to/repo\ngit remote set-url origin [email protected]:WBurney/Blockchain_SDO.git\n\nThen any command like git push/git fetch/git pull/git ls-remote would use the SSH URL set by git remote set-url.\nBut regarding your original issue, try and follow \"Creating a personal access token for the command line\".\nIf you are on Mac, update your credentials from the OSX Keychain.\nYou might need to remove an old cached credential first.\n(As commented by RayLoveless)\nAs drazen Bjelovuk confirms in the comments:\n\nUpdating the password to a personal token in my OSX Keychain worked for me." } ]
[ { "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 -t" }, { "role": "assistant", "content": "Show status tags together with filenames. Note that for\nscripting purposes, git-status --porcelain and git-diff-files --name-status are almost always\nsuperior alternatives; users should look at git-status --short or git-diff --name-status for more user-friendly alternatives. This option provides a reason for showing each filename, in the form\nof a status tag (which is followed by a space and then the filename).\nThe status tags are all single characters from the following list: H tracked file that is not either unmerged or skip-worktree S tracked file that is skip-worktree M tracked file that is unmerged R tracked file with unstaged removal/deletion C tracked file with unstaged modification/change K untracked paths which are part of file/directory conflicts\nwhich prevent checking out tracked files ? untracked file U file with resolve-undo information" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-log - Show commit logs --parents" }, { "role": "assistant", "content": "Print also the parents of the commit (in the form \"commit parent…​\").\nAlso enables parent rewriting, see History Simplification above." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-log - Show commit logs --word-diff[=<mode>]" }, { "role": "assistant", "content": "Show a word diff, using the <mode> to delimit changed words.\nBy default, words are delimited by whitespace; see --word-diff-regex below. The <mode> 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." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to reset a branch to another branch with git?\nlet's say that we have an hotfixes branch which was created from master. we added commits to hotfixes, but those commits were not useful, so now we want to start from a fresh copy of master again.\nto clarify better, this is the reference workflow: http://nvie.com/posts/a-successful-git-branching-model/\nlet's also say that we pushed hotfixes to the origin remote because we have an awful set up and that's the only way to test something, so we need to reset the branch also on the remote server.\nhow to reset hotfixes to a copy of master?" }, { "role": "assistant", "content": "this is how i did it with basic Git commands:\ngit checkout hotfixes\ngit reset --hard master\ngit push --force origin hotfixes\n\nof course it's important to notify everyone working on hotfixes. most likely they will have to delete their local copy and start from a fresh one. an alternative, less invasive idea is to create a new branch:\ngit checkout master\ngit branch -tb hotfixes-2 # this creates branch `hotfixes-2` from a copy of `master`\ngit push origin HEAD # this creates `hotfixes-2` on the remote server" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-log - Show commit logs --relative-date" }, { "role": "assistant", "content": "Synonym for --date=relative ." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-filter-branch - Rewrite branches --msg-filter <command>" }, { "role": "assistant", "content": "This is the filter for rewriting the commit messages.\nThe argument is evaluated in the shell with the original\ncommit message on standard input; its standard output is\nused as the new commit message." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "GitHub Error Message - Permission denied (publickey)\n\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" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Pull Request, ignore some file changes\n\nWhen I do a Pull Request on GitHub (against master branch), can we ignore some file changes, like\n\nwe have one file named 'fileA' in branch 'release', and we have the same file in 'master', but we do some changes in 'fileA' in branch 'release'\nwhen we do a Pull Request, is there any way we can ignore the changes in 'fileA', do not let that merge into 'master'." }, { "role": "assistant", "content": "You can't ignore some files from a pull request selectively.\nTwo workarounds for this can be -\nFirst -\n\nCreate a new branch from 'release'\nReplace the non-required files from 'master'\nCreate pull request from this new branch\n\nSecond -\n\nCreate a new branch from 'master'\nPut changes of required files from 'release'\nCreate pull request from this new branch\n\nAny of this method will work. Which will be easier depends upon how many files are to be included / excluded." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-show - Show various types of objects git show next~10:Documentation/README" }, { "role": "assistant", "content": "Shows the contents of the file Documentation/README as\nthey were current in the 10th last commit of the branch next ." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git - the stupid content tracker GIT_GLOB_PATHSPECS" }, { "role": "assistant", "content": "Setting this Boolean environment variable to true will cause Git to treat all\npathspecs as glob patterns (aka \"glob\" magic)." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "`git tag` sorted in chronological order of the date of the commit pointed to\nThe output from git tag is ordered alphabetically. I would like it to be ordered chronological (the date of the commits they are assigned to, not the date on which they were created), otherwise the output should stay the same.\nI’ve tried the suggestion from http://networkadmin20.blogspot.de/2010/08/howto-list-git-tags-by-date.html, but the order is still the same.\nTo make sure it is not an error with my repository, I tried the following with a clean repository:\nsoeren@ubuntu ~/Projects/sandbox % mkdir chronogit\nsoeren@ubuntu ~/Projects/sandbox % cd chronogit \nsoeren@ubuntu ~/Projects/sandbox/chronogit % git init\nInitialized empty Git repository in /home/soeren/Projects/sandbox/chronogit/.git/\nsoeren@ubuntu ~/Projects/sandbox/chronogit (git)-[master] % touch a\nsoeren@ubuntu ~/Projects/sandbox/chronogit (git)-[master] % git add a\nsoeren@ubuntu ~/Projects/sandbox/chronogit (git)-[master] % git commit -m 'a'\n[master (root-commit) f88e0e9] a\n 0 files changed\n create mode 100644 a\nsoeren@ubuntu ~/Projects/sandbox/chronogit (git)-[master] % git tag 'A-first'\nsoeren@ubuntu ~/Projects/sandbox/chronogit (git)-[master] % git mv a b\nsoeren@ubuntu ~/Projects/sandbox/chronogit (git)-[master] % git commit -m 'c'\n[master ecc0c08] c\n 1 file changed, 0 insertions(+), 0 deletions(-)\n rename a => b (100%)\nsoeren@ubuntu ~/Projects/sandbox/chronogit (git)-[master] % git tag 'C-second'\nsoeren@ubuntu ~/Projects/sandbox/chronogit (git)-[master] % git mv b c\nsoeren@ubuntu ~/Projects/sandbox/chronogit (git)-[master] % git commit -m 'b'\n[master e72682d] b\n 1 file changed, 0 insertions(+), 0 deletions(-)\n rename b => c (100%)\nsoeren@ubuntu ~/Projects/sandbox/chronogit (git)-[master] % git tag 'B-third'\nsoeren@ubuntu ~/Projects/sandbox/chronogit (git)-[master] % git tag\nA-first\nB-third\nC-second\nsoeren@ubuntu ~/Projects/sandbox/chronogit (git)-[master] % git for-each-ref refs/tags --sort=taggerdate --format=\"%(refname:short)\"\nA-first\nB-third\nC-second\n\nThe desired output is:\nA-first\nC-second\nB-third\n\nor, since inverting it shouldn’t be too hard:\nB-third\nC-second\nA-first\n\nEdit: As pointed out in the comments, this question is pretty similiar, so I tried the following:\nsoeren@ubuntu ~/Projects/sandbox/chronogit (git)-[master] % git log --tags --simplify-by-decoration --pretty=\"format:%ai %d\" \n2013-09-06 16:08:43 +0200 (HEAD, B-third, master)\n2013-09-06 16:08:21 +0200 (C-second)\n2013-09-06 16:07:42 +0200 (A-first)\n\nThe order is fine, but now I’m fighting with the formatting…\nsoeren@ubuntu ~/Projects/sandbox/chronogit (git)-[master] % git log --tags --simplify-by-decoration --pretty=\"format:%(refname:short)\"\n%(refname:short)\n%(refname:short)\n%(refname:short)\nsoeren@ubuntu ~/Projects/sandbox/chronogit (git)-[master] % git log --tags --simplify-by-decoration --format=\"%(refname:short)\" \n%(refname:short)\n%(refname:short)\n%(refname:short)" }, { "role": "assistant", "content": "Just tested with git 2.8.0:\ngit tag --sort=committerdate\n\nFor a full list of field names you can use, see https://git-scm.com/docs/git-for-each-ref#_field_names\n\nFor commit and tag objects, the special creatordate and creator fields will correspond to the appropriate date or name-email-date tuple from the committer or tagger fields depending on the object type. These are intended for working on a mix of annotated and lightweight tags.\nFields that have name-email-date tuple as its value (author, committer, and tagger) can be suffixed with name, email, and date to extract the named component." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How can I fetch an unmerged pull request for a branch I don't own?\nI need to pull in a specific pull request (that hasn't been processed into the main stream yet) in the NServiceBus repo:\nhttps://github.com/johnsimons/NServiceBus/commit/d8524d53094e8181716e771c1023e968132abc15\nIt's obviously not my repo, but I need the changes that exist in that pull request.\nWhat is the best way to do this?" }, { "role": "assistant", "content": "git pull origin pull/28/head\n\nOr\ngit fetch origin pull/28/head:28\ngit checkout 28\n\nCan I pull a not-yet-merged pull request?" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-log - Show commit logs" }, { "role": "assistant", "content": "Generating patch text with -p Running git-diff , git-log , git-show , git-diff-index , git-diff-tree , or git-diff-files with the -p option produces patch text.\nYou can customize the creation of patch text via the GIT_EXTERNAL_DIFF and the GIT_DIFF_OPTS environment variables\n(see git ), and the diff attribute (see gitattributes ). What the -p option produces is slightly different from the traditional\ndiff format: It is preceded by a \"git diff\" header that looks like this: diff --git a/file1 b/file2 The a/ and b/ filenames are the same unless rename/copy is\ninvolved. Especially, even for a creation or a deletion, /dev/null is not used in place of the a/ or b/ filenames. When a rename/copy is involved, file1 and file2 show the\nname of the source file of the rename/copy and the name of\nthe file that the rename/copy produces, respectively. It is followed by one or more extended header lines: old mode <mode>\nnew mode <mode>\ndeleted file mode <mode>\nnew file mode <mode>\ncopy from <path>\ncopy to <path>\nrename from <path>\nrename to <path>\nsimilarity index <number>\ndissimilarity index <number>\nindex <hash>..<hash> <mode> File modes are printed as 6-digit octal numbers including the file type\nand file permission bits. Path names in extended headers do not include the a/ and b/ prefixes. The similarity index is the percentage of unchanged lines, and\nthe dissimilarity index is the percentage of changed lines. It\nis a rounded down integer, followed by a percent sign. The\nsimilarity index value of 100% is thus reserved for two equal\nfiles, while 100% dissimilarity means that no line from the old\nfile made it into the new one. The index line includes the blob object names before and after the change.\nThe <mode> is included if the file mode does not change; otherwise,\nseparate lines indicate the old and the new mode. Pathnames with \"unusual\" characters are quoted as explained for\nthe configuration variable core.quotePath (see git-config ). All the file1 files in the output refer to files before the\ncommit, and all the file2 files refer to files after the commit.\nIt is incorrect to apply each change to each file sequentially. For\nexample, this patch will swap a and b: diff --git a/a b/b\nrename from a\nrename to b\ndiff --git a/b b/a\nrename from b\nrename to a Hunk headers mention the name of the function to which the hunk\napplies. See \"Defining a custom hunk-header\" in gitattributes for details of how to tailor this to\nspecific languages." } ]