messages
listlengths
3
3
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Diff syntax highlighting in Github Markdown\n\nI'm writing documents that should explain code in C# using Markdown.\nI use the ```csharp to get csharp highlighting.\nI sometimes want to highlight something specific in the code using bold or anything.\nI know about <pre> etc... but it takes away my csharp highlighting.\nBest case scenario - some way to highlight code in the ```csharp section.\nNext best thing - I can write the code as diff - using + and - to highlight stuff, but how do I tell Github to highlight diff syntax with the red and green backcolor?\nIs there a way to use both diff and csharp syntax highlighting?" }, { "role": "assistant", "content": "Github's markdown supports diff when formatting code. For example:\n```diff\npublic class Hello1\n{\n public static void Main()\n {\n- System.Console.WriteLine(\"Hello, World!\");\n+ System.Console.WriteLine(\"Rock all night long!\");\n }\n}\n```\n\nOutput:\n\nand it should give you the Diff looks you are looking for, highlighting in red what has been removed and in green what has been added." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-log - Show commit logs --no-renames" }, { "role": "assistant", "content": "Turn off rename detection, even when the configuration\nfile gives the default to do so." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to manage one only key per each git repository?\nI use git under two scenarios:\n\nI use some Github repositories.\nI'm currently working with OpenShift, which uses ssh and git for deployment.\n\nFirst, I used ssh-keygen for generating a key which updated at OpenShift site. Such key is stored at ~/.ssh/ and created id_rsa and id_rsa.pub.\nThen I started cloning a repository from Github, I once did ssh-keygen again and started pushing, it worked ok. Then I cloned another repository and started having problems:\nI got problems when cloning to the second repository. Every time I try to push will show something like:\n\nERROR: Permission to diegoaguilar/cursoJava.git denied to diegoaguilar/cursoCannibalCreatures.\n fatal: The remote end hung up unexpectedly\n\nBut as it can be seen diegoaguilar/cursoCannibalCreatures isn't correct as it's another repository.\nI even tried removing such repository directory, and cloning it again, same happened.\nI already got under ~/.ssh:\nconfig:\nHost cursoJava\nHostname github.com\nUser git\nIdentityFile ~/.ssh/id_java\n\nHost cursoCannibalCreatures\nHostname github.com\nUser git\nIdentityFile ~/.ssh/id_cannibal\n\nHost openshift\nHostname openshift.com\nUser git\nIdentityFile ~/.ssh/openshift\n\nAnd so got:\nid_cannibal id_cannibal.pub id_java id_java.pub known_hosts\n\nSomething like id_openshift and id_openshift.pub isn't there but as it's not working, I don't care much now.\nI created such files and they're .pub by ssh-keygen -f <filename> and gave different pass phrases to each. I added the content of the .pub's as deploy keys at each Github repository settings.\nWhat am I doing wrong? How is this supposed to work? And, when working at another machine, how to properly obtain these keys, proof it's me and work transparently? \nEDIT\nOutput of git remote -v:\n\nFor cursoJava repository \n\norigin [email protected]:diegoaguilar/cursoJava.git (fetch)\n origin [email protected]:diegoaguilar/cursoJava.git (push)\n\nFor cursoCannibalCreatures\n\norigin [email protected]:diegoaguilar/cursoCannibalCreatures.git (fetch)\n origin [email protected]:diegoaguilar/cursoCannibalCreatures.git (push)" }, { "role": "assistant", "content": "As mentioned in \"ssh,github,it doesnot work\", the trick is to not use the default id_rsa(.pub) names for your public:private keys (because yo can only define one couple of those), but different names.\nBut that would be only if you were to access those repos as different users\nIn your case, you are accessing the repos with the same users, and one ssh key should be enough.\nSee \"GitHub help\":\n\nThis error means the key you are pushing with is attached to another repository as a deploy key, and does not have access to the repository you are trying to push to.\nTo remedy this, remove the deploy key from the repository, and attach the key to your user account instead.\n\n\nThis is for using GitHub for two different users.\nYou then define a ~/.ssh/config file in which you reference each private keys by their full path:\nHost github1\n HostName github.com\n User git\n IdentityFile ~/.ssh/id_repo1\n\nHost github2\n HostName github.com\n User git\n IdentityFile ~/.ssh/id_repo2\n\nInstead of using [email protected]:user/repo1, you would use:\ngithub1:user/repo1\n\nThat uses the key Host entry 'github1' to reference the user (git), hostname (github.com) and the exact private/public key to use ~/.ssh/id_repo1(.pub)\n\nSo if you have a second repo which use a second key stored as ~/.ssh/id_repo2(.pub), you need to use the entry 'github2' (you can name it as you want) defined above, and then change the url you have for origin:\ngit remote set-url origin github2:user/repo2\n\nThat way, a git push will use the right key (the one for the repo2)\nIf you don't, you will be able to push for one repo (using the default key ~/.ssh/id_rsa(.pub), default name), but you won't be able to push to the second repo, which need a different set of public/private key." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Configuring so that pip install can work from github\nWe'd like to use pip with github to install private packages to our production servers. This question concerns what needs to be in the github repo in order for the install to be successful.\nAssuming the following command line (which authenticates just fine and tries to install):\npip install git+ssh://[email protected]/BlahCo/search/tree/prod_release_branch/ProductName\n\nWhat needs to reside in the ProductName? Is it the contents of what would normally be in the tar file after running setup.py with the sdist option, or is the actual tar.gz file, or something else?\nI'm asking here because I've tried several variations and can't make it work. Any help appreciated." }, { "role": "assistant", "content": "You need the whole python package, with a setup.py file in it.\nA package named foo would be:\nfoo # the installable package\n├── foo\n│   ├── __init__.py\n│   └── bar.py\n└── setup.py\n\nAnd install from github like:\n$ pip install git+ssh://[email protected]/myuser/foo.git\nor\n$ pip install git+https://github.com/myuser/foo.git@v123\nor\n$ pip install git+https://github.com/myuser/foo.git@newbranch\n\nMore info at https://pip.pypa.io/en/stable/cli/pip_install/" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to find a Github file 's SHA blob\n\nI'm using this API to update a file on my repo, it requires me to have a valid SHA blob for a file that I want to update:\nhttp://developer.github.com/v3/repos/contents/\nHow do I find the SHA blob for the specific file? Supposed in my testrepo in the test account here, what is the SHA blob for the test.txt file?\nhttps://github.com/testacc01/testrepo01\nThank you so much!" }, { "role": "assistant", "content": "The docs for updating a file specify that you will need to provide the SHA for the file you will be replacing. The easiest way would be to query github for that, too. For example:\n> curl https://api.github.com/repos/testacc01/testrepo01/contents/test.txt\n{\n \"name\": \"test.txt\",\n \"path\": \"test.txt\",\n \"sha\": \"4f8a0fd8ab3537b85a64dcffa1487f4196164d78\",\n \"size\": 13,\n …\n\nSo, you can see what the SHA is in the \"sha\" field of the JSON response. Use that when you formulate your request to update the file with a new version. After you have successfully updated the file, the file will have a new SHA that you will need to request before it can be updated again. (Unless, I guess, your next update goes on a different branch.)" } ]
[ { "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) <range1> <range2>" }, { "role": "assistant", "content": "Compare the commits specified by the two ranges, where <range1> is considered an older version of <range2> ." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git pull fails \"unable to resolve reference\" \"unable to update local ref\"\nUsing git 1.6.4.2, when I tried a git pull I get this error: \nerror: unable to resolve reference refs/remotes/origin/LT558-optimize-sql: No such file or directory\nFrom git+ssh://remoteserver/~/misk5\n ! [new branch] LT558-optimize-sql -> origin/LT558-optimize-sql (unable to update local ref)\nerror: unable to resolve reference refs/remotes/origin/split-css: No such file or directory\n ! [new branch] split-css -> origin/split-css (unable to update local ref)\n\nI've tried git remote prune origin, but it didn't help." }, { "role": "assistant", "content": "Try cleaning-up your local repository with:\n$ git gc --prune=now\n$ git remote prune origin\n\n\nman git-gc(1):\ngit-gc - Cleanup unnecessary files and optimize the local repository\n\ngit gc [--aggressive] [--auto] [--quiet] [--prune=<date> | --no-prune]\n\n Runs a number of housekeeping tasks within the current repository, such as compressing file revisions\n (to reduce disk space and increase performance) and removing unreachable objects which may have been\n created from prior invocations of git add.\n\n Users are encouraged to run this task on a regular basis within each repository to maintain good disk\n space utilization and good operating performance.\n\nman git-remote(1):\ngit-remote - manage set of tracked repositories\n\ngit remote prune [-n | --dry-run] <name>\n\n Deletes all stale remote-tracking branches under <name>. These stale branches have already been\n removed from the remote repository referenced by <name>, but are still locally available in\n \"remotes/<name>\"." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-notes - Add or inspect object notes add" }, { "role": "assistant", "content": "Add notes for a given object (defaults to HEAD). Abort if the\nobject already has notes (use -f to overwrite existing notes).\nHowever, if you’re using add interactively (using an editor\nto supply the notes contents), then - instead of aborting -\nthe existing notes will be opened in the editor (like the edit subcommand). If you specify multiple -m and -F , a blank\nline will be inserted between the messages. Use the --separator option to insert other delimiters." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-merge - Join two or more development histories together" }, { "role": "assistant", "content": "MERGING TAG When merging an annotated (and possibly signed) tag, Git always\ncreates a merge commit even if a fast-forward merge is possible, and\nthe commit message template is prepared with the tag message.\nAdditionally, if the tag is signed, the signature check is reported\nas a comment in the message template. See also git-tag . When you want to just integrate with the work leading to the commit\nthat happens to be tagged, e.g. synchronizing with an upstream\nrelease point, you may not want to make an unnecessary merge commit. In such a case, you can \"unwrap\" the tag yourself before feeding it\nto git merge , or pass --ff-only when you do not have any work on\nyour own. e.g. git fetch origin\ngit merge v1.2.3^0\ngit merge --ff-only v1.2.3" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Insert a commit before the root commit in Git?\nI've asked before about how to squash the first two commits in a git repository.\nWhile the solutions are rather interesting and not really as mind-warping as some other things in git, they're still a bit of the proverbial bag of hurt if you need to repeat the procedure many times along the development of your project. \nSo, I'd rather go through pain only once, and then be able to forever use the standard interactive rebase. \nWhat I want to do, then, is to have an empty initial commit that exists solely for the purpose of being the first. No code, no nothing. Just taking up space so it can be the base for rebase.\nMy question then is, having an existing repository, how do I go about inserting a new, empty commit before the first one, and shifting everyone else forward?" }, { "role": "assistant", "content": "There are 2 steps to achieving this:\n\nCreate a new empty commit\nRewrite history to start from this empty commit\n\nWe’ll put the new empty commit on a temporary branch newroot for convenience.\n1. Create a new empty commit\nThere is a number of ways you can do this.\nUsing just plumbing\nThe cleanest approach is to use Git’s plumbing to just create a commit directly, which avoids touching the working copy or the index or which branch is checked out, etc.\n\nCreate a tree object for an empty directory:\ntree=`git hash-object -wt tree --stdin < /dev/null`\n\nWrap a commit around it:\ncommit=`git commit-tree -m 'root commit' $tree`\n\nCreate a reference to it:\ngit branch newroot $commit\n\n\nYou can of course rearrange the whole procedure into a one-liner if you know your shell well enough.\nWithout plumbing\nWith regular porcelain commands, you cannot create an empty commit without checking out the newroot branch and updating the index and working copy repeatedly, for no good reason. But some may find this easier to understand:\ngit checkout --orphan newroot\ngit rm -rf .\ngit clean -fd\ngit commit --allow-empty -m 'root commit'\n\nNote that on very old versions of Git that lack the --orphan switch to checkout, you have to replace the first line with this:\ngit symbolic-ref HEAD refs/heads/newroot\n\n2. Rewrite history to start from this empty commit\nYou have two options here: rebasing, or a clean history rewrite.\nRebasing\ngit rebase --onto newroot --root master\n\nThis has the virtue of simplicity. However, it will also update the committer name and date on every last commit on the branch.\nAlso, with some edge case histories, it may even fail due to merge conflicts – despite the fact that you are rebasing onto a commit that contains nothing.\nHistory rewrite\nThe cleaner approach is to rewrite the branch. Unlike with git rebase, you will need to look up which commit your branch starts from:\ngit replace <currentroot> --graft newroot\ngit filter-branch master\n\nThe rewriting happens in the second step, obviously; it’s the first step that needs explanation. What git replace does is it tells Git that whenever it sees a reference to an object you want replaced, Git should instead look at the replacement of that object.\nWith the --graft switch, you are telling it something slightly different than normally. You are saying don’t have a replacement object yet, but you want to replace the <currentroot> commit object with an exact copy of itself except the parent commit(s) of the replacement should be the one(s) that you listed (i.e. the newroot commit). Then git replace goes ahead and creates this commit for you, and then declares that commit as the replacement for your original commit.\nNow if you do a git log, you will see that things already look as you want them to: the branch starts from newroot.\nHowever, note that git replace does not actually modify history – nor does it propagate out of your repository. It merely adds a local redirect to your repository from one object to another. What this means is that nobody else sees the effect of this replacement – only you.\nThat’s why the filter-branch step is necessary. With git replace you create an exact copy with adjusted parent commits for the root commit; git filter-branch then repeats this process for all the following commits as well. That is where history actually gets rewritten so that you can share it." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-log - Show commit logs --full-history without parent rewriting" }, { "role": "assistant", "content": "This mode differs from the default in one point: always follow\nall parents of a merge, even if it is TREESAME to one of them.\nEven if more than one side of the merge has commits that are\nincluded, this does not imply that the merge itself is! In\nthe example, we get I A B N D O P Q M was excluded because it is TREESAME to both parents. E , C and B were all walked, but only B was !TREESAME, so the others\ndo not appear. Note that without parent rewriting, it is not really possible to talk\nabout the parent/child relationships between the commits, so we show\nthem disconnected." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to apply SVN diff to Git?\nI have my projects in 2 repositories. One under SVN and one under Git.\nWhenever I change something in SVN I want to do the same thing to the Git repository.\nSay I make a change to SVN repository, producing revision 125. How would I apply these same changes to my Git repository (assuming my Git repository is up to date with revision 124).\nThank you." }, { "role": "assistant", "content": "What I actually did for was:\ncd /path/to/svn/repo\nsvn diff -r 125 > /tmp/patch.diff\ncd /path/to/git/repo\npatch -p0 < /tmp/patch.diff" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "show all tags in git log\nWhy does git log --decorate not display more than one tag per commit?\nEDIT: Charles Bailey has come up with the answer (at least in my case)\nEssentially, I had one tag that pointed to another tag that pointed to the commit. Because of this extra layer of indirection, the tag wasn't showing up in the log. I'll have to fix this, wither by fixing our tagging script to tag correctly, or by some shell script voodoo to recursively follow tags. Anyway, I'll leave this question up just for reference in case anyone wants it. (I'm new to stack overflow, but I assume that is the correct protocol?)\n... Original question follows ...\nBackstory: We use GIT at work for source control, and we have a policy of always tagging a commit when we deploy. (It's actually a script that does tags, and then pulls the tag on the server). Since it's a web application with separate staging and production servers, we often tag a release for staging (for testing or whatever), and then later tag the same commit for production.\nSo it's actually very often that we have multiple tags on the same commit. It would be very nice to be able to see this in the text log, but it doesn't seem to support it. I'm currently working around the issue by manually checking the tag I'm looking for, or by firing up gitk. While both of these solutions work, it seems to me that it's really weird for git log --decorate to only support one tag per commit by default.\nI did some googling around, but didn't find much. Am I missing something obvious?\nP.S. (I actually use a custom format string with %d, according to the man pages and some quick tests, it's equivalent to --decorate)" }, { "role": "assistant", "content": "git log --no-walk --tags --pretty=\"%h %d %s\" --decorate=full\n\nThis version will print the commit message as well:\n $ git log --no-walk --tags --pretty=\"%h %d %s\" --decorate=full\n3713f3f (tag: refs/tags/1.0.0, tag: refs/tags/0.6.0, refs/remotes/origin/master, refs/heads/master) SP-144/ISP-177: Updating the package.json with 0.6.0 version and the README.md.\n00a3762 (tag: refs/tags/0.5.0) ISP-144/ISP-205: Update logger to save files with optional port number if defined/passed: Version 0.5.0\nd8db998 (tag: refs/tags/0.4.2) ISP-141/ISP-184/ISP-187: Fixing the bug when loading the app with Gulp and Grunt for 0.4.2\n3652484 (tag: refs/tags/0.4.1) ISP-141/ISP-184: Missing the package.json and README.md updates with the 0.4.1 version\nc55eee7 (tag: refs/tags/0.4.0) ISP-141/ISP-184/ISP-187: Updating the README.md file with the latest 1.3.0 version.\n6963d0b (tag: refs/tags/0.3.0) ISP-141/ISP-184: Add support for custom serializers: README update\n4afdbbe (tag: refs/tags/0.2.0) ISP-141/ISP-143/ISP-144: Fixing a bug with the creation of the logs\ne1513f1 (tag: refs/tags/0.1.0) ISP-141/ISP-143: Betterr refactoring of the Loggers, no dependencies, self-configuration for missing settings." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-blame - Show what revision and author last modified each line of a file blame.blankBoundary" }, { "role": "assistant", "content": "Show blank commit object name for boundary commits in git-blame . This option defaults to false." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to change Git log date formats\nI am trying to display the last commit within Git, but I need the date in a special format.\nI know that the log pretty format %ad respects the --date format, but the only --date format I can find is \"short\". I want to know the others, and whether I can create a custom one such as:\ngit -n 1 --date=**YYMMDDHHmm** --pretty=format:\"Last committed item in this release was by %%an, %%aD, message: %%s(%%h)[%%d]\"" }, { "role": "assistant", "content": "In addition to --date=(relative|local|default|iso|iso-strict|rfc|short|raw), as others have mentioned, you can also use a custom log date format with\n--date=format:'%Y-%m-%d %H:%M:%S' # committer's timezone\n--date=format-local:'%Y-%m-%d %H:%M:%S' # current user's timezone\n\nThis outputs something like 2016-01-13 11:32:13.\nNOTE: If you take a look at the commit linked to below, I believe you'll need at least Git v2.6.0-rc0 for this to work.\nIn a full command it would be something like:\ngit config --global alias.lg \"log --graph --decorate -30 --all --topo-order --date=format-local:'%Y-%m-%d %H:%M:%S' --pretty=format:'%C(cyan)%h%Creset %C(black bold)%ad%Creset%C(auto)%d %s'\"\n\nI haven't been able to find this in documentation anywhere (if someone knows where to find it, please comment) so I originally found the placeholders by trial and error.\nIn my search for documentation on this I found a commit to Git itself that indicates the format is fed directly to strftime. Looking up strftime (here or here) the placeholders I found match the placeholders listed.\nThe placeholders include:\n%a Abbreviated weekday name\n%A Full weekday name\n%b Abbreviated month name\n%B Full month name\n%c Date and time representation appropriate for locale\n%d Day of month as decimal number (01 – 31)\n%H Hour in 24-hour format (00 – 23)\n%I Hour in 12-hour format (01 – 12)\n%j Day of year as decimal number (001 – 366)\n%m Month as decimal number (01 – 12)\n%M Minute as decimal number (00 – 59)\n%p Current locale's A.M./P.M. indicator for 12-hour clock\n%S Second as decimal number (00 – 59)\n%U Week of year as decimal number, with Sunday as first day of week (00 – 53)\n%w Weekday as decimal number (0 – 6; Sunday is 0)\n%W Week of year as decimal number, with Monday as first day of week (00 – 53)\n%x Date representation for current locale\n%X Time representation for current locale\n%y Year without century, as decimal number (00 – 99)\n%Y Year with century, as decimal number\n%z, %Z Either the time-zone name or time zone abbreviation, depending on registry settings\n%% Percent sign" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How do I fix \"remote: fatal error in commit_refs\" errors trying to push with Git?\nWhen I try to push to master branch that is hosted on https://github.com I get:\n\nremote: fatal error in commit_refs\n\nHow can I solve this?" }, { "role": "assistant", "content": "In my case, GitHub was down by the time I was trying to push.\nJust check https://www.githubstatus.com to know about GitHub site status.\nWhen it's up you'll be able to push." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-grep - Print lines matching a pattern git grep solution -- :^Documentation" }, { "role": "assistant", "content": "Looks for solution , excluding files in Documentation ." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Passing ssh options to git clone\nI'm trying to run git clone without ssh checking the repository host's key. I can do it from ssh like that:\nssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no user@host\n\nIs there any way to pass the same ssh options to the git clone command?\nEdit: There is a restriction that I can't modify ~/.ssh/config or any other files on that machine." }, { "role": "assistant", "content": "The recently released git 2.3 supports a new variable \"GIT_SSH_COMMAND\" which can be used to define a command WITH parameters.\nGIT_SSH_COMMAND=\"ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no\" git clone user@host\n\n\n$GIT_SSH_COMMAND takes precedence over $GIT_SSH, and is\ninterpreted by the shell, which allows additional arguments to be\nincluded.\n\nEdit: While this answers the exact question that was asked I would agree with the edit that Poyoman suggested to better use this option that was added in the last decade instead.\nGIT_SSH_COMMAND=\"ssh -o StrictHostKeyChecking=accept-new\" git clone user@host" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to abort a git rebase from inside vim during interactive editing\nWhen I do an interactive rebase, e.g.\ngit rebase -i HEAD~3\n\nthe rebase interactive editor (vim in my case) opens to let me edit the commits to rebase\npick c843ea2 Set Vim column limit to 80 (OS X)\npick fc32eac Add Bash alias for `pbcopy` (OS X)\n....\n\nIf I now decide that I want to abort the rebase and quit vim using :q the rebase starts anyway. I'm using git version 1.9.0.msysgit.0 on windows.\nSure I can just delete all pick lines, but it might be a lot to do if I rebase a longer history. Is there another way?\nHow can I quit the rebase interactive editor (vim) and abort the rebase?" }, { "role": "assistant", "content": "If you exit the editor with an error code, the rebase will be aborted.\nTo exit with an error code on vim, do\n:cq\n\nSee here and vimdoc here." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to conclude your merge of a file?\nAfter I merged a file in Git I tried to pull the repository but error came up:\n\nYou have not concluded your merge. (MERGE_HEAD exists)\n\nHow does one conclude a merge?" }, { "role": "assistant", "content": "Check status (git status) of your repository. Every unmerged file (after you resolve conficts by yourself) should be added (git add), and if there is no unmerged file you should git commit" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-log - Show commit logs --numstat" }, { "role": "assistant", "content": "Similar to --stat , but shows number of added and\ndeleted lines in decimal notation and pathname without\nabbreviation, to make it more machine friendly. For\nbinary files, outputs two - instead of saying 0 0 ." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-log - Show commit logs cumulative" }, { "role": "assistant", "content": "Count changes in a child directory for the parent directory as well.\nNote that when using cumulative , the sum of the percentages\nreported may exceed 100%. The default (non-cumulative) behavior can\nbe specified with the noncumulative parameter." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Git: Exclude a file with git clean\ni'm working on a big python project, and i'm really sick if .pyc and *~ files. I'd like to remove them. I've seen that the -X flag of git clean would remove untracked files. As you can imagine, i'm not tracking .pyc nor *~ files. And that would make the trick. The problem is that i've a local_settings.py file that I'd like to keep after the git clean.\nSo, this is what I've got.\n.gitignore:\n*.pyc\n*~\nlocal_settings.py\n\nWhen I execute this command:\ngit clean -X -n -e local_settings.py\n\nI get this list of results:\n\nWould remove local_settings.py\n Would remove requirements.txt~\n Would remove (other bunch of) ~ files\n Would remove (other bunch of) pyc files \n\nI don't want to remove the local_settings.py file. I've tryed lots of ways to do it, but i can't figure out how to acomplish it.\ngit clean -X -n -e local_settings.py\ngit clean -X -n -e \"local_settings.py\"\ngit clean -X -n --exclude=local_settings.py\ngit clean -X -n --exclude=\"local_settings.py\"\n\nAnd nothing seems to work.\nEDIT:\nFor posterity, the right way to do it is (Thanks @Rifat):\ngit clean -x -n -e local_settings.py # Shows what would remove (-n flag)\ngit clean -x -f -e local_settings.py # Removes it (note the -f flag)" }, { "role": "assistant", "content": "The difference is the capital X you're using. Use a small x instead of the capital one. Like in: git clean -x.\ngit clean -x -n -e local_settings.py # Shows what would remove (-n flag)\ngit clean -x -f -e local_settings.py # Removes it (note the -f flag)\n\nFrom the git documentation:\n\n -x\n Don't use the standard ignore rules read from .gitignore (per\n directory) and $GIT_DIR/info/exclude, but do still use the ignore\n rules given with -e options. This allows removing all untracked\n files, including build products. This can be used (possibly in\n conjunction with git reset) to create a pristine working directory\n to test a clean build.\n\n -X\n Remove only files ignored by git. This may be useful to rebuild\n everything from scratch, but keep manually created files." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-log - Show commit logs --branches[=<pattern>]" }, { "role": "assistant", "content": "Pretend as if all the refs in refs/heads are listed\non the command line as <commit> . If <pattern> is given, limit\nbranches to ones matching given shell glob. If pattern lacks ? , * , or [ , /* at the end is implied." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-show - Show various types of objects --stat[=<width>[,<name-width>[,<count>]]]" }, { "role": "assistant", "content": "Generate a diffstat. By default, as much space as necessary\nwill be used for the filename part, and the rest for the graph\npart. Maximum width defaults to terminal width, or 80 columns\nif not connected to a terminal, and can be overridden by <width> . The width of the filename part can be limited by\ngiving another width <name-width> after a comma or by setting diff.statNameWidth=<width> . The width of the graph part can be\nlimited by using --stat-graph-width=<width> or by setting diff.statGraphWidth=<width> . Using --stat or --stat-graph-width affects all commands generating a stat graph,\nwhile setting diff.statNameWidth or diff.statGraphWidth does not affect git format-patch .\nBy giving a third parameter <count> , you can limit the output to\nthe first <count> lines, followed by ... if there are more. These parameters can also be set individually with --stat-width=<width> , --stat-name-width=<name-width> and --stat-count=<count> ." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "What is a good workflow for submodule forks\n\nSuppose we have the following repository structure on github:\ncompany:project.git\n \\- company:submodule.git\n\nA developer in my company forks the company project, making his workspace look like this:\ndeveloper:project.git\n \\- company:submodule.git\n\nThis is fine for 90% of the developers since they don't change the submodule library, they only work in the project. Now suppose there's a new feature which requires improvements in the submodule. The developer charged with this converts his workspace to this:\ndeveloper:project.git\n \\- developer:submodule.git\n\nGetting there is not trivial as he needs to replace a submdule with another submodule (to git, the original and the fork of the submodule are two different things).\nIf this developer works on the library for a bit longer, he commits this structure to his master branch, so his fork on github always uses the forked submodule.\nOnce he's ready with development, he'll create a pull request. The problem is that when merging the pull request the main repository will look like this:\ncompany:project.git\n \\- developer:submodule.git\n\nThis is problematic as now every developer that tracks the company branch will end up with the developer's submodule.\nTo workaround the problem, before the developer makes a pull request, his master branch should be moved back to the company:submodule.git - which is just very awkward, especially since locally he'll always still want to work with developer:submodule.git.\nWe've tried several workflows, and the above issue is the only one where we don't have a good workflow yet." }, { "role": "assistant", "content": "When the developer creates a commit with the submodule at a particular version, that's a strong statement that the supermodule works with the submodule at that exact version. If his code does actually work with the company's version of the submodule, I think the right thing to do is for the developer to:\n\nbranch the supermodule\ncheckout the company version in the submodule\nupdate .gitmodules in the supermodule, if the developer changed that from the upstream version\nstage and commit that change\ntest everything\nissue the pull request\n\nHe can then switch back to his normal development branch in the supermodule.\nOne thing I don't understand about your question is the following:\n\nGetting there is not trivial as he needs to replace a submdule with another submodule (to git, the original and the fork of the submodule are two different things).\n\nOn the contrary, the submodule can be any git repository so long as it contains the commit which the supermodule points to. If there are two different remote repositories, he can just add an extra remote in the submodule. (The developer should change .gitmodules as well if they're going to share their repository with anyone else.)\n\nIn response to your comment below, perhaps it's worth going through how to switch a submodule from pointing to one version to another. Let's suppose that the developer is using their own repositories for the super and submodule, but those are both cloned from the company's versions (i.e. so most of the history is the same), and the submodule is at the path lib. The developer now wants to switch the submodule to point to the company's version instead. They can do the following:\n\nEdit the url parameter for the submodule in .gitmodules to point to the company's repository.\ncd lib\ngit remote add company developer@company:/srv/git/lib.git\ngit fetch company\ngit checkout -b upstream-master company/master\ncd ..\ngit add .gitmodules lib\ngit commit -m \"Switch the lib submodule to point back to the company's version\"\n\nSteps 3 to 5 can just be changed to git checkout <whatever> once the remote and branch are set up." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-update-index - Register file contents in the working tree to the index --untracked-cache --no-untracked-cache" }, { "role": "assistant", "content": "Enable or disable untracked cache feature. Please use --test-untracked-cache before enabling it. These options take effect whatever the value of the core.untrackedCache configuration variable (see git-config ). But a warning is\nemitted when the change goes against the configured value, as the\nconfigured value will take effect next time the index is read and this\nwill remove the intended effect of the option." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Generating SSH keys for 'apache' user\n\nHow do I add SSH keys for 'apache' user in Linux? \nBACKGROUND \nI am trying to add a service hook to github to notify a URL once I push to my repo. I have the following php page set up:\n<?php `git pull origin master`; \n\nHowever I get the following output:\nsh: git: Permission denied\n\nThis is because the keys I generated for github access were generated by my 'root' user. However when I exectue a command from php it is the 'apache' user that runs it.\nThe keys therefore do not correspond and permission is denied to pull.\nAs I cannot switch user from the terminal to generate keys as 'apache', I am not too sure what to do. Can anyone suggest a solution?" }, { "role": "assistant", "content": "You may have to copy the root generated keys in the .ssh directory of your apache user.\nAssuming the homedir of apache is /var/www (check /etc/passwd) and the named key is id_rsa-git :\nmkdir -p /var/www/.ssh/\ncp /root/.ssh/id_rsa-git /var/www/.ssh/id_rsa\n\nNo need to copy the public key.\nNote : by default the key used are id_rsa or id_dsa. You may change the name of the copied key to match this.\nYou may also change ownership of the id_rsa key and .ssh directory: \nchown -R apache:apache /var/www/.ssh\nchmod 0700 /var/www/.ssh\nchmod 0600 /var/www/.ssh/id_rsa" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to see all tags in a git repository in command line [duplicate]\nThis question already has answers here:\n \n \n\n\n\n\nHow to list all Git tags?\n\n (11 answers)\n \n\nClosed 9 years ago.\n\n\n\nIs there something like \"git show tags\"?" }, { "role": "assistant", "content": "git tag to list tags used in the repo.\ngit tag -l if you use the -l option you can pass a search pattern to filter out tags." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How can I pass git SHA1 to compiler as definition using cmake?\nIn a Makefile this would be done with something like:\ng++ -DGIT_SHA1=\"`git log -1 | head -n 1`\" ...\n\nThis is very useful, because the binary knows exact commit SHA1 so it can dump it in case of segfault.\nHow can I achieve the same with CMake?" }, { "role": "assistant", "content": "I've made some CMake modules that peer into a git repo for versioning and similar purposes - they're all in my repository at https://github.com/rpavlik/cmake-modules\nThe good thing about these functions is, they will force a re-configure (a rerun of cmake) before a build every time the HEAD commit changes. Unlike doing something just once with execute_process, you don't need to remember to re-cmake to update the hash definition.\nFor this specific purpose, you'd need at least the GetGitRevisionDescription.cmake and GetGitRevisionDescription.cmake.in files. Then, in your main CMakeLists.txt file, you'd have something like this\nlist(APPEND CMAKE_MODULE_PATH \"${CMAKE_CURRENT_SOURCE_DIR}/whereYouPutMyModules/\")\ninclude(GetGitRevisionDescription)\nget_git_head_revision(GIT_REFSPEC GIT_SHA1)\n\nThen, you could either add it as a system-wide definition (which unfortunately would cause lots of rebuilding)\nadd_definitions(\"-DGIT_SHA1=${GIT_SHA1}\")\n\nor, my suggested alternative: Make a generated source file. Create these two files in your source:\nGitSHA1.cpp.in:\n#define GIT_SHA1 \"@GIT_SHA1@\"\nconst char g_GIT_SHA1[] = GIT_SHA1;\n\nGitSHA1.h:\nextern const char g_GIT_SHA1[];\n\nAdd this to your CMakeLists.txt (assuming you have a list of source files in SOURCES):\nconfigure_file(\"${CMAKE_CURRENT_SOURCE_DIR}/GitSHA1.cpp.in\" \"${CMAKE_CURRENT_BINARY_DIR}/GitSHA1.cpp\" @ONLY)\nlist(APPEND SOURCES \"${CMAKE_CURRENT_BINARY_DIR}/GitSHA1.cpp\" GitSHA1.h)\n\nThen, you have a global variable containing your SHA string - the header with the extern doesn't change when the SHA does, so you can just include that any place you want to refer to the string, and then only the generated CPP needs to be recompiled on every commit to give you access to the SHA everywhere." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-merge - Join two or more development histories together --rerere-autoupdate --no-rerere-autoupdate" }, { "role": "assistant", "content": "After the rerere mechanism reuses a recorded resolution on\nthe current conflict to update the files in the working\ntree, allow it to also update the index with the result of\nresolution. --no-rerere-autoupdate is a good way to\ndouble-check what rerere did and catch potential\nmismerges, before committing the result to the index with a\nseparate git add ." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Git commit bash script\n\nI'm writing a bash script to add, commit, push all files in a directory.\n#!/bin/bash \ngit add . \nread -p \"Commit description: \" desc \ngit commit -m $desc \ngit push origin master\n\nI'm getting the following error:\n$ ./togithub \nCommit description: \ntest commit script \nerror: pathspec 'commit' did not match any file(s) known to git. \nerror: pathspec 'script\"' did not match any file(s) known to git. \nEverything up-to-date\n\nI'm not sure if this is a problem with reading in the text (it echos fine) or passing it to git commit -m." }, { "role": "assistant", "content": "You have to do:\ngit commit -m \"$desc\"\n\nIn the current script, test is going as commit message and commit and script are being treated as next arguments." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Login to Gitlab with username and password using cURL\n\nFor testing a command line tool against a Gitlab instance in Docker, I would like to login to Gitlab using username and password and grab the created session to authenticate my API requests.\nTherefore I do the following:\n\ncurl the user login page with curl -i http://localhost:8080/users/sign_in -s\nget me the _gitlab_session from the headers\nget me the authenticity_token from the login form\nsend a second curl request with\n\n\ncurl 'http://localhost:8080/users/sign_in' \\\n -H \"_gitlab_session=${cookie}\" \\\n -H 'Origin: http://localhost:8080' \\\n -H 'Content-Type: application/x-www-form-urlencoded' \\\n -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8' \\\n -H 'Referer: http://localhost:8080/users/sign_in' \\\n -H 'Connection: keep-alive' \\\n --data-urlencode \"authenticity_token=${token}\" \\\n --data-urlencode \"user[login]=root\" \\\n --data-urlencode \"user[password]=12341234\" \\\n --data-urlencode \"user[remember_me]=0\"\n\nBut instead of a valid user login, I get a \n422 - The change you requested was rejected.\n\nAnd in the logfiles, I see\n==> gitlab-rails/production.log <==\nStarted POST \"/users/sign_in\" for 172.17.0.1 at 2017-12-23 00:22:16 +0000\nProcessing by SessionsController#create as HTML\nParameters: {\"authenticity_token\"=>\"[FILTERED]\", \"user\"=>{\"login\"=>\"root\", \"password\"=>\"[FILTERED]\", \"remember_me\"=>\"0\"}}\nCan't verify CSRF token authenticity\nCompleted 422 Unprocessable Entity in 125ms (ActiveRecord: 7.8ms)\n\n==> gitlab-rails/production_json.log <==\n{\"method\":\"POST\",\"path\":\"/users/sign_in\",\"format\":\"html\",\"controller\":\"SessionsController\", \n\"action\":\"create\",\"status\":422,\"error\":\" \nActionController::InvalidAuthenticityToken:ActionController::InvalidAuthenticityToken\",\n\"duration\":126.29,\"view\":0.0,\"db\":7.78,\"time\":\"2017-12-23T00:22:16.039Z\",\n\"params\":{\"authenticity_token\":\"[FILTERED]\",\"user\":{\"login\":\"root\",\"password\":\"\n[FILTERED]\",\"remember_me\":\"0\"}},\"remote_ip\":\"172.17.0.1\",\n\"user_id\":1,\"username\":\"root\"}\n\n==> gitlab-rails/production.log <==\n\nActionController::InvalidAuthenticityToken (ActionController::InvalidAuthenticityToken):\n lib/gitlab/middleware/multipart.rb:93:in `call'\n lib/gitlab/request_profiler/middleware.rb:14:in `call'\n lib/gitlab/middleware/go.rb:18:in `call'\n lib/gitlab/etag_caching/middleware.rb:11:in `call'\n lib/gitlab/middleware/read_only.rb:31:in `call'\n lib/gitlab/request_context.rb:18:in `call'\n lib/gitlab/metrics/requests_rack_middleware.rb:27:in `call'\n\nI assume that I forgot to pass a necessary ingredient in the second request - but I can't figure out, which one." }, { "role": "assistant", "content": "With some helpful tips by other answers and comments, I finally came up with this solution:\ngitlab_host=\"http://localhost:8080\"\ngitlab_user=\"root\"\ngitlab_password=\"12341234\"\n\n# curl for the login page to get a session cookie and the sources with the auth tokens\nbody_header=$(curl -c cookies.txt -i \"${gitlab_host}/users/sign_in\" -s)\n\n# grep the auth token for the user login for\n# not sure whether another token on the page will work, too - there are 3 of them\ncsrf_token=$(echo $body_header | perl -ne 'print \"$1\\n\" if /new_user.*?authenticity_token\"[[:blank:]]value=\"(.+?)\"/' | sed -n 1p)\n\n# send login credentials with curl, using cookies and token from previous request\ncurl -b cookies.txt -c cookies.txt -i \"${gitlab_host}/users/sign_in\" \\\n --data \"user[login]=${gitlab_user}&user[password]=${gitlab_password}\" \\\n --data-urlencode \"authenticity_token=${csrf_token}\"\n\n# send curl GET request to personal access token page to get auth token\nbody_header=$(curl -H 'user-agent: curl' -b cookies.txt -i \"${gitlab_host}/profile/personal_access_tokens\" -s)\ncsrf_token=$(echo $body_header | perl -ne 'print \"$1\\n\" if /authenticity_token\"[[:blank:]]value=\"(.+?)\"/' | sed -n 1p)\n\n# curl POST request to send the \"generate personal access token form\"\n# the response will be a redirect, so we have to follow using `-L`\nbody_header=$(curl -L -b cookies.txt \"${gitlab_host}/profile/personal_access_tokens\" \\\n --data-urlencode \"authenticity_token=${csrf_token}\" \\\n --data 'personal_access_token[name]=golab-generated&personal_access_token[expires_at]=&personal_access_token[scopes][]=api')\n\n# Scrape the personal access token from the response HTML\npersonal_access_token=$(echo $body_header | perl -ne 'print \"$1\\n\" if /created-personal-access-token\"[[:blank:]]value=\"(.+?)\"/' | sed -n 1p)\n\nAccording to the GitLab API documentation you can now use the session cookie to authenticate API requests:\ncurl --header \"Private-Token: ${personal_access_token}\" https://gitlab.example.com/api/v4/projects\n\nSome hints:\n\nI first got confused with the curl -c file (which reads cookies from the headers and writes them to the file) vs. the curl -b file (which uses the cookies in the file and sends them with the request)\nUnfortunately I did not find a regex that worked with sed so I have to use perl here.\nUsing the developer console in Chrome and copying a POST request as curl command was very helpful: https://www.alexkras.com/copy-any-api-call-as-curl-request-with-chrome-developer-tools/" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to un-submodule a Git submodule?\nWhat are the best practices for un-submoduling a Git submodule, bringing all the code back into the core repository?" }, { "role": "assistant", "content": "If all you want is to put your submodule code into the main repository, you just need to remove the submodule and re-add the files into the main repo:\ngit rm --cached submodule_path # delete reference to submodule HEAD (no trailing slash)\ngit rm .gitmodules # if you have more than one submodules,\n # you need to edit this file instead of deleting!\nrm -rf submodule_path/.git # make sure you have backup!!\ngit add --force submodule_path # will add files instead of commit reference\n # --force adds files ignored by .gitignore\ngit commit -m \"remove submodule\"\n\nIf you also want to preserve the history of the submodule, you can do a small trick: “merge” the submodule into the main repository, so that the result will be the same as it was before, except that the submodule files are now in the main repository.\nIn the main module you will need to do the following:\n# Create a 'marker' at the submodule commit being used\ncd submodule_path\ngit switch --create \"submodule_merge_marker\"\ngit push --set-upstream origin submodule_merge_marker\n\n# Fetch the submodule commits into the main repository\ngit remote add submodule_origin git://url/to/submodule/origin\ngit fetch submodule_origin\n\n# Start a fake merge (won't change any files, won't commit anything)\ngit merge -s ours --no-commit submodule_origin/submodule_merge_marker\n\n# Do the same as in the first solution\ngit rm --cached submodule_path # delete reference to submodule HEAD\ngit rm .gitmodules # if you have more than one submodules,\n # you need to edit this file instead of deleting!\nrm -rf submodule_path/.git # make sure you have backup!!\ngit add --force submodule_path # will add files instead of commit reference\n # --force adds files ignored by .gitignore\n\n# Commit and cleanup\ngit commit -m \"remove submodule\"\ngit remote rm submodule_origin\n\nThe resulting repository will look a bit weird: there will be more than one initial commit. But it won’t cause any problems for Git.\nA big advantage of this second solution is that you can still run git blame or git log on the files which were originally in submodules. In fact, what happens here is just a renaming of many files inside one repository, and Git should automatically detect this. If you still have problems with git log, try some options (e.g., --follow, -M, -C) which do better rename and copy detection." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-log - Show commit logs --single-worktree" }, { "role": "assistant", "content": "By default, all working trees will be examined by the\nfollowing options when there are more than one (see git-worktree ): --all , --reflog and --indexed-objects .\nThis option forces them to examine the current working tree\nonly." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Gitlab CI - docker: command not found\n\nI am trying to build my docker image within the gitlab ci pipeline.\nHowever it is not able to find the docker command.\n\n/bin/bash: line 69: docker: command not found ERROR: Job failed: error\n executing remote command: command terminated with non-zero exit code:\n Error executing in Docker Container: 1\n\n.gitlab-ci.yml\nstages:\n - quality\n - test\n - build\n - deploy\n\nimage: node:8.11.3\n\nservices:\n - mongo\n - docker:dind\n\nbefore_script:\n- npm install\n\nquality:\n stage: quality\n script:\n - npm run-script lint\n\ntest:\n stage: test\n script:\n - npm run-script test\n\nbuild:\n stage: build\n script:\n - docker build -t server .\n\ndeploy:\n stage: deploy\n script:\n - echo \"TODO deploy push docker image\"" }, { "role": "assistant", "content": "you need to choose an image including docker binaries\nimage: gitlab/dind\n\nservices:\n - docker:dind" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Docker: How to use selenium server to do nightwatchJS test?\n\nI don't know how to run a selenium server with my NodeJS application, whose files are located in the ./bundle folder of the custom e2e:latest docker image.\nI think I have to add the selenium server and webdriver chrome into the Dockerfile for the e2e:latest image, don't I?\nThis is what I have done so far:\nI've created a java:8-jre based docker image with NodeJS and nightwatchJS:\nDockerfile\nFROM java:8-jre\n\n## Node.js setup\nRUN curl -sL https://deb.nodesource.com/setup_4.x | bash -\nRUN apt-get install -y nodejs\n\n## Nightwatch\nRUN npm install -g nightwatch\n\nThis image is then used for the test:\ngitlab-ci.yml\nbuild:\n stage: build\n tags:\n - deploy\n script:\n - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY\n - meteor npm install --production\n - meteor build $PACKAGE_PATH --directory\n # Maybe something like...? - docker build -t $CI_REGISTRY_IMAGE:e2e .\n\nnightwatch:\n image: e2e:latest\n stage: e2e\n tags:\n - e2e\n before_script:\n - cd ./bundle\n script:\n - nightwatch\n\nThe configuration looks like this:\nnightwatch.conf.js\nmodule.exports = {\n 'src_folders' : ['test/e2e'],\n 'output_folder' : 'reports',\n 'custom_commands_path' : '',\n 'custom_assertions_path': '',\n 'page_objects_path' : '',\n 'globals_path' : '',\n 'test_runner' : {\n 'type' : 'mocha',\n 'options': {\n 'ui' : 'bdd',\n 'reporter': 'list'\n }\n },\n\n 'selenium': {\n 'start_process': false,\n 'server_path' : '',\n 'log_path' : '',\n 'host' : '127.0.0.1',\n 'port' : 4444,\n 'cli_args' : {\n 'webdriver.chrome.driver': './bin/chromedriver'\n }\n },\n\n 'test_settings': {\n 'default': {\n 'launch_url' : 'http://localhost',\n 'selenium_port': 4444,\n 'selenium_host': 'localhost',\n 'silent' : true,\n 'screenshots' : {\n 'enabled': true,\n 'path' : 'reports/error-screenshots'\n },\n 'desiredCapabilities': {\n 'browserName' : 'chrome',\n 'javascriptEnabled': true,\n 'acceptSslCerts' : true\n }\n },\n\n 'chrome': {\n 'desiredCapabilities': {\n 'browserName' : 'chrome',\n 'javascriptEnabled': true,\n 'acceptSslCerts' : true\n }\n }\n }\n}" }, { "role": "assistant", "content": "Not sure whether this is suitable for Gitlab CI but take a look at Selenoid project. This is a small (6 Mb) binary that launches browsers in separate Docker containers or by starting Webdriver process directly. So if container approach is not suitable for your needs try to pack Selenoid + e.g. Chromedriver + Chrome to the same container with Node.js. No need to install Java when using Selenoid." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-gc - Cleanup unnecessary files and optimize the local repository gc.rerereResolved" }, { "role": "assistant", "content": "Records of conflicted merge you resolved earlier are\nkept for this many days when git rerere gc is run.\nYou can also use more human-readable \"1.month.ago\", etc.\nThe default is 60 days. See git-rerere ." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to use terminal commands with Github?\n\nI have forked a private repository (an iPhone project) as follows:\ncd nameofdirectory\ngit init\ngit clone forkedURL\n\nNow I want to push the changes done by me to my forked repository so that the main admin can review my written code and merge it with the main repository.\nHow can I push the changes done by me to my forked repository using terminal on MacOS?" }, { "role": "assistant", "content": "You can't push into other people's repositories. This is because push permanently gets code into their repository, which is not cool.\nWhat you should do, is to ask them to pull from your repository. This is done in GitHub by going to the other repository and sending a \"pull request\".\nThere is a very informative article on the GitHub's help itself: https://help.github.com/articles/using-pull-requests\n\nTo interact with your own repository, you have the following commands. I suggest you start reading on Git a bit more for these instructions (lots of materials online).\nTo add new files to the repository or add changed files to staged area:\n$ git add <files>\n\nTo commit them:\n$ git commit\n\nTo commit unstaged but changed files:\n$ git commit -a\n\nTo push to a repository (say origin):\n$ git push origin\n\nTo push only one of your branches (say master):\n$ git push origin master\n\nTo fetch the contents of another repository (say origin):\n$ git fetch origin\n\nTo fetch only one of the branches (say master):\n$ git fetch origin master\n\nTo merge a branch with the current branch (say other_branch):\n$ git merge other_branch\n\nNote that origin/master is the name of the branch you fetched in the previous step from origin. Therefore, updating your master branch from origin is done by:\n$ git fetch origin master\n$ git merge origin/master\n\nYou can read about all of these commands in their manual pages (either on your linux or online), or follow the GitHub helps:\n\nhttps://help.github.com/articles/create-a-repo for commit and push\nhttps://help.github.com/articles/fork-a-repo for fetch and merge" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-switch - Switch branches checkout.workers" }, { "role": "assistant", "content": "The number of parallel workers to use when updating the working tree.\nThe default is one, i.e. sequential execution. If set to a value less\nthan one, Git will use as many workers as the number of logical cores\navailable. This setting and checkout.thresholdForParallelism affect\nall commands that perform checkout. E.g. checkout, clone, reset,\nsparse-checkout, etc. Note: Parallel checkout usually delivers better performance for repositories\nlocated on SSDs or over NFS. For repositories on spinning disks and/or machines\nwith a small number of cores, the default sequential checkout often performs\nbetter. The size and compression level of a repository might also influence how\nwell the parallel version performs." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-format-patch - Prepare patches for e-mail submission" }, { "role": "assistant", "content": "NAME git-format-patch - Prepare patches for e-mail submission" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-shortlog - Summarize git log output --exclude=<glob-pattern>" }, { "role": "assistant", "content": "Do not include refs matching <glob-pattern> that the next --all , --branches , --tags , --remotes , or --glob would otherwise\nconsider. Repetitions of this option accumulate exclusion patterns\nup to the next --all , --branches , --tags , --remotes , or --glob option (other options or arguments do not clear\naccumulated patterns). The patterns given should not begin with refs/heads , refs/tags , or refs/remotes when applied to --branches , --tags , or --remotes ,\nrespectively, and they must begin with refs/ when applied to --glob or --all . If a trailing /* is intended, it must be given\nexplicitly." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Git adding files to repo\n\nI followed basic Git tutorial and added README file, which worked. Then I copied my project files to the same folder and tried to add them to repository by running\ngit add --all\ngit ci 'test' (my alias for commit)\ngit push origin master\n\nand nothing got pushed. \nWhat are the commands I should run to push my files to the remote repository (master)?\nI tried to commit changes and run status but it says 'nothing to commit'. It does not recognize, that I copied lots of new files to that folder..\nOK, so I type: git add . (get no response from console)\nthen type to commit, and says no changes.." }, { "role": "assistant", "content": "This is actually a multi-step process. First you'll need to add all your files to the current stage:\ngit add .\n\nYou can verify that your files will be added when you commit by checking the status of the current stage:\ngit status\n\nThe console should display a message that lists all of the files that are currently staged, like this:\n# On branch master\n#\n# Initial commit\n#\n# Changes to be committed:\n# (use \"git rm --cached <file>...\" to unstage)\n#\n# new file: README\n# new file: src/somefile.js\n#\n\nIf it all looks good then you're ready to commit. Note that the commit action only commits to your local repository. \ngit commit -m \"some message goes here\"\n\nIf you haven't connected your local repository to a remote one yet, you'll have to do that now. Assuming your remote repository is hosted on GitHub and named \"Some-Awesome-Project\", your command is going to look something like this:\ngit remote add origin [email protected]:username/Some-Awesome-Project\n\nIt's a bit confusing, but by convention we refer to the remote repository as 'origin' and the initial local repository as 'master'. When you're ready to push your commits to the remote repository (origin), you'll need to use the 'push' command:\ngit push origin master\n\nFor more information check out the tutorial on GitHub: http://learn.github.com/p/intro.html" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Warning: Permanently added the RSA host key for IP address\n\nWhen I do pull from Github, I am getting this warning message. \n MYPC:/Rails$ git pull origin master\n Warning: Permanently added the RSA host key for IP address '#{Some IP address}' to the list of known hosts.\n From github.com:Example/Demo\n * branch master -> FETCH_HEAD\n Already up-to-date.\n\nI just want to know which IP address it is adding to the known hosts." }, { "role": "assistant", "content": "If you are accessing your repositories over the SSH protocol, you will receive a warning message each time your client connects to a new IP address for github.com. As long as the IP address from the warning is in the range of IP addresses , you shouldn't be concerned. Specifically, the new addresses that are being added this time are in the range from 192.30.252.0 to 192.30.255.255. The warning message looks like this:\nWarning: Permanently added the RSA host key for IP address '$IP' to the list of \n\n\nhttps://github.com/blog/1606-ip-address-changes" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-push - Update remote refs along with associated objects -u --set-upstream" }, { "role": "assistant", "content": "For every branch that is up to date or successfully pushed, add\nupstream (tracking) reference, used by argument-less git-pull and other commands. For more information,\nsee branch.<name>.merge in git-config ." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-diff - Show changes between commits, commit and working tree, etc git diff [<options>] [--] [<path>…​]" }, { "role": "assistant", "content": "This form is to view the changes you made relative to\nthe index (staging area for the next commit). In other\nwords, the differences are what you could tell Git to\nfurther add to the index but you still haven’t. You can\nstage these changes by using git-add ." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Is there any way to git checkout previous branch?\nI sort of want the equivalent of cd - for git. If I am in branch master and I checkout foo, I would love to be able to type something like git checkout - to go back to master, and be able to type it again to return to foo.\nDoes anything like this exist? Would it be hard to implement?" }, { "role": "assistant", "content": "From the release notes for 1.6.2\n\n@{-1} is a way to refer to the last branch you were on. This is\naccepted not only where an object name is expected, but anywhere a\nbranch name is expected and acts as if you typed the branch name.\nE.g. git branch --track mybranch @{-1}, git merge @{-1}, and\ngit rev-parse --symbolic-full-name @{-1} would work as expected.\n\nand\n\ngit checkout - is a shorthand for git checkout @{-1}.\n\nTo see the list of previous checkouts:\n\ni=0; while [ $? -eq 0 ]; do i=$((i+1)); echo -n \"$i. \"; git rev-parse --symbolic-full-name @{-$i} 2> /dev/null; done\nThis Bash one-liner script is not perfect but it should work for most cases. Note that sometimes the number may skip.\nTip: You can add it to .bashrc as a function." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to 'git pull' without switching branches (git checkout)?\nI'm used to running git pull and other commands from within a branch I'm working on. But I have set up a development server that several people work on, so I don't want to have to switch branches when I do it.\nIf I want to update an existing branch on the dev server from the github repository we all use, what would be the right way to do that?\nIf I run the command git pull github branchname will that simply pull the branch into the current branch?\nAll of the git examples I can find seem to indicate that you run checkout branchname first, then do the pull. I'm trying to avoid that. As I said, this is an existing branch and I just want to update to the latest version." }, { "role": "assistant", "content": "I was looking for the same thing and finally found the answer that worked for me in another stackoverflow post: Merge, update, and pull Git branches without using checkouts\nBasically:\ngit fetch <remote> <srcBranch>:<destBranch>\n\nExample: git fetch origin branchname:branchname\nUse the pull command\ngit pull <remote> <srcBranch>:<destBranch>\n\nExample: git pull origin branchname:branchname" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to permanently delete a file stored in GIT? [duplicate]\nThis question already has answers here:\n \n \n\n\n\n\nRemove sensitive files and their commits from Git history\n\n (12 answers)\n \n\n\nHow do you fix a bad merge, and replay your good commits onto a fixed merge?\n\n (12 answers)\n \n\nClosed 4 years ago.\n\n\n\nI backed up my database to GIT just so I could get the db at my home computer.\nI don't want this file to be versioned, it was just a 1 time thing really.\nCan I delete it for good so GIT doesn't keep track of it going forward or historically?" }, { "role": "assistant", "content": "I always find Guides: Completely remove a file from all revisions feed helpful.\n\nTo remove the file called Rakefile:\ngit filter-branch --force --index-filter \\\n  'git rm --cached --ignore-unmatch Rakefile' \\\n  --prune-empty --tag-name-filter cat -- --all\n\nThis command will run the entire history of every branch and tag, changing any commit\n that involved the file Rakefile, and any commits afterwards. Commits\n that are empty afterwards (because they only changed the Rakefile) are\n removed entirely." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to configure kdiff3 instead of emerge as a git mergetool?\nI have Git on mac OSX Snow Leopard and I tried to edit my merge and diff tool to use kdiff3 instead of emerge.\nBut when I try to use it does not launch the GUI of kdiff and keeps me with a cmd based interface.\nMy setting in gitconfig are: \n[merge]\n tool = kdiff3\n[mergetool \"kdiff3\"]\n cmd = /Applications/kdiff3.app/Contents/MacOS/kdiff3\n args = $base $local $other -o $output\n trustExitCode = false\n[diff]\ntool = kdiff3\n[difftool \"kdiff3\"]\ncmd = /Applications/kdiff3.app/Contents/MacOS/kdiff3\nargs = $base $local $other -o $output\ntrustExitCode = false\n\nThere is obviously something missing but what did I do wrong ?" }, { "role": "assistant", "content": "Recent Git versions have built-in support for kdiff3, so there's no need to configure it manually using the generic cmd and args settings. Instead do:\n$ git config --global merge.tool kdiff3\n\nAnd if kdiff3 is not in your PATH environment also do:\n$ git config --global mergetool.kdiff3.path /Applications/kdiff3.app/Contents/MacOS/kdiff3\n\nThis makes git mergetool launch kdiff3. Note that there is no way to configure Git to automatically launch your merge tool after a manual merge that has conflicts.\nIn case you really want to see how Git is calling kdiff3 internally, take a look at the built-in mergetool configuration for kdiff3.\nEdit: For Beyond Compare 4, which now also supports Mac OS X, simply exchange kdiff3 with bc3 (yes, \"3\") and adjust the path in the above lines. Starting with Git 2.2.0 you'll be able to use bc as an alias for bc3 so that you do not have to care about the version number." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "GitHub - prevent collaborators from using push -f\n\nIs there a way to prevent force push into a branch or repository? \nI want to stop important branches from having their history rewritten either accidentally or intentionally. How do people deal with this in larger development teams?\nIdeally, in my view, would possible to lock few branches per repository, and prevent everyone, other than the repository owner from doing a force push into them." }, { "role": "assistant", "content": "This is easy to do with Git with a pre-receive hook. Of course, this requires that you are actually able to install hooks, and for obvious reasons, GitHub doesn't allow you to upload arbitrary executable files to run on their servers :-)\nIn general, the workflow with Git or really any distributed version control system, is that you don't allow other people to push to your repository. Instead, you pull from theirs. This requires a much lower level of trust. So, this would be workaround number 1: don't let them push, have them fork and then pull from them. That way, you can control what goes into your repository.\nAnother workaround would be to set up your own staging repository on a server you own, where you can install your own Git hooks. You can configure a pre-receive hook which denies pushing if it's not a fast-forward and post-receive hook which automatically forwards all pushes to GitHub. Of course, this means that you lose many of the benefits of using GitHub in the first place.\nAs a third workaround, you could use multiple repositories. This is a combination of the two other approaches: have one repository that your collaborators can push to and another one that only you have access to, that you pull into from the first repository.\nAt any rate, you should file a feature request with GitHub (especially if you are a paying customer!) since this seems to be a useful feature." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-fsck - Verifies the connectivity and validity of the objects in the database gitignoreSymlink" }, { "role": "assistant", "content": "(INFO) .gitignore is a symlink." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Gitlab auto merge when build succeeds not working\n\nI have a quite simple question. We have setup Gitlab CI and want to allow auto merge as soon as the build succeeds for some of our branches. \nThing is, we see that the build passes, but the merge does not actually happen and the status stays at \"to be merged automatically once the build succeeds\".\nDo you have any idea why? \nI attached a screenshot of the bogus behaviour.\n\nEDIT: Some additional information that was requested: \n\nIt looks like no background job is put in the queue where I activate a \"automatic merge when build succeeds\nWhen a build finishes running, no background jobs is triggered as far as I can see. Nothing new being scheduled, dead or in progress. \nI also don't see anything crazy or ERROR like in the logs. \nTwo screenshots of my dashboard as a MR with an automated build runs : \n\n\n\nThanks, \nJulien" }, { "role": "assistant", "content": "Maybe your merge job is scheduled or dead.\n\nUse your admin account and click the Admin Area button.\nClick Monitoring -> Background Jobs\n\nThen,click the dashboard and check the if your merge job is in the Scheduled queue or Dead queue." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-read-tree - Reads tree information into the index" }, { "role": "assistant", "content": "SPARSE CHECKOUT Note: The skip-worktree capabilities in git-update-index and read-tree predated the introduction of git-sparse-checkout . Users are encouraged to use the sparse-checkout command in preference to these plumbing commands for\nsparse-checkout/skip-worktree related needs. However, the information\nbelow might be useful to users trying to understand the pattern style\nused in non-cone mode of the sparse-checkout command. \"Sparse checkout\" allows populating the working directory sparsely.\nIt uses the skip-worktree bit (see git-update-index ) to\ntell Git whether a file in the working directory is worth looking at. git read-tree and other merge-based commands ( git merge , git\ncheckout …​) can help maintaining the skip-worktree bitmap and working\ndirectory update. $GIT_DIR/info/sparse-checkout is used to\ndefine the skip-worktree reference bitmap. When git read-tree needs\nto update the working directory, it resets the skip-worktree bit in the index\nbased on this file, which uses the same syntax as .gitignore files.\nIf an entry matches a pattern in this file, or the entry corresponds to\na file present in the working tree, then skip-worktree will not be\nset on that entry. Otherwise, skip-worktree will be set. Then it compares the new skip-worktree value with the previous one. If\nskip-worktree turns from set to unset, it will add the corresponding\nfile back. If it turns from unset to set, that file will be removed. While $GIT_DIR/info/sparse-checkout is usually used to specify what\nfiles are in, you can also specify what files are not in, using\nnegate patterns. For example, to remove the file unwanted : /*\n!unwanted Another tricky thing is fully repopulating the working directory when you\nno longer want sparse checkout. You cannot just disable \"sparse\ncheckout\" because skip-worktree bits are still in the index and your working\ndirectory is still sparsely populated. You should re-populate the working\ndirectory with the $GIT_DIR/info/sparse-checkout file content as\nfollows: /* Then you can disable sparse checkout. Sparse checkout support in git\nread-tree and similar commands is disabled by default. You need to\nturn core.sparseCheckout on in order to have sparse checkout\nsupport." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Git push master fatal: You are not currently on a branch\n\nMaster is it at say commit #10. However, I ended up realizing I broke something along the way that wasn't caught by tests.\nI ended up going to commit #5, and then slowly re-did the dev of each commit and adjusted it continually to ensure it didn't re-cause the bug. Now I'm essentially back to commit #10, but with a number of changes that prevent the bug from happening.\nI now want to create commit #11 using my changes. But when I try to push to master I get \nfatal: You are not currently on a branch.\nTo push the history leading to the current (detached HEAD)\nstate now, use\n\n git push master HEAD:<name-of-remote-branch>\n\nWhich is to be expected. But how do I actually get that to push up to my remote branch?\nI tried git push origin HEAD:master but then got this:\n! [rejected] HEAD -> master (non-fast-forward)\nerror: failed to push some refs to 'https://github.com/tomhammond/sample.git'\nhint: Updates were rejected because a pushed branch tip is behind its remote\nhint: counterpart. Check out this branch and integrate the remote changes\nhint: (e.g. 'git pull ...') before pushing again.\nhint: See the 'Note about fast-forwards' in 'git push --help' for details.\n\nWhen I do a git status I see HEAD detached from 4a74ac3" }, { "role": "assistant", "content": "But when I try to push to master I get\n\nfatal: You are not currently on a branch.\nTo push the history leading to the current (detached HEAD)\n\nWhich is to be expected\n\nWorking in a detached state is not to be expected, unless you deliberately want to be doing this, which I doubt is the case for you. Instead of checking out commit #5, you should have either reverted the master branch to that commit, or do a git rebase in interactive mode where you can rehash the commits as you want.\nThat being said, if you are certain that the version of master in the detached state is what you really want to keep, then you can get around the non-fast-forward error, by force pushing the branch to the remote:\ngit push origin HEAD:master --force\n\nHowever, if you force push you run the risk of causing problems for all other users who have that branch checked out. A less risky solution would be to create a temporary branch from the detached HEAD, and then merge that branch into master:\ngit branch temp-branch\ngit checkout master\ngit merge temp-branch\ngit push origin master" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-remote - Manage set of tracked repositories set-head" }, { "role": "assistant", "content": "Sets or deletes the default branch (i.e. the target of the\nsymbolic-ref refs/remotes/<name>/HEAD ) for\nthe named remote. Having a default branch for a remote is not required,\nbut allows the name of the remote to be specified in lieu of a specific\nbranch. For example, if the default branch for origin is set to master , then origin may be specified wherever you would normally\nspecify origin/master . With -d or --delete , the symbolic ref refs/remotes/<name>/HEAD is deleted. With -a or --auto , the remote is queried to determine its HEAD , then the\nsymbolic-ref refs/remotes/<name>/HEAD is set to the same branch. e.g., if the remote HEAD is pointed at next , git remote set-head origin -a will set\nthe symbolic-ref refs/remotes/origin/HEAD to refs/remotes/origin/next . This will\nonly work if refs/remotes/origin/next already exists; if not it must be\nfetched first. Use <branch> to set the symbolic-ref refs/remotes/<name>/HEAD explicitly. e.g., git\nremote set-head origin master will set the symbolic-ref refs/remotes/origin/HEAD to refs/remotes/origin/master . This will only work if refs/remotes/origin/master already exists; if not it must be fetched first." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Tortoisegit undo last commit into the repo\nIs there an option in tortoisegit to undo the last commit into the repo?\nBy mistake I pushed a large number of unnecessary files into my git repository(branch:master) which I need to undo. I have searched a lot for the right option in tortoise git to undo the push and go back to the state before the last commit. Please show me a way to undo my last commit." }, { "role": "assistant", "content": "If you haven't pushed your changes yet (so your commit is only local)\n\nTortoiseGit -> Show log\nSelect the commit to which you want to rollback to\nReset \"<branch>\" to this... (Note: The commit is not lost after the reset, the HEAD is just not pointing to it)\nTortoiseGit -> Show log\n\nIf you have, then this can still be done, but then you'd have to also do a force-push (check \"overwrite known changes\" 1).\n1 The \"overwrite known changes\" flag will replace the already pushed commit with a new one. If there is a chance that someone already fetched the commit that you're replacing, don't use this feature, otherwise doing so will create a fork in the history with two conflicting truths.\n\nThere is also a shortcut for when you want to just (1) redo the last commit and (2) you haven't pushed it yet:\n\nCommit -> Check \"Amend Last Commit\"\n\nThat will replace the last commit with a new one. But I don't recommend using this - if the last commit is already pushed, you can end up with a big mess. TortoiseGit will not stop you here.\nBy doing a Reset you are forced to have a look at the log, and there you see if the commit is local or not." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-request-pull - Generates a summary of pending changes" }, { "role": "assistant", "content": "SYNOPSIS git request-pull [-p] <start> <URL> [<end>]" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Git: auto pull from repository?\nIs there any way to set up git such that it listens for updates from a remote repo and will pull whenever something changes? The use case is I want to deploy a web app using git (so I get version control of the deployed application) but want to put the \"central\" git repo on Github rather than on the web server (Github's interface is just soooo nice). \nHas anyone gotten this working? How does Heroku do it? My Google-fu is failing to give me any relevant results." }, { "role": "assistant", "content": "Git has \"hooks\", actions that can be executed after other actions. What you seem to be looking for is \"post-receive hook\". In the github admin, you can set up a post-receive url that will be hit (with a payload containing data about what was just pushed) everytime somebody pushes to your repo.\nFor what it's worth, I don't think auto-pull is a good idea -- what if something wrong was pushed to your branch ? I'd use a tool like capistrano (or an equivalent) for such things." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-config - Get and set repository or global options color.showBranch" }, { "role": "assistant", "content": "A boolean to enable/disable color in the output of git-show-branch . May be set to always , false (or never ) or auto (or true ), in which case colors are used\nonly when the output is to a terminal. If unset, then the\nvalue of color.ui is used ( auto by default)." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-remote - Manage set of tracked repositories" }, { "role": "assistant", "content": "SYNOPSIS git remote [-v | --verbose] git remote add [-t <branch>] [-m <master>] [-f] [--[no-]tags] [--mirror=(fetch|push)] <name> <URL> git remote rename [--[no-]progress] <old> <new> git remote remove <name> git remote set-head <name> (-a | --auto | -d | --delete | <branch>) git remote set-branches [--add] <name> <branch>…​ git remote get-url [--push] [--all] <name> git remote set-url [--push] <name> <newurl> [<oldurl>] git remote set-url --add [--push] <name> <newurl> git remote set-url --delete [--push] <name> <URL> git remote [-v | --verbose] show [-n] <name>…​ git remote prune [-n | --dry-run] <name>…​ git remote [-v | --verbose] update [-p | --prune] [(<group> | <remote>)…​]" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-checkout-index - Copy files from the index to the working tree -u --index" }, { "role": "assistant", "content": "update stat information for the checked out entries in\nthe index file." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How do I execute several git commands in a batch file without terminating after the first command?\nI tried to put a series of GIT commands that I always use continuously togeter as batch files so that I don't repeat myself too much. For example, I have this batch file called update_repo_branch.bat to update a local repo and synch a branch with the remote branch: \n\n@echo off\n if(%1) == () goto end\n if(%2) == () goto end\n cd %1\n git checkout %2\n git fetch origin\n git merge oring/%2\n :end\n\nGood to be lazy, but what I found is that when a GIT command is finished, it seems to send an exit flag back to terminate whatever is running. Therefore, using a batch file to exectute them all in one go simply doesn't work. Any idea how to work around it?" }, { "role": "assistant", "content": "I'm not sure if this is true for all Windows git packages, but at least some use a git.cmd script as a wrapper around the actual git executables (for example git.exe). So when you're batch file uses a git command, Windows is actually running another batch file.\nUnfortunately, when one batch file invokes another, by default it 'jumps' to the invoked batch file, never to return (this is for compatibility with ancient MS-DOS command processors or something).\nYou can solve this problem in a couple ways:\n\ninvoke git in your batch files using the call command to run the git.cmd batch file and return back to yours:\ncall git checkout %2\ncall git fetch origin\nrem etc...\n\ninvoke git in your batch file using the .exe extension explicitly to avoid the git.cmd batch file altogether. For this to work, you might need to make sure that you have your path and other environment variables set the way git.exe expects (that seems to be what git.cmd does in msysgit):\ngit.exe checkout %2\nrem etc..." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "GitHub - Find the pull request associated with a commit\nI'm trying to find a past pull request to see which comments / actions were made on a particular issue. \nI know the file and the change, so I can get to the commit that introduced it by looking at the blame view. However I can't find a way to look at the pull request that pushed that commit to the branch for the first time. \nIs there a way to do this? Or do I have to go on a trip down memory lane and manually browse through past pull requests?" }, { "role": "assistant", "content": "You can filter your pull requests based on the commit SHA - see here\n\nIf you know the specific SHA hash of a commit, you can use it to search for pull requests that contain that SHA. Note that the SHA syntax must be at least seven characters.\n\n\nFor example:\n\n\ne1109ab\nMatches pull requests with a commit SHA that starts with e1109ab.\n\n\n0eff326d6213c is:merged\nMatches merged pull requests with a commit SHA that starts with 0eff326d6213c." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-config - Get and set repository or global options diff.renames" }, { "role": "assistant", "content": "Whether and how Git detects renames. If set to \"false\",\nrename detection is disabled. If set to \"true\", basic rename\ndetection is enabled. If set to \"copies\" or \"copy\", Git will\ndetect copies, as well. Defaults to true. Note that this\naffects only git diff Porcelain like git-diff and git-log , and not lower level commands such as git-diff-files ." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "gitglossary - A Git Glossary gitfile" }, { "role": "assistant", "content": "A plain file .git at the root of a working tree that\npoints at the directory that is the real repository.\nFor proper use see git-worktree or git-submodule .\nFor syntax see gitrepository-layout ." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Is there a way to get download/clone statistics of a git repository?\nIs there any way to get how many times a git repository has been cloned or downloaded from github?\nI was just curious as I found other statistics such as commit times lines of code can be generated using: http://gitstats.sourceforge.net/ but I did not find how to check for clone/download count." }, { "role": "assistant", "content": "Its super easy now!\nGo \"REPO -> Insights -> Traffic\"" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Forking a sub directory of a repository on GitHub and making it part of my own repo\nApologies, I am very new to Git and GitHub, I've read through a few things but I'm not sure if what I'm trying to do is entirely possible.\nBasically I want to fork the Confluence Skin used on XBMC and modify various elements located here:\nhttps://github.com/xbmc/xbmc/tree/master/addons/skin.confluence\nHowever I don't want to fork the entire XBMC repository, so a simple fork action won't do.\nHere are my general requirements:\n\nI would like to take the contents of the skin.confluence folder and put it into a repository on my own GitHub account\nI need to be able to keep it linked within the original XBMC repo to receive upstream commits, as my modifications will generally be theme based, rather than functionality.\n\nThanks to the response posted by tbekolay, I have been able to do a subtree split to take only the skin.confluence part of repo and essentially create a branch, however I am unsure on how to keep it linked with the original XBMC repo while being pushed to my own repo with my modifications." }, { "role": "assistant", "content": "This is mostly possible with git, though it is not a typical use case, so there may be some rough edges as you do this (especially if you are new to git).\nThe tool that we'll use for this job is git subtree.\nSetting up a repository\nStart by cloning the whole XBMC repository.\ngit clone https://github.com/xbmc/xbmc.git\ncd xbmc\n\nWe start on the master branch by default. We want to make our own master branch, so let's rename master to upstream-master.\ngit branch -m upstream-master\n\nNow use git subtree split to only include the part that you want. We'll make the split off part a new branch called upstream-skin.\ngit subtree split --prefix=addons/skin.confluence -b upstream-skin\ngit checkout upstream-skin\n\nThis gives you a new upstream-skin branch that only contains the contents of addons/skin.confluence, and with a filtered history that contains only the commits that modified files in addons/skin.confluence.\nNow, let's set up our remotes. Since you cloned xbmc/xbmc.git, the origin remote will point there. Let's rename that to upstream.\ngit remote rename origin upstream\n\nMake a repository on Github to contain your modifications to addons/skin.confluence. As an example, I'll use tbekolay/xbmc-skin, but replace this with your own repo. Add this repo as a remote, and push your upstream-skin branch to it.\ngit remote add origin https://github.com/tbekolay/xbmc-skin.git\ngit fetch origin\ngit push -u origin upstream-skin\n\nFinally, we'll make a new branch called master that will contain your changes.\ngit checkout -b master\ngit push -u origin master\n\nYou now have a \"fork\" of the addons/skin.confluence subdirectory.\nMaking changes to your repositories\nWhen you're dealing with your own local and remote repositories, you can use normal git commands. Make sure to do this on the master branch (or some other branch, if you'd like) and not the upstream-skin branch, which should only ever contain commits from the upstream project.\ngit checkout master\necho \"My XBMC Skin\" > README\ngit add README\ngit commit -m \"Added README\"\ngit push\n\nReceiving upstream commits\nWhen you're dealing with the upstream repository, you will have to use a mix of git and git subtree commands. To get new filtered commits, we need to do it in three stages.\nIn the first stage, we'll update upstream-master to the current version of the XBMC repository.\ngit checkout upstream-master\ngit pull\n\nThis should pull down new commits, if there are any.\nNext, we will update upstream-skin with the new filtered version of the commits. Since git subtree ensures that commit hashes will be the same, this should be a clean process. Note that you want to run these commands while still on the upstream-master branch.\ngit subtree split --prefix=addons/skin.confluence \\\n --onto upstream-skin -b upstream-skin\n\nWith upstream-skin now updated, you can update your master branch as you see fit (either by merging or rebasing).\ngit checkout master\ngit rebase upstream-skin\n\n\nNote that the XBMC repository is gigantic, and the git subtree commands will take quite a bit of time to filter through all that history -- and since you're regenerating the split subtree each time you interact with the remote repository, it's quite an expensive operation. I'm not sure if this can be sped up.\nThis blog post goes into some more detail on the commands above. Also see the git-subtree docs for even more detail." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How do I discard unstaged changes in Git?\nHow do I discard changes in my working copy that are not in the index?" }, { "role": "assistant", "content": "For all unstaged files in current working directory use:\ngit restore .\n\nFor a specific file use:\ngit restore path/to/file/to/revert\n\nThat together with git switch replaces the overloaded git checkout (see here), and thus removes the argument disambiguation.\nIf a file has both staged and unstaged changes, only the unstaged changes shown in git diff are reverted. Changes shown in git diff --staged stay intact.\nBefore Git 2.23\nFor all unstaged files in current working directory:\ngit checkout -- .\n\nFor a specific file:\ngit checkout -- path/to/file/to/revert\n\n-- here to remove ambiguity (this is known as argument disambiguation)." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-fast-import - Backend for fast Git data importers feature" }, { "role": "assistant", "content": "Enable the specified feature. This requires that fast-import\nsupports the specified feature, and aborts if it does not." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Git's famous \"ERROR: Permission to .git denied to user\"\nI have tried googling and read through https://help.github.com/en/articles/connecting-to-github-with-ssh and various, various guides. I am unable to git push -u origin master or git push origin master ( the same command ).\nI've had my git account for at least 2 or so years. I've successfully been able to create repos and push -u origin master fine on my laptop but on this desktop I'm having issues.\nHere's what I tried:\n1. I have setup my git user name\n2. I have setup my git user email\n3. I have uploaded the contents of my /home/meder/.ssh/id_rsa.pub to github's account page. I have verified I did not paste any whitespace\n4. I have created a ~/.ssh/config with these contents:\n Host github.com\n User git\n Hostname github.com\n PreferredAuthentications publickey\n IdentityFile ~/.ssh/id_rsa\n\nI have chmodded the .ssh to 700, id_rsa 600\n5. I have added the proper remote origin without making typos : git remote add origin [email protected]:medero/cho.git\n6. To confirm #5, here is my .git/config. The directory is correct and not another directory:\n[remote \"origin\"]\n fetch = +refs/heads/*:refs/remotes/origin/*\n url = [email protected]:medero/cho.git\n\n7. ssh [email protected] -v gives me a successful Authentication\n8. One weird thing is, the username which it greets me with has t appended to it. My github username is medero, not medert.\n\nHi mederot! You've successfully\n authenticated, but GitHub does not\n provide shell access.\n\n9. I am not behind a proxy or firewall\n10. The key is offered, heres the output from -v:\n\ndebug1: Host 'github.com' is known and matches the RSA host key.\ndebug1: Found key in /home/meder/.ssh/known_hosts:58\ndebug1: ssh_rsa_verify: signature correct\ndebug1: SSH2_MSG_NEWKEYS sent\ndebug1: expecting SSH2_MSG_NEWKEYS\ndebug1: SSH2_MSG_NEWKEYS received\ndebug1: SSH2_MSG_SERVICE_REQUEST sent\ndebug1: SSH2_MSG_SERVICE_ACCEPT received\ndebug1: Authentications that can continue: publickey\ndebug1: Next authentication method: publickey\ndebug1: Offering public key: /home/meder/.ssh/id_rsa\ndebug1: Remote: Forced command: gerve mederot\ndebug1: Remote: Port forwarding disabled.\ndebug1: Remote: X11 forwarding disabled.\ndebug1: Remote: Agent forwarding disabled.\ndebug1: Remote: Pty allocation disabled.\ndebug1: Server accepts key: { some stuff, dont know if i should share it\n\ndebug1: Remote: Forced command: gerve mederot\ndebug1: Remote: Port forwarding disabled.\ndebug1: Remote: X11 forwarding disabled.\ndebug1: Remote: Agent forwarding disabled.\ndebug1: Remote: Pty allocation disabled.\ndebug1: Authentication succeeded (publickey).\n\n\n11. Here are the commands I used\nmkdir cho\ngit init\ntouch README\ngit add README\ngit commit -m 'test'\ngit remote add origin [email protected]:medero/cho.git\ngit push -u origin master\n\n12. I don't want to create a new SSH key.\n13. If I git clone using ssh and make an edit, commit, and git push, I get the same exact thing.\n14. Here's the actual error:\n$ git push\nERROR: Permission to medero/cho.git denied to mederot.\nfatal: The remote end hung up unexpectedly\n\n15. I have setup my github username and github token:\n$ git config --global github.user medero\n$ git config --global github.token 0123456789yourf0123456789tokenSets the GitHub token for all git instances on the system\n16. I have confirmed my github username is NOT mederot and my github token IS CORRECT per my account page ( validated first 2 chars and last 2 chars ).\n17. To confirm #16, ~/.gitconfig contains\n[github]\n token = mytoken...\n user = medero\n\n18. I did ssh-key add ~/.ssh/id_rsa if that's even necessary...\n\nTHEORIES:\nI suspect there's something fishy because when I get ssh authenticated, the user greeting is mederot and not medero, which is my acct. Could something in my github account possibly be incorrectly cached?\nI also suspect some local ssh caching weirdness because if i mv ~/.ssh/id_rsa KAKA and mv ~/.ssh/id_rsa.pub POOPOO, and do ssh [email protected] -v, it still Authenticates me and says it serves my /home/meder/.ssh/id_rsa when I renamed it?! It has to be cached?!" }, { "role": "assistant", "content": "After Googling for few days, I found this is the only question similar to my situation.\nHowever, I just solved the problem! So I am putting my answer here to help anyone else searching for this issue.\nHere is what I did:\n\nOpen \"Keychain Access.app\" (You can find it in Spotlight or LaunchPad)\nSelect \"All items\" in Category\nSearch \"git\"\nDelete every old & strange item\nTry to Push again and it just WORKED" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "GIT pull failed: 'unable to unlink file: invalid argument'\nNew GIT user here, managing a Moodle course web site system on a Windows server. Trying to do my first Pull update of the core code (using TortoiseGit) and it's not working. Git is unable to unlink old versions of any the 200+ files to be updated because of an \"invalid argument\". I have no idea what that means.\nHere's what it looks like after I dismiss 210 error dialogs:\ntortoisegit\nI've rebooted the server and scoured the web for ideas, but I'm at a loss for what to try next.\nAny ideas would be greatly appreciated!" }, { "role": "assistant", "content": "I lost hours with that error too.\nIn my case, I got this error because some files was locked by another program. I had to close everything then I was able to pull again.\nHope this help someone :)" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Bypass pre-commit hook during `git revert --continue`\nI was doing a git revert (of a previous revert), which caused some merge conflicts.\nAfter resolving the conflicts my pre-commit hook threw some code sniffer issues.\nSince these code sniffer notices are fixed elsewhere I wanted to bypass the pre-commit hook at this point using git revert --continue --no-verify, apparently git revert doesn't have the --no-verify subcommand.\ngit revert does have a --no-commit subcommand but this doesn't work in combination with --continue.\nI ended up renaming the pre-commit file, but out of curiosity. Is there any better wat to bypass pre-commit hooks at that point?" }, { "role": "assistant", "content": "Changing the hooks\nIf you are able to change the hooks, you can just add a toggle for each\none. Or just use a script to temporarily rename a given hook,\nas commented.\nEither way will selectively skip the problematic hook while letting the\nother ones run normally. This ensures that other checks occur (if they exist),\nsuch as a commit message validation with the commit-msg hook.\nCommitting\nIf that does not apply, there is an alternative:\nUsually, when an operation is stopped by a conflict, after fixing it you can\njust run\ngit commit\n\ninstead of\ngit $operation --continue\n\nThis applies to revert, merge, cherry-pick and possibly others (although\nin rebase it might behave differently, since it is a sequence of operations).\nSo, as noted, to bypass the hooks, you can just add --no-verify:\ngit commit --no-verify\n\n\nNote: The feature above seems to be undocumented, but it WorksForMe(tm).\nFrom a diff of strace git commit and strace git revert --continue, the\nformer does a lot of other things (515 vs 173 lines, respectively), such as\nchecking if a rebase is in progress and creating some temporary files in\n$GIT_DIR/objects. Example:\nstat(\".git/MERGE_HEAD\", 0x7ffefb5d0760) = -1 ENOENT (No such file or directory)\nstat(\".git/rebase-apply\", 0x7ffefb5d0620) = -1 ENOENT (No such file or directory)\nstat(\".git/rebase-merge\", 0x7ffefb5d0620) = -1 ENOENT (No such file or directory)\nstat(\".git/CHERRY_PICK_HEAD\", 0x7ffefb5d0760) = -1 ENOENT (No such file or directory)\nstat(\".git/BISECT_LOG\", 0x7ffefb5d0620) = -1 ENOENT (No such file or directory)\nstat(\".git/REVERT_HEAD\", {st_mode=S_IFREG|0644, st_size=41, ...}) = 0\nlstat(\".git/REVERT_HEAD\", {st_mode=S_IFREG|0644, st_size=41, ...}) = 0\nopenat(AT_FDCWD, \".git/REVERT_HEAD\", O_RDONLY) = 4\n\nBut the result appears to be same: They open up the editor with the\ngit-generated message (e.g.: \"This reverts commit [...]\") and commit after\nexiting. I have used the alternative form multiple times and never had any\nproblems at least (by the way, I probably discovered it under the same\nscenario)." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-diff - Show changes between commits, commit and working tree, etc --color[=<when>]" }, { "role": "assistant", "content": "Show colored diff. --color (i.e. without =<when> ) is the same as --color=always . <when> can be one of always , never , or auto .\nIt can be changed by the color.ui and color.diff configuration settings." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-log - Show commit logs --basic-regexp" }, { "role": "assistant", "content": "Consider the limiting patterns to be basic regular expressions;\nthis is the default." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Need to reset git branch to origin version\nI was accidentally working on a branch I shouldn't have been for a while, so I branched off of it giving it the appropriate name. Now I want to overwrite the branch I shouldn't have been on to the version from origin (github). Is there an easy way to do this? I tried deleting the branch and then resetting up the tracking branch, but it just gives me the version I was working on again." }, { "role": "assistant", "content": "If you haven't pushed to origin yet, you can reset your branch to the upstream branch with:\ngit checkout mybranch\ngit reset --hard origin/mybranch\n\n(Make sure that you reference your latest commit in a separate branch, like you mention in your question)\nNote that just after the reset, mybranch@{1} refers to the old commit, before reset.\nBut if you had already pushed, see \"Create git branch, and revert original to upstream state\" for other options.\n\nWith Git 2.23 (August 2019), that would be one command: git switch.\nNamely: git switch -C mybranch origin/mybranch\nExample\nC:\\Users\\vonc\\git\\git>git switch -C master origin/master\nReset branch 'master'\nBranch 'master' set up to track remote branch 'master' from 'origin'.\nYour branch is up to date with 'origin/master'.\n\nThat restores the index and working tree, like a git reset --hard would.\n\nAs commented by Brad Herman, a reset --hard would remove any new file or reset modified file to HEAD. \nActually, to be sure you start from a \"clean slate\", a git clean -f -d after the reset would ensure a working tree exactly identical to the branch you just reset to.\n\nThis blog post suggests those aliases (for master branch only, but you can adapt/extend those):\n\n[alias]\n resetorigin = !git fetch origin && git reset --hard origin/master && git clean -f -d\n resetupstream = !git fetch upstream && git reset --hard upstream/master && git clean -f -d\n\nThen you can type:\ngit resetupstream\n\nor\ngit resetorigin" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "gitattributes - Defining attributes per path Unspecified" }, { "role": "assistant", "content": "If the eol attribute is unspecified for a file, its line endings\nin the working directory are determined by the core.autocrlf or core.eol configuration variable (see the definitions of those\noptions in git-config ). If text is set but neither of\nthose variables is, the default is eol=crlf on Windows and eol=lf on all other platforms." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to remove Github's Wiki default sidebar\n\nSince a few weeks, Github wikis present a compulsory side bar to the right of wiki pages that take up some space for writing. Example:\n\nI could not find any button nor instructions on the net to remove this sidebar.\nIs there a command or instructions to get it removed somewhere?" }, { "role": "assistant", "content": "As of right now there is not a way to remove the sidebar. I would suggest you make a note to the developers of this issue and they may act upon it. Until then we will just have to deal with the stick sidebar." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How can I recover a lost commit in Git?\nFirst, got \"your branch is ahead of origin/master by 3 commits\" then my app has reverted to an earlier time with earlier changes. \nHow can I get what I spent the last 11 hours doing back?" }, { "role": "assistant", "content": "git reflog is your friend. Find the commit that you want to be on in that list and you can reset to it (for example:git reset --hard e870e41).\n(If you didn't commit your changes... you might be in trouble - commit early, and commit often!)" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-diff - Show changes between commits, commit and working tree, etc diff.interHunkContext" }, { "role": "assistant", "content": "Show the context between diff hunks, up to the specified number\nof lines, thereby fusing the hunks that are close to each other.\nThis value serves as the default for the --inter-hunk-context command line option." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "error: cannot overwrite multiple values with a single value\n\nI want to change my git mergetool kdiff3 to p4merge. because I'm getting an error on my windows system using kdiff3 mergetool. \n\n/mingw32/libexec/git-core/git-mergetool--lib: line 128: C:\\Program\n Files\\KDiff3\\kdiff3: cannot execute binary file: Exec format error\n application/config/constants.php seems unchanged.\n\nSo that I want to change to kdiff3 to p4merge, Here also I'm getting an error like\n\nwarning: merge.tool has multiple values error: cannot overwrite\n multiple values with a single value\n Use a regexp, --add or --replace-all to change merge.tool.\n\n\nHow can I solve this problem? Either kdiff3 or p4merge" }, { "role": "assistant", "content": "It is possible your kdiff3 installation is broken since it is not working. Or maybe you tried to edit config file manually and messed its content. why? Because windows executables have .exe extension in general. you may try editing config again. \nAnyways, that is not important anymore. This is what you need to use if you want to try any other tool.\ngit mergetool --tool=p4merge\n\nThere are possibly others already installed with your git. You can see all of them in addition to compatible others.\ngit mergetool --tool-help\n\nEdit:\nThis command works only if you set your path to the tool correctly. Otherwise, you always get No files need merging result. You already know how to set the path, but I will include here for anyone else that might need.\nGet the list of configuration items:\ngit config -l\n\nSee if you already have values set correctly, if any. then set to correct value or remove.\ngit config --unset mergetool.p4merge.path\ngit config --add mergetool.p4merge.path \"c:/somewhere/p4merge.exe\"\n\n\nEDIT:\nI will offer a cleaning process so, these additional commands will help.\nfirst steps are to make a backup of current settings. The simplest way is using these listings, then copy paste results.\ngit config --list\ngit config --global --list\n\nthen with these edit commands, just get config files' path and backup them (vim shows path) or save to a different location inside the editor.\ngit config --edit\ngit config --global --edit\n\nnow backups are ready, just exit editor. do not try to edit manually if it is not really needed.\ngit config --unset name\ngit config --global --unset name\ngit config --remove-section name\ngit config --global --remove-section name\n\nmerge.tool, mergetool.name, diff.tool and difftool.name are the ones to clean here. when you list the configs again, you should not see these names. local and global should be cleaned separately.\nThen set back those we just cleaned one by one. but this time first try them on local configuration first then if successful set on global too.\ngit config merge.tool name\ngit config mergetool.name.property value\ngit config diff.tool name\ngit config difftool.name.property value\n\nHere property is those like cmd and path, and value is their values which you can copy from your backups. Now the important thing here is to set only 1 tool at a time at first.\nOne last thing about paths. You (the OP) seem to use Linux-like environment, so using / instead of \\\\ would make path and cmd better to understand." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-show - Show various types of objects %as" }, { "role": "assistant", "content": "author date, short format ( YYYY-MM-DD )" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Clone git repository without history?\nI want to clone a repository from Github. It has lot of history so I'd like to clone without any history.\nIs this possible?" }, { "role": "assistant", "content": "You can get a shallow clone using the --depth option with value 1\ngit clone --depth 1 reponame.git\n\nIf you want more commit history, increase the value to meet your needs as required." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-shortlog - Summarize git log output --ancestry-path[=<commit>]" }, { "role": "assistant", "content": "When given a range of commits to display (e.g. commit1..commit2 or commit2 ^commit1 ), only display commits in that range\nthat are ancestors of <commit>, descendants of <commit>, or\n<commit> itself. If no commit is specified, use commit1 (the\nexcluded part of the range) as <commit>. Can be passed multiple\ntimes; if so, a commit is included if it is any of the commits\ngiven or if it is an ancestor or descendant of one of them." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git - the stupid content tracker git-p4" }, { "role": "assistant", "content": "Import from and submit to Perforce repositories" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Why is there a `remotes/origin/HEAD -> origin/master` entry in my `git branch -l -a` output?\nI don't understand the second line in the output to git branch -l -a: remotes/origin/HEAD -> origin/master.\ngit branch -l -a\n* master\n remotes/origin/HEAD -> origin/master\n remotes/origin/master\n\nIs that a leftover from another operation? Should I clean it up? And how would I do that?\nUsually I work with git on the cli, but on this local repository I experimented with TortoiseGit to find an easy git workflow for a friend." }, { "role": "assistant", "content": "No, no need to clean up: it is the symbolic branch referenced by your remote repo.\nWhen you clone your repo, you will be by default on the branch referenced by remotes/origin/HEAD.\nSee also:\n\n\"Git: Correct way to change Active Branch in a bare repository?\"\n\"How do I change a Git remote HEAD to point to something besides “master”\"\n\"How does origin/HEAD get set?\"\n\nNote: on Git versions older than 2.20, you need to use git branch --list (or git branch), not git branch -l." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How do I pull from a Git repository through an HTTP proxy?\nNote: while the use-case described is about using submodules within a project, the same applies to a normal git clone of a repository over HTTP.\nI have a project under Git control. I'd like to add a submodule:\ngit submodule add http://github.com/jscruggs/metric_fu.git vendor/plugins/metric_fu\n\nBut I get\n...\ngot 1b0313f016d98e556396c91d08127c59722762d0\ngot 4c42d44a9221209293e5f3eb7e662a1571b09421\ngot b0d6414e3ca5c2fb4b95b7712c7edbf7d2becac7\nerror: Unable to find abc07fcf79aebed56497e3894c6c3c06046f913a under http://github.com/jscruggs/metri...\nCannot obtain needed commit abc07fcf79aebed56497e3894c6c3c06046f913a\nwhile processing commit ee576543b3a0820cc966cc10cc41e6ffb3415658.\nfatal: Fetch failed.\nClone of 'http://github.com/jscruggs/metric_fu.git' into submodule path 'vendor/plugins/metric_fu'\n\nI have my HTTP_PROXY set up:\nc:\\project> echo %HTTP_PROXY%\nhttp://proxy.mycompany:80\n\nI even have a global Git setting for the http proxy:\nc:\\project> git config --get http.proxy\nhttp://proxy.mycompany:80\n\nHas anybody gotten HTTP fetches to consistently work through a proxy? What's really strange is that a few project on GitHub work fine (awesome_nested_set for example), but others consistently fail (rails for example)." }, { "role": "assistant", "content": "You can also set the HTTP proxy that Git uses in global configuration property http.proxy:\ngit config --global http.proxy http://proxy.mycompany:80\n\nTo authenticate with the proxy:\ngit config --global http.proxy http://mydomain\\\\myusername:mypassword@myproxyserver:8080/\n\n(Credit goes to @EugeneKulabuhov and @JaimeReynoso for the authentication format.)" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Issue with renaming a directory in git to lowercase while ignoreLowercase=True\nWhen I type git status, I see:\n# On branch master\n# Changes not staged for commit:\n# (use \"git add <file>...\" to update what will be committed)\n# (use \"git checkout -- <file>...\" to discard changes in working directory)\n#\n# modified: DIR/a\n#\n\nHowever, in my working directory I see that this file is actually called dir/a (note the lowercase dir instead of DIR).\nQuestion: I want to add this modified a file to the staging area and commit, but I want it to be as it is in my working directory (which shows dir/a) - as opposed to the way git is seeing it as DIR/a. How can I do this?\nImportant Note: \nUnfortunately, I can't simply git mv DIR/a dir/a because DIR/a doesn't actually exist in the working tree.\nCurrently my .git/config file shows ingorecase = true, so I know that I have to set that equal to false. However, after doing nothing but changing this flag, a git status of this now reveals:\n# On branch master\n# Changes not staged for commit:\n# (use \"git add <file>...\" to update what will be committed)\n# (use \"git checkout -- <file>...\" to discard changes in working directory)\n#\n# modified: DIR/a\n#\n # Untracked files:\n# (use \"git add <file>...\" to include in what will be committed)\n#\n# dir/\n\nI expected this since git only tracks content, and switching ignorecase would make git think a new file was added. Unfortunately, git now thinks that I have two files that are modified, when in fact I only have one. I want git status to simply show dir/a (as it is in my working directory) instead of DIR/a, with the same diffs of a I had just recently made.\nAdditional Note\nIf you are curious as to how such a precarious situation arose in the first place, I have managed to replicate the silly mistakes I had made when originally renaming the case of my directory from DIR to dir. If you think this would help in getting to a solution for this problem, I would be happy to make an edit that would reveal how I mistakenly made git so confused. (it involves me accidentally hitting mv instead of git mv, and being unaware of the ignorecase flag and leaving it as ignorecase=true)." }, { "role": "assistant", "content": "Example: if you are lower-casing Mydir\ngit mv src/Mydir src/mydirs\n\ngit mv src/mydirs src/mydir\n\ngit commit -m \"Rename folder Mydir to mydir\"" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "What does git update-server-info do?\nWhat does git update-server-info do? How do I know if I need it? The manual says:\n\nA dumb server that does not do on-the-fly pack generations must have some auxiliary information files in $GIT_DIR/info and $GIT_OBJECT_DIRECTORY/info directories to help clients discover what references and packs the server has. This command generates such auxiliary files.\n\nHow do I know if my server is dumb, and whether it does or does not do \"on-the-fly pack generations\", and whether it \"must have some auxiliary information files\"?\nI am pushing a web app via ssh to a bare repository, then pulling from that bare repository into the web root." }, { "role": "assistant", "content": "Dumb server basically means accessed over HTTP. So if you access your Git repository over http: or https: URLs, you need the update-server-info business, otherwise (git:, ssh:, etc.) you don't need it." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-switch - Switch branches --conflict=<style>" }, { "role": "assistant", "content": "The same as --merge option above, but changes the way the\nconflicting hunks are presented, overriding the merge.conflictStyle configuration variable. Possible values are\n\"merge\" (default), \"diff3\", and \"zdiff3\"." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Git push: \"fatal 'origin' does not appear to be a git repository - fatal Could not read from remote repository.\"\nI know similar questions have already been asked.\nBut, I believe my issue is due to a mistake I have previously made and therefore is different: let me explain.\nEverything was working smoothly, as I could:\n\ngit add . all the files from my local repository.\ngit commit -m \"message here\" to add messages to my commits.\ngit push origin master to upload my files to GitHub.\ngit push heroku master to upload my files to Heroku.\n\nHowever, at some point, I created a new branch locally called add-calendar-model in case next steps of the app development would go south...\n... which is exactly what happened.\nHowever, despite many attempts, I did not manage to get the initial code — i.e. the code from before I created the new branch — from the master branch to my local repository.\nSo, I decided to manually delete all the files from my local repository and git clone my master branch from GitHub.\nThis way, I got all my files back, but now, I cannot push any more to the remote repository.\nAny time I try to run git push origin add-calendar-model or git push origin master, I get the following error:\nfatal: 'origin' does not appear to be a git repository\nfatal: Could not read from remote repository.\n\nPlease make sure you have the correct access rights\nand the repository exists.\n\nI am not very comfortable with Git and GitHub, as you may have guessed by now, and I have to admit that I have no clue about how to fix this.\nAny idea?" }, { "role": "assistant", "content": "First, check that your origin is set by running\ngit remote -v\n\nThis should show you all of the push / fetch remotes for the project.\nIf this returns with no output, skip to last code block.\nVerify remote name / address\nIf this returns showing that you have remotes set, check that the name of the remote matches the remote you are using in your commands.\n$git remote -v\nmyOrigin ssh://[email protected]:1234/myRepo.git (fetch)\nmyOrigin ssh://[email protected]:1234/myRepo.git (push)\n\n# this will fail because `origin` is not set\n$git push origin main\n\n# you need to use\n$git push myOrigin main\n\nIf you want to rename the remote or change the remote's URL, you'll want to first remove the old remote, and then add the correct one.\nRemove the old remote\n$git remote remove myOrigin\n\nAdd missing remote\nYou can then add in the proper remote using\n$git remote add origin ssh://[email protected]:1234/myRepo.git\n\n# this will now work as expected\n$git push origin main" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-worktree - Manage multiple working trees --porcelain" }, { "role": "assistant", "content": "With list , output in an easy-to-parse format for scripts.\nThis format will remain stable across Git versions and regardless of user\nconfiguration. It is recommended to combine this with -z .\nSee below for details." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-apply - Apply a patch to files and/or to the index" }, { "role": "assistant", "content": "SUBMODULES If the patch contains any changes to submodules then git apply treats these changes as follows. If --index is specified (explicitly or implicitly), then the submodule\ncommits must match the index exactly for the patch to apply. If any\nof the submodules are checked-out, then these check-outs are completely\nignored, i.e., they are not required to be up to date or clean and they\nare not updated. If --index is not specified, then the submodule commits in the patch\nare ignored and only the absence or presence of the corresponding\nsubdirectory is checked and (if possible) updated." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-log - Show commit logs --show-pulls" }, { "role": "assistant", "content": "Include all commits from the default mode, but also any merge\ncommits that are not TREESAME to the first parent but are\nTREESAME to a later parent. This mode is helpful for showing\nthe merge commits that \"first introduced\" a change to a branch." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-log - Show commit logs --full-history with parent rewriting" }, { "role": "assistant", "content": "Ordinary commits are only included if they are !TREESAME\n(though this can be changed, see --sparse below). Merges are always included. However, their parent list is rewritten:\nAlong each parent, prune away commits that are not included\nthemselves. This results in .-A---M---N---O---P---Q\n\t / / / / /\n\tI B / D /\n\t \\ / / / /\n\t `-------------' Compare to --full-history without rewriting above. Note that E was pruned away because it is TREESAME, but the parent list of P was\nrewritten to contain E 's parent I . The same happened for C and N , and X , Y and Q ." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-rev-list - Lists commit objects in reverse chronological order %(trailers[:<options>])" }, { "role": "assistant", "content": "display the trailers of the body as interpreted by git-interpret-trailers . The trailers string may be followed by\na colon and zero or more comma-separated options. If any option is provided\nmultiple times, the last occurrence wins. key=<key> : only show trailers with specified <key>. Matching is done\ncase-insensitively and trailing colon is optional. If option is\ngiven multiple times trailer lines matching any of the keys are\nshown. This option automatically enables the only option so that\nnon-trailer lines in the trailer block are hidden. If that is not\ndesired it can be disabled with only=false . E.g., %(trailers:key=Reviewed-by) shows trailer lines with key Reviewed-by . only[=<bool>] : select whether non-trailer lines from the trailer\nblock should be included. separator=<sep> : specify the separator inserted between trailer\nlines. Defaults to a line feed character. The string <sep> may contain\nthe literal formatting codes described above. To use comma as\nseparator one must use %x2C as it would otherwise be parsed as\nnext option. E.g., %(trailers:key=Ticket,separator=%x2C ) shows all trailer lines whose key is \"Ticket\" separated by a comma\nand a space. unfold[=<bool>] : make it behave as if interpret-trailer’s --unfold option was given. E.g., %(trailers:only,unfold=true) unfolds and shows all trailer lines. keyonly[=<bool>] : only show the key part of the trailer. valueonly[=<bool>] : only show the value part of the trailer. key_value_separator=<sep> : specify the separator inserted between\nthe key and value of each trailer. Defaults to \": \". Otherwise it\nshares the same semantics as separator=<sep> above." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How does github figure out a project's language?\n\nI was recently working on a github project in both JavaScript and C++, and noticed that github tagged the project as C++. If you have to pick a single language, this is probably the correct designation since the C++ code is compiled as a JavaScript library, but this made me wonder... how does github figure out what language to tag each project?" }, { "role": "assistant", "content": "Update April 2013, by nuclearsandwich (GitHub support team or \"supportocat\"):\n\nthe help page \"My repository is marked as the wrong language\" mentions using now the linguist library to determine file language for syntax highlighting and repo statistics. Linguist will exclude certain file names and paths from statistic, excluding certain vendor files and directories.\n\nthe help page \"Why isn't my favorite language recognized?\" adds:\n\n\n\nIf your desired language is not receiving syntax highlighting you can contribute to the Linguist library to add it.\n\n\n(Original answer, Oct. 2012)\nThis thread on GitHub support explains it:\n\nIt just sums up file sizes for each extension. Largest one \"wins\".\nWe'd like to avoid opening files up and parsing their content, as both would slow down the process... but that might be the only method of resolving conflicts like this one.\n\nSince this is not 100% accurate, that had lead some to add:\n\nI, too, would vote for a simple manual-override switch for the cases where the guess is wrong.\n\n\nNote: as Mark Rushakoff mentions in his answer (upvoted), the guessing got better since then with the linguist project (open-sourced from June 2011).\nYou can see there are still issues though: GitHub Linguist Issues.\nSee here for more details:\n\nOnce the language has been detected, it is passed to Albino, a Pygments wrapper, which does the actual syntax highlighting.\n\nAnd you can add linguist directives in a .gitattributes file." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-switch - Switch branches --no-track" }, { "role": "assistant", "content": "Do not set up \"upstream\" configuration, even if the branch.autoSetupMerge configuration variable is true." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "GitLab CI/CD: Run jobs only when files in a specific directory have changed\n\nI would like to run specific jobs on the .gitlab-ci.yaml if and only if files within specific directories of the repository have changed. Is there a way to do this with gilab's ci/cd tooling or would it be easier just to run a custom build script?" }, { "role": "assistant", "content": "Changes policy introduced in GitLab 11.4.\nFor example:\ndocker build:\n script: docker build -t my-image:$CI_COMMIT_REF_SLUG .\n only:\n changes:\n - Dockerfile\n - docker/scripts/*\n - dockerfiles/**/*\n - more_scripts/*.{rb,py,sh}\n\nIn the scenario above, if you are pushing multiple commits to GitLab to an existing branch, GitLab creates and triggers the docker build job, provided that one of the commits contains changes to either:\n\nThe Dockerfile file.\nAny of the files inside docker/scripts/ directory.\nAny of the files and subdirectories inside the dockerfiles directory.\nAny of the files with rb, py, sh extensions inside the more_scripts directory.\n\nYou can read more in the documentation and with some more examples." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "What's the difference between \"git add -u\" and \"git add -A\"?\nOkay, so I was searching \"How to Remove Manually Deleted files from Git\" without actually doing git rm file.txt for each file when I came across \"Removing multiple files from a Git repo that have already been deleted from disk\".\nThe two most Up-Voted commands were:\n\ngit add -u\ngit add -A\n\nAlthough both of them worked for me, I still can't understand the difference and the solutions on the page don't explain it either. My questions are, how are they differ from each other, and what other git commands can be used to remove files that have been deleted manually from the disk?" }, { "role": "assistant", "content": "Brief Answer:\ngit add -A is equal to git add . + git add -u\n\nExplanation:\nWhen you do a \"git add .\", it adds all files (existing, modified and new) to the staging area but it does not remove files that have been deleted from the disk.\n\"git add -u\" only adds currently tracked files (which have been modified) to the staging area and also checks if they have been deleted (if yes, they are removed from staging area). This means that it does not stage new files.\nDoing \"git add -A\" performs both of these steps, that is, stages your entire directory as it is.\n\nSummary:\n\ngit add -A : Stages Everything\ngit add -u : Stages only Modified Files\ngit add . : Stages everything, without Deleted Files\n\nRead the Documentation for more." } ]