messages
listlengths
3
3
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Using GitLab token to clone without authentication\nI want to clone GitLab repository without prompt for my automation script, by using my private token from my GitLab account.\nCan someone provide me a sample?\nI know I can do so with user and password:\ngit clone https://\" + user + \":\" + password + \"@\" + gitlaburl;\n\nand I know it is possible with ssh key\nBut, both options are insufficient." }, { "role": "assistant", "content": "This is how you do it:\ngit clone https://oauth2:[email protected]/vendor/package.git" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-log - Show commit logs --line-prefix=<prefix>" }, { "role": "assistant", "content": "Prepend an additional prefix to every line of output." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git - the stupid content tracker GIT_PROTOCOL" }, { "role": "assistant", "content": "For internal use only. Used in handshaking the wire protocol.\nContains a colon : separated list of keys with optional values <key>[=<value>] . Presence of unknown keys and values must be\nignored. Note that servers may need to be configured to allow this variable to\npass over some transports. It will be propagated automatically when\naccessing local repositories (i.e., file:// or a filesystem path), as\nwell as over the git:// protocol. For git-over-http, it should work\nautomatically in most configurations, but see the discussion in git-http-backend . For git-over-ssh, the ssh server may need\nto be configured to allow clients to pass this variable (e.g., by using AcceptEnv GIT_PROTOCOL with OpenSSH). This configuration is optional. If the variable is not propagated, then\nclients will fall back to the original \"v0\" protocol (but may miss out\non some performance improvements or features). This variable currently\nonly affects clones and fetches; it is not yet used for pushes (but may\nbe in the future)." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git ignore all files of a certain type, except those in a specific subfolder\nI have a directory structure like this:\n\nroot\n\nfolder1\n\nabc.json\ndef.json\nsomedir\n\nmore.json\n\n\n\n\nfolder2\n\nqwe.json\nrty.json\n\n\nspec\n\nmock1.json\nmock2.json\nsomedir\n\nmore_mocks.json\n\n\n\n\n\n\n\nNow using a .gitignore I want to ignore all *.json files except for the ones in the spec. I don't want to use a .gitignore in folder1 and folder2 because there are a ton of these and they will get added to a lot, and I'm sure I will forget to move the right .gitignore file in place.\nIn addition, there may be more nested directories with JSON files, and this rule needs to apply to all subdirectories as well.\nSo how do I ignore all files of a type, except for a certain subdirectory?" }, { "role": "assistant", "content": "An optional prefix ! which negates the\npattern; any matching file excluded by\na previous pattern will become\nincluded again. If a negated pattern\nmatches, this will override lower\nprecedence patterns sources.\n\nhttps://git-scm.com/docs/gitignore\n*.json\n!spec/*.json" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-revert - Revert some existing commits -e --edit" }, { "role": "assistant", "content": "With this option, git revert will let you edit the commit\nmessage prior to committing the revert. This is the default if\nyou run the command from a terminal." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-cherry-pick - Apply the changes introduced by some existing commits --quit" }, { "role": "assistant", "content": "Forget about the current operation in progress. Can be used\nto clear the sequencer state after a failed cherry-pick or\nrevert." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git - the stupid content tracker GIT_ICASE_PATHSPECS" }, { "role": "assistant", "content": "Setting this Boolean environment variable to true will cause Git to treat all\npathspecs as case-insensitive." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-show - Show various types of objects %(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": "git-diff-index - Compare a tree to the working tree or index zebra" }, { "role": "assistant", "content": "Blocks of moved text are detected as in blocks mode. The blocks\nare painted using either the color.diff.{old,new}Moved color or color.diff.{old,new}MovedAlternative . The change between\nthe two colors indicates that a new block was detected." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Moving a git repository up one hierarchy level\nGit beginner question:\nI have a small private webproject which is versioned locally with msysgit. There is no exterior repository, as it's only for me, so i can bascially do whatever I want.\nI've had this set up in the project directory, ie in \"webroot\".\nNow a second directory had to be created, placed parallel to webroot. Let's call it assets.\nSo structure is now as follows:\n\\ project directory\n----\\webroot\n----\\assets\n\nI'd love to include this new directory in the git repository, so that I'd also version changes to files stored there, but of course I can't use \"git add ../assets\". Neither am I inclined to create a new git project in project_directory, as this would loose all my previous commits.\nSo how do I go about moving the repository out of \"webroot\" up into \"project_directory\", while keeping my commits and then being able to include \"assets\"?" }, { "role": "assistant", "content": "So, you want your git repo to look like this:\n<projectdir>\n /.git\n /webroot\n /assets\n\nTo do this, you must move the existing files in your repo into a new webroot subdirectory.\ncd <git repo root>\nmkdir webroot\ngit mv <all your files> webroot\ngit commit --all -m \"moved all existing files to new 'webroot' directory\"\n\nThen, on your local filesystem you want to relocate your clone one directory above where it is now:\ncd <projectdir>\nmv webroot/* .\nrmdir webroot\n\nThen you want to add the assets directory (and files) to the git repo:\ngit add assets\ngit commit -m \"added assets to the repo\"" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-config - Get and set repository or global options http.sslCertPasswordProtected" }, { "role": "assistant", "content": "Enable Git’s password prompt for the SSL certificate. Otherwise\nOpenSSL will prompt the user, possibly many times, if the\ncertificate or private key is encrypted. Can be overridden by the GIT_SSL_CERT_PASSWORD_PROTECTED environment variable." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-log - Show commit logs --exclude-first-parent-only" }, { "role": "assistant", "content": "When finding commits to exclude (with a ^ ), follow only\nthe first parent commit upon seeing a merge commit.\nThis can be used to find the set of changes in a topic branch\nfrom the point where it diverged from the remote branch, given\nthat arbitrary merges can be valid topic branch changes." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Git remote branch deleted, but still it appears in 'branch -a'\nLet's say I had a branch named coolbranch in my repository.\nNow, I decided to delete it (both remotely and locally) with:\ngit push origin :coolbranch\ngit branch -D coolbranch\n\nGreat!\nNow the branch is really deleted.\nBut when I run\ngit branch -a\n\nI still get:\nremotes/origin/coolbranch\n\nSomething to notice, is that when I clone a new repository, everything is fine and git branch -a doesn't show the branch.\nI want to know - is there a way to delete the branch from the branch -a list without cloning a new instance?" }, { "role": "assistant", "content": "git remote prune origin will remove all such stale branches. That's probably what you'd want in most cases, but if you want to just remove that particular remote-tracking branch, you should do:\ngit branch -d -r origin/coolbranch\n\n(The -r is easy to forget...)\n-r in this case will \"List or delete (if used with -d) the remote-tracking branches.\" according to the Git documentation found here: https://git-scm.com/docs/git-branch" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Can I make 'git diff' only display the line numbers AND changed file names?\nThis question calls for \"line numbers\". If you do not care about line numbers in the output, see this question and answer.\n\nBasically, I don't want to see the changed content, just the file names and line numbers." }, { "role": "assistant", "content": "You can use this command to see the changed file names, but not with line numbers:\ngit diff --name-only\n\nGo forth and diff!" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Unable to connect to git remote repository\n\nAfter performing git push -u origin master, I got:\nfatal: unable to access 'https://github.com/xxxx/xxxx.git': Failed to connect to 127.0.0.1 port 8087: Connection refused\n\nSame error occurred, when I tried to clone other repositories, too.\nThe Port 8087 doesn't seem to be busy. What could go wrong?\nEdit:\nwhen I do clone from git:// instead of https://, it works just fine." }, { "role": "assistant", "content": "This happens because a proxy is configured in git.\nSince it's https proxy (and not http) git config http.proxy and git config --global http.proxy can't help.\n\nTake a look at your git configuration\ngit config --global -l\n\nIf you have nothing related to https proxy like https_proxy=... the problem is not here.\nIf you have something related to https proxy then remove it from the file ~/.gitconfig and try again\n\nIf it still doesn't work, unset environment variables\nCheck your environment variables :\nenv|grep -i proxy \n\nYou should have one or several lines with https_proxy=...\nUnset one by one with :\nunset https_proxy (or HTTPS_PROXY depending of the name of the variable)\n\nCheck environment variables again\nenv|grep -i proxy\n\nIf it shows nothing you should be good.\nNote: This solution can applies to http and https proxy problems. just the variables name changes from https to http" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-rebase - Reapply commits on top of another base tip --reapply-cherry-picks --no-reapply-cherry-picks" }, { "role": "assistant", "content": "Reapply all clean cherry-picks of any upstream commit instead\nof preemptively dropping them. (If these commits then become\nempty after rebasing, because they contain a subset of already\nupstream changes, the behavior towards them is controlled by\nthe --empty flag.) In the absence of --keep-base (or if --no-reapply-cherry-picks is\ngiven), these commits will be automatically dropped. Because this\nnecessitates reading all upstream commits, this can be expensive in\nrepositories with a large number of upstream commits that need to be\nread. When using the merge backend, warnings will be issued for each\ndropped commit (unless --quiet is given). Advice will also be issued\nunless advice.skippedCherryPicks is set to false (see git-config ). --reapply-cherry-picks allows rebase to forgo reading all upstream\ncommits, potentially improving performance. See also INCOMPATIBLE OPTIONS below." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-send-email - Send a collection of patches as emails --transfer-encoding=(7bit|8bit|quoted-printable|base64|auto)" }, { "role": "assistant", "content": "Specify the transfer encoding to be used to send the message over SMTP.\n7bit will fail upon encountering a non-ASCII message. quoted-printable\ncan be useful when the repository contains files that contain carriage\nreturns, but makes the raw patch email file (as saved from a MUA) much\nharder to inspect manually. base64 is even more fool proof, but also\neven more opaque. auto will use 8bit when possible, and quoted-printable\notherwise. Default is the value of the sendemail.transferEncoding configuration\nvalue; if that is unspecified, default to auto ." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-rev-list - Lists commit objects in reverse chronological order --date-order" }, { "role": "assistant", "content": "Show no parents before all of its children are shown, but\notherwise show commits in the commit timestamp order." } ]
[ { "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 -M[<num>]" }, { "role": "assistant", "content": "Detect moved or copied lines within a file. When a commit\nmoves or copies a block of lines (e.g. the original file\nhas A and then B, and the commit changes it to B and then\nA), the traditional blame algorithm notices only half of\nthe movement and typically blames the lines that were moved\nup (i.e. B) to the parent and assigns blame to the lines that\nwere moved down (i.e. A) to the child commit. With this\noption, both groups of lines are blamed on the parent by\nrunning extra passes of inspection. <num> is optional but it is the lower bound on the number of\nalphanumeric characters that Git must detect as moving/copying\nwithin a file for it to associate those lines with the parent\ncommit. The default value is 20." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-format-patch - Prepare patches for e-mail submission -W --function-context" }, { "role": "assistant", "content": "Show whole function as context lines for each change.\nThe function names are determined in the same way as git diff works out patch hunk headers (see Defining a\ncustom hunk-header in gitattributes )." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "fatal: could not open '.git/COMMIT_EDITMSG': Permission denied\n\nI am trying to deploy octopress on github pages. I followed these instructions:\nhttp://octopress.org/docs/deploying/github/\nIt all worked well until the commit part, where I get error:\n\nfatal: could not open '.git/COMMIT_EDITMSG': Permission denied\n\nI am the owner of my github.io page, of course, and I never had this issue before. Why is this happening, and more importantly how do I resolve it?" }, { "role": "assistant", "content": "I solved it by deleting .git/COMMIT_EDITMSG. Weird, I know." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Using Git with an existing Xcode project\nI am trying to figure out how to use git in my project workflow, and I have an existing Xcode project that I want to put into the repository. I think I have the repository set up correctly under organizer, but the Source Control menu is grayed out.\nApparently, it's easy to do if you start a new project, but how do I import an existing project with snapshots and everything?\nI'm using Xcode 4 and git 1.7.4\nAlso, if there are any good walkthroughs on git configuration and best practices, that would be nice. I'm a little late to the game, so anything that can get me up to speed would be cool." }, { "role": "assistant", "content": "GitHub has some very good git tutorials at help.github.com.\nto do the initial setup of a repository, open up a terminal window, and CD to the project directory. once there, type \ngit init\ngit add .\ngit commit -m \"Initial commit\"\n\nRestart Xcode. \nThe repository should now be set up, and you will be able to manage it in xcode 4." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-fetch - Download objects and refs from another repository -P --prune-tags" }, { "role": "assistant", "content": "Before fetching, remove any local tags that no longer exist on\nthe remote if --prune is enabled. This option should be used\nmore carefully, unlike --prune it will remove any local\nreferences (local tags) that have been created. This option is\na shorthand for providing the explicit tag refspec along with --prune , see the discussion about that in its documentation. See the PRUNING section below for more details." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git switch branch without discarding local changes\nAlright, lets say one day we make happen to make a bunch of modifications and when we go to commit them we notice we were working on the wrong branch.\nHow can we force git to switch branches without discarding local changes.\nI'm probably going to go about this in a naive way while I wait a reply, but I would like to know if theres a correct procedure as I'd be lying if I said this hasn't happened to me before...\n\nBackup changed repo\ngit reset --hard\ngit checkout right-branch\nRestore changes\ngit commit -m \"changes\"" }, { "role": "assistant", "content": "There are a bunch of different ways depending on how far along you are and which branch(es) you want them on.\nLet's take a classic mistake:\n$ git checkout master\n... pause for coffee, etc ...\n... return, edit a bunch of stuff, then: oops, wanted to be on develop\n\nSo now you want these changes, which you have not yet committed to master, to be on develop.\n\nIf you don't have a develop yet, the method is trivial:\n$ git checkout -b develop\n\nThis creates a new develop branch starting from wherever you are\nnow. Now you can commit and the new stuff is all on develop.\nYou do have a develop. See if Git will let you switch without\ndoing anything:\n$ git checkout develop\n\nThis will either succeed, or complain. If it succeeds, great! Just\ncommit. If not (error: Your local changes to the following files would be overwritten ...), you still have lots of options.\nThe easiest is probably git stash (as all the other answer-ers\nthat beat me to clicking post said). Run git stash save or git stash push,1 or just plain git stash which is short for save / push:\n$ git stash\n\nThis commits your code (yes, it really does make some commits) using\na weird non-branch-y method. The commits it makes are not \"on\" any\nbranch but are now safely stored in the repository, so you can now\nswitch branches, then \"apply\" the stash:\n$ git checkout develop\nSwitched to branch 'develop'\n$ git stash apply\n\nIf all goes well, and you like the results, you should then git stash drop the stash. This deletes the reference to the weird non-branch-y commits. (They're still in the repository, and can sometimes be retrieved in an emergency, but for most purposes, you should consider them gone at that point.)\n\nThe apply step does a merge of the stashed changes, using Git's powerful underlying merge machinery, the same kind of thing it uses when you do branch merges. This means you can get \"merge conflicts\" if the branch you were working on by mistake, is sufficiently different from the branch you meant to be working on. So it's a good idea to inspect the results carefully before you assume that the stash applied cleanly, even if Git itself did not detect any merge conflicts.\nMany people use git stash pop, which is short-hand for git stash apply && git stash drop. That's fine as far as it goes, but it means that if the application results in a mess, and you decide you don't want to proceed down this path, you can't get the stash back easily. That's why I recommend separate apply, inspect results, drop only if/when satisfied. (This does of course introduce another point where you can take another coffee break and forget what you were doing, come back, and do the wrong thing, so it's not a perfect cure.)\n\n1The save in git stash save is the old verb for creating a new stash. Git version 2.13 introduced the new verb to make things more consistent with pop and to add more options to the creation command. Git version 2.16 formally deprecated the old verb (though it still works in Git 2.23, which is the latest release at the time I am editing this)." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-symbolic-ref - Read, modify and delete symbolic refs --short" }, { "role": "assistant", "content": "When showing the value of <name> as a symbolic ref, try to shorten the\nvalue, e.g. from refs/heads/master to master ." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How can I create a table on gitlab wiki?\n\nHow can one create a table on gitlab wiki?\nIt uses github flavored markdown, and this flavor of markdown support tables but I can't make the following example work:\nColons can be used to align columns.\n| Tables | Are | Cool |\n| ------------- |:-------------:| -----:|\n| col 3 is | right-aligned | $1600 |\n| col 2 is | centered | $12 |\n| zebra stripes | are neat | $1 |\n\nThe outer pipes (|) are optional, and you don't need to make the raw Markdown line up prettily. You can also use inline Markdown.\n\nMarkdown | Less | Pretty\n--- | --- | ---\n*Still* | `renders` | **nicely**\n1 | 2 | 3\n\nIs there a trick to activate tables?" }, { "role": "assistant", "content": "Update: See GitLab 14.1 (July 2021)\n\nCreate tables and upload images in the Wiki Content Editor\nCreate tables and upload images in the Wiki Content Editor\nWe began improving your wiki editing experience in GitLab 14.0, when we introduced the MVC of a new WYSIWYG Markdown editor.\nIt supported the most common Markdown formatting options, but with some notable gaps.\nGitLab 14.1 continues to improve your editing experience for images and tables.\nYou can now upload images directly into the editor. You can also insert and edit tables, including copying and pasting content from popular spreadsheet applications to bring tables from other sources into your wiki. ​\n\nSee Documentation and Issue.\n\nAnd:\nSee GitLab 14.3 (September 2021)\n\nEdit a table’s structure visually in the new wiki editor\nEdit a table’s structure visually in the new wiki editor\nEditing a Markdown table that has 9 columns and 25 rows is one thing.\nBut adding a tenth column to that table in Markdown?\nThat involves very repetitive and error-prone edits to every row. One mistake or misplaced | and the table fails to render.\nThe new WYSIWYG Markdown editor in the wiki lets you quickly and easily insert a table using the button in the toolbar.\nAfter selecting the initial number of rows and columns, however, dealing with the structure of the table can be more difficult.\nIn GitLab 14.3, you can now click on the caret icon in the top right corner of any selected cell to add or remove columns and rows, either before or after the selected cell.\nNow, as your content scales, the complexity doesn’t follow suit.\n\nSee Documentation and Issue.\n\n\nSee GitLab 14.5 (November 2021)\n\nTables in wikis support block-level elements\nGitLab 14.1 introduced WYSIWYG editing for tables in the new wiki editor, but the types of content supported in table cells were limited by the underlying Markdown implementation: you couldn’t add block-level elements like lists, code blocks, or pull quotes inside a table.\nNow, in GitLab 14.5, these block-level elements are fully supported inside table cells.\nYou can insert lists, code blocks, paragraphs, headings, and even nested tables inside a table cell, giving you more flexibility and freedom to format your content to meet your needs.\n\nSee Documentation and Issue.\n\n\nOriginal answer: 2013:\nIt seems to be still the case, as described in Issue 3651 and issue 1238, even though Flavored Markdown is supported:\nThis wouldn't work:\n| parameters | desc |\n| :--------- | :------------------- |\n| -w | --word | Parameter for Word |\n\nSo contributions are welcome on this specific bug.\nHowever, AJNeufeld suggest (in 2016) in the comments:\n\nYou need to use the &#124; entity code to get the vertical pipe between \"-w\" and \"--word\", so it appears as \"-w | --word\" in the rendered table.\nIe, the full line should be:\n\n| -w &#124; --word | Parameter for Word |" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Remove all git files from a directory?\nI have a folder under version control. I want to make a copy of it to send around, but don't want to include all the .git directories and the files underneath it. \nIs there a way to remove all the git files instead of manually deleting all of them?" }, { "role": "assistant", "content": "How to remove all .git directories under a folder in Linux.\nRun this find command, it will list all .git directories under the current folder:\nfind . -type d -name \".git\" \\\n&& find . -name \".gitignore\" \\\n&& find . -name \".gitmodules\"\n\nPrints:\n./.git\n./.gitmodules\n./foobar/.git\n./footbar2/.git\n./footbar2/.gitignore\n\nThere should only be like 3 or 4 .git directories because git only has one .git folder for every project. You can rm -rf yourpath each of the above by hand. \nIf you feel like removing them all in one command and living dangerously:\n//Retrieve all the files named \".git\" and pump them into 'rm -rf'\n//WARNING if you don't understand why/how this command works, DO NOT run it!\n\n( find . -type d -name \".git\" \\\n && find . -name \".gitignore\" \\\n && find . -name \".gitmodules\" ) | xargs rm -rf\n\n//WARNING, if you accidentally pipe a `.` or `/` or other wildcard\n//into xargs rm -rf, then the next question you will have is: \"why is\n//the bash ls command not found? Requiring an OS reinstall." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to stop tracking and ignore changes to a file in Git?\nI have cloned a project that includes some .csproj files. I don't need/like my local csproj files being tracked by Git (or being brought up when creating a patch), but clearly they are needed in the project.\nI have added *.csproj to my LOCAL .gitignore, but the files are already in the repo.\nWhen I type git status, it shows my changes to csproj which I am not interested in keeping track of or submitting for patches.\nHow do I remove the \"tracking of\" these files from my personal repo (but keep them in the source so I can use them) so that I don't see the changes when I do a status (or create a patch)?\nIs there a correct/canonical way to handle this situation?" }, { "role": "assistant", "content": "Just calling git rm --cached on each of the files you want to remove from revision control should be fine. As long as your local ignore patterns are correct you won't see these files included in the output of git status.\nNote that this solution removes the files from the repository, so all developers would need to maintain their own local (non-revision controlled) copies of the file\nTo prevent git from detecting changes in these files you should also use this command:\ngit update-index --assume-unchanged [path]\n\nWhat you probably want to do: (from below @Ryan Taylor answer)\n\n\nThis is to tell git you want your own independent version of the file or folder. For instance, you don't want to overwrite (or delete)\n production/staging config files.\n\ngit update-index --skip-worktree <path-name>\n\nThe full answer is here in this URL: http://source.kohlerville.com/2009/02/untrack-files-in-git/" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Disable auto-completion of remote branches in Git Bash?\nI'm working on a fairly large git repo with a couple of thousand (remote) branches. I am used to using auto-completion (using [TAB]) in the console (Git Bash in that case), so I unconsciously do that for git commands, too.\ne.g. I'd type\ngit checkout task[TAB]\n\nwith the effect that the console stalls for often minutes. Is there a way to limit auto-completion to local branches only?" }, { "role": "assistant", "content": "With Git 2.13 (Q2 2017), you can disable (some of) the branch completion.\ngit checkout --no-guess ...\n# or:\nexport GIT_COMPLETION_CHECKOUT_NO_GUESS=1\n\nSee commit 60e71bb (21 Apr 2017) by Jeff King (peff).\n(Merged by Junio C Hamano -- gitster -- in commit b439747, 01 May 2017) \nAs documented in contrib/completion/git-completion.bash now:\n\nYou can set the following environment variables to influence the behavior of the completion routines:\nGIT_COMPLETION_CHECKOUT_NO_GUESS\n\nWhen set to \"1\", do not include \"DWIM\" suggestions in git-checkout\n completion (e.g., completing \"foo\" when \"origin/foo\" exists).\n\nNote: DWIM is short for Do What I Mean, where a system attempts to anticipate what users intend to do, correcting trivial errors automatically rather than blindly executing users' explicit but potentially incorrect inputs.\n\ncompletion: optionally disable checkout DWIM\nWhen we complete branch names for \"git checkout\", we also complete remote branch names that could trigger the DWIM behavior. Depending on your workflow and project, this can be either convenient or annoying.\nFor instance, my clone of gitster.git contains 74 local \"jk/*\" branches, but origin contains another 147.\n When I want to checkout a local branch but can't quite remember the name, tab completion shows me 251 entries. And worse, for a topic that has been picked up for pu, the upstream branch name is likely to be similar to mine, leading to a high probability that I pick the wrong one and accidentally create a new branch.\n\n\nNote: \"picked up for pu\": see a What's cooking in git.git: it starts with:\n\nCommits prefixed with '-' are only in 'pu' (proposed updates) while commits prefixed with '+' are in 'next'. \n\nThis is part of the Git Workflow Graduation process.\n\npu (proposed updates) is an integration branch for things that are not quite ready for inclusion yet \n\n\n\nThis patch adds a way for the user to tell the completion\n code not to include DWIM suggestions for checkout.\n This can already be done by typing:\ngit checkout --no-guess jk/<TAB>\n\nbut that's rather cumbersome. \nThe downside, of course, is that you no longer get completion support when you do want to invoke the DWIM behavior.\n But depending on your workflow, that may not be a big loss (for instance, in git.git I am much more likely to want to detach, so I'd type \"git checkout origin/jk/<TAB>\" anyway)." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Can a local Git clone be considered a complete backup of the repo it was cloned from?\nSuppose I have cloned a Git repository to my local disk using:\ngit clone [email protected]:someproject.git\n\nNow suppose that git.example.com is not being backed up, and it goes down in a blaze of glory. Does my clone contain everything necessary to rebuild the remote repo that was lost? The Ultimate Backups section of Git Magic suggests that the answer is \"yes,\" but it isn't clear to me.\nNote that I'm not asking \"is my local clone a sufficient backup of the master branch?\" I'm asking whether my local clone can be considered a complete backup of everything that was contained in the remote repo; all branches, all tags, everything. For example, what about remote branches that aren't tracked in the local repo?\nTo futher confuse the issue, the existence of git clone --mirror suggests to me that my local clone should not be considered a complete backup of the remote repo." }, { "role": "assistant", "content": "A clone can be considered a full backup of all the data in your remote repository, but not necessarily the meta-data (that's where the --mirror switch comes in). Your clone will contain all the commit, tree, blob, branch, and tag objects that are in any way referenced by the repository. That means your backup will contain all your source code, history, and associated branches or tags.\nThe difference with the --mirror switch is that without it, the clone won't include things like remotes that have been created on the server. These are not important in a \"I hope I haven't lost any source!\" kind of way, but they may be for getting your server back up and running like it was.\nIf you're interested in creating a backup that can be restored onto the server like there was never any issue, then you should use --mirror, but for most scenarios a simple clone is fine." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to git fetch efficiently from a shallow clone\nWe use git to distribute an operating system and keep it upto date. We can't distribute the full repository since it's too large (>2GB), so we have been using shallow clones (~300M). However recently when fetching from a shallow clone, it's now inefficiently fetches the entire >2GB repository. This is an untenable waste of bandwidth for deployments.\nThe git documentation says you cannot fetch from a shallow repository, though that's strictly not true. Are there any workarounds to make a git clone --depth 1 able to fetch just what's changed from it? Or some other strategy to keep the distribution size as small as possible whilst having all the bits git needs to do an update?\nI have unsuccessfully tried cloning from --depth 20 to see if it will upgrade more efficiently, that didn't work. I did also look into http://git-scm.com/docs/git-bundle, but that seems to create huge bundles." }, { "role": "assistant", "content": "--depth is a git fetch option. I see the doc doesn't really highlight that git clone does a fetch. \nWhen you fetch, the two repos swap info on who has what by starting from the remote's heads and searching backward for the most recent shared commit in the fetched refs' histories, then filling in all the missing objects to complete just the new commits between the most recent shared commits and the newly fetched ones.\nA --depth=1 fetch just gets the branch tips and no prior history. Further fetches of those histories will fetch everything new by the above procedure, but if the previously-fetched commits aren't in the newly fetched history, fetch will retrieve all of it -- unless you limit the fetch with --depth.\nYour client did a depth=1 fetch from one repo and switched urls to a different repo. At least one long ancestry path in this new repo's refs apparently shares no commits with anything currently in your repo. That might be worth investigating, but either way unless there's some particular reason, your clients can just do every fetch --depth=1." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Git: How to remove proxy\nI am trying to push to my repo but receiving an error:\nfatal: unable to access 'https://github.com/myrepo.git/': Could not resolve proxy: --list \n\nI already changed the proxy settings :\ngit config --global --unset http.proxy \n\nmy global config settings are:\npush.default=simple\nhttp.sslverify=false\nurl.https://.insteadof=git://\ncredential.helper=cache --timeout=3600\n\nBut still getting this error? How can I solve this?" }, { "role": "assistant", "content": "Check your enviroment:\necho $http_proxy\necho $https_proxy\necho $HTTPS_PROXY\necho $HTTP_PROXY\n\nand delete with export http_proxy=\nCheck your git config files for a proxy:\ngit config -l --show-origin | grep \"proxy\"\n\nYou can unset a global proxy <user_directory>/.gitconfig:\ngit config --global --unset https.proxy\ngit config --global --unset http.proxy\n\nOr a proxy from the local config .git/config:\ngit config --unset http.proxy\ngit config --unset https.proxy\n\nIt is also possible that the proxy is from a system config file." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-rebase - Reapply commits on top of another base tip -x <cmd> --exec <cmd>" }, { "role": "assistant", "content": "Append \"exec <cmd>\" after each line creating a commit in the\nfinal history. <cmd> will be interpreted as one or more shell\ncommands. Any command that fails will interrupt the rebase,\nwith exit code 1. You may execute several commands by either using one instance of --exec with several commands: git rebase -i --exec \"cmd1 && cmd2 && ...\" or by giving more than one --exec : git rebase -i --exec \"cmd1\" --exec \"cmd2\" --exec ... If --autosquash is used, exec lines will not be appended for\nthe intermediate commits, and will only appear at the end of each\nsquash/fixup series. This uses the --interactive machinery internally, but it can be run\nwithout an explicit --interactive . See also INCOMPATIBLE OPTIONS below." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-archive - Create an archive of files from a named tree --mtime=<time>" }, { "role": "assistant", "content": "Set modification time of archive entries. Without this option\nthe committer time is used if <tree-ish> is a commit or tag,\nand the current time if it is a tree." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Continue looping over submodules with the \"git submodule foreach\" command after a non-zero exit\nI have a project that contains many submodules. I want to loop over each submodule with the following command:\ngit submodule foreach npm install\nAnd I want the script to continue looping over each submodule even if one submodule returns an error (non zero return code). Currently, a non-zero return code from running this command in any submodule will cause git to stop looping over the remaining submodules.\nAny recommendations on how to accomplish this?" }, { "role": "assistant", "content": "Just make your command always return a 0 code like so:\ngit submodule foreach 'npm install || :'\n\nThis is taken from the manual: git help submodule:\n\n foreach\n Evaluates an arbitrary shell command in each checked out submodule.\n The command has access to the variables $name, $path, $sha1 and\n $toplevel: $name is the name of the relevant submodule section in\n .gitmodules, $path is the name of the submodule directory relative\n to the superproject, $sha1 is the commit as recorded in the\n superproject, and $toplevel is the absolute path to the top-level\n of the superproject. Any submodules defined in the superproject but\n not checked out are ignored by this command. Unless given --quiet,\n foreach prints the name of each submodule before evaluating the\n command. If --recursive is given, submodules are traversed\n recursively (i.e. the given shell command is evaluated in nested\n submodules as well). A non-zero return from the command in any\n submodule causes the processing to terminate. This can be\n overridden by adding || : to the end of the command.\n\n As an example, git submodule foreach 'echo $path `git rev-parse\n HEAD`' will show the path and currently checked out commit for each\n submodule.\n\nThe command : from help : in bash:\n:: :\n Null command.\n\n No effect; the command does nothing.\n\n Exit Status:\n Always succeeds.\n\nAlways succeeds :)" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git - the stupid content tracker git-stash" }, { "role": "assistant", "content": "Stash the changes in a dirty working directory away" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to delete all Git remote branches except master?\n\nLooking for a command to delete all branches on Git repository except for master and push them to remote.\nThis is to clean up Git repository before making a release as the previous history branches everything else are totally dev changes and doesn't matter." }, { "role": "assistant", "content": "This will remove all branches (except for master), even if the branch has a slash '/' in it:\ngit branch -r | grep 'origin' | grep -v 'master$' | grep -v HEAD | cut -d/ -f2- | while read line; do git push origin :heads/$line; done;\n\nThis will do the same, leaving both develop and master branches alone:\ngit branch -r | grep 'origin' | grep -v 'master$' | grep -v 'develop$' | grep -v HEAD | cut -d/ -f2- | while read line; do git push origin :heads/$line; done;\n\nThis is the script for fish shell:\ngit branch -r | grep 'origin' | grep -v 'master$' | grep -v 'develop$' | grep -v HEAD | cut -d/ -f2- | while read line; git push origin :heads/$line; end;" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-fast-import - Backend for fast Git data importers --stats" }, { "role": "assistant", "content": "Display some basic statistics about the objects fast-import has\ncreated, the packfiles they were stored into, and the\nmemory used by fast-import during this run. Showing this output\nis currently the default, but can be disabled with --quiet." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "GitLab Omnibus configuration for Postgres\n\nI'm trying to install gitlab_6.8.1-omnibus.4-1_amd64.deb on my development Debian 7 (Wheezy) machine where Postgres 9.1 is already installed.\nWhen I run sudo gitlab-ctl reconfigure I catch an error:\nError executing action `run` on resource 'execute[migrate database]'\n ======================================================================\n\n Mixlib::ShellOut::ShellCommandFailed \n------------------------------------\nExpected process to exit with [0], but received '1'\n---- Begin output of /opt/gitlab/bin/gitlab-rake db:migrate ----\nSTDOUT:\nSTDERR: WARNING: Nokogiri was built against LibXML version 2.8.0, but has dynamically loaded 2.7.8\nrake aborted!\nFATAL: password authentication failed for user \"gitlab\"\nFATAL: password authentication failed for user \"gitlab\"\n\nI created both users git and gitlab (with passwords git and gitlab) in Postgres but it didn't help.\n/var/log/postgresql/postgresql-9.1-main.log is full of authentication errors:\n2014-05-10 14:51:30 MSK FATAL: password authentication failed for user \"gitlab\"\n\nHow can I configure PostgreSQL options to install GitLab Omnibus?" }, { "role": "assistant", "content": "I solved the problem with my existing PostgreSQL instance.\n\nAdd to /etc/gitlab/gitlab.rb:\n# Disable the built-in Postgres\npostgresql['enable'] = false\n\ngitlab_rails['db_adapter'] = 'postgresql'\ngitlab_rails['db_encoding'] = 'unicode'\n# Create database manually and place its name here.\ngitlab_rails['db_database'] = 'gitlabhq_production'\ngitlab_rails['db_host'] = '127.0.0.1'\ngitlab_rails['db_port'] = '5432'\ngitlab_rails['db_username'] = 'git' # Database owner.\ngitlab_rails['db_password'] = 'git' # Database owner's password.\n\nRun sudo gitlab-ctl reconfigure.\nImport default data: \nsudo gitlab-rake gitlab:setup\n\n\nAlternative variant is to set custom port for build-in PostgreSQL: \n postgresql['enable'] = true\n postgresql['port'] = 5433\n\nThis will run separate PostgreSQL instance on specified port." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How do I sync tags to a forked github repo?\n\nI forked a repository on github and use the \"fetch and merge\" button on the web page to sync the latest code to my fork. I noticed that the code gets updated but new tags from the master repro don't end up in my fork. How do I make that happen?" }, { "role": "assistant", "content": "You would need, in command-line, to fetch tags\ngit fetch --tags upstream\n\nAssuming upstream is the remote name referencing the original repository URL.\n(If not yet defined: git remote add upstream https://github.com/original/repository).\nThen push tags to your fork\ngit push --tags\n\nIf you want to push only the tags from the branch you are pushing:\ngit config --global push.followTags true\n\nThat way, a simple git push is enough." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-shortlog - Summarize git log output" }, { "role": "assistant", "content": "DESCRIPTION Summarizes git log output in a format suitable for inclusion\nin release announcements. Each commit will be grouped by author and title. Additionally, \"[PATCH]\" will be stripped from the commit description. If no revisions are passed on the command line and either standard input\nis not a terminal or there is no current branch, git shortlog will\noutput a summary of the log read from standard input, without\nreference to the current repository." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-shortlog - Summarize git log output --sparse" }, { "role": "assistant", "content": "All commits in the simplified history are shown." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How can I diff changed files versus previous versions after a pull?\nWhen I run \"git pull\", I often want to know what changed between the last version of a file and the new one. Say I want to know what someone else committed to a particular file.\nHow is that done?\nI'm assuming it's \"git diff\" with some parameters for commit x versus commit y, but I can't seem to get the syntax. I also find \"git log\" confusing a bit and am not sure where to get the commit ID of my latest version of the file versus the new one." }, { "role": "assistant", "content": "There are all kinds of wonderful ways to specify commits - see the specifying revisions section of man git-rev-parse for more details. In this case, you probably want:\ngit diff HEAD@{1}\n\nThe @{1} means \"the previous position of the ref I've specified\", so that evaluates to what you had checked out previously - just before the pull. You can tack HEAD on the end there if you also have some changes in your work tree and you don't want to see the diffs for them.\nI'm not sure what you're asking for with \"the commit ID of my latest version of the file\" - the commit \"ID\" (SHA1 hash) is that 40-character hex right at the top of every entry in the output of git log. It's the hash for the entire commit, not for a given file. You don't really ever need more - if you want to diff just one file across the pull, do\ngit diff HEAD@{1} filename\n\nThis is a general thing - if you want to know about the state of a file in a given commit, you specify the commit and the file, not an ID/hash specific to the file." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Migrate from CVS to Git without losing history\nI need to know if there is a way to migrate my code from CVS source control to Git?\nIf yes, what about my history of commits?" }, { "role": "assistant", "content": "Here is the process I used to migrate a SourceForge CVS repo to Git using cvs2git (latest stable release is here, but IIRC I used the github dev version), which works on both Windows and Linux without any compilation required since it's just Python.\nAlso, you don't need to own the repo with this method, you can for example migrate SourceForge projects that you don't own (you just need the right to checkout, so this works on any public repo).\n\nHow to import from sourceforge CVS to git.\nFirst, you need to download/checkout the cvs repo with the whole history (not just checkout the HEAD/Trunk):\n\nrsync -av rsync://PROJECT.cvs.sourceforge.net/cvsroot/PROJECT/\\* cvs\n\n\nthen use cvs2git (python script, works on all platforms, no compilation needed):\n\npython cvs2git --blobfile=\"blob.dat\" --dumpfile=\"dump.dat\" --username=\"username_to_access_repo\" --options=cvs2git.options --fallback-encoding utf-8 cvs\n\n\nthis should have generated two files blob and dump containing your whole cvs history. You can open them in a text editor to check that the content seems correct.\n\n\nthen initialize your git repo inside another folder:\n\nmkdir gitexport/\ncd gitexport\ngit init\n\n\nthen load up the exported cvs history onto git:\n\ncat ../{blob,dump}.dat | git fast-import\n\n\nand then place the git commit cursor at the end of history:\n\ngit reset --hard\n\n\nfinally and optionally, you can push to your remote git repository:\n\ngit push -u origin master\n\n\nof course you need before to git remote add origin https://your_repo_url\n\nNote: cvs2git.options is a JSON formatted configuration file for cvs2git where you can specify transforms for various things like author names (so that their nicknames will be automagically transformed to their full name after import). See the documentation here or the included example options file." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-fetch - Download objects and refs from another repository <refspec>" }, { "role": "assistant", "content": "Specifies which refs to fetch and which local refs to update.\nWhen no <refspec>s appear on the command line, the refs to fetch\nare read from remote.<repository>.fetch variables instead\n(see CONFIGURED REMOTE-TRACKING BRANCHES below). The format of a <refspec> parameter is an optional plus + , followed by the source <src>, followed\nby a colon : , followed by the destination ref <dst>.\nThe colon can be omitted when <dst> is empty. <src> is\ntypically a ref, but it can also be a fully spelled hex object\nname. A <refspec> may contain a * in its <src> to indicate a simple pattern\nmatch. Such a refspec functions like a glob that matches any ref with the\nsame prefix. A pattern <refspec> must have a * in both the <src> and\n<dst>. It will map refs to the destination by replacing the * with the\ncontents matched from the source. If a refspec is prefixed by ^ , it will be interpreted as a negative\nrefspec. Rather than specifying which refs to fetch or which local refs to\nupdate, such a refspec will instead specify refs to exclude. A ref will be\nconsidered to match if it matches at least one positive refspec, and does\nnot match any negative refspec. Negative refspecs can be useful to restrict\nthe scope of a pattern refspec so that it will not include specific refs.\nNegative refspecs can themselves be pattern refspecs. However, they may only\ncontain a <src> and do not specify a <dst>. Fully spelled out hex object\nnames are also not supported. tag <tag> means the same as refs/tags/<tag>:refs/tags/<tag> ;\nit requests fetching everything up to the given tag. The remote ref that matches <src>\nis fetched, and if <dst> is not an empty string, an attempt\nis made to update the local ref that matches it. Whether that update is allowed without --force depends on the ref\nnamespace it’s being fetched to, the type of object being fetched, and\nwhether the update is considered to be a fast-forward. Generally, the\nsame rules apply for fetching as when pushing, see the <refspec>... section of git-push for what those are. Exceptions to those\nrules particular to git fetch are noted below. Until Git version 2.20, and unlike when pushing with git-push , any updates to refs/tags/* would be accepted\nwithout + in the refspec (or --force ). When fetching, we promiscuously\nconsidered all tag updates from a remote to be forced fetches. Since\nGit version 2.20, fetching to update refs/tags/* works the same way\nas when pushing. I.e. any updates will be rejected without + in the\nrefspec (or --force ). Unlike when pushing with git-push , any updates outside of refs/{tags,heads}/* will be accepted without + in the refspec (or --force ), whether that’s swapping e.g. a tree object for a blob, or\na commit for another commit that doesn’t have the previous commit as\nan ancestor etc. Unlike when pushing with git-push , there is no\nconfiguration which’ll amend these rules, and nothing like a pre-fetch hook analogous to the pre-receive hook. As with pushing with git-push , all of the rules described\nabove about what’s not allowed as an update can be overridden by\nadding an optional leading + to a refspec (or using the --force command line option). The only exception to this is that no amount of\nforcing will make the refs/heads/* namespace accept a non-commit\nobject. Note When the remote branch you want to fetch is known to\nbe rewound and rebased regularly, it is expected that\nits new tip will not be a descendant of its previous tip\n(as stored in your remote-tracking branch the last time\nyou fetched). You would want\nto use the + sign to indicate non-fast-forward updates\nwill be needed for such branches. There is no way to\ndetermine or declare that a branch will be made available\nin a repository with this behavior; the pulling user simply\nmust know this is the expected usage pattern for a branch." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "'git diff' between a remote and local repository\nI am trying to diff my local file with a GitHub repository before I submit a pull request, so I can see what will show up. Is there an accurate way of doing this?\nI assume GitHub's compare tool manipulates Git's diff." }, { "role": "assistant", "content": "To compare a local working directory against a remote branch, for example origin/master:\n\ngit fetch origin master\nThis tells git to fetch the branch named 'master' from the remote named 'origin'. git fetch will not affect the files in your working directory; it does not try to merge changes like git pull does. \ngit diff --summary FETCH_HEAD\nWhen the remote branch is fetched, it can be referenced locally via FETCH_HEAD. The command above tells git to diff the working directory files against FETCHed branch's HEAD and report the results in summary format. Summary format gives an overview of the changes, usually a good way to start. If you want a bit more info, use --stat instead of --summary. \ngit diff FETCH_HEAD -- mydir/myfile.js\nIf you want to see changes to a specific file, for example myfile.js, skip the --summary option and reference the file you want (or tree).\n\nAs noted, origin references the remote repository and master references the branch within that repo. By default, git uses the name origin for a remote, so if you do git clone <url> it will by default call that remote origin. Use git remote -v to see what origin points to.\nYou may have more than one remote. For example, if you \"fork\" a project on GitHub, you typically need a remote referencing the original project as well as your own fork. Say you create https://github.com/yourusername/someproject as a fork of https://github.com/theoriginal/someproject. By convention, you would name the remote to the original repo upstream, while your own fork would be origin. If you make changes to your fork on GitHub and want to fetch those changes locally, you would use git fetch origin master. If the upstream has made changes that you need to sync locally before making more changes, you would use git fetch upstream master." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "I can't delete a remote master branch on git\nI need to delete a master branch, but it's proving to be hard. I just want to clean that branch out and start new. I am deleting from the dev branch. I want master on GitHub to be clean.\n # git push origin --delete master\n\n> To https://github.com/mymasterb.git ! [remote rejected] master\n> (deletion of the current branch prohibited) error: failed to push some\n> refs to 'https://github.com/mymaster.git'\n\nHow do I quite simply start my master with a fresh slate?" }, { "role": "assistant", "content": "As explained in \"Deleting your master branch\" by Matthew Brett, you need to change your GitHub repo default branch.\n\nYou need to go to the GitHub page for your forked repository, and click on the “Settings” button.\nClick on the \"Branches\" tab on the left hand side. There’s a “Default branch” dropdown list near the top of the screen. \nFrom there, select placeholder (where placeholder is the dummy name for your new default branch).\nConfirm that you want to change your default branch.\nNow you can do (from the command line):\n\ngit push origin :master\n\nOr, since 2012, you can delete that same branch directly on GitHub:\n\nThat was announced in Sept. 2013, a year after I initially wrote that answer.\n\nFor small changes like documentation fixes, typos, or if you’re just a walking software compiler, you can get a lot done in your browser without needing to clone the entire repository to your computer.\n\n\nNote: for BitBucket, Tum reports in the comments:\n\nAbout the same for Bitbucket\nRepo -> Settings -> Repository details -> Main branch" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "GitHub: searching through older versions of files\n\nI know that using GitHub I can search through all the current versions of my files in a repo. However, I would also like to search through the older versions of my repo files. For example, say, I used to have a function called get_info() in my code, but deleted it several versions ago, is it possible to search for get_info and find the code. If it is not possible using GitHub, is it possible from the git command line?\nEDIT\nThanks to @Mark Longair for showing how this can be done from the git command line. If it's not possible in GitHub it would be a great feature to have." }, { "role": "assistant", "content": "Currently, I don't believe it's possible to search within the complete history of a repository's code on the github website - the closest is just searching within the current code of a repository with the \"code search\" option on this page.\nHowever, from the command line, you can find any commits that introduced or removed lines mentioning get_info with the -S option to git log. e.g.:\ngit log -Sget_info -p\n\n(n.b. there should be no space between -S and the search term)\n(also note: to search for more than one word, surround in '):\ngit log -S'get info' -p\n\nSo, at a minimum that should find the commit where the function was first introduced and the one that removed it. I added the -p so you can also see the patches - if lots of commits introduced changes that mentioned the function that may be helpful. If the function was only on another branch it might also be useful to use --all to search all branches.\nJefromi points out in a comment below that git 1.7.4 will introduce the -G option as an alternative - this change is summarized in a recent blog post from Junio Hamano (git maintainer): http://gitster.livejournal.com/48191.html" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to change a connection to GitHub from SSH to HTTPS?\nI created my first repository in GitHub yesterday. When making the connection I used SSH instead of HTTPS, so I went through a little painful SSH key creation and connection process. At some point I got stuck and the connection failed. I wondered at that moment how I could revert the process I started and begin with a HTTPS connection instead. Happily, today I got the connection working through SSH but I'm wondering about the value of being able to change the type of connection (SSH vs HTTPS) and if there is a way to do it." }, { "role": "assistant", "content": "Assuming your remote is called origin, run\n\ngit remote set-url origin https://...\ngit remote set-url --push origin https://...\n\nYou can view the configured remotes with git remote -v, which should now show your updated URLs.\nSee the documentation for git-remote for more details." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to git log from all branches for the author at once?\nI need to get the report of all commits that the author did. So far, I have the script that wraps the following command:\ngit log --pretty=format:\"%ad:%an:%d:%B\" --date=short --reverse --all --since=2.months.ago --author=Petr\n\nIt works fine. However, it reports only the actions of the current branch. Is there any option that would log the commit messages for the author from all branches, not only from the current one?\nIn other words, can git make a reverse sorted (by datetime) sequence of all the commits in repository and extract the log info from that sequence?\nSolved: (copied from the comment below that is hidden otherwise)\nThe problem was that I have one repository and two clones to work concurrently on two branches. I did push the changes to the origin repository, but I forgot to fetch the changes to the cloned repository. This way it seemed that --all did not work when using it for the cloned repository." }, { "role": "assistant", "content": "Your command is right, since you use the --all switch which gives all commits from all branches. To answer the question in your comment, it works also in bare repositories.\ngit log --all --author=Petr" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-diff - Show changes between commits, commit and working tree, etc -B[<n>][/<m>] --break-rewrites[=[<n>][/<m>]]" }, { "role": "assistant", "content": "Break complete rewrite changes into pairs of delete and\ncreate. This serves two purposes: It affects the way a change that amounts to a total rewrite of a file\nnot as a series of deletion and insertion mixed together with a very\nfew lines that happen to match textually as the context, but as a\nsingle deletion of everything old followed by a single insertion of\neverything new, and the number m controls this aspect of the -B\noption (defaults to 60%). -B/70% specifies that less than 30% of the\noriginal should remain in the result for Git to consider it a total\nrewrite (i.e. otherwise the resulting patch will be a series of\ndeletion and insertion mixed together with context lines). When used with -M, a totally-rewritten file is also considered as the\nsource of a rename (usually -M only considers a file that disappeared\nas the source of a rename), and the number n controls this aspect of\nthe -B option (defaults to 50%). -B20% specifies that a change with\naddition and deletion compared to 20% or more of the file’s size are\neligible for being picked up as a possible source of a rename to\nanother file." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to filter git diff based on file extensions?\nIs there an option to restrict git diff to a given set of file extensions?" }, { "role": "assistant", "content": "Yes, if you ensure that git expands a glob rather than your shell then it will match at any level so something like this (quotes are important) should work fine.\ngit diff -- '*.c' '*.h'" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-log - Show commit logs ignore-space-at-eol" }, { "role": "assistant", "content": "Ignore changes in whitespace at EOL." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Following git-flow how should you handle a hotfix of an earlier release?\nIf you try to follow the git-flow branching model, documented here and with tools here, how should you handle this situation:\nYou have made a 1.0 release and a 2.0 release. Then you need to make a hotfix for 1.0. You create a hotfix branch off the 1.0 tag and implement the fix there. But what then?\nNormally you would merge to master and put a 1.1 release tag there. But you can't merge 1.1 to a point after 2.0 on master.\nI guess you could put the release tag on the hotfix branch, but that would create a permanent branch beside the master that would contain a release tag. Is that the right way?" }, { "role": "assistant", "content": "It seems that there is a concept of a \"support\" branch in git flow. This is used to add a hotfix to an earlier release.\nThis thread has more information, with these examples:\ngit checkout 6.0\ngit checkout -b support/6.x\ngit checkout -b hotfix/6.0.1\n\n... make your fix, then:\ngit checkout support/6.x\ngit merge hotfix/6.0.1\ngit branch -d hotfix/6.0.1\ngit tag 6.0.1\n\nor using git flow commands\ngit flow support start 6.x 6.0\ngit flow hotfix start 6.0.1 support/6.x\n\n... make changes then:\ngit flow hotfix finish 6.0.1" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Git Push ERROR: Repository not found\nI am having a very strange problem with git and github. When I try and push, I am getting:\ngit push -u origin master\nERROR: Repository not found.\nfatal: The remote end hung up unexpectedly\n\nI added the remote:\ngit remote add origin [email protected]:account-name/repo-name.git\n\nAny ideas?" }, { "role": "assistant", "content": "Check to see if you have read-write access.\nThe Git error message is misleading. I had a similar issue. I had been added to an existing project. I cloned it and committed a local change. I went to push and got the ERROR: Repository not found. error message.\nThe person who added me to the project gave me read-only access to the repository. A change by them and I was able to push." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How can I push a local Git branch to a remote with a different name easily?\nI've been wondering if there's an easy way to push and pull a local branch with a remote branch with a different name without always specifying both names.\nFor example:\n$ git clone myrepo.git\n$ git checkout -b newb\n$ ...\n$ git commit -m \"Some change\"\n$ git push origin newb:remote_branch_name\n\nNow if someone updates remote_branch_name, I can:\n$ git pull\n\nAnd everything is merged / fast-forwarded. However, if I make changes in my local \"newb\", I can't:\n$ git push\n\nInstead, I have to:\n% git push origin newb:remote_branch_name\n\nSeems a little silly. If git-pull uses git-config branch.newb.merge to determine where to pull from, why couldn't git-push have a similar config option? Is there a nice shortcut for this or should I just continue the long way?" }, { "role": "assistant", "content": "When you do the initial push add the -u parameter:\ngit push -u origin my_branch:remote_branch\n\nSubsequent pushes will go where you want. \nEDIT:\nAs per the comment, that only sets up pull. \ngit branch --set-upstream\n\nshould do it." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-checkout - Switch branches or restore working tree files 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-config - Get and set repository or global options pack.threads" }, { "role": "assistant", "content": "Specifies the number of threads to spawn when searching for best\ndelta matches. This requires that git-pack-objects be compiled with pthreads otherwise this option is ignored with a\nwarning. This is meant to reduce packing time on multiprocessor\nmachines. The required amount of memory for the delta search window\nis however multiplied by the number of threads.\nSpecifying 0 will cause Git to auto-detect the number of CPUs\nand set the number of threads accordingly." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-push - Update remote refs along with associated objects push.recurseSubmodules" }, { "role": "assistant", "content": "May be \"check\", \"on-demand\", \"only\", or \"no\", with the same behavior\nas that of \"push --recurse-submodules\".\nIf not set, no is used by default, unless submodule.recurse is\nset (in which case a true value means on-demand )." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to correctly require a specific commit in Composer so that it would be available for dependent packages?\n\nI have a library foo/foo-lib which requires a specific commit from GitHub:\n{\n \"name\": \"foo/foo-lib\",\n \"repositories\": [\n {\n \"type\": \"vcs\",\n \"url\": \"https://github.com/KnpLabs/Gaufrette.git\"\n }\n ],\n \"require\": {\n \"knplabs/gaufrette\": \"dev-master#2633721877cae79ad461f3ca06f3f77fb4fce02e\"\n }\n}\n\nand it works fine:\n$ composer update\nLoading composer repositories with package information\nUpdating dependencies (including require-dev) \n - Updating knplabs/gaufrette dev-master (2633721 => 2633721)\n Checking out 2633721877cae79ad461f3ca06f3f77fb4fce02e\n\nGenerating autoload files\n\nbut when I require that library in other project:\n{\n \"name\": \"bar/bar-app\",\n \"repositories\": [\n {\n \"type\": \"vcs\",\n \"url\": \"ssh://git.example.com/foo-lib\"\n }\n ],\n \"require-dev\": {\n \"foo/foo-lib\": \"dev-master\"\n }\n}\n\nit yields dependency error:\nYour requirements could not be resolved to an installable set of packages.\n\n Problem 1\n - Installation request for foo/foo-lib dev-master -> satisfiable by foo/foo-lib[dev-master].\n - foo/foo-lib dev-master requires knplabs/gaufrette dev-master#2633721877cae79ad461f3ca06f3f77fb4fce02e -> no matching package found.\n\nSo my question is: how to correctly require the specific commit from GitHub in my library, so that it would be available in dependent packages?" }, { "role": "assistant", "content": "You'll have to explicitly require the Gaufrette library at that hash, with a dev flag, in both your library and your application. Something like this should work in the application composer.json:\n{\n \"name\": \"bar/bar-app\",\n \"repositories\": [\n {\n \"type\": \"vcs\",\n \"url\": \"ssh://git.example.com/foo-lib\"\n }\n ],\n \"require-dev\": {\n \"foo/foo-lib\": \"dev-master\",\n \"knplabs/gaufrette\": \"dev-master#2633721877cae79ad461f3ca06f3f77fb4fce02e\"\n }\n}\n\nFrom the documentation:\n\nIf one of your dependencies has a dependency on an unstable package\n you need to explicitly require it as well, along with its sufficient\n stability flag.\n\nThe documentation also suggests that you'll need to include the repository for Gaufrette in your bar/bar-app Composer file, though it sounds like this wasn't necessary in this case. I'm not sure why." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How long should I keep my fork projects on github?\n\nWhen I have a feature request on a library in github, I would either\n\ntry to contact the author\nand/or implement it myself on a local copy, and when I am done, fork the project and push my changes.\n\nMore often than not, the original authors are happy to see the enhancements, and they'll either pull them as is, or merge them manually after some modifications.\nThe question is, what should I do with my fork projects after my commits have been accepted by the upstream? If I am not going to make any further updates, should I delete the repository? Or, should I keep it around for historical interest?\ngithub does not really indicate whose copy is the \"definitive\" repository, so my inactive forks may distract other people from finding the right copy. In fact, I just got a pull request form someone, which was also accepted at the upstream." }, { "role": "assistant", "content": "If I have no interest in being an active contributor or developer, I usually delete mine after the patch has been accepted upstream. I don't see a need to keep the repo around for historical reasons -- the commit will already have my name and email, and the timestamp of the commit, so that seems to be all the historical record it really needs." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Can forks be synced automatically in GitHub?\n\nStash enables automatic fork syncing if selected:\nhttps://confluence.atlassian.com/display/STASH/Keeping+forks+synchronized\nIt will update any branches in your fork that you haven't modified.\nI've been unable to find similar automatic functionality in GitHub; all google searches are turning up manual ways to sync forks via your local cache." }, { "role": "assistant", "content": "For the record, recently I ran into this same problem and addressed it with Github Actions. The solution is rather easy: an scheduled action fetches the upstream repository and merges it into mine.\n# .github/workflows/example.yml\n\nname: Merge upstream branches\non:\n schedule:\n # actually, ~5 minutes is the highest\n # effective frequency you will get\n - cron: '* * * * *'\njobs:\n merge:\n runs-on: ubuntu-latest\n steps:\n - uses: actions/checkout@v2\n - name: Merge upstream\n run: |\n git config --global user.name 'your-name'\n git config --global user.email '[email protected]'\n\n # \"git checkout master\" is unnecessary, already here by default\n git pull --unshallow # this option is very important, you would get\n # complains about unrelated histories without it.\n # (but actions/checkout@v2 can also be instructed\n # to fetch all git depth right from the start)\n\n git remote add upstream https://github.com/example/test.git\n git fetch upstream\n\n # Neither forget the -b opt,\n # the feature/x ref is ambiguous at this stage\n git checkout -b feature/x origin/feature/x\n git merge --no-edit upstream/feature/x\n git push origin feature/x\n\n git checkout master\n git merge --no-edit upstream/master\n git push origin master\n\n # etc\n\n\nI run it every Sunday which is more than enough for me. Just schedule this to whatever is fine for you.\nAlso, it is probably wiser to sync every branch in a different job since they will run in parallel and can independently succeed or fail if conflicts occur.\nIf you need to merge an arbitrary number of branches, you can refer to questions like How to fetch all Git branches to find shell tricks to do it.\nI noticed a public action exists to address this by rebasing. It looked promising but it was fairly undocumented so here is my snippet instead. Hope it helps!" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git - the stupid content tracker git-credential-store" }, { "role": "assistant", "content": "Helper to store credentials on disk" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to disable osxkeychain as credential helper in git config?\n\nI need to disable the credential helper for OS X: git credential-osxkeychain \nIt is disabled both in the global config file and in the local one, in fact it has never ben enabled. Still, it keeps memorizing my github login details.\nI'm on a laptop, so I don't want automatic passwordless access to my repos.\nI will use ssh keys. This is a new computer, and the whole system setup is still a work in progress.\nFor now I used the https repo refs, and the credential helper keeps kicking in. \nThese are my conf files: \n\ngit config --edit =>\n[core]\n repositoryformatversion = 0\n filemode = true\n bare = false\n logallrefupdates = true\n ignorecase = true\n precomposeunicode = false\n[remote \"origin\"]\n url = https://github.com/user/repo.git\n fetch = +refs/heads/*:refs/remotes/origin/*\n[branch \"master\"]\n remote = origin\n merge = refs/heads/master\n[branch \"develop\"]\n remote = origin\n merge = refs/heads/develop\n[branch \"deploy\"]\n remote = origin\n merge = refs/heads/deploy\n\n\ngit config --global --edit =>\n[user]\n email = ****************\n name = tom\n[color]\n ui = true\n[core]\n editor = subl -w\n[github]\n user = tompave\n[merge]\n conflictstyle = diff3\n[push]\n default = simple\n\n\nAlso, running git config --global credential.helper returns nothing (and that's right). \nHowever, running git config credential.helper returns osxkeychain! \nHow is it possible? I can't see it in the local config file, where is it set? \nI tried to set it up locally to see what would happen, and it did appear in the repodir/.git/config. Then I deleted the entry... but the helper is still here and active. \nI can clearly see its entry in OS X keychain.\nI can delete it, and then git will ask for the password again... but as soon as I type it (let's say, for a git fetch), the entry in keychain is restored." }, { "role": "assistant", "content": "To help track down the setting, I'd try to use:\ngit config --local credential.helper\ngit config --global credential.helper\ngit config --system credential.helper\n\nThe first one checks the local repo config, the second is your ~/.gitconfig, and the third is based on where git is installed. Depending on which one comes back showing the credential helper, you can try using the equivalent --unset option:\ngit config --local --unset credential.helper\ngit config --global --unset credential.helper\ngit config --system --unset credential.helper\n\nThe last one may not work if you don't have proper permissions. So you may need to run the last one under sudo for it to work correctly. FWIW, you may have installed for the pre-built git images for Mac OS X. If you cat /usr/local/git/etc/gitconfig (or /usr/local/etc/gitconfig if you installed git via Homebrew or a building locally), you'll see that it does set up the credential helper for you. So the last command above would help fix that problem." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-config - Get and set repository or global options $(prefix)/etc/gitconfig" }, { "role": "assistant", "content": "System-wide configuration file." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Why git can't remember my passphrase under Windows\nI have just start using git and i can't get it to remember my passphrase I'm using cmd.exe elevated and my git host is github and i have create a ssh key like that guide on github\nbut i still get \n*\\subnus.mvc>git push origin master\nEnter passphrase for key '/c/Users/Subnus/.ssh/id_rsa':" }, { "role": "assistant", "content": "Every time I set up a new desktop I forget these instructions, so I'm adding another answer here since I stumble across it equally often!\n\nQuick Steps for Impatient Users Like Me\n\nEnable the OpenSSH Authentication Agent service and make it start automatically.\n\n👉 Update 👈\nWith the latest Windows update Version 10.0.19042.867 I had to re-do this step!\n\n\nAdd your SSH key to the agent with ssh-add on the command line.\nTest git integration, if it still asks for your passphrase, continue on.\nAdd the environment variable $ENV:GIT_SSH=C:\\Windows\\System32\\OpenSSH\\ssh.exe to your session, or permanently to your user environment.\n\n\nDetailed Steps: Overview\nWindows has been shipping with OpenSSH for some time now. It includes all the necessary bits for ssh to work alongside Git, but it still seems to need some TLC before it works 100% seamlessly. Here's the steps I've been following with success as of Windows ver 10.0.18362.449 (you can see your Windows 10 version by opening a cmd.exe shell and typing ver).\nI assume here that you already have your SSH key setup, and is located at ~/.ssh/id_rsa\nEnable the ssh-agent service on your Windows 10 box.\n\nStart-> Type 'Services' and click on the Services App that appears.\nFind the OpenSSH Authentication Agent service in the list.\nRight-click on the OpenSSH Authentication Agent service, and choose 'Properties'.\nChange the Startup type: to Automatic.\nClick the Start button to change the service status to Running.\nDismiss the dialog by clicking OK, and close the Services app.\n\nAdd your key to the ssh-agent\n\nOpen your shell of preference (I'll use Windows Powershell in this example, applies to Powershell Core too).\nAdd your SSH key to the ssh-agent: ssh-add (you can add the path to your key as the first argument if it differs from the default).\nEnter your passphrase if/when prompted to do so.\n\nTry Git + SSH\n\nOpen your shell (again, I'm using Powershell) and clone a repo. git clone [email protected]:octocat/Spoon-Knife\nIf you see this prompt, continue on to the next section:\n\nEnter passphrase for key '/c/Users/your_user_name/.ssh/id_rsa':\n\nSet your GIT_SSH Environment Variable\nIn any session you can simply set this environment variable and the prompt for your passphrase will stop coming up and ssh will use the ssh-agent on your behalf. Alternatively, you can set your passphrase into your user's environment permanently.\nTo set GIT_SSH in the current shell only:\n\nOpen your shell of preference. (Powershell for me)\nSet the environment variable GIT_SSH to the appropriate ssh.exe: $Env:GIT_SSH=$((Get-Command -Name ssh).Source)\nRetry the steps in Try Git + SSH above.\n\nTo set GIT_SSH permanently\n\nOpen File Explorer. Start-> type 'File Explorer' and click on it in the list.\nRight-click 'This PC' and click on 'Properties'.\nClick on 'Advanced system settings'.\nClick the 'Environment Variables...' button.\nUnder 'User variables for your_user_name' click New...\nSet Variable name: field to GIT_SSH\nSet the Variable value: field to path-to-ssh.exe (typically C:\\Windows\\System32\\OpenSSH\\ssh.exe).\nClick OK to dismiss the New User Variable dialog.\nClick OK to dismiss the Environment Variables dialog.\nRetry the steps in Try Git + SSH above.\n\n\nNote that this is likely going to change with new steps/procedures as Windows 10 progresses and as I learn more. I will attempt to keep this updated, I look forward to feedback in the comments." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-log - Show commit logs log.follow" }, { "role": "assistant", "content": "If true , git log will act as if the --follow option was used when\na single <path> is given. This has the same limitations as --follow ,\ni.e. it cannot be used to follow multiple files and does not work well\non non-linear history." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to 'Watch' only a directory in a GitHub repository?\n\nFor example, https://github.com/vanillaforums/Garden is the GitHub repository. But I only want to 'watch' this directory https://github.com/vanillaforums/Garden/tree/master/plugins in the repository.\nHow do I do that? There doesn't seem to be a way." }, { "role": "assistant", "content": "GitHub provides feeds that can do this for both directories and files.1 Using that syndication, a service like Blog Trottr can send you an email whenever the feed is updated.\nSome samples, taken from the Linux source code on master:\n\n\n\n\n\nDirectory\nFile\n\n\n\n\nSource on GitHub\n/Documentation\n/Documentation/Makefile\n\n\nHistory on GitHub\n/Documentation\n/Documentation/Makefile\n\n\nHistory Atom feed\n/Documentation\n/Documentation/Makefile\n\n\n\n\n1 Thank you, youfu." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-config - Get and set repository or global options format.noprefix" }, { "role": "assistant", "content": "If set, do not show any source or destination prefix in patches.\nThis is equivalent to the diff.noprefix option used by git\ndiff (but which is not respected by format-patch ). Note that\nby setting this, the receiver of any patches you generate will\nhave to apply them using the -p0 option." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Using a remote repository with non-standard port\nI am setting up my local git project for a remote repository. The remote repository is being served on a non-standard port (4019).\nBut it doesn't work. Instead I get the following error message:\nssh: connect to host git.host.de:4019 port 22: Connection refused\nfatal: The remote end hung up unexpectedly\nerror: failed to push to 'ssh://[email protected]:4019/var/cache/git/project.git'\n\nMy local git config is as follows:\n[core]\n repositoryformatversion = 0\n filemode = true\n bare = false\n logallrefupdates = true\n[remote \"origin\"]\n url = ssh://[email protected]:4019/var/cache/git/project.git\n fetch = +refs/heads/*:refs/remotes/origin/*\n[branch \"master\"]\n remote = origin\n merge = refs/heads/master\n\n(The port and host are placeholders for the actual port and host.)\nWhat is wrong with my git configuration?" }, { "role": "assistant", "content": "SSH based git access method can be specified in <repo_path>/.git/config using either a full URL or an SCP-like syntax, as specified in http://git-scm.com/docs/git-clone:\nURL style:\nurl = ssh://[user@]host.xz[:port]/path/to/repo.git/\n\nSCP style:\nurl = [user@]host.xz:path/to/repo.git/\n\nNotice that the SCP style does not allow a direct port change, relying instead on an ssh_config host definition in your ~/.ssh/config such as:\nHost my_git_host\nHostName git.some.host.org\nPort 24589\nUser not_a_root_user\n\nThen you can test in a shell with:\nssh my_git_host\n\nand alter your SCP-style URI in <repo_path>/.git/config as:\nurl = my_git_host:path/to/repo.git/" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-diff - Show changes between commits, commit and working tree, etc lines" }, { "role": "assistant", "content": "Compute the dirstat numbers by doing the regular line-based diff\nanalysis, and summing the removed/added line counts. (For binary\nfiles, count 64-byte chunks instead, since binary files have no\nnatural concept of lines). This is a more expensive --dirstat behavior than the changes behavior, but it does count rearranged\nlines within a file as much as other changes. The resulting output\nis consistent with what you get from the other --*stat options." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Will remote URL for fetch and push be different?\ngit remote --v show remote info\norigin https://github.com/test/testing-iOS.git (fetch)\norigin https://github.com/test/testing-iOS.git (push)\n\nIt shows that both fetch and push are using the same remote URL.\nQuestion:\nWhen will (if ever) remote URL for fetch and push be different?\nWhat commands can you use to change remote URL for fetch or push separately?" }, { "role": "assistant", "content": "Yes (using different remote), and that is why Git 2.5 introduces a new ref shorthand @{push}.\nSee \"Viewing Unpushed Git Commits\"\n\nWhat commands can you use to change remote URL for fetch or push separately?\n\nYou need a separate remote:\ngit remote add myfork /url/for/my/fork\ngit config remote.pushdefault myfork\n\nThe GitHub blog post \"Improved support for triangular workflows\" illustrates the use of @{push}:\n\n\nSee what commits you've added to your current branch since the last push:\n\ngit clone https://github.com/YOUR-USERNAME/atom\ncd atom\ngit config remote.pushdefault origin\ngit config push.default current\n\n\nremote.pushdefault specifies where to push (to which remote repo). \npush.default specifies what to push (what refspec), when no refspec is explicitly given.\ncurrent, in that latter case, means \"push the current branch to update a branch with the same name on the receiving end.\" \n\nThe following branch will fetch from one url, push to another:\ngit remote add upstream https://github.com/atom/atom\ngit fetch upstream\ngit checkout -b whizbang upstream/master\n\n(Here the whizbang branches tracks upstream/master, but pushes to origin/whizbang)\ngit log @{push}..\n\n\nThis uses the new @{push} notation, which denotes the current value of the remote-tracking branch that the current branch would be pushed to by git push, namely origin/whizbang.\n You can also refer to the push destination of an arbitrary branch using the notation whizbang@{push}." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-show - Show various types of objects %ce" }, { "role": "assistant", "content": "committer email" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "gitignore does not ignore .idea directory [duplicate]\nThis question already has answers here:\n \n \n\n\n\n\nHow do I make Git forget about a file that was tracked, but is now in .gitignore?\n\n (35 answers)\n \n\nClosed 3 months ago.\n\n\n\nWorking on a Symfony2 project using PhpStorm IDE, I have added couple of files to git ignore but one file despite being added to git ignore is always appearing. I have tried multiple times but its always there\n.gitignore file:\n/app/config/parameters.yml\n/bin/\n/build/\n/composer.phar\n/vendor/\n/web/bundles/\n/app/bootstrap.php.cache\n/app/cache/*\n!app/cache/.gitkeep\n/app/config/parameters.yml\n/app/logs/*\n!app/logs/.gitkeep\n/app/phpunit.xml\n\n#IDE metadata\n**.idea/**\n\n#Bash files\nrun.sh\n\nAnd it is the .idea folder/files that Git just will not ignore:\nOn branch develop\nChanges 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: .idea/workspace.xml\n\nno changes added to commit (use \"git add\" and/or \"git commit -a\")\n\nAny idea why git will just not ignore the whole directory like i have specified in gitignore?" }, { "role": "assistant", "content": "Git never ignores changes to tracked files. As it appears as modified, the file is under version control (the idea/workspace.xml file usually should not be) and thus changes to it are tracked. Delete it from the index, leaving your local copy intact with git rm --cached .idea/workspace.xml and commit this change. From then on it will be ignored unless you force-add it back to the repository or change your gitignore settings." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "GitHub: What is a \"wip\" branch?\nWhen I was browsing GitHub repositories I quite often saw \"wip\" branches (e.g. 3.1.0-wip). What does \"wip\" mean?\nI couldn't find the answer anywhere - neither on Google nor on GitHub:help." }, { "role": "assistant", "content": "Conventionally, \"wip\" stands for \"work in progress\"." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How do I set up Eclipse/EGit with GitHub?\nI've never used Git before and would like to learn.\nI have a private repository with GitHub.\nI've installed the EGit plugin for Eclipse.\nI have a workspace where I do my work, generally: ~/Documents/workspace.\nI am able to add my GitHub repository and download it, but in doing so it creates ~/MyRepository.\nWhen I create a project, do I need to point it to ~/MyRepository?\nAlso, how come when I make an edit and I say push to upstream it says up to date?" }, { "role": "assistant", "content": "Make sure your refs for pushing are correct. This tutorial is pretty great, right from the documentation:\nhttp://wiki.eclipse.org/EGit/User_Guide#GitHub_Tutorial\nYou can clone directly from GitHub, you choose where you clone that repository. And when you import that repository to Eclipse, you choose what refspec to push into upstream.\nClick on the Git Repository workspace view, and make sure your remote refs are valid. Make sure you are pointing to the right local branch and pushing to the correct remote branch." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-diff - Show changes between commits, commit and working tree, etc --color-moved[=<mode>]" }, { "role": "assistant", "content": "Moved lines of code are colored differently.\nIt can be changed by the diff.colorMoved configuration setting.\nThe <mode> defaults to no if the option is not given\nand to zebra if the option with no mode is given.\nThe mode must be one of: no Moved lines are not highlighted. default Is a synonym for zebra . This may change to a more sensible mode\nin the future. plain Any line that is added in one location and was removed\nin another location will be colored with color.diff.newMoved .\nSimilarly color.diff.oldMoved will be used for removed lines\nthat are added somewhere else in the diff. This mode picks up any\nmoved line, but it is not very useful in a review to determine\nif a block of code was moved without permutation. blocks Blocks of moved text of at least 20 alphanumeric characters\nare detected greedily. The detected blocks are\npainted using either the color.diff.{old,new}Moved color.\nAdjacent blocks cannot be told apart. zebra Blocks of moved text are detected as in blocks mode. The blocks\nare painted using either the color.diff.{old,new}Moved color or color.diff.{old,new}MovedAlternative . The change between\nthe two colors indicates that a new block was detected. dimmed-zebra Similar to zebra , but additional dimming of uninteresting parts\nof moved code is performed. The bordering lines of two adjacent\nblocks are considered interesting, the rest is uninteresting. dimmed_zebra is a deprecated synonym." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "What is the difference between Forking and Cloning on GitHub?\nI'd like to know the differences between doing a Fork of a project and doing a clone of it.\nCan I only send pull requests via GitHub if I've forked a project?" }, { "role": "assistant", "content": "When you say you are Forking a repository you are basically creating a copy of the repository under your GitHub ID. The main point to note here is that any changes made to the original repository will be reflected back to your forked repositories(you need to fetch and rebase). However, if you make any changes to your forked repository you will have to explicitly create a pull request to the original repository. If your pull request is approved by the administrator of the original repository, then your changes will be committed/merged with the existing original code-base. Until then, your changes will be reflected only in the copy you forked. \nIn short:\nThe Fork & Pull Model lets anyone fork an existing repository and push changes to their personal fork without requiring access be granted to the source repository. The changes must then be pulled into the source repository by the project maintainer. \nNote that after forking you can clone your repository (the one under your name) locally on your machine. Make changes in it and push it to your forked repository. However, to reflect your changes in the original repository your pull request must be approved.\nCouple of other interesting dicussions - \nAre git forks actually git clones?\nHow do I update a GitHub forked repository?" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "What's the equivalent of Subversion's \"use-commit-times\" for Git?\nI need the timestamps of files on my local system and on my server to be in sync. This is accomplished with Subversion by setting use-commit-times=true in the configuration so that the last modified of each file is when it was committed.\nEach time I clone my repository, I want the timestamps of files to reflect when they were last changed in the remote repository, not when I cloned the repository.\nIs there a way to do this with Git?" }, { "role": "assistant", "content": "UPDATE: My solution is now packaged into Debian, Ubuntu, Linux Mint, Fedora, Gentoo Linux, Arch Linux and possibly other distributions:\nhttps://github.com/MestreLion/git-tools#install\napt install git-restore-mtime # Debian, Ubuntu, Linux Mint\nyum install git-tools # Fedora, Red Hat Enterprise Linux (RHEL), CentOS\nemerge dev-vcs/git-tools # Gentoo Linux\npacman -S git-tools-git # Arch Linux\n\n\nIMHO, not storing timestamps (and other metadata like permissions and ownership) is a big limitation of Git.\nLinus' rationale of timestamps being harmful just because it \"confuses make\" is lame:\n\nmake clean is enough to fix any problems.\n\nApplies only to projects that use make, mostly C/C++. It is completely moot for scripts like Python, Perl, or documentation in general.\n\nThere is only harm if you apply the timestamps. There would be no harm in storing them in repo. Applying them could be a simple --with-timestamps option for git checkout and friends (clone, pull, etc.), at the user's discretion.\n\n\nBoth Bazaar and Mercurial stores metadata. Users can apply them or not when checking out. But in Git, since original timestamps are not even available in the repository, there is no such option.\nSo, for a very small gain (not having to re-compile everything) that is specific to a subset of projects, Git as a general DVCS was crippled, some information from about files is lost, and, as Linus said, it's infeasible to do it now. Sad.\nThat said, may I offer two approaches?\n1 - http://repo.or.cz/w/metastore.git , by David Härdeman. It tries to do what Git should have done in the first place: stores metadata (not only timestamps) in the repository when committing (via a pre-commit hook), and reapplies them when pulling (also via hooks).\n2 - My humble version of a script I used before for generating release tarballs. As mentioned in other answers, the approach is a little different: to apply for each file the timestamp of the most recent commit where the file was modified.\n\ngit-restore-mtime, with lots of options, supports any repository layout, and runs on Python 3.\n\nBelow is a really bare-bones version of the script, as a proof-of-concept, on Python 2.7. For actual usage I strongly recommend the full version above:\n#!/usr/bin/env python\n# Bare-bones version. Current directory must be top-level of work tree.\n# Usage: git-restore-mtime-bare [pathspecs...]\n# By default update all files\n# Example: to only update only the README and files in ./doc:\n# git-restore-mtime-bare README doc\n\nimport subprocess, shlex\nimport sys, os.path\n\nfilelist = set()\nfor path in (sys.argv[1:] or [os.path.curdir]):\n if os.path.isfile(path) or os.path.islink(path):\n filelist.add(os.path.relpath(path))\n elif os.path.isdir(path):\n for root, subdirs, files in os.walk(path):\n if '.git' in subdirs:\n subdirs.remove('.git')\n for file in files:\n filelist.add(os.path.relpath(os.path.join(root, file)))\n\nmtime = 0\ngitobj = subprocess.Popen(shlex.split('git whatchanged --pretty=%at'),\n stdout=subprocess.PIPE)\nfor line in gitobj.stdout:\n line = line.strip()\n if not line: continue\n\n if line.startswith(':'):\n file = line.split('\\t')[-1]\n if file in filelist:\n filelist.remove(file)\n #print mtime, file\n os.utime(file, (mtime, mtime))\n else:\n mtime = long(line)\n\n # All files done?\n if not filelist:\n break\n\nPerformance is pretty impressive, even for monster projects wine, git or even the Linux kernel:\nBash\n# 0.27 seconds\n# 5,750 log lines processed\n# 62 commits evaluated\n# 1,155 updated files\n\nGit\n# 3.71 seconds\n# 96,702 log lines processed\n# 24,217 commits evaluated\n# 2,495 updated files\n\nWine\n# 13.53 seconds\n# 443,979 log lines processed\n# 91,703 commits evaluated\n# 6,005 updated files\n\nLinux kernel\n# 59.11 seconds\n# 1,484,567 log lines processed\n# 313,164 commits evaluated\n# 40,902 updated files" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How can I remove an applied git patch?\nI have a git repo, where we apply many patches in test environment.\ngit apply --stat --check --ignore-whitespace /home/kent/Desktop/patches/test.patch --exclude .gitignore\n\ngit am -s --ignore-whitespace /home/kent/Desktop/patches/test.patch --exclude .gitignore --exclude .gitignore\n\nIf I have to remove the patch and apply a new one, at present I clone the live content and reapply all the test patches and push again.\nThis process is somehow cumbersome and also leads to errors at times I also miss one or two patches.\nI wanted to know if there is a way to remove a patch and apply the new one\nAlso, to add one way is there if we commit each time to the patch and then i can use:\ngit revert <<commit id>>\n\nThe above does not work for me at all times." }, { "role": "assistant", "content": "TL;DR\nYou can revert a patch with:\n$ git apply -R <patch>\n\n\nYou can generate a patch either by one of the following:\nThis will generate a patch from a diff\n$ git diff --patch > 0001-some-modifications.patch\n\nIf you want to generate a patch for just the HEAD commit:\n$ git show --patch HEAD^ > 0001-some-modifications.patch\n\nYou can generate a patch for the previous 3 commits from HEAD:\n$ git show --patch HEAD~3 > 0001-some-modifications.patch\n\nYou can apply the patch by:\n$ git apply -- 0001-some-modifications.patch\n\nYou can revert a patch with:\n$ git apply -R <patch>\n\nWhen you generate a patch it is just a diff with metadata; files, line numbers adds/removes; something along the following:\ncommit 9dad147cbf16befecdef2e812c1249499bdef5ac\nAuthor: My Name <[email protected]>\nDate: Mon Dec 21 20:46:01 2015 +0000\n\n Example commit message.\n\ndiff --git a/src/example.md b/src/example.md\nnew file mode 100644\nindex 0000000..ab73512\n--- /dev/null\n+++ b/src/example.md\n@@ -0,0 +1,3 @@\n+# Example document\n+\n+ Hello World\n\nSo when you use git apply you're essentially applying the edits as per to the tree.\nWhen you then run git apply -R git will simply do the opposite to the patch." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-commit - Record changes to the repository -z --null" }, { "role": "assistant", "content": "When showing short or porcelain status output, print the\nfilename verbatim and terminate the entries with NUL, instead of LF.\nIf no format is given, implies the --porcelain output format.\nWithout the -z option, filenames with \"unusual\" characters are\nquoted as explained for the configuration variable core.quotePath (see git-config )." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Git: How to commit a manually deleted file? [duplicate]\nThis question already has answers here:\n \n \n\n\n\n\nDelete files from git index when they are already deleted from fs\n\n (7 answers)\n \n\n\nStaging Deleted files\n\n (10 answers)\n \n\nClosed 11 years ago.\n\n\n\nIn my git repository I manually deleted a file(rm) after moving it to another folder. I than committed all the changes to my repo but now when I do git status .\nronnie@ronnie:/home/github/Vimfiles/Vim$ git status .\n# On branch master\n# Changes not staged for commit:\n# (use \"git add/rm <file>...\" to update what will be committed)\n# (use \"git checkout -- <file>...\" to discard changes in working directory)\n#\n# deleted: plugin/dwm.vim\n#\nno changes added to commit (use \"git add\" and/or \"git commit -a\")\n\nNow, how should I commit so that dwm.vim is deleted from the plugin folder in my remote repo. I know that I have to use git add && git commit but I have no file to commit/add because /plugin/dwm.vim is already deleted." }, { "role": "assistant", "content": "The answer's here, I think.\nIt's better if you do git rm <fileName>, though." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "'Go Get' Private Repo from Bitbucket\nSo basically, I have an Openshift Project that on Git push, downloads all libraries with 'Go get' and builds the project on-the-fly and so, I have some code I don't want people to see from my own library, and for it to compile properly, the code needs to be taken from github.com or another repo, so I created a private bitbucket.org repo, now, as a public repo it works fine, but when I try to 'Go Get' from my private repo, it gives me 'Forbidden 403' \nHow can I avoid this occurency?\nThank you for reading and have a nice day!" }, { "role": "assistant", "content": "go get uses git internally. The following one liners will make git and consequently go get clone your package via SSH.\nGithub:\ngit config --global url.\"[email protected]:\".insteadOf \"https://github.com/\"\nBitBucket:\ngit config --global url.\"[email protected]:\".insteadOf \"https://bitbucket.org/\"" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Using Git, how could I search for a string across all branches?\n\nUsing Git, how could I search within all files in all local branches for a given string?\nGitHub specific: is it possible to perform the above search across all GitHub branches? (There are several remote branches on my remote GitHub repository that ideally I wouldn't have to bring down for this search...)" }, { "role": "assistant", "content": "You can do this on a Git repository:\ngit grep \"string/regexp\" $(git rev-list --all)\n\nGitHub advanced search has code search capability:\nThe code search will look through all of the code publicly hosted on GitHub. You can also filter by:\n\nthe language: language:\nthe repository name (including the username): repo:\nthe file path: path:" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Adding commits to another person's pull request on GitHub\n\nMy project on GitHub has received a pull request. The pull request only partly fixes the issue that it's addressing. I've pulled in the changes to a local branch and added some commits of my own.\nI'd now like to push those commits back to my remote repo and have them show up on the pull request, but without merging them into the target branch. I'd like to keep the pull request open for further review and discussion, and potentially further commits.\nIs there a way I can add commits to the pull request without merging them into the target branch and therefore closing the pull request?" }, { "role": "assistant", "content": "As long as the original author has clicked the checkbox in the bottom right:\n\nIf that box is checked, then you can push back to the original branch without needing to add a remote by using:\ngit push [email protected]:user/repo local_branch_name:remote_branch_name\n\nThis is particularly useful if you're using a tool like hub where you can check out a pull request without needing to add a remote.\nEdit: You also need to have write access to the repository where the PR has been opened.\nFurther Edit: The new command line tool from GitHub does a good job of checking out PRs so that you can just use git push as is to push updates to remotes (assuming you have permission)." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Gitlab CI - How to trigger a build only if changes happen on particular set of files\n\nIn Gitlab CI, how do you trigger a build only if changes happen on particular set of files?\nIs there a way to either include or exclude certain files from triggering a build? For eg: updating README.md, .gitignore files should not cause a build to trigger." }, { "role": "assistant", "content": "UPDATE 2\nOnly/except seem to be an unstable feature. The doc recommends using rules:changes instead:\njob:\n script:\n - build # replace with your build command\n rules:\n - changes:\n - /*.{java, py} # ... or whatever your file extension is\n - dockerfiles/**/* # all files under folder 'dockerfiles'\n\nUPDATE 1:\nLike Gajus mentioned in the comments, it is now possible!\nMerge Request: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/21981\nDocumentation: https://docs.gitlab.com/ee/ci/yaml/#onlyexcept-basic (Thanks to Connor Shea for the tip in the comments)\nOriginal post:\nNo, it is not possible – not now!\nI think this is the issue you are looking for: https://gitlab.com/gitlab-org/gitlab-ce/issues/19232 – It is a very high rated issue (over 100 thumps-up).\nThe milestone has changed to Next 3-6 months, 4 months ago. (https://gitlab.com/gitlab-org/gitlab-ce/issues/19232#note_31943850)\nI hope we will see this function soon." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git - the stupid content tracker -C <path>" }, { "role": "assistant", "content": "Run as if git was started in <path> instead of the current working\ndirectory. When multiple -C options are given, each subsequent\nnon-absolute -C <path> is interpreted relative to the preceding -C\n<path> . If <path> is present but empty, e.g. -C \"\" , then the\ncurrent working directory is left unchanged. This option affects options that expect path name like --git-dir and --work-tree in that their interpretations of the path names would be\nmade relative to the working directory caused by the -C option. For\nexample the following invocations are equivalent: git --git-dir=a.git --work-tree=b -C c status\ngit --git-dir=c/a.git --work-tree=c/b status" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git - the stupid content tracker git-pack-refs" }, { "role": "assistant", "content": "Pack heads and tags for efficient repository access" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Gitlab:Peer's Certificate issuer is not recognized\n\nI get this error on a fresh install of gitlab. The message looks like: \nfatal: unable to access 'https://gitlab-ci-\ntoken:[email protected]/something.git/': Peer's \nCertificate issuer is not recognized.ERROR: Job \nfailed: exit status 1\n\nAny suggestions on how to fix it?" }, { "role": "assistant", "content": "Had faced the same problem after enabling verbose mode by following command \nexport GIT_CURL_VERBOSE=1 and found the following issue:\nNSS error -8179 (SEC_ERROR_UNKNOWN_ISSUER)\nFound this following site helpful,But its good when you have entire control for \nthe proxy server as well to enter the certificates.\nhttp://dropbit.com/?p=168\nI instead ran following command to bypass ssl verification by porxy server and it worked \ngit config --global http.sslVerify \"false\"" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "gitignore - Specifies intentionally untracked files to ignore" }, { "role": "assistant", "content": "NAME gitignore - Specifies intentionally untracked files to ignore" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-merge - Join two or more development histories together" }, { "role": "assistant", "content": "HOW TO RESOLVE CONFLICTS After seeing a conflict, you can do two things: Decide not to merge. The only clean-ups you need are to reset\nthe index file to the HEAD commit to reverse 2. and to clean\nup working tree changes made by 2. and 3.; git merge --abort can be used for this. Resolve the conflicts. Git will mark the conflicts in\nthe working tree. Edit the files into shape and git add them to the index. Use git commit or git merge --continue to seal the deal. The latter command\nchecks whether there is a (interrupted) merge in progress\nbefore calling git commit . You can work through the conflict with a number of tools: Use a mergetool. git mergetool to launch a graphical\nmergetool which will work through the merge with you. Look at the diffs. git diff will show a three-way diff,\nhighlighting changes from both the HEAD and MERGE_HEAD versions. git diff AUTO_MERGE will show what changes you’ve\nmade so far to resolve textual conflicts. Look at the diffs from each branch. git log --merge -p <path> will show diffs first for the HEAD version and then the MERGE_HEAD version. Look at the originals. git show :1:filename shows the\ncommon ancestor, git show :2:filename shows the HEAD version, and git show :3:filename shows the MERGE_HEAD version." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-fetch - Download objects and refs from another repository flag" }, { "role": "assistant", "content": "A single character indicating the status of the ref: (space) for a successfully fetched fast-forward; + for a successful forced update; - for a successfully pruned ref; t for a successful tag update; * for a successfully fetched new ref; ! for a ref that was rejected or failed to update; and = for a ref that was up to date and did not need fetching." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-log - Show commit logs -P --perl-regexp" }, { "role": "assistant", "content": "Consider the limiting patterns to be Perl-compatible regular\nexpressions. Support for these types of regular expressions is an optional\ncompile-time dependency. If Git wasn’t compiled with support for them\nproviding this option will cause it to die." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-log - Show commit logs %ce" }, { "role": "assistant", "content": "committer email" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "When listing git-ls-remote why there's \"^{}\" after the tag name? [duplicate]\nThis question already has answers here:\n \n \n\n\n\n\nWhat does ^{} mean in git?\n\n (2 answers)\n \n\nClosed 11 years ago.\n\n\n\nWhen I run git ls-remote in the work tree, the command outputs a list of revisions in the origin repo. For some reason I get 2 revisions with every tag and for the second revision of the same tag, the tag name includes ^{}\ngit ls-remote\nFrom [email protected]:andris9/zzzzzz.git\nd69e66d7c915b9682618b7f304b80cc0ae4c7809 HEAD\n....\nbb944682f7f65272137de74ed18605e49257356c refs/tags/v0.1.6\n771a930dc0ba86769d6862bc4dc100acc50170fa refs/tags/v0.1.6^{}\na72251d945353a360087eb78ee75287c38a1c0e6 refs/tags/v0.1.7\nd69e66d7c915b9682618b7f304b80cc0ae4c7809 refs/tags/v0.1.7^{}\n\nI create tags with\ngit tag -a v0.1.8 -m \"tag message\"\ngit push --tags\n\nFrom the examples of git-ls-remote man page there are no such duplicate tags, so maybe I'm doing something wrong?" }, { "role": "assistant", "content": "There are 2 types of tags:\n\nlightweight - merely refs that point to some object (like a commit).\nannotated - a separate git object by themselves, and store a lot more information like author, committer, a commit message, etc.\n\nWhen you used git tag -a to create a tag, git would have created an annotated tag for you.\nThe ^{} is the syntax used to dereference a tag. It is described in gitrevisions.\n\nWhen used with tag objects, git would recursively dereference the tag until it finds a non-tag object.\n\nWhen used with non-tag objects, it doesn't do anything and is equivalent to skipping the ^{}\n\n\nThe refs/tags/v0.1.6 ref in your repository points to the tag object bb944682f7f65272137de74ed18605e49257356c, which in turn points to 771a930dc0ba86769d6862bc4dc100acc50170fa (a non-tag object) which I'm guesssing is storing the commit information when you created the tag.\nSo when you do refs/tags/v0.1.6^{}, git is going to dereference the tag and resolve it to 771a930dc0ba86769d6862bc4dc100acc50170fa - the non-tag object.\nThere is also a git show-ref command that can be used to list only tags, and optionally dereference as follows, and in your case should produce the following output:\n$ git show-ref --tags\nbb944682f7f65272137de74ed18605e49257356c refs/tags/v0.1.6\na72251d945353a360087eb78ee75287c38a1c0e6 refs/tags/v0.1.7\n\n$ git show-ref --tags --dereference\nbb944682f7f65272137de74ed18605e49257356c refs/tags/v0.1.6\n771a930dc0ba86769d6862bc4dc100acc50170fa refs/tags/v0.1.6^{}\na72251d945353a360087eb78ee75287c38a1c0e6 refs/tags/v0.1.7\nd69e66d7c915b9682618b7f304b80cc0ae4c7809 refs/tags/v0.1.7^{}\n\nTo confirm this, you can use git show command to give you more details about the git object.\nThis is the information from one of my test git repositories.\n$ git show 43f9a98886ba873c0468c608f24c408b9991414f\ntag v0.1\nTagger: Ash <tuxdude@OptimusPrime>\nDate: Sun Jul 15 00:14:43 2012 -0700\n\nTagging Stable repo 0.1 :)\n-----BEGIN PGP SIGNATURE-----\n<PGP-SIGNATURE>\n-----END PGP SIGNATURE-----\n\ncommit e55df25f2321a6b2c9a02fa80ccba7cbe3c38c08\nMerge: 796efcd 58e3a4d\nAuthor: Ash <tuxdude@OptimusPrime>\nDate: Sun Jul 15 00:02:44 2012 -0700\n\n Merge branch 'dev' into 'master' for stable 0.1.\n\n$ git show e55df25f2321a6b2c9a02fa80ccba7cbe3c38c08\ncommit e55df25f2321a6b2c9a02fa80ccba7cbe3c38c08\nMerge: 796efcd 58e3a4d\nAuthor: Ash <tuxdude@OptimusPrime>\nDate: Sun Jul 15 00:02:44 2012 -0700\n\n Merge branch 'dev' into 'master' for stable 0.1." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Undo a merge by pull request?\nSomeone accepted a pull request which they shouldn't have. Now we have a bunch of broken code merged in. How do you undo a pull request? I was just going to revert the changes to the commit just before the merge, but I noticed that it merged in a bunch of commits. So now there are all these commits from this person from days before the merge. How do you undo this?" }, { "role": "assistant", "content": "There is a better answer to this problem, though I could just break this down step-by-step. \nYou will need to fetch and checkout the latest upstream changes like so, e.g.:\ngit fetch upstream\ngit checkout upstream/master -b revert/john/foo_and_bar\n\nTaking a look at the commit log, you should find something similar to this:\n\ncommit b76a5f1f5d3b323679e466a1a1d5f93c8828b269\nMerge: 9271e6e a507888\nAuthor: Tim Tom <[email protected]>\nDate: Mon Apr 29 06:12:38 2013 -0700\n\n Merge pull request #123 from john/foo_and_bar\n\n Add foo and bar\n\ncommit a507888e9fcc9e08b658c0b25414d1aeb1eef45e\nAuthor: John Doe <[email protected]>\nDate: Mon Apr 29 12:13:29 2013 +0000\n\n Add bar\n\ncommit 470ee0f407198057d5cb1d6427bb8371eab6157e\nAuthor: John Doe <[email protected]>\nDate: Mon Apr 29 10:29:10 2013 +0000\n\n Add foo\n\n\nNow you want to revert the entire pull request with the ability to unrevert later.\nTo do so, you will need to take the ID of the merge commit.\nIn the above example the merge commit is the top one where it says \"Merged pull request #123...\".\nDo this to revert the both changes (\"Add bar\" and \"Add foo\") and you will end up with in one commit reverting the entire pull request which you can unrevert later on and keep the history of changes clean:\ngit revert -m 1 b76a5f1f5d3b323679e466a1a1d5f93c8828b269" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Generating statistics from Git repository [closed]\nClosed. This question is seeking recommendations for software libraries, tutorials, tools, books, or other off-site resources. It does not meet Stack Overflow guidelines. It is not currently accepting answers.\n \n \n\n\n\n\n\n\n\n\n\n\n\n We don’t allow questions seeking recommendations for software libraries, tutorials, tools, books, or other off-site resources. You can edit the question so it can be answered with facts and citations.\n\n\nClosed 3 years ago.\n\n\nThe community reviewed whether to reopen this question last year and left it closed:\n\nOriginal close reason(s) were not resolved\n\n\n\n\n\n\n Improve this question\n \n\n\n\nI'm looking for some good tools/scripts that allow me to generate a few statistics from a git repository. I've seen this feature on some code hosting sites, and they contained information like...\n\ncommits per author\ncommits per day/week/year/etc.\nlines of code over time\ngraphs\n... much more\n\nBasically I just want to get an idea how much my project grows over time, which developer commits most code, and so on." }, { "role": "assistant", "content": "commits per author\n\ngit shortlog -s -n" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": ".gitignore: Ignore one specific directory and that one only [duplicate]\nThis question already has answers here:\n \n \n\n\n\n\nHow to exclude file only from root folder in Git\n\n (5 answers)\n \n\nClosed 11 years ago.\n\n\n\nI have this directory structure\n./bin/<java class files>\n./sometool/bin/<files for the tool>\n\n...as well as some other files and directories.\nIt seens that if I want to avoid tracking the java class files, I should add this to the .gitignore file:\nbin/\n\nHowever, it appears that this also ignores the path ./sometool/bin\nIs that correct, and if so, how do I get the behavior I want." }, { "role": "assistant", "content": "I think paths in .gitignore have their root at the project's root, so you may try /bin\nEDIT\nAnd by the way, this is normal behaviour from git." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-log - Show commit logs log.date" }, { "role": "assistant", "content": "Set the default date-time mode for the log command.\nSetting a value for log.date is similar to using git log 's --date option. See git-log for details. If the format is set to \"auto:foo\" and the pager is in use, format\n\"foo\" will be used for the date format. Otherwise, \"default\" will\nbe used." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git - the stupid content tracker git-reflog" }, { "role": "assistant", "content": "Manage reflog information" } ]