messages
listlengths
3
3
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-apply - Apply a patch to files and/or to the index --unsafe-paths" }, { "role": "assistant", "content": "By default, a patch that affects outside the working area\n(either a Git controlled working tree, or the current working\ndirectory when \"git apply\" is used as a replacement of GNU\npatch) is rejected as a mistake (or a mischief). When git apply is used as a \"better GNU patch\", the user can pass\nthe --unsafe-paths option to override this safety check. This option\nhas no effect when --index or --cached is in use." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "GitHub Api download zip or tarball link\n\nThere was a good link here about how the zip/tarball string is created\nWhen I download a zip from github, what is the hex string at the end of the file name represent?\nBut I'm looking at the GitHub APIv3 and I was curious if I'm missing something.\n\nIs there a way to get the zip/tarball link via an API call?\nIf not, is there a way I can build that string without using the git binary or library? Meaning, can I use various API calls to pull out th data a need and assemble to URL I need?\n\nI know the second question is a little unreasonable for stackoverflow and this is a bit of a fun project for me, so I would prefer on the second question if you just kind of nudged me in the right direction as opposed to throwing down a code snippet. Or just told me if it was possible." }, { "role": "assistant", "content": "You can wget your way out of the GitHub repo to get a tar file (archive):\nwget --no-check-certificate https://github.com/User/repo/archive/master.tar.gz\n\n# better, if the certificate authorities are present:\nwget https://github.com/User/repo/archive/master.tar.gz\n\nwill get you a file named 'master' from the user 'User''s repo 'repo'.\nThe updated V3 API url is:\nhttps://api.github.com/repos/User/repo/:archive_format/:ref\n#\n# two possibilities for fomat:\nhttps://api.github.com/repos/User/repo/tarball/master\nhttps://api.github.com/repos/User/repo/zipball/master\n\n# from github example:\n$curl -L https://api.github.com/repos/octokit/octokit.rb/tarball > octokit.tar.gz\n\nYou can then tar xpvf master, getting the full archive. It will create a directory following the naming convention described in the question you mentioned.\nNo Git binary is needed to get an archive from GitHub, thanks to their download service \"Nodeload\".\n\nligemer proposed in an edit the following example:\nEdit 2016-08-25 - Shell Example With Wget, Variables, and Untar:\n#!/bin/bash -ex\n\n# arguments:\n# token = $1\n# organization = $2\n# repo name = $3\n# branch = $4\n\nwget --header=\"Authorization: token ${1}\" --header=\"Accept:application/vnd.github.v3.raw\" -O - https://api.github.com/repos/${2}/${3}/tarball/${4} | tar xz\n\nCall via:\n$ scriptName.sh token my-organization site.example master\n\nThe command above will download and extract the GitHub folder to the same directory as the script.\n\nDiogo Quintela suggests in the comments:\n\nThe following example allow the download, extract and cut the top level directory\n\ncurl -L https://api.github.com/repos/octokit/octokit.rb/tarball | tar xz --strip=1" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "msysgit on windows -- what should I be aware of, if any?\nThis is related to another question I asked recently.\nWhen installing msysgit, the installer presents 3 options related to system path:\n\nNever change windows environment. With this option, you have to use the \"bash\" shell to work with git.\nAdd the git\\bin directory to the PATH environment variable, but without overriding some builtin windows tools. Fellow stackoverflow-ian Gabe Moothart told me in a comment that this option will make some git operations fail! What are these operations? Should I worry about them?\nSame as 2 but override some default system tools. What are these tools? What parts of windows depend on them? and will this hurt in practice?\n\nAnother issue has come to my mind, unrelated to the system PATH.\nWhat if I have symbolic links and hard links inside my project directory? Does git know how to deal with these? or, will it suffer from infinite recursion, if say, the directory structure was such that some folder was actually a symbolic link to one of its parents?" }, { "role": "assistant", "content": "You get bash regardless of which option you pick, the latter options just add methods for using Git outside it.\nFor the latter options, msysgit adds Windows builds of common Linux utilities to PATH. This includes find, kill and sort, as well as cp, ls, rm, and about 20-30 others.\nThe problem with the first 3 (and similar) is that they exist in both OSs and function differently in each.\nNot a huge ordeal if you know which one you'll be using, but any applications developed expecting one and getting the other will surely throw a fit.\n\nTo prevent the conflict, while still having Git work as expected, you can create a simple batch script that adjusts PATH only for the session. (e.g., readygit.bat)\n@echo off\nsetlocal\nset PATH=C:\\Git\\bin;%PATH%\ncmd\n\nAdjust C:\\Git\\bin accordingly. But, just run this and use Git within the cmd.\nWith this, you can use install option 3 and safely remove C:\\Git\\bin from your system's PATH, removing any confusion for Windows apps without confusing Git.\nI currently use a similar script with GnuWin apps, including find." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git - the stupid content tracker git-help" }, { "role": "assistant", "content": "Display help information about Git" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Unable to find current origin/master revision in submodule path\nIn my project (which uses git), I need to use a library, which is still in progress. I decided to create a submodule for that library, because I want to update from time to time its latest version (I don't plan to make my own change there).\nI did:\ngit submodule add https://github.com/mb21/JSONedit.git\ngit commit -am 'added JSNedit submodule'\ngit push -u origin master\ngit pull origin master\n\nThen, I did see the JSONedit folder in my local folder, and a link in my git folder online. But when I did git submodule update --remote JSONedit/, I got the following errors: \nfatal: Needed a single revision\nUnable to find current origin/master revision in submodule path 'JSONedit'\n\nDoes anyone know what's wrong here?" }, { "role": "assistant", "content": "Running this in the main repository should do the trick:\ngit pull --recurse-submodules\n\nAccording to the other discussion, especially as @Tobu pointed out in his comment over there, if the error persists, it might be needed to first:\n\nremove both the submodule worktree (ext/blah) and the matching folder inside the GIT_DIR (.git/modules/ext/blah)\n\n\nAlternatively, you could git checkout the branch from which you want to pull while inside the submodule, and then run a git pull.\nResults should be the same." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-show-ref - List references in a local repository" }, { "role": "assistant", "content": "FILES .git/refs/* , .git/packed-refs" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-branch - List, create, or delete branches -a --all" }, { "role": "assistant", "content": "List both remote-tracking branches and local branches.\nCombine with --list to match optional pattern(s)." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-log - Show commit logs %D" }, { "role": "assistant", "content": "ref names without the \" (\", \")\" wrapping." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Including JavaScript files from GitHub into HTML pages\n\nPAY ATTENTION!\nYou can't include Github scripts directly from Github after this change.\nWe added the X-Content-Type-Options: nosniff header to our raw URL responses way back in 2011 as a first step in combating hotlinking. This has the effect of forcing the browser to treat content in accordance with the Content-Type header. That means that when we set Content-Type: text/plain for raw views of files, the browser will refuse to treat that file as JavaScript or CSS.\nBut there are alternatives. Check my answer to this question.\n\n\nI am trying to include a JavaScript file from GitHub into a local HTML file for testing (like an image found on the internet: <img src=\"http://...\">). \nI would like something like this:\n<script src=\"https://github.com/[username]/[repository]/blob/master/public/[fileName].js\"></script>\n\nThe problem is that this doesn't work.\nHow can I do this?" }, { "role": "assistant", "content": "https://rawgit.com has been shut down. This answer is unfortunately no longer relevant.\n\n\nYou will be able to do it with a URL similar to this:\n\nhttps://rawgit.com/h5bp/html5-boilerplate/master/src/js/plugins.js\n\nNote that this is not the same as clicking on the \"raw\" button within GitHub;\nthat button will also give you a clean version of the file, but it will be sent\nwith the wrong headers.\n\nA Word of warning; the file is not not being served from GitHub. It is being\nredirected through the rawgit.com domain. As is stated on https://rawgit.com:\n\nHey! rawgit.com is just for fun and is not associated with GitHub in any\nway.\n\nKeep in mind that the owner of that domain is now in control of the traffic and\nis able to manipulate it as they see fit." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Is it possible to create a remote repo on GitHub from the CLI without opening browser?\nI created a new local Git repository:\n~$ mkdir projectname\n~$ cd projectname\n~$ git init\n~$ touch file1\n~$ git add file1\n~$ git commit -m 'first commit'\n\nIs there any git command to create a new remote repo and push my commit to GitHub from here? I know it's no big deal to just fire up a browser and head over to Create a New Repository, but if there is a way to achieve this from the CLI I would be happy.\nI read a vast amount of articles but none that I found mention how to create a remote repo from the CLI using git commands. Tim Lucas's nice article Setting up a new remote git repository is the closest I found, but GitHub does not provide shell access." }, { "role": "assistant", "content": "CLI commands for github API v3 (replace all CAPS keywords):\ncurl -u 'USER' https://api.github.com/user/repos -d '{\"name\":\"REPO\"}'\n# Remember replace USER with your username and REPO with your repository/application name!\ngit remote add origin [email protected]:USER/REPO.git\ngit push origin master" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Unable to pull/push in git repository\n$ git pull origin master\nfatal: unable to access 'https://xxxxxxxxxxxxxxx': \n error setting certificate verify locations:\nCAfile: C:/Users/abc/AppData/Local/Programs/Git/usr/bin/curl-ca-bundle.crt\nCApath: none\n\nI am getting this error when I pull or push my code. \nPlease guide me to fix this." }, { "role": "assistant", "content": "When using https you will need to supply password or using a certificate.\nIn your case looks like the certificate is not a valid one.\nTry fixing it like this by telling git where to find the certificate:\n// Add the certificate to your configuration file\ngit config --system http.sslcainfo \"C:\\Program Files (x86)\\git\\bin\\curl-ca-bundle.crt\"\n\n\nAlternatively, you could disable SSL checks:\n// or switch off SSL checks completely by executing:\ngit config --system http.sslverify false\n\nSet this in your config to disable it only for the given url and not for all requests\n[http \"https://weak.example.com\"]\n sslVerify = false\n\n\nhttp.sslVerify\n\nWhether to verify the SSL certificate when fetching or pushing over HTTPS.\n\n\nhttp.sslCAInfo\n\nFile containing the certificates to verify the peer with when fetching or pushing over HTTPS" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Why is git-cherrypick saying nothing to commit?\n\nI searched a lot for the below issue but couldn't get any substantial info.\nI created a temporary branch 202116 and am trying to do a cherrypick of gerrit 202116 and I get the below message. Why am I not able to cherry-pick this commit and why am I getting this error?\n<>git fetch ssh://[email protected]:29418/platform/vendor/company-proprietary/radio refs/changes/25/202116/1 && git cherry-pick FETCH_HEAD\nFrom ssh://company.com:29418/platform/vendor/company-proprietary/radio\n * branch refs/changes/25/206025/1 -> FETCH_HEAD\n# On branch 202116\n# You are currently cherry-picking.\n# (all conflicts fixed: run \"git commit\")\n#\nnothing to commit, working directory clean\nThe previous cherry-pick is now empty, possibly due to conflict resolution.\nIf you wish to commit it anyway, use:\n\n git commit --allow-empty" }, { "role": "assistant", "content": "It's exactly what it says: the changes you're trying to cherry-pick are already wholly contained in the branch you're on. I.e. the result of the cherry-pick is no changes. You can create an empty commit with the --allow-empty flag to indicate that you attempted to cherry-pick, but there were no changes to pull in." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git - the stupid content tracker GIT_LITERAL_PATHSPECS" }, { "role": "assistant", "content": "Setting this Boolean environment variable to true will cause Git to treat all\npathspecs literally, rather than as glob patterns. For example,\nrunning GIT_LITERAL_PATHSPECS=1 git log -- '*.c' will search\nfor commits that touch the path *.c , not any paths that the\nglob *.c matches. You might want this if you are feeding\nliteral paths to Git (e.g., paths previously given to you by git ls-tree , --raw diff output, etc)." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-notes - Add or inspect object notes" }, { "role": "assistant", "content": "NAME git-notes - Add or inspect object notes" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Git - Can we recover deleted commits? [duplicate]\nThis question already has answers here:\n \n \n\n\n\n\nHow can I recover a lost commit in Git?\n\n (9 answers)\n \n\nClosed 8 years ago.\n\n\n\nI am surprised, I couldn't find the answer to this on SO.\n\nCan we recover/restore deleted commits in git?\n\nFor example, this is what I did:\n# Remove the last commit from my local branch\n$ git reset --hard HEAD~1\n\n# Force push the delete\n$ git push --force\n\nNow, is there a way to get back the commit which was deleted? Does git record(log) the delete internally?" }, { "role": "assistant", "content": "To get back to that commit you can use the reflog to look up it's ref.\n\nReference logs, or \"reflogs\", record when the tips of branches and\n other references were updated in the local repository.\n\nRun this command:\ngit reflog\n\nScan the first few entries, and find the commit that was lost. Keep track of the identifier to that commit (you can use either the 1st or 2nd columns). Let's call the identifier \"ID\".\nIf you have not made any extra work since you did the reset --hard you can do:\ngit reset --hard ID\ngit push -f origin master\n\nIf you have made other work since the reset, you could cherry-pick if back onto your branch like this:\ngit cherry-pick ID\ngit push origin master" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-config - Get and set repository or global options http.followRedirects" }, { "role": "assistant", "content": "Whether git should follow HTTP redirects. If set to true , git\nwill transparently follow any redirect issued by a server it\nencounters. If set to false , git will treat all redirects as\nerrors. If set to initial , git will follow redirects only for\nthe initial request to a remote, but not for subsequent\nfollow-up HTTP requests. Since git uses the redirected URL as\nthe base for the follow-up requests, this is generally\nsufficient. The default is initial ." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How can I let the gitlab-ci-runner DinD image cache intermediate images?\n\nI have a Dockerfile that starts with installing the texlive-full package, which is huge and takes a long time. If I docker build it locally, the intermedate image created after installation is cached, and subsequent builds are fast.\nHowever, if I push to my own GitLab install and the GitLab-CI build runner starts, this always seems to start from scratch, redownloading the FROM image, and doing the apt-get install again. This seems like a huge waste to me, so I'm trying to figure out how to get the GitLab DinD image to cache the intermediate images between builds, without luck so far.\nI have tried using the --cache-dir and --docker-cache-dir for the gitlab-runner register command, to no avail.\nIs this even something the gitlab-runner DinD image is supposed to be able to do?\nMy .gitlab-ci.yml:\nbuild_job:\n script:\n - docker build --tag=example/foo .\n\nMy Dockerfile:\nFROM php:5.6-fpm\nMAINTAINER Roel Harbers <[email protected]>\nRUN apt-get update && apt-get install -qq -y --fix-missing --no-install-recommends texlive-full\nRUN echo Do other stuff that has to be done every build.\n\nI use GitLab CE 8.4.0 and gitlab/gitlab-runner:latest as runner, started as\ndocker run -d --name gitlab-runner --restart always \\\n -v /var/run/docker.sock:/var/run/docker.sock \\\n -v /usr/local/gitlab-ci-runner/config:/etc/gitlab-runner \\\n gitlab/gitlab-runner:latest \\\n; \\\n\nThe runner is registered using:\ndocker exec -it gitlab-runner gitlab-runner register \\\n --name foo.example.com \\\n --url https://gitlab.example.com/ci \\\n --cache-dir /cache/build/ \\\n --executor docker \\\n --docker-image gitlab/dind:latest \\\n --docker-privileged \\\n --docker-disable-cache false \\\n --docker-cache-dir /cache/docker/ \\\n; \\\n\nThis creates the following config.toml:\nconcurrent = 1\n[[runners]]\n name = \"foo.example.com\"\n url = \"https://gitlab.example.com/ci\"\n token = \"foobarsldkflkdsjfkldsj\"\n tls-ca-file = \"\"\n executor = \"docker\"\n cache_dir = \"/cache/build/\"\n [runners.docker]\n image = \"gitlab/dind:latest\"\n privileged = true\n disable_cache = false\n volumes = [\"/cache\"]\n cache_dir = \"/cache/docker/\"\n\n(I have experimented with different values for cache_dir, docker_cache_dir and disable_cache, all with the same result: no caching whatsoever)" }, { "role": "assistant", "content": "I suppose there's no simple answer to your question. Before adding some details, I strongly suggest to read this blog article from the maintainer of DinD, which was originally named \"do not use Docker in Docker for CI\".\nWhat you might try is declaring /var/lib/docker as a volume for your GitLab runner. But be warned, depending on your file-system drivers you may use AUFS in the container on an AUFS filesystem on your host, which is very likely to cause problems.\nWhat I'd suggest to you is creating a separate Docker-VM, only for the runner(s), and bind-mount docker.sock from the VM into your runner-container.\nWe are using this setup with GitLab with great success (>27.000 builds in about 12 months).\nYou can take a look at our runner with docker-compose support which is actually based on the shell-executor of GitLab's runner." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How does 'git log --graph' or 'hg graphlog' work?\n\nI know that the history in Git is stored in a data structure called a DAG. I've heard about DFS and know it's somewhat related.\nI'm curious, how do programs such as git log --graph or hg graphlog draw the history? I always thought it's quite complicated to draw the lanes and everything in such a nice way.\nCould someone write some pseudo code that demonstrates it?\nnote: I tried looking around Git or hg's code but it's very hard to follow and get a general idea of what's going on." }, { "role": "assistant", "content": "First, one obtains a list of commits (as with git rev-list), and parents of each commit. A \"column reservation list\" is kept in memory.\nFor each commit then:\n\nIf the commit has no column reserved for it, assign it to a free column. This is how the branch heads will start.\nPrint the tree graphics according to the column reservation list, and then the commit message\nThe reservation's list entry for the current column/commit is updated with the first parent of the current commit, such that the parent is going to be printed in the same column.\nOther parents get a new free column.\nIf this was a merge, the next line will try to link the second parent to a column where the commit is expected (this makes for the loops and the \"≡ bridge\")\n\nExample showing output of git-forest on aufs2-util with an extra commit to have more than one branch).\n\nWith lookahead, one can anticipate how far down the merge point will be and squeeze the wood between two columns to give a more aesthetically pleasing result." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git - the stupid content tracker gitk" }, { "role": "assistant", "content": "The Git repository browser" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git - the stupid content tracker git-index-pack" }, { "role": "assistant", "content": "Build pack index file for an existing packed archive" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "GitHub Error: Key already in use\n\nI have created two GitHub accounts. One for my work user and one for my personal self. I needed to do catch up on some work and as such cloned my work repo onto my personal PC. In order to do simple \"git push origin master\" commits without entering my username and password the whole time I simply want to add my public key from my home pc to the work repo. However Github gives this error:\nError: Key already use\n\nAfter a bit of Googling I came across this link which states \"To resolve the issue, remove the key from the other account or repository and add it to your account\" Of course there is a duplicate key as I've added my home public key to github so that I can code on my own personal projects. After all I want to be able to code to my work repo using both my work pc and personal pc.\nHow can you add multiple \"same\" public keys without Github throwing that error and also why in the world, is that error thrown in the first place?" }, { "role": "assistant", "content": "You can create one more key pair, say id_rsa_personal.pub, and add it to the Github account.\nNext, create/edit the .ssh/config file.\n# Default GitHub\nHost github.com\n HostName github.com\n User git\n IdentityFile ~/.ssh/id_rsa\n\nHost github-public\n HostName github.com\n User git\n IdentityFile ~/.ssh/id_rsa_public\n\nHost github-personal\n HostName github.com\n User git\n IdentityFile ~/.ssh/id_rsa_personal\n\nThe above file will help you to use more than one Github account. For background info, refer to the answers to this question.\nNext, you will need to alter your .git/config remote url to point to:\ngithub-personal:<gh_username>/<gh_reponame>.git\nRather than the usual:\n[email protected]:<gh_username>/<gh_reponame>.git" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "View git history of specific line\nI want to view the commit history related to the specific line in the file. I know we can get the history of the file. Are there any commands available to sort only the commits related to one specific line?" }, { "role": "assistant", "content": "bomz gave the right option but with wrong syntax. Fixed line would look like this:\ngit log -L '/the line from your file/,+1:path/to/your/file.txt'\n\nThe meaning of argument to -L is \"find the first occurrence of regex /the line from your file/, in path/to/your/file.txt and show the log regarding one line range starting at this point (meaning, just this line, but you could say +5 instead)\".\nThe caveat is, if the line contains characters with special meaning in regex, you need to escape them.\nHowever, it's likely much simpler to use line number, like this:\ngit log -L15,+1:'path/to/your/file.txt'\n\n(for line 15 of file path/to/your/file.txt)\nIn both cases +1 can be replaced with bigger number to get more line, or with regex to match the end of selected range.\nDetailed description from the docs:\n\n-L <start>,<end>:<file>\n-L :<funcname>:<file>\n\nTrace the evolution of the line range given by \"<start>,<end>\" (or the function name regex <funcname>) within the\n <file>. You may not give any pathspec limiters. This is currently\n limited to a walk starting from a single revision, i.e., you may only\n give zero or one positive revision arguments. You can specify this\n option more than once.\n<start> and <end> can take one of these forms:\n\nnumber\nIf <start> or <end> is a number, it specifies an absolute line number\n (lines count from 1).\n/regex/\nThis form will use the first line matching the given POSIX regex. If\n <start> is a regex, it will search from the end of the previous -L\n range, if any, otherwise from the start of file. If <start> is\n “^/regex/”, it will search from the start of file. If <end> is a\n regex, it will search starting at the line given by <start>.\n+offset or -offset\nThis is only valid for <end> and will specify a number of lines before\n or after the line given by <start>.\n\nIf “:<funcname>” is given in place of <start> and <end>, it is a\n regular expression that denotes the range from the first funcname line\n that matches <funcname>, up to the next funcname line. “:<funcname>”\n searches from the end of the previous -L range, if any, otherwise from\n the start of file. “^:<funcname>” searches from the start of file." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-diff - Show changes between commits, commit and working tree, etc --patch-with-raw" }, { "role": "assistant", "content": "Synonym for -p --raw ." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Changing an existing submodule's branch\nWhen I initially added my submodule, I specified a particular branch, as seen in the .gitmodule file:\n[submodule \"externals/grpc/grpc\"]\n path = externals/grpc/grpc\n url = [email protected]:me/grpc.git\n branch = release-1.0\n\nI want to change to the master branch of my submodule, so I changed the branch in .gitmodules from release-1.0 to master, and for good measure, just deleted the submodule from my parent git tree:\ncd $submodules\nrm -rf grpc\ncd $gitroot\ngit submodule sync\ngit submodule update --init --recursive\n\nNow, when I go back to my submodule, it's still checked out from a commit on the release-1.0 branch, not the latest master commit.\nWhat steps am I missing to switch my submodule's branch?" }, { "role": "assistant", "content": "Go into the directory where the submodule resides and git checkout the correct branch/commit. Then go up one level and git add and git commit the directory. This will check in the submodule with the correct commit.\nAnd don't forget to run git submodule update --recursive on the other clients after updating them." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-merge-base - Find as good common ancestors as possible for a merge" }, { "role": "assistant", "content": "DISCUSSION Given two commits A and B , git merge-base A B will output a commit\nwhich is reachable from both A and B through the parent relationship. For example, with this topology: o---o---o---B\n\t/\n---o---1---o---o---o---A the merge base between A and B is 1 . Given three commits A , B , and C , git merge-base A B C will compute the\nmerge base between A and a hypothetical commit M , which is a merge\nbetween B and C . For example, with this topology: o---o---o---o---C\n /\n / o---o---o---B\n / /\n---2---1---o---o---o---A the result of git merge-base A B C is 1 . This is because the\nequivalent topology with a merge commit M between B and C is: o---o---o---o---o\n / \\\n / o---o---o---o---M\n / /\n---2---1---o---o---o---A and the result of git merge-base A M is 1 . Commit 2 is also a\ncommon ancestor between A and M , but 1 is a better common ancestor,\nbecause 2 is an ancestor of 1 . Hence, 2 is not a merge base. The result of git merge-base --octopus A B C is 2 , because 2 is\nthe best common ancestor of all commits. When the history involves criss-cross merges, there can be more than one best common ancestor for two commits. For example, with this topology: ---1---o---A\n \\ /\n X\n / \\\n---2---o---o---B both 1 and 2 are merge bases of A and B. Neither one is better than\nthe other (both are best merge bases). When the --all option is not given,\nit is unspecified which best one is output. A common idiom to check \"fast-forward-ness\" between two commits A\nand B is (or at least used to be) to compute the merge base between\nA and B, and check if it is the same as A, in which case, A is an\nancestor of B. You will see this idiom used often in older scripts. A=$(git rev-parse --verify A)\nif test \"$A\" = \"$(git merge-base A B)\"\nthen\n\t... A is an ancestor of B ...\nfi In modern git, you can say this in a more direct way: if git merge-base --is-ancestor A B\nthen\n\t... A is an ancestor of B ...\nfi instead." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How do I get the Git commit count?\nI'd like to get the number of commits of my Git repository, a bit like SVN revision numbers.\nThe goal is to use it as a unique, incrementing build number.\nI currently do like that, on Unix/Cygwin/msysGit:\ngit log --pretty=format:'' | wc -l\n\nBut I feel it's a bit of a hack.\nIs there a better way to do that? It would be cool if I actually didn't need wc or even Git, so it could work on a bare Windows. Just read a file or a directory structure..." }, { "role": "assistant", "content": "To get a commit count for a revision (HEAD, master, a commit hash):\ngit rev-list --count <revision>\n\nTo get the commit count across all branches:\ngit rev-list --count --all\n\nI recommend against using this for build identifier, but if you must, it's probably best to use the count for the branch you're building against. That way the same revision will always have the same number. If you use the count for all branches, activity on other branches could change the number." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-diff - Show changes between commits, commit and working tree, etc git-diff-files [<pattern>…​]" }, { "role": "assistant", "content": "compares the index and the files on the filesystem." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Git lfs - \"this exceeds GitHub's file size limit of 100.00 MB\"\nI have some csv files that are larger than github's file size limit of 100.00 MB. I have been trying to use the Git Large File Storage extension.\nhttps://git-lfs.github.com/\nFrom LFS - \"Large file versioning- Version large files—even those as large as a couple GB in size—with Git.\"\nI have applied the following on the folders of concern:\ngit lfs track \"*.csv\"\n\nHowever, when I push:\nremote: error: File Time-Delay-ftn/Raw-count-data-minor-roads1.csv is 445.93 MB; this exceeds GitHub's file size limit of 100.00 MB\nremote: error: File Time-Delay-ftn/Raw-count-data-major-roads.csv is 295.42 MB; this exceeds GitHub's file size limit of 100.00 MB\n\nWhen I look at the folder in question:\n-rw-r----- 1 user staff 42B 23 Oct 12:34 .gitattributes\n-rw-r--r-- 1 user staff 1.3K 19 Oct 14:32 DfT_raw_major_manipulation.py\n-rw-r--r-- 1 user staff 1.2K 16 Oct 15:08 DfT_raw_minor_manipulation.py\ndrwxr-xr-x 21 user staff 714B 22 Oct 11:35 Driving/\n-rwxr-xr-x@ 1 user staff 295M 19 Oct 14:47 Raw-count-data-major-roads1.csv*\n-rwxr-xr-x@ 1 user staff 446M 16 Oct 14:52 Raw-count-data-minor-roads1.csv*\n\nwhen I vim the .gitattributes file you can see the lfs setup:\n*.csv filter=lfs diff=lfs merge=lfs -text\n\nWhat am I doing wrong?\nUPDATE\nWhen I query \ngit lfs ls-files\n\nI get nothing returned. This indicates that despite the .csv filter being successfully applied to the .gitattributes file the csv files are not being picked up by lfs" }, { "role": "assistant", "content": "Since Git LFS 2.2.0 you can use git lfs migrate command. In your case it would look this way:\ngit lfs migrate import --include=\"*.csv\"\n\nAfter this, you should be able to push changes into origin.\nMore information about git lfs migrate is available on Git LFS 2.2.0 release note site and git-lfs-migrate command documentation." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "gitignore ignore files within a folder that has whitespace in the middle\n\nI have a folder that have a space in the middle, but have a webconfig file inside it. I want git to ignore the webconfig file but somehow it's not ignoring it because of the space in the folder. Anybody know how to work around this?\nMy FolderName/Web.config\n\nI tried to insert the %20 in the middle but that did not help.\nThank you for your help." }, { "role": "assistant", "content": "Try My\\ FolderName/Web.config or \"My FolderName/Web.config\"" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-show - Show various types of objects %Creset" }, { "role": "assistant", "content": "reset color" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Git: Ignoring Version-Controlled Files\nThe .gitignore file is very useful in ignoring some of the files that we don't want to control. Unfortunately, it cannot be used when the file is already under version control. For example, my .gitignore (which is already added to git) file might be different than what my coworker wants it to be (e.g. I want to ignore Vim files). Whenever I make changes to this file, git shows it as a modified file. So my questions:\n\nIs there any way to ignore changes for a certain file, which is already controlled by Git?!\nIs there any way to commit these changes, but keep it for myself only? Obviously, I don't want to use a branch, because I am working on a certain branch." }, { "role": "assistant", "content": "Use git-update-index to temporarily ignore changes to files that are already under version control:\ngit update-index --assume-unchanged <files>\n\nTo undo that use:\ngit update-index --no-assume-unchanged <files>\n\nAlso have a look at the skip-worktree and no-skip-worktree options for update-index if you need this to persist past a git-reset" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git - the stupid content tracker HEAD" }, { "role": "assistant", "content": "indicates the head of the current branch." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-log - Show commit logs log.showRoot" }, { "role": "assistant", "content": "If true, the initial commit will be shown as a big creation event.\nThis is equivalent to a diff against an empty tree.\nTools like git-log or git-whatchanged , which\nnormally hide the root commit will now show it. True by default." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to build Docker Images with Dockerfile behind HTTP_PROXY by Jenkins?\nBuilding Docker images works in a desktop without a problem. Installing Node.js NPM dependencies work as usual. However, when using a continuous integration server such as Jenkins that is hosted behind a corporate proxy, the build Docker Images fail.\nNode.js NPM Dependencies\nWhile building Node.js pacakges, the command npm install fails when it cannot connect to GIT while cloning GIT dependencies.\ne1ce5e8407d1: Already exists\nStatus: Image is up to date for node:0.10.33\n ---> e1ce5e8407d1\nStep 1 : RUN mkdir -p /usr/src/app\n ---> Using cache\n ---> 965cad0c68b0\nStep 2 : WORKDIR /usr/src/app\n ---> Using cache\n ---> 4c498f0c07e9\nStep 3 : COPY package.json /usr/src/app/\n ---> b0662a8275fb\nRemoving intermediate container 5aca20551452\nStep 4 : RUN npm install\n ---> Running in 7ccf9e5362af\nnpm WARN package.json [email protected] No README data\nnpm WARN package.json Dependency 'async-cache' exists in both dependencies and devDependencies, using 'async-cache@^0.1.5' from dependencies\nnpm ERR! git clone https://github.com/npm/npm2es.git Cloning into bare repository '/root/.npm/_git-remotes/https-github-com-npm-npm2es-git-60a75edb'...\nnpm ERR! git clone https://github.com/npm/npm2es.git fatal: unable to access 'https://github.com/npm/npm2es.git/': Failed to connect to github.com port 443: Connection timed out\n\nJava Maven, Ruby, Go Docker Images with Dependencies\nThe same occurs when building Java, Ruby or Go containers, where dependencies are located in repository servers across your corporate Proxy server. \nKnowing that you can configure Docker with HTTP_PROXY environment variable, how to properly configure Docker to properly build images in CI environments?" }, { "role": "assistant", "content": "Note: Docker 1.9 might help solve this:\n\n\"Issue 14634\": Builder - Build-time argument passing (e.g., HTTP_PROXY)\n\"PR 15182\": Support for passing build-time variables in build context\n\nUsage (proposed):\ndocker build --build-arg http_proxy=http://my.proxy.url --build-arg foo=bar <<MARK\nFROM busybox\nRUN <command that need http_proxy>\nARG --description=\"foo's description\" foo\nUSER $foo\nMARK" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-daemon - A really simple server for Git repositories" }, { "role": "assistant", "content": "SYNOPSIS git daemon [--verbose] [--syslog] [--export-all]\n\t [--timeout=<n>] [--init-timeout=<n>] [--max-connections=<n>]\n\t [--strict-paths] [--base-path=<path>] [--base-path-relaxed]\n\t [--user-path | --user-path=<path>]\n\t [--interpolated-path=<pathtemplate>]\n\t [--reuseaddr] [--detach] [--pid-file=<file>]\n\t [--enable=<service>] [--disable=<service>]\n\t [--allow-override=<service>] [--forbid-override=<service>]\n\t [--access-hook=<path>] [--[no-]informative-errors]\n\t [--inetd |\n\t [--listen=<host-or-ipaddr>] [--port=<n>]\n\t [--user=<user> [--group=<group>]]]\n\t [--log-destination=(stderr|syslog|none)]\n\t [<directory>…​]" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "What happens if you force push to a branch with an existing pull request?\n\nI am working on a git branch that is currently part of a closed pull request on github. Subsequently to the initial pull request, I made some additional commits, pushed those commits to github, and then reverted those commits and recommitted them because I need to revise the commits. \nNow if I want to push those commits to github, I'll need to issue a force push: git push --force. But I have the strong feeling that this might cause mayhem with the existing pull request, even though the changed commits occurred after the commits that existed prior to me making the pull request.\nCan anyone describe to me how best to handle this situation? I think I may need to just create an entirely new branch and then issue a pull request on that branch instead. But if there's a way to link this to the existing pull request that would be preferable." }, { "role": "assistant", "content": "If my memory serves me correctly, then if you force push or update the branch in question in any way, GitHub will automatically update the pull request. If doing the force push would result in the pull request not being possible, then GitHub will tell you this.\nYou do not need to worry about updating the pull request as GitHub will take care of this for you.\nThis being said, doing a git push --force on any remote branch can cause mayhem for your coworkers who are also currently working on this branch. So you are correct to be shying away from doing a force push, but fortunately a GitHub pull request is not your biggest problem." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Using the same deploy key for multiple github projects\n\nGithub does not allow the same ssh deploy key to be used for more than one project, which would be very useful in some cases (e.g. CI server dealing with project with private sub-modules). I've seen various threads that seem to say that this limitation is there for 'security reasons', but I'm yet to see a convincing explanation about exactly what risk that would raise.\nNote that the fact that Github doesn't allow Account Level keys to be reused makes sense (two users shouldn't share keys). It is only the restriction on Deploy Keys that I'm questioning.\nAnd to be clear, I'm not looking for workarounds (create a dummy user, use multiple keys, ...), but only for a plausible explanation for this limitation on Deploy Keys.\nRelated threads:\n\nOne showing a workaround\nOne discussing the issue but not really going anywhere" }, { "role": "assistant", "content": "Unfortunately, this is a scenario where github just misinterprets the distinction between a key pair and an account or project.\nSince a key pair is used for authentication and authorization, it is effectively an identity. Github accounts are another identity. Connecting github accounts to key pairs effecticely establishes a 1:N mapping between github account based identities and key pair identities.\nConversely, github enforces a 1:N mapping of projects to key pair based identities. The real world analogue is that there is a door granting access to the project that can be unlocked by many different people. But once any of them gets a key to the door, they cannot get any other keys for any other doors, ever again.\nIt makes sense not to re-use keys often from the perspective of containing breaches if a key gets compromised. But that's just a good administration policy. It doesn't make much sense to prevent a key from being used more than once on principle. That there are some keys for some doors that are never re-used, well, again that's down to policy.\n\nA slightly more complex view is to illustrate key pairs as roles. You can possess many key pairs, and therefore inhabit many roles. The private key authenticates you for the role.\nGithub's deploy key mapping to projects states that a role can never encompass more than one task. That's rarely realistic.\nNone of which changes what github allows, of course." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git - the stupid content tracker git-rm" }, { "role": "assistant", "content": "Remove files from the working tree and from the index" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Git SSH error: \"Connect to host: Bad file number\"\n\nI followed the git guide but I have this strange issue when trying to connect to github:\n$ ssh -v [email protected]\nOpenSSH_4.6p1, OpenSSL 0.9.8e 23 Feb 2007\ndebug1: Reading configuration data /c/Documents and Settings/mugues/.ssh/config\ndebug1: Applying options for github.com\ndebug1: Connecting to github.com [207.97.227.239] port 22.\ndebug1: connect to address 207.97.227.239 port 22: Attempt to connect timed out without establishing a connection\nssh: connect to host github.com port 22: Bad file number\n\nThis is my config file under .ssh\nHost github.com\n User git\n Hostname github.com\n PreferredAuthentications publickey\n IdentityFile \"C:\\Documents and Settings\\mugues\\.ssh\\id_rsa\"\n TCPKeepAlive yes\n IdentitiesOnly yes\n\nAny idea?" }, { "role": "assistant", "content": "After having this problem myself, I found a solution that works for me:\nError message: \n ssh -v [email protected]\n OpenSSH_5.8p1, OpenSSL 1.0.0d 8 Feb 2011\n debug1: Connecting to github.com [207.97.227.239] port 22.\n debug1: connect to address 207.97.227.239 port 22: Connection timed out\n ssh: connect to host github.com port 22: Connection timed out\n ssh: connect to host github.com port 22: Bad file number\n\nYou will only see the bad file number message when on windows using the MINGGW shell. Linux users will just get Timed out.\nProblem:\nSSH is probably blocked on port 22. You can see this by typing\n $nmap -sS github.com -p 22\n Starting Nmap 5.35DC1 ( http://nmap.org ) at 2011-11-05 10:53 CET\n Nmap scan report for github.com (207.97.227.239)\n Host is up (0.10s latency).\n PORT STATE SERVICE\n 22/tcp ***filtered*** ssh\n\n Nmap done: 1 IP address (1 host up) scanned in 2.63 seconds\n\nAs you can see the state is Filtered, which means something is blocking it.\nYou can solve this by performing an SSH to port 443 (your firewall / isp will not block this).\nIt is also important that you need to ssh to \"ssh.github.com\" instead of github.com.\nOtherwise, you will report to the webserver instead of the ssh server. \nBelow are all the steps needed to solve this problem.\nSolution:\n(First of all make sure you generated your keys like explained on http://help.github.com/win-set-up-git/)\ncreate file ~/.ssh/config (ssh config file located in your user directory. \nOn windows probably %USERPROFILE%\\.ssh\\config\nPaste the following code in it:\n Host github.com\n User git\n Hostname ssh.github.com\n PreferredAuthentications publickey\n IdentityFile ~/.ssh/id_rsa\n Port 443\n\nSave the file.\nPerform ssh like usual:\n$ssh -T github.com \n $Enter passphrase for key '.......... (you can smile now :))\n\nNote that I do not have to supply the username or port number." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to create a good-looking notification or warning box in Github Flavoured Markdown?\n\nI am looking for something simple like triple backticks, but that still allows other markdown syntax inside.\nThis is not the case for triple backticks, since it is used for code blocks:\n**NOTE:**\nFind the docs [here](http://example.com/).\n\nEverything inside is taken literally, so it is not possible to use other markdown features inside, like links or bold text ...\nIs there any syntax or feature in markdown that enables such notification boxes?" }, { "role": "assistant", "content": "As Waylan mentions in his answer, Github strips script and style tags from the markdown before displaying it. This means the only possibilities for notification boxes that will render on Github are those provided by native markdown or html.\nAfter some searching and experimenting, I discovered it is possible to (ab)use the\ntables syntax,\nand combine it with Github emoji markdown.\nFor example:\n\nBoxes from a single cell table:\n| :exclamation: This is very important |\n|-----------------------------------------|\n\n\n| :zap: Ignore at your own risk! |\n|-----------------------------------------|\n\n\n\nBoxes from a single row table with 2 cells:\n| :memo: | Take note of this |\n|---------------|:------------------------|\n\n\n| :point_up: | Remember to not forget! |\n|---------------|:------------------------|\n\n\n\nBoxes from a 2 row table:\n| :warning: WARNING |\n|:---------------------------|\n| I should warn you ... |\n\n\n| :boom: DANGER |\n|:---------------------------|\n| Will explode when clicked! |\n\n\n\n\nNote that markdown tables do not allow newlines, so you should use <br /> tags if you need multiple lines inside the box. In this case it might be simpler to directly use the html <table> tag, since it doesn't have this newline restriction. It also allows getting rid of the bold styling of the table header <thead> by replacing its <th> tags with <td> tags:\n<table>\n <thead>\n <tr>\n <td align=\"left\">\n :information_source: Information\n </td>\n </tr>\n </thead>\n\n <tbody>\n <tr>\n <td>\n <ul>\n <li>Tis not true.</li>\n <li>I won't explode.</li>\n </ul>\n </td>\n </tr>\n </tbody>\n</table>" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-clean - Remove untracked files from the working tree" }, { "role": "assistant", "content": "NAME git-clean - Remove untracked files from the working tree" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git - the stupid content tracker git-mailinfo" }, { "role": "assistant", "content": "Extracts patch and authorship from a single e-mail message" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-diff - Show changes between commits, commit and working tree, etc --diff-algorithm={patience|minimal|histogram|myers}" }, { "role": "assistant", "content": "Choose a diff algorithm. The variants are as follows: default , myers The basic greedy diff algorithm. Currently, this is the default. minimal Spend extra time to make sure the smallest possible diff is\nproduced. patience Use \"patience diff\" algorithm when generating patches. histogram This algorithm extends the patience algorithm to \"support\nlow-occurrence common elements\". For instance, if you configured the diff.algorithm variable to a\nnon-default value and want to use the default one, then you\nhave to use --diff-algorithm=default option." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-format-patch - Prepare patches for e-mail submission --no-prefix" }, { "role": "assistant", "content": "Do not show any source or destination prefix." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-log - Show commit logs --graph" }, { "role": "assistant", "content": "Draw a text-based graphical representation of the commit history\non the left hand side of the output. This may cause extra lines\nto be printed in between commits, in order for the graph history\nto be drawn properly.\nCannot be combined with --no-walk . This enables parent rewriting, see History Simplification above. This implies the --topo-order option by default, but the --date-order option may also be specified." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-reset - Reset current HEAD to the specified state --pathspec-file-nul" }, { "role": "assistant", "content": "Only meaningful with --pathspec-from-file . Pathspec elements are\nseparated with NUL character and all other characters are taken\nliterally (including newlines and quotes)." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-show-ref - List references in a local repository -d --dereference" }, { "role": "assistant", "content": "Dereference tags into object IDs as well. They will be shown with ^{} appended." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Gitlab API: How to generate the private token\n\nThis is what I tried:\ncurl http://git.ep.petrobras.com.br/api/v3/session --data-urlencode 'login=myUser&password=myPass'\n\nAnswer:\n{\"message\":\"401 Unauthorized\"}" }, { "role": "assistant", "content": "The problem is the data-urlencode CURL option. Since it's an HTTP POST you don't need to URL encode the data, and is actually encoding the & into &amp; and causing your issue. Instead use the --data option.\ncurl http://git.ep.petrobras.com.br/api/v3/session --data 'login=myUser&password=myPass'\n\nAlso, be careful sending credentials over plain HTTP. It could be easily sniffed." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-config - Get and set repository or global options sendemail.signedOffCc (deprecated)" }, { "role": "assistant", "content": "Deprecated alias for sendemail.signedOffByCc ." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Make Jira links clickable in Github\n\nIs there a way I can make Jira ticket id's on Github link to Jira? (much the same way as how it happens on Bitbucket).\nMaybe there is a plugin or something I could use ?\nEDIT:\nI specifically want ticket id's in Github to link through to Jira, this is not described in any of the resources below:\n\nHow do I connect github to JIRA?\n\nhttps://confluence.atlassian.com/display/BITBUCKET/Linking+Bitbucket+and+GitHub+accounts+to+JIRA\n\nhttps://help.github.com/articles/integrating-jira-with-your-projects/" }, { "role": "assistant", "content": "Update 2022:\nDusan Plavak mentions in the comments that, as of today (Q1 2022), you can also import / automate creation of autolinks via github api.\nYou can also use gh api:\ngh api repos/octocat/hello-world/autolinks \\\n -f -q 'key_prefix:key_prefix url_template:url_template'\n\n\nAnd since July 2022, you also have autolinks with alphanumeric IDs (for instance for a Trello card URL: https://trello.com/c/3eZr2Bxw).\n\n2019: No need for Chrome plugin, Safari hack or scripts.\nFrom October 2019, GitHub can automatically transform TICKET references to Jira links, for example.\nSee \"Save time linking resources with autolink references\" from Lars Schneider.\n\nNow you can set up an autolink reference and GitHub will automatically create links (to external systems) for you.\n\nHow it works\nIf you use GitHub with external services (like Jira), you might be familiar with shorthand references (like TICKET-123) to point to resources in those external systems.\nStarting today, GitHub can automatically transform shorthand references into clickable links for GitHub Pro, Team, and Enterprise plans.\n\nSo not the regular github.com.\n\nTo enable this feature, a repository admin needs to register the reference prefix (such as TICKET-) in the settings.\nAfterwards, references of that type are detected in issues, pull requests, comments, or commit messages, and turned into links.\nThis speeds up navigation between GitHub and external systems.\n\nSee documentation.\nNote that the ticket prefix is not included in the hyperlink despite being included in the anchor text. The URL preview in the setting is accurate:\n\nThe animation in the feature announcement, replicated above, shows this limitation but not clearly.\nThis means that you have to either include the project key in the target URL as well or prefix all project keys with a another key and use that as the autolink prefix.\nYou cannot even use Git's trailers to reference tickets and use autolinks, because trailers are key-value pairs separated by : (colon space) and an autolink prefix that ends with a space is invalid." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "See what's in a stash without applying it [duplicate]\nThis question already has answers here:\n \n \n\n\n\n\nHow do I preview stash contents in Git?\n\n (18 answers)\n \n\nClosed 4 years ago.\n\n\n\nHow do I see what is inside a stash without actually applying it?" }, { "role": "assistant", "content": "From man git-stash (which can also be obtained via git help stash):\n\nThe modifications stashed away by this command can be listed with git stash list, inspected with git stash show, and ...\n\nshow [<stash>]\n Show the changes recorded in the stash as a diff between the stashed\n state and its original parent. When no <stash> is given, shows the\n latest one. By default, the command shows the diffstat, but it will\n accept any format known to git diff (e.g., git stash show -p stash@{1}\n to view the second most recent stash in patch form).\n\nNote: the -p option generates a patch, as per git-diff documentation.\nList the stashes:\ngit stash list\n\nShow the files in the most recent stash:\ngit stash show\n\nShow the changes of the most recent stash:\ngit stash show -p\n\nShow the changes of the named stash:\ngit stash show -p stash@{1}\n\nOr in short:\ngit stash show -p 1 \n\nIf you want to view changes of only the last stash:\ngit stash show -p 0" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to exclude a folder in a working git repository (Visual Studio Code)\nI am using Visual Studio Code version 0.7.10. I want to use version control. I figured this was a good time to start teaching myself to use git. I have never used it before.\nHow do I make git ignore my \"node_modules\" folder? Every item in this folder is listed for possible commits and that is cluttering up my workspace. I don't want to upload all the packages. I figure whoever runs the package.json can do that on their own computer.\nThought: I found under File > Preferences > User Settings that there is a configuration file called \"settings.json\" that will overwrite the default settings. I see a \"Git configuration\" in the default settings but I can't find any documentation on my possible options here. I would think I could do a \"git.exclude\" but where do I begin. This is only a guess at a solution. I am sure the real answer is something completely different.\nI am looking for any documentation you could point me to. Thanks!\nUPDATE: I made a change to the \".git/info/exclude\" file and my Git repository view cleared up instantly. Here is a link that talks about the exclude file and why it worked for my VS Code editor. (https://help.github.com/articles/ignoring-files/)" }, { "role": "assistant", "content": "Follow the steps to add a folder to .gitignore using UI\n\nClick Source Control on left pane\nClick on three dots at right top of Source Control tab\nSelect View & Sort>View as Tree\nRight click on the folder you want to add to .gitignore\nSelect Add to .gitignore\n\nYou are done!" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-diff - Show changes between commits, commit and working tree, etc ignore-all-space" }, { "role": "assistant", "content": "Ignore whitespace when comparing lines. This ignores differences\neven if one line has whitespace where the other line has none." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Git on Windows, \"Out of memory - malloc failed\"\nHave run into a problem with repository and tried almost every possible config setting found out there eg. pack.WindowMemory etc etc\nI believe someone has checked in a large file to remote repository and now each time I try and pull or push to it, GIT tries to pack it and runs out of memory:\nAuto packing the repository for optimum performance. You may also\nrun \"git gc\" manually. See \"git help gc\" for more information.\nCounting objects: 6279, done.\nCompressing objects: 100% (6147/6147), done.\nfatal: Out of memory, malloc failed (tried to allocate 1549040327 bytes)\nerror: failed to run repack\n\nHave tried git gc & git repack with various options but keeps returning same error.\nAlmost given up and about to just create a new repo but thought I'd ask around first :)" }, { "role": "assistant", "content": "I found a solution Here that worked for me.\nIn .git/config file (client and/or server) I added the following:\n[core]\n packedGitLimit = 128m\n packedGitWindowSize = 128m\n\n[pack]\n deltaCacheSize = 128m\n packSizeLimit = 128m\n windowMemory = 128m" } ]
[ { "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) --[no-]notes[=<ref>]" }, { "role": "assistant", "content": "This flag is passed to the git log program\n(see git-log ) that generates the patches." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Getting Clear read only status on Webstorm 8\nI have webstorm 8 installed on Ubuntu 14.04 LTS.\nI am trying to edit a file but I am getting a popup, with heading \"Clear read only status\", which shows file and two radio button\n\nUsing File System\nUsing version control integration\n\nWhen I select Using File system and click OK, nothing happens, and it doesn't allow to select Second option.\nI am using git as my dcvs.\nPlease guide me on how I can remove this read only status from that file." }, { "role": "assistant", "content": "I had similar problem and I ran following command and my problem was resolved:\n\nsudo chown -R $(whoami) my-project-folder\n\nWorks on both Ubuntu & OS X\nTo check username use: whoami" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-config - Get and set repository or global options gc.aggressiveWindow" }, { "role": "assistant", "content": "The window size parameter used in the delta compression\nalgorithm used by git gc --aggressive . This defaults\nto 250, which is a much more aggressive window size than\nthe default --window of 10. See the documentation for the --window option in git-repack for more details." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Add binary distribution to github's download link\n\nGithub has this download link on the repositories. How can I add binary distributions to this list?\nI cannot find any info on help.github, so a link to some documentation would be helpful." }, { "role": "assistant", "content": "On Dec 11, 2012 \"Upload Releases\" functionality aka \"Downloads\" was deprecated.\nhttps://github.com/blog/1302-goodbye-uploads\nUpdate: On July 2, 2013 GitHub team announced a new \"Releases\" feature as a replacement for \"Downloads\"\nhttps://github.com/blog/1547-release-your-software" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-diff - Show changes between commits, commit and working tree, etc --find-copies-harder" }, { "role": "assistant", "content": "For performance reasons, by default, -C option finds copies only\nif the original file of the copy was modified in the same\nchangeset. This flag makes the command\ninspect unmodified files as candidates for the source of\ncopy. This is a very expensive operation for large\nprojects, so use it with caution. Giving more than one -C option has the same effect." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-for-each-ref - Output information on each ref symref" }, { "role": "assistant", "content": "The ref which the given symbolic ref refers to. If not a\nsymbolic ref, nothing is printed. Respects the :short , :lstrip and :rstrip options in the same way as refname above." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-log - Show commit logs --pickaxe-regex" }, { "role": "assistant", "content": "Treat the <string> given to -S as an extended POSIX regular\nexpression to match." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-fetch - Download objects and refs from another repository" }, { "role": "assistant", "content": "EXAMPLES Update the remote-tracking branches: $ git fetch origin The above command copies all branches from the remote refs/heads/ namespace and stores them to the local refs/remotes/origin/ namespace,\nunless the remote.<repository>.fetch option is used to specify a\nnon-default refspec. Using refspecs explicitly: $ git fetch origin +seen:seen maint:tmp This updates (or creates, as necessary) branches seen and tmp in\nthe local repository by fetching from the branches (respectively) seen and maint from the remote repository. The seen branch will be updated even if it does not fast-forward,\nbecause it is prefixed with a plus sign; tmp will not be. Peek at a remote’s branch, without configuring the remote in your local\nrepository: $ git fetch git://git.kernel.org/pub/scm/git/git.git maint\n$ git log FETCH_HEAD The first command fetches the maint branch from the repository at git://git.kernel.org/pub/scm/git/git.git and the second command uses FETCH_HEAD to examine the branch with git-log . The fetched\nobjects will eventually be removed by git’s built-in housekeeping (see git-gc )." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-config - Get and set repository or global options http.proxySSLCAInfo" }, { "role": "assistant", "content": "Pathname to the file containing the certificate bundle that should be used to\nverify the proxy with when using an HTTPS proxy. Can be overridden by the GIT_PROXY_SSL_CAINFO environment variable." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git - the stupid content tracker --info-path" }, { "role": "assistant", "content": "Print the path where the Info files documenting this\nversion of Git are installed and exit." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Git global ignore not working\nI've created the file .gitignore_global and put it in my git install directory. When I run the command:\ngit config --global core.excludesfile ~/.gitignore\n\nthe rules in the ignore file do not get applied to my commits.\nWhen I rename the file .gitignore and put it in my project root, the rules do apply.\nWhat is wrong here?" }, { "role": "assistant", "content": "Maybe you need to do:\ngit config --global core.excludesFile ~/.gitignore_global \n\nAnd to have some coffee." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-log - Show commit logs -I<regex> --ignore-matching-lines=<regex>" }, { "role": "assistant", "content": "Ignore changes whose all lines match <regex>. This option may\nbe specified more than once." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Bad git config file .git/config\nIn my git repositiory, whenever I do any git commands like git status or git log, I get the error:\nfatal: bad config file line 1 in .git/config\nHow do I rebuild that file or a new one?" }, { "role": "assistant", "content": "For those hitting into this issue (I believe it's due to crashing out git mid init?) in windows, if you have a recent backup of the config file from your git repo's .git/ folder you can fix it by replacing the existing with it (any ref's added since the copy will obviously need re-adding) - not at all ideal but better than loosing all the commits." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-merge - Join two or more development histories together merge.conflictStyle" }, { "role": "assistant", "content": "Specify the style in which conflicted hunks are written out to\nworking tree files upon merge. The default is \"merge\", which\nshows a <<<<<<< conflict marker, changes made by one side,\na ======= marker, changes made by the other side, and then\na >>>>>>> marker. An alternate style, \"diff3\", adds a ||||||| marker and the original text before the ======= marker. The\n\"merge\" style tends to produce smaller conflict regions than diff3,\nboth because of the exclusion of the original text, and because\nwhen a subset of lines match on the two sides, they are just pulled\nout of the conflict region. Another alternate style, \"zdiff3\", is\nsimilar to diff3 but removes matching lines on the two sides from\nthe conflict region when those matching lines appear near either\nthe beginning or end of a conflict region." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-branch - List, create, or delete branches -t --track[=(direct|inherit)]" }, { "role": "assistant", "content": "When creating a new branch, set up branch.<name>.remote and branch.<name>.merge configuration entries to set \"upstream\" tracking\nconfiguration for the new branch. This\nconfiguration will tell git to show the relationship between the\ntwo branches in git status and git branch -v . Furthermore,\nit directs git pull without arguments to pull from the\nupstream when the new branch is checked out. The exact upstream branch is chosen depending on the optional argument: -t , --track , or --track=direct means to use the start-point branch\nitself as the upstream; --track=inherit means to copy the upstream\nconfiguration of the start-point branch. The branch.autoSetupMerge configuration variable specifies how git switch , git checkout and git branch should behave when neither --track nor --no-track are specified: The default option, true , behaves as though --track=direct were given whenever the start-point is a remote-tracking branch. false behaves as if --no-track were given. always behaves as though --track=direct were given. inherit behaves as though --track=inherit were given. simple behaves as though --track=direct were given only when\nthe start-point is a remote-tracking branch and the new branch has the same\nname as the remote branch. See git-pull and git-config for additional discussion on\nhow the branch.<name>.remote and branch.<name>.merge options are used." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Notify all group members of failed pipelines in GitLab\n\nThe goal is to have everyone get a notification for every failed pipeline (at their discretion). Currently, any of us can run a pipeline on this project branch, and the creator of the pipeline gets an email, no one else does. I have tried setting the notification level to watch and custom (with failed pipelines checked) at project, group and global levels without success. The help page regarding notifications says the failed pipeline checkbox for custom notification levels notifies the author of the pipeline (which is the behavior I am experiencing). Is there any way to allow multiple people to get notified of a failed pipeline?\n\nUsing Gitlab CE v10.0\nHave Group (security::internal)\nGroup has Project (security::internal)\nProject has scheduled pipleine (runs nighly)\nPipeline runs integration tests (purposely failing)\nSchedule created by me (schedules have to have an owner)\nWhen the automated pipeline runs and fails, I get an email (good)\nNo one else gets email (bad)" }, { "role": "assistant", "content": "Have a look at following Integration:\nProject -> Settings -> Integrations -> Pipelines emails" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "What is the use of \"actions/checkout\" in GitHub Actions?\n\nI saw a lot of uses of :\njobs:\n myjob:\n steps:\n - name: checkout\n uses: \"actions/checkout@something\"\n - ...\n\nBut i can not find what is the purpose of the line :\nuses : \"actions/checkout@something\"\n\nIs it similar to this ?\n run: git checkout something" }, { "role": "assistant", "content": "For this line: uses : \"actions/checkout@something\", it will use the actions/checkout github action (source here) with the ref something. This ref only refers to the github action version (nothing to do with your repo)\nThe uses statement refers to a github action that is being used in this step. From github documentation for jobs.<job_id>.steps[*].uses:\n\nSelects an action to run as part of a step\nin your job. An action is a reusable unit of code. You can use an\naction defined in the same repository as the workflow, a public\nrepository, or in a published Docker container image.\n\nFrom actions/checkout readme :\n\nThis action checks-out your repository under $GITHUB_WORKSPACE, so your workflow can access it.\n\nBy default it checks out only one commit. My understanding is that it's doing something similar to:\ngit fetch --depth 1 origin $GITHUB_REF\n\nThis action also persists an auth token in git config. This way, your workflow can run authenticated git commands\nBy default, it clones your current repository ({{ github.repository }}) but you can also use this action to clone a different repository, and specify additionnal parameters like token, branch, path etc...\nAn example with additionnal input parameters: check out all git history by setting fetch-depth to 0 (default is 1), see usage doc:\n- uses: actions/checkout@v2\n with:\n fetch-depth: 0" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How would I write a pre-merge hook in Git?\nThe question says it all. Is there a way to perform an action before a merge? I'm guessing there's a way to make use of a pre-commit hook, but I'm not quite sure." }, { "role": "assistant", "content": "With Git 2.24 (Q4 2019), no need for script wrapper, or prepare-message hook.\nA new \"pre-merge-commit\" hook has been introduced.\nSee commit bc40ce4, commit 6098817, commit a1f3dd7 (07 Aug 2019) by Michael J Gruber (mjg).\nSee commit f78f6c7 (07 Aug 2019) by Josh Steadmon (steadmon).\n(Merged by Junio C Hamano -- gitster -- in commit f76bd8c, 18 Sep 2019)\n\ngit-merge: honor pre-merge-commit hook\n\n\ngit-merge does not honor the pre-commit hook when doing automatic merge\ncommits, and for compatibility reasons this is going to stay.\nIntroduce a pre-merge-commit hook which is called for an automatic merge\ncommit just like pre-commit is called for a non-automatic merge commit\n(or any other commit).\n\nThe documentation now includes:\n\npre-merge-commit\nThis hook is invoked by git-merge.\nIt takes no parameters, and is invoked after the merge has been carried out successfully and before obtaining the proposed commit log message to make a commit.\nExiting with a non-zero status from this script causes the git merge command to abort before creating a commit.\nThe default 'pre-merge-commit' hook, when enabled, runs the 'pre-commit' hook, if the latter is enabled.\nThis hook is invoked with the environment variable GIT_EDITOR=: if the command will not bring up an editor to modify the commit message.\nIf the merge cannot be carried out automatically, the conflicts need to be resolved and the result committed separately (see git-merge).\nAt that point, this hook will not be executed, but the 'pre-commit' hook will, if it is enabled.\n\n\nWith Git 2.36 (Q2 2022), the callers of run_commit_hook() learn if it got \"success\" because the hook succeeded or because there wasn't any hook.\nSee commit a8cc594, commit 9f6e63b (07 Mar 2022) by Ævar Arnfjörð Bjarmason (avar).\n(Merged by Junio C Hamano -- gitster -- in commit 7431379, 16 Mar 2022)\n\nmerge: don't run post-hook logic on --no-verify\nSigned-off-by: Ævar Arnfjörð Bjarmason\n\n\nFix a minor bug introduced in bc40ce4 (\"merge: --no-verify to bypass pre-merge-commit hook\", 2019-08-07, Git v2.24.0-rc0 -- merge listed in batch #3), when that change made the --no-verify option bypass the pre-merge-commit hook it didn't update the corresponding find_hook() (later hook_exists()) condition.\nAs can be seen in the preceding commit in 6098817 (\"git-merge: honor pre-merge-commit hook\", 2019-08-07, Git v2.24.0-rc0 -- merge listed in batch #3) the two should go hand in hand.\nThere's no point in invoking discard_cache() here if the hook couldn't have possibly updated the index.\nIt's buggy that we use \"hook_exist()\" here, and as discussed in the subsequent commit it's subject to obscure race conditions that we're about to fix, but for now this change is a strict improvement that retains any caveats to do with the use of \"hooks_exist()\" as-is.\n\n\nWarning: Devin Rhode reports (Nov. 2022) in the comments:\n\nI think I actually found a bug with the pre-merge-commit hook not running.\nSee PR \"pre-merge-commit hook is not running\"\n\nBut Pascal Jufer adds:\n\nI came to the conclusion that the pre-merge-commit hook is actually working as intended, which means this is not a bug.\nThe documentation states the following:\n\n[...] is invoked after the merge has been carried out successfully and before obtaining the proposed commit log message to make a commit\n[...]\n\nand\n\n[...] If the merge cannot be carried out automatically, the conflicts need to be resolved and the result committed separately (see git-merge1).\nAt that point, this hook will not be executed, but the pre-commit hook will, if it is enabled.\n\nThat means:\n\nIf there's a conflict like provoked in your reproduction (merge cannot be carried out automatically), the pre-merge-commit hook won't be called at all.\nUnderstandably, after resolving the conflict and committing the changes, Git treats it like a normal commit and only calls the pre-commit hook:\n$ git merge remotes/origin/feature/make-eggs\n$ git add readme.md\n$ git commit\npre-commit hook\n[main 26262e1] Merge remote-tracking branch 'remotes/origin/feature/make-eggs'\n\n\nWhen executing a \"conflict-free\" merge, there's no commit log message to obtain (fast-forward updates do not create a merge commit) which means the pre-merge-commit hook is skipped here as well.\n\nThe pre-merge-commit is getting called (also with custom hooksPath) as intended when a merge commit is generated, for example using git merge --no-ff:\n$ git merge test --no-ff\npre-merge-commit hook\nMerge made by the 'ort' strategy." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Managing large binary files with Git\nI am looking for opinions of how to handle large binary files on which my source code (web application) is dependent. We are currently discussing several alternatives:\n\nCopy the binary files by hand.\n\n\nPro: Not sure.\nContra: I am strongly against this, as it increases the likelihood of errors when setting up a new site/migrating the old one. Builds up another hurdle to take.\n\nManage them all with Git.\n\n\nPro: Removes the possibility to 'forget' to copy a important file\nContra: Bloats the repository and decreases flexibility to manage the code-base and checkouts, clones, etc. will take quite a while.\n\nSeparate repositories.\n\n\nPro: Checking out/cloning the source code is fast as ever, and the images are properly archived in their own repository.\nContra: Removes the simpleness of having the one and only Git repository on the project. It surely introduces some other things I haven't thought about.\n\n\nWhat are your experiences/thoughts regarding this?\nAlso: Does anybody have experience with multiple Git repositories and managing them in one project?\nThe files are images for a program which generates PDFs with those files in it. The files will not change very often (as in years), but they are very relevant to a program. The program will not work without the files." }, { "role": "assistant", "content": "I discovered git-annex recently which I find awesome. It was designed for managing large files efficiently. I use it for my photo/music (etc.) collections. The development of git-annex is very active. The content of the files can be removed from the Git repository, only the tree hierarchy is tracked by Git (through symlinks). However, to get the content of the file, a second step is necessary after pulling/pushing, e.g.:\n$ git annex add mybigfile\n$ git commit -m'add mybigfile'\n$ git push myremote\n$ git annex copy --to myremote mybigfile ## This command copies the actual content to myremote\n$ git annex drop mybigfile ## Remove content from local repo\n...\n$ git annex get mybigfile ## Retrieve the content\n## or to specify the remote from which to get:\n$ git annex copy --from myremote mybigfile\n\nThere are many commands available, and there is a great documentation on the website. A package is available on Debian." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Has Bitbucket the git-blame on a line feature similiar to GitHub?\n\nCan I view the of a file/ a line who committed what and when on bitbucket? Can't find these functions on the site. Thank you!" }, { "role": "assistant", "content": "Yes, but the button is not visible in all views. If you go to source view you should see the blame button at the upper right hand side of the code view pane. Depending on your version of bitbucket, it may be labeled as \"annotate\" instead of \"blame\" in an (unpopular with users) attempt to give the feature a more \"positive\" name!\nhttps://bitbucket.org/site/master/issues/16318/blame-button-seems-to-be-missing" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-stash - Stash the changes in a dirty working directory away Pulling into a dirty tree" }, { "role": "assistant", "content": "When you are in the middle of something, you learn that there are\nupstream changes that are possibly relevant to what you are\ndoing. When your local changes do not conflict with the changes in\nthe upstream, a simple git pull will let you move forward. However, there are cases in which your local changes do conflict with\nthe upstream changes, and git pull refuses to overwrite your\nchanges. In such a case, you can stash your changes away,\nperform a pull, and then unstash, like this: $ git pull\n ...\nfile foobar not up to date, cannot merge.\n$ git stash\n$ git pull\n$ git stash pop" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Unable to access GitLab: SSL certificate has expired\n\nIn Visual Studio, I'm trying to pull some changes from the repository on GitLab, but it gives me an error:\n\nGit failed with a fatal error.\nunable to access https://gitlab...git/: SSL certificate problem: certificate has expired*\n\nHow can I generate a new certificate and add it to VS? I don't have any experience with GitLab." }, { "role": "assistant", "content": "There's a quick fix you can run in the command line:\ngit config --global http.sslVerify \"false\"\n\nThe solution was found in the following article.\nUpdated:\nWhile the original solution provided a quick workaround, it's essential to emphasize the security implications and responsible usage due to the concerns raised in the comments.\nWarning: The below quick fix can expose you to security risks by disabling SSL verification:\ngit config --global http.sslVerify \"false\" \n\nUse this solution with utmost caution and strictly for troubleshooting purposes.\nA Safer Alternative:\n\nUpdate Git: Ensure you are using the latest version of Git which might have improved handling of SSL and certificate issues.\n\nFor Windows\ndownload and install from the official website \n\nFor macOS (using Homebrew):\nbrew upgrade git\n\nFor Debian-based Linux distributions:\nsudo apt-get update && sudo apt-get upgrade git \n\n2. Verify Certificate:\nIdentify why the certificate has expired and engage the repository\nadministrator or IT department for a resolution, as managing and\nrenewing certificates is typically their responsibility.\nUsing the Quick Fix Responsibly:\nIf you find yourself obliged to use the quick fix:\n\nLocal Environment Only:\n\nEnsure it is applied only in a secure and controlled environment. Never in a production setting.\n\nLimited Time:\n\nRe-enable SSL verification as soon as possible by running\ngit config --global http.sslVerify \"true\"\n\nAdditional Notes:\n\nQuality vs. Security:\n\nAs commented by Eric K, having a valid SSL certificate doesn’t equate to the safety of the code you pull. Always ensure code quality and integrity.\n\nEngage Experts:\n\nIf unsure, consult your IT department or cybersecurity experts regarding expired certificates and any temporary workarounds.\nConclusion:\nSecurity should always be paramount. Adopt solutions that not only solve the immediate problem but also uphold the integrity and security of your development environment and code." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-apply - Apply a patch to files and/or to the index --ignore-space-change --ignore-whitespace" }, { "role": "assistant", "content": "When applying a patch, ignore changes in whitespace in context\nlines if necessary.\nContext lines will preserve their whitespace, and they will not\nundergo whitespace fixing regardless of the value of the --whitespace option. New lines will still be fixed, though." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Visualizing branch topology in Git\nI'm playing with Git in isolation on my own machine, and I find it difficult to maintain a mental model of all my branches and commits. I know I can do a git log to see the commit history from where I am, but is there a way to see the entire branch topography, something like these ASCII maps that seem to be used everywhere for explaining branches?\n .-A---M---N---O---P\n / / / / /\n I B C D E\n \\ / / / /\n `-------------'\n\nIt just feels like someone coming along and trying to pick up my repository would have difficulty working out exactly what was going on.\nI guess I'm influenced by AccuRev's stream browser..." }, { "role": "assistant", "content": "Use git log --graph or gitk. (Both also accept --all, which will show all the branches instead of just the current one.)\nFor branch names and a compact view, try:\ngit log --graph --decorate --oneline" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Find project in gitlab by ID\n\nHow i can find a project in Gitlab by ID?\nI found description to search by issue id #123 and MR !123 but not find by id" }, { "role": "assistant", "content": "As mentioned by Daly in the comments, you can browse to\nhttps://gitlab.com/projects/{id}\n\nand be redirected to the appropriate project." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git push all branches from one remote to another remote\n\nI have two remote: upstream and origin. upstream is something I can't push to. origin is my own repo. How can I fetch all branches from upstream and then push them to origin?\nI tried:\ngit fetch upstream\ngit push --all origin\n\nBut it doesn't work." }, { "role": "assistant", "content": "I just needed to copy one repository from Bitbucket to GitHub, these are the steps assuming your remote is called origin, all branches and tags will be copied:\ngit remote add neworigin url-to-new-remote\ngit push neworigin --tags \"refs/remotes/origin/*:refs/heads/*\"\n\nGood thing about this is that files in your working copy won't be modified." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to configure git hooks for all developers\n\nI want to apply consistent commit message rule globally for all developers to have jira issue in commit message.\nUsing enterprise github.\nAs found, it can be achieve using, .git/hooks/commit-msg file to updated accordingly.\nIssue: How to apply this updated git hooks to available for all the developers.\nI don't see any changes appear on git status.\nNot sure if it has to configure different way so, commit-msg constrain will apply for all developers instead of locally one.\nCan you please guide on this." }, { "role": "assistant", "content": "Any files in .git/hooks are not part of the repository and will not be transmitted by any push or fetch operation (including the fetch run by git pull). The reason is simple enough; see below. By the same token, a developer who has a Git repository has full control over his/her/their .git/hooks directory and whether any pre-commit and commit-msg hook is run (git commit --no-verify will skip both of these hooks).\nWhat all this means is that you cannot force a developer to use any particular pre-commit or commit-msg hook. Instead of making this happen (which you can't do), you should do what you can to make it easy for your developers to use some hook(s) that you supply. There are many ways to achieve this. In the examples below I'll mention pre-commit hooks rather than commit-msg hooks.\nOne very simple one is to have a script that you write as a setup command that:\n\nclones the repository or repositories developers should use; then\nadds to those clones the hooks that you'd like them to use.\n\nIf the clones already exist, this command can simply update the hooks in place, so that your developers can just run the setup script again if the hooks have changed.\nAnother is to have a script in the repository that installs symbolic links, so that .git/hooks/pre-commit becomes a symbolic link to ../../scripts/pre-commit. This path climbs back out of hooks and then .git and then reaches into scripts/pre-commit, which means that the script in scripts/pre-commit is the one that will be run. You can of course use different names, e.g., make .git/hooks/pre-commit a symlink to ../../.git-precommit, if you like. This method does of course require that your developers' systems support symbolic links.\nYour scripts, whether they're all in the repository itself or in some separate repository or whatever, can be as simple or as fancy as you like, and you can write them in any language that you like. This applies both to \"install some hooks\" scripts, and to the hooks themselves. The only constraint is that the hooks must be able to run on the developers' machines. Note that there are entire frameworks for Git hooks, such as Husky and the various options on pre-commit.com.\nOne small warning: it's easy to go overboard here. I'll recommend that anyone contemplating setting up fancy hooks have a look at this blog post for instance. Your check on commit messages is an example of not going overboard: it's simple and fast and does not get in anyone's way.\nWhy hooks are not copied\nImagine if git clone did copy and install hooks. Then imagine that the hook in some repository includes this bit of pseudo shell script in, say, the post-checkout hook:\nif [ ! -x /tmp/trojan-horse ]; then\n install-trojan-horse &\nfi\n\nAs soon as you clone this repository, boom, you've been pwned." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-config - Get and set repository or global options fetch.fsck.skipList" }, { "role": "assistant", "content": "Acts like fsck.skipList , but is used by git-fetch-pack instead of git-fsck . See\nthe fsck.skipList documentation for details." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-fsck - Verifies the connectivity and validity of the objects in the database missingTypeEntry" }, { "role": "assistant", "content": "(ERROR) Missing type line in a tag object." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-commit - Record changes to the repository" }, { "role": "assistant", "content": "COMMIT INFORMATION Author and committer information is taken from the following environment\nvariables, if set: GIT_AUTHOR_NAME\nGIT_AUTHOR_EMAIL\nGIT_AUTHOR_DATE\nGIT_COMMITTER_NAME\nGIT_COMMITTER_EMAIL\nGIT_COMMITTER_DATE (nb \"<\", \">\" and \"\\n\"s are stripped) The author and committer names are by convention some form of a personal name\n(that is, the name by which other humans refer to you), although Git does not\nenforce or require any particular form. Arbitrary Unicode may be used, subject\nto the constraints listed above. This name has no effect on authentication; for\nthat, see the credential.username variable in git-config . In case (some of) these environment variables are not set, the information\nis taken from the configuration items user.name and user.email , or, if not\npresent, the environment variable EMAIL, or, if that is not set,\nsystem user name and the hostname used for outgoing mail (taken\nfrom /etc/mailname and falling back to the fully qualified hostname when\nthat file does not exist). The author.name and committer.name and their corresponding email options\noverride user.name and user.email if set and are overridden themselves by\nthe environment variables. The typical usage is to set just the user.name and user.email variables;\nthe other options are provided for more complex use cases." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Install npm module from gitlab private repository\nWe are using GitLab for our private project. There are some forked libraries from github, that we want to install as npm module. Installing that module directly from npm is ok and for example this:\nnpm install git://github.com/FredyC/grunt-stylus-sprite.git\n\n...works correctly too, but doing the same for GitLab, just changing domain gets me this error.\nnpm WARN `git config --get remote.origin.url` returned wrong result (git://git.domain.com/library/grunt-stylus-sprite.git)\nnpm ERR! git clone git://git.domain.com/library/grunt-stylus-sprite.git Cloning into bare repository 'D:\\users\\Fredy\\AppData\\Roaming\\npm-cache\\_git-remotes\\git-git-domain-com-library-grunt-stylus-sprite-git-6f33bc59'...\nnpm ERR! git clone git://git.domain.com/library/grunt-stylus-sprite.git fatal:unable to connect to git.domain.com:\nnpm ERR! git clone git://git.domain.com/library/grunt-stylus-sprite.git git.domain.com[0: 77.93.195.214]: errno=No error\nnpm ERR! Error: Command failed: Cloning into bare repository 'D:\\users\\Fredy\\App\nData\\Roaming\\npm-cache\\_git-remotes\\git-git-domain-com-library-grunt-stylus-spr\nite-git-6f33bc59'...\nnpm ERR! fatal: unable to connect to git.domain.com:\nnpm ERR! git.domain.com[0: xx.xx.xx.xx]: errno=No error\n\nFrom the web interface of GitLab, I have this URL\n[email protected]:library/grunt-stylus-sprite.git. Running this against npm install it tries to install git module from npm registry.\nHowever using URL: [email protected]:library/grunt-stylus-sprite.git is suddenly asking me for the password. My SSH key doesn't include passphrase, so I assume it wasn't able to load that key. Maybe there is some configuration for that I have missed ? Key is located at standard location in my home directory with the name \"id_rsa\".\nI am on Windows 7 x64.\nUPDATE\nSince NPM v3 there is built-in support for GitLab and other sources (BitBucket, Gist), from where you can install packages. It works for public and private ones so it's not exactly related to this, but some might find it useful.\nnpm install gitlab:<gitlabname>/<gitlabrepo>[#<commit-ish>]\n\nCheck out documentation: https://docs.npmjs.com/cli/install\nI you want to work with private repos in Gitlab you are required to manage your credentials/auth-token in your .npmrc. See here: https://docs.gitlab.com/ee/user/packages/npm_registry/#authenticate-to-the-package-registry" }, { "role": "assistant", "content": "You have the following methods for connecting to a private gitlab repository\nWith SSH\ngit+ssh://[email protected]:Username/Repository#{branch|tag}\ngit+ssh://[email protected]/Username/Repository#{branch|tag}\n\nWith HTTPS\ngit+https://[email protected]/Username/Repository#{branch|tag}\n\nWith HTTPS and deploy token\ngit+https://<token-name>:<token>@gitlab.com/Username/Repository#{branch|tag}" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-show-ref - List references in a local repository <pattern>…​" }, { "role": "assistant", "content": "Show references matching one or more patterns. Patterns are matched from\nthe end of the full name, and only complete parts are matched, e.g. master matches refs/heads/master , refs/remotes/origin/master , refs/tags/jedi/master but not refs/heads/mymaster or refs/remotes/master/jedi ." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-request-pull - Generates a summary of pending changes" }, { "role": "assistant", "content": "EXAMPLES Imagine that you built your work on your master branch on top of\nthe v1.0 release, and want it to be integrated into the project.\nFirst you push that change to your public repository for others to\nsee: git push https://git.ko.xz/project master Then, you run this command: git request-pull v1.0 https://git.ko.xz/project master which will produce a request to the upstream, summarizing the\nchanges between the v1.0 release and your master , to pull it\nfrom your public repository. If you pushed your change to a branch whose name is different from\nthe one you have locally, e.g. git push https://git.ko.xz/project master:for-linus then you can ask that to be pulled with git request-pull v1.0 https://git.ko.xz/project master:for-linus" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to fix git error: RPC failed; curl 56 GnuTLS\nI use Ubuntu 16.04. When I want to git push origin master I get:\nerror: RPC failed; curl 56 GnuTLS recv error (-12): A TLS fatal alert has been received.\nfatal: The remote end hung up unexpectedly\nfatal: The remote end hung up unexpectedly\nEverything up-to-date" }, { "role": "assistant", "content": "The accepted answer from @harlequin might work, but I spend 2 hours and could not build git package from source code.\nHowever, Check the below link as this works for me.\nThe remote end hung up unexpectedly while git cloning\njust update the http post buffer value\ngit config --global http.postBuffer 1048576000\ngit config --global https.postBuffer 1048576000" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Receiving \"fatal: Not a git repository\" when attempting to remote add a Git repo\nI am following this tutorial. Everything works fine until I run this on my local machine (after replacing the $VARIABLEs with their actual values):\ngit remote add nfsn ssh://$USERNAME@$SERVER/home/private/git/$REPONAME.git\n\nI receive the following error message:\n\nfatal: Not a git repository (or any of the parent directories): .git\n\nHow do I get past this step?" }, { "role": "assistant", "content": "Did you init a local Git repository, into which this remote is supposed to be added?\nDoes your local directory have a .git folder?\nTry git init." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How do I add image to README file on GitLab?\n\nThe title says it all. I took a look into GitLab docs but couldn't find clear-cut solution to this.\nHow do I add image to readme on GitLab ? Image that's within the repo." }, { "role": "assistant", "content": "You can use ![image info](images/image.png) where images could be a directory in your project structure." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Move .git repo to parent directory [duplicate]\n\nThis question already has answers here:\n \n \n\n\n\n\nMy Git repository is in the wrong root directory. Can I move it? (../ instead of ./)\n\n (10 answers)\n \n\nClosed 7 years ago.\n\n\n\nI have a subdirectory named \"www\" that is a repo:\nsite\n|-- www/\n| |-- .git/\n| |-- index.html\n|-- design/\n| |-- images.jpg\n\nI'd like to change the repo to the parent directory so that the repo structure mirrors the original file structure as follows:\nsite\n|-- .git/\n|-- www/\n| |-- index.html\n|-- design/\n| |-- images.jpg\n\nCan this be done? Are there implications with then pushing the changes up to Gitlab?" }, { "role": "assistant", "content": "Create a www directory in your repo.\ngit mv the HTML files to that directory. Optionally commit this step.\nmv the design directory into your repo, and git add .\nCommit.\nRename/move your whole repo." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-config - Get and set repository or global options remote.<name>.promisor" }, { "role": "assistant", "content": "When set to true, this remote will be used to fetch promisor\nobjects." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How do you rename a Git commit pushed to GitHub?\n\nI stupidly pushed a commit to GitHub with a very messed up commit name. How do I change this?\nDoes git commit --amend still work for already pushed commit?" }, { "role": "assistant", "content": "git commit --amend\n\nwhich will bring up your editor, or\ngit commit --amend -m \"Your new message here\"\n\nwhich will allow you to specify the new message on the command line. Also possible, but more useful if you have other commits to reword\ngit rebase -i HEAD^\n# then replace 'pick' with 'r' or 'reword' and save, editor should pop up again to edit the msg\n\nBecause this commit has a new SHA1 due to the change of the contents, you will need to force push the new reference. The force is needed because it tells git to forget about the previous commit. It's a safety measure.\ngit push origin your-branch-name -f" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Install an npm module from a private GitHub repository using GitHub Actions\n\nI am trying to run a build for a Node.js project using GitHub Actions. As part of the npm install, I need to install an npm module directly from a private GitHub repository (not from GPR!).\nIn the package.json I have:\n\"dependencies\": {\n ...\n \"my-module\": \"github:<org>/<my-module>#master\",\n ...\n},\n\nHowever, when running npm install, I get:\n\nnpm ERR! [email protected]: Permission denied (publickey).\n npm ERR! fatal: Could not read from remote repository.\n\nThe repository is part of my own organization, and locally (i.e. from my machine) it works. How can I make this run? \nI have already tried setting the NODE_AUTH_TOKEN environment variable, but it didn't make a difference. Although you find this suggestion quite often, it seems to only address GPR. What I would like to avoid is having to hardcode the token into the package.json file. Any thoughts on this?" }, { "role": "assistant", "content": "This is how I have managed to install dependencies from private GitHub repositories.\nDependencies in package.json can be added as follows. The github: prefix is optional. Specifying the #branch or #tag is also optional.\n \"dependencies\": {\n ...\n \"myrepo\": \"username/myrepo#master\",\n \"myotherrepo\": \"github:username/myotherrepo\"\n },\n\nHere is an example workflow. PAT is a repo scoped Personal Access Token. It is important to disable persisted credentials on actions/checkout, otherwise they will override your PAT. Note that the git config change persists between steps so you only need to run it once per job.\n - uses: actions/checkout@v2\n with:\n persist-credentials: false\n - uses: actions/setup-node@v1\n with:\n node-version: 12.x\n - run: git config --global url.\"https://${{ secrets.PAT }}@github.com/\".insteadOf ssh://[email protected]/\n - run: npm ci\n ..." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Gitlab code quality: where is the report?\n\nOn this project: https://gitlab.com/tyvain/parcoursup/tree/master\nI have a code quality stage:\ncode_quality:\n stage: code_quality\n image: docker:stable\n variables:\n DOCKER_DRIVER: overlay2\n allow_failure: true\n services:\n - docker:stable-dind\n script:\n - export SP_VERSION=$(echo \"$CI_SERVER_VERSION\" | sed 's/^\\([0-9]*\\)\\.\\([0-9]*\\).*/\\1-\\2-stable/')\n - docker run\n --env SOURCE_CODE=\"$PWD\"\n --volume \"$PWD\":/code\n --volume /var/run/docker.sock:/var/run/docker.sock\n \"registry.gitlab.com/gitlab-org/security-products/codequality:$SP_VERSION\" /code\n artifacts:\n paths: [gl-code-quality-report.json]\n\nThis stage always endup 'passed'. Logs: https://gitlab.com/tyvain/parcoursup/-/jobs/94665791\nI doubt that my code is perfect, so there should be some code quality issues somewhere. \nWhere is the code quality report supposed to be output ?\nWhat is this parameter: \"paths: [gl-code-quality-report.json]\" ?" }, { "role": "assistant", "content": "2 problems here:\n\nthe report is only available for merge request in 'gitlab EE edition' (not free)\nthe report can be downloaded as a json file here:" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-rev-list - Lists commit objects in reverse chronological order --oneline" }, { "role": "assistant", "content": "This is a shorthand for \"--pretty=oneline --abbrev-commit\"\nused together." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-rebase - Reapply commits on top of another base tip diff-algorithm=[patience|minimal|histogram|myers]" }, { "role": "assistant", "content": "Use a different diff algorithm while merging, which can help\navoid mismerges that occur due to unimportant matching lines\n(such as braces from distinct functions). See also git-diff --diff-algorithm . Note that ort specifically uses diff-algorithm=histogram , while recursive defaults to the diff.algorithm config setting." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git - the stupid content tracker git-rev-parse" }, { "role": "assistant", "content": "Pick out and massage parameters" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Ignore all files with the same name in git\nIs there a way to have a git ignore file to ignore all files with the name test in them?\nI have files like this:\n - css/test.css \n - js/subfolder/test.js \n - lib/main/sub/test.html\n\nand so on.\nI want git to avoid adding or committing any files with the name test." }, { "role": "assistant", "content": "From git docs\nA leading \"**\" followed by a slash means match in all directories. For\nexample, \"**/foo\" matches file or directory \"foo\" anywhere, the same\nas pattern \"foo\". \"**/foo/bar\" matches file or directory \"bar\"\nanywhere that is directly under directory \"foo\".\n\nFor your case:\n**/[Tt]est*\n\nit also matches both upper and lower case." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to abort a stash pop?\nI popped a stash and there was a merge conflict. Unlike the question that is listed as a duplicate, I already had some uncommitted changes in the directory which I wanted to keep. I don't just want to make the merge conflict disappear, but also to get my directory back to the state it was before the pop.\nI tried git merge --abort, but git claimed no merge was in progress. Is there an easy way to abort a pop without destroying the changes I originally had in the directory?" }, { "role": "assistant", "content": "Simple one liner\nI have always used\ngit reset --merge\nI can't remember it ever failing.\n\nNote: git reset --merge will discard any staged changes. Also, as noted by @Saroopashree Kumaraguru in the comments, the stash contents won't be lost and can be re-applied later." } ]