messages
listlengths
3
3
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-reset - Reset current HEAD to the specified state" }, { "role": "assistant", "content": "SYNOPSIS git reset [-q] [<tree-ish>] [--] <pathspec>…​ git reset [-q] [--pathspec-from-file=<file> [--pathspec-file-nul]] [<tree-ish>] git reset (--patch | -p) [<tree-ish>] [--] [<pathspec>…​] git reset [--soft | --mixed [-N] | --hard | --merge | --keep] [-q] [<commit>]" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-diff - Show changes between commits, commit and working tree, etc diff.statNameWidth" }, { "role": "assistant", "content": "Limit the width of the filename part in --stat output. If set, applies\nto all commands generating --stat output except format-patch." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Delete forked repo from GitHub\nI'm starting with git and GitHub and there's a project I'm watching on GitHub. I unintentionally clicked to fork it. Now it appears as a new project to me.\nI have some doubts about it:\n\nI know if commit or do another thing to my forked repo, it will be updated, but the updated code will take effect only after the project's author request the pull. Right?\nIf I go to admin panel on GitHub there's a delete option. If I delete it as the option above, will it make any effect in the original one or not?\n\nI'd like to delete it. By now I'm just studying the code and don't really need the fork." }, { "role": "assistant", "content": "By far the easiest way is to log in GitHub account:\n\nClick to your repository for example yourUsername/yourRepository for example mbaric/zpropertyz.\nThen in the main toolbar of GitHub click on Settings\nScroll to the bottom of the page to the section called Danger Zone and you will find Delete this repository button\nWhen you click it another pop up will appear here you need to type in your Github username and the name of your repository in this format gitHubUsername/nameOfTheRepository and click on the button below which says: I understand the consequences, delete the repository\nIf you are having trouble doing it, below are the images that can be checked…\n\n2020-01-15 - Here are images. Enjoy." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Why does \"git difftool\" not open the tool directly?\nI configured git like this:\ngit config --global diff.tool meld\n\nWhen I run: \ngit difftool\n\nI get the following message:\nViewing: 'hello.txt'\nHit return to launch 'meld': \n\nThen, if I press Enter, meld will launch.\nHow can I disable this message, so that meld will be launched straight away after typing git difftool?" }, { "role": "assistant", "content": "There's also an option:\ndifftool.prompt\n Prompt before each invocation of the diff tool.\n\nThe following command turns off the prompt globally (for all repos):\ngit config --global difftool.prompt false\n\nWhich is like writing in ~/.gitconfig:\n(or in %HOMEDRIVE%%HOMEPATH%\\.gitconfig)\n[difftool]\n prompt = false" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-commit-tree - Create a new commit object" }, { "role": "assistant", "content": "SYNOPSIS git commit-tree <tree> [(-p <parent>)…​] git commit-tree [(-p <parent>)…​] [-S[<keyid>]] [(-m <message>)…​]\n\t\t [(-F <file>)…​] <tree>" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-log - Show commit logs --ancestry-path[=<commit>]" }, { "role": "assistant", "content": "When given a range of commits to display (e.g. commit1..commit2 or commit2 ^commit1 ), only display commits in that range\nthat are ancestors of <commit>, descendants of <commit>, or\n<commit> itself. If no commit is specified, use commit1 (the\nexcluded part of the range) as <commit>. Can be passed multiple\ntimes; if so, a commit is included if it is any of the commits\ngiven or if it is an ancestor or descendant of one of them." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-log - Show commit logs plain" }, { "role": "assistant", "content": "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." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-apply - Apply a patch to files and/or to the index apply.ignoreWhitespace" }, { "role": "assistant", "content": "When set to change , tells git apply to ignore changes in\nwhitespace, in the same way as the --ignore-space-change option.\nWhen set to one of: no, none, never, false, it tells git apply to\nrespect all whitespace differences.\nSee git-apply ." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git - the stupid content tracker git-prune-packed" }, { "role": "assistant", "content": "Remove extra objects that are already in pack files" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Git keeps prompting me for a password\nI've been using Git for a while now, but the constant requests for a password are starting to drive me up the wall.\nI'm using Mac OS X and GitHub, and I set up Git and my SSH keys as instructed by GitHub's Set Up Git page. \nI've also added the github SSH key to my Mac OS X keychain, as mentioned on GitHub's SSH key passphrases page. My public key is registered with Git.\nNevertheless, every time I try to Git pull, I have to enter my username and password. Is there something other than an SSH key that I need to set up for this?" }, { "role": "assistant", "content": "I think you may have the wrong Git repository URL. \nOpen .git/config and find the [remote \"origin\"] section. Make sure you're using the SSH one:\nssh://[email protected]/username/repo.git\n\nYou can see the SSH URL in the main page of your repository if you click Clone or download and choose ssh.\nAnd NOT the https or git one:\nhttps://github.com/username/repo.git\ngit://github.com/username/repo.git\n\nYou can now validate with just the SSH key instead of the username and password. \nIf Git complains that 'origin' has already been added, open the .config file and edit the url = \"...\" part after [remote origin] as url = ssh://github/username/repo.git\n\nThe same goes for other services. Make sure the address looks like: protocol://something@url\nE.g. .git/config for Azure DevOps:\n[remote \"origin\"]\n url = https://[email protected]/mystore/myproject/\n fetch = +refs/heads/*:refs/remotes/origin/*" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-config - Get and set repository or global options branch.<name>.pushRemote" }, { "role": "assistant", "content": "When on branch <name>, it overrides branch.<name>.remote for\npushing. It also overrides remote.pushDefault for pushing\nfrom branch <name>. When you pull from one place (e.g. your\nupstream) and push to another place (e.g. your own publishing\nrepository), you would want to set remote.pushDefault to\nspecify the remote to push to for all branches, and use this\noption to override it for a specific branch." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-am - Apply a series of patches from a mailbox --empty=(drop|keep|stop)" }, { "role": "assistant", "content": "How to handle an e-mail message lacking a patch: drop The e-mail message will be skipped. keep An empty commit will be created, with the contents of the e-mail\nmessage as its log. stop The command will fail, stopping in the middle of the current am session. This is the default behavior." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Can't push from Git Bash: Could not find UI helper 'GitHub.UI'\nAfter a fresh install, I could clone the repository, make changes and commits, but when I try to push I get the following warning:\n\nwarning: could not find UI helper 'GitHub.UI'\n\nAfter this, the process seems to still be running, but it gets stuck until I press Ctrl + C it.\nI couldn't find this error online.\nI can push from GitHub Desktop." }, { "role": "assistant", "content": "Maybe, there is some kind of issue in the latest update of Git v(2.39.0). However, you can get rid of this by installing the previous version of Git v(2.38.1).\nFollow these few steps to solve this issue:\n\nUninstall the currently installed Git.\nGo to Git for Windows 2.38.1 to download the Git v(2.38.1)\nInstall the Git v(2.38.1)\n\nDone!" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Git merge two local branches\nI have branch Master, branchA and branchB.\nNow I'm working in the branchA and I need to merge branchA with branchB and proceed my work in the branchA. All files are comitted in the branchA and branchB.\nWhat's the fast way to implement it?" }, { "role": "assistant", "content": "If I understood your question, you want to merge branchB into branchA. To do so,\nfirst checkout branchA like below,\ngit checkout branchA\n\nThen execute the below command to merge branchB into branchA:\ngit merge branchB\n\nYou can also condense this into one liner:\ngit merge branchA branchB" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Hard reset of a single file\nHow do I discard the changes to a single file and overwrite it with a fresh HEAD copy? I want to do git reset --hard to only a single file." }, { "role": "assistant", "content": "To reset both the working copy of my-file.txt and its state in the Git index to that of HEAD:\ngit checkout HEAD -- my-file.txt\n\n-- means \"treat every argument after this point as a filename\". More details in this answer. Thanks to VonC for pointing this out." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "What is a back-merge\nI’ve watched some videos on the git-flow scripts and one term that comes up is “back merge” - e.g. hotfix is merged into master and back merged into develop.\nI’m assuming back merge is a concept and not a native git command. What exact commands comprise a back merge operation?" }, { "role": "assistant", "content": "The use of the term \"back merge\" is usually somewhat arbitrary. \nIt just means to do a merge, like any other, but in a direction that is \"backwards\" compared to the normal flow of the branching conventions. If you visualize branches arranged like\nmaster hotfix release dev feature\n | | | | |\n | | | | |\n | | | | |\n | | | | |\n\nthen changes normally \"flow\" from right to left - feature to dev to release to master. But while hotfixes are pretty far left - they get created from master - they still have to be merged \"to the right\" into dev, so some people describe that as merging backwards, or back-merging.\nIn my opinion, that's not the most compelling use of the term, because it can be read to imply that the opposite merge (from dev to a hotfix branch) were a \"forward merge\" - but in fact that's something that shouldn't be done. In this case the direction being \"backward\" is more about the general flow of changes if you visualize the branches in a particular way as above.\nA more compelling use of the term is when you have a long-lived feature branch (which itself is something of an anti-pattern in agile processes that are likely to use gitflow; but sometimes you may need one). In that case you periodically should update your long-lived feature from dev, so that the two don't deviate too much leading to a disaster of a merge conflict later. (And this opens up a whole can of worms about \"unnecessary\" merges, what makes a good history, and git rerere... but I digress.) That can clearly be called a back-merge because the opposite - merging your feature in to dev - is a normal, textbook use of merge in the branch model." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-cherry-pick - Apply the changes introduced by some existing commits git cherry-pick master~4 master~2" }, { "role": "assistant", "content": "Apply the changes introduced by the fifth and third last\ncommits pointed to by master and create 2 new commits with\nthese changes." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to handle your first Pull Request on GitHub?\n\nI'm relatively new to Git. My knowledge thus far includes git add push commit. That's about it, and until now it served me well enough. :)\nHowever this morning someone sent me a pull request, which as I've read means someone forked my repository, made some tweaks and is flagging me saying, \"Hey Sergio, I made some improvement. Consider them for the master branch.\"\nAm I correct?\nhttps://github.com/sergiotapia/CherryTomato/pulls\nIf so, how do I easily merge this users changes into the master branch of the repository? What commands do I need to fire? More importantly, can someone explain the process in layman terms to what has to happen?" }, { "role": "assistant", "content": "You have the right idea. if that set of changes looks useful to you then you probably want to merge it into your repository.\nGithub offers a nice guide to responding to pull requests: https://help.github.com/articles/using-pull-requests – I'd start with that and see if you have any more specific questions about the process." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to import a GIT non-Eclipse Java project into Eclipse?\nI have some problems importing a Java project into my workspace. I am following this tutorial - however I can not use the final Import existing projects step because the GIT repository I use does not include the Eclipse specific .project and .classpath files.\nUse the New Projects wizard\nTherefore the project is not recognizes as project and hence can not be imported. Therefore I tried my luck using the option Use the New Projects wizard and select \"Java Project\" in the next dialog. The problem is that this creates a new Java project without any content!\nThe project is also not connected to the GIT repository.\nEdit: This is a known bug of eGIT: Bug 324145 - Project import doesn't work for abitary project types - if you want this problem fixed vote for it...\nImport as general Project\nIf I use Import as general Project Eclipse always wants to use the external repository directory as project directory which is not what I want and additionally the created Project is not Java-enabled. \nTherefore I am asking why it is so complicated to import a Java project into Eclipse using eGIT?" }, { "role": "assistant", "content": "It is possible by first cloning the repository and then creating a General project based on that. Then you can convert it to Java project. Here is how:\n\nFirst go to File>Import...>Projects from GIT.\nIn the Select a Git Repository view you first press Clone. And follow instructions. This will create a local \"checkout\" of the repository to your computer. You can set the folder to be your workspace so it looks like any other of your eclipse projects. \nAfter you have cloned the repository you get back to Import-view. Now you can select the repository you just cloned from the list. \nClick Next and select Import as General Project. Now you have a git repository to eclipse. \nConvert it to Java project: Add nature and buildCommand elements from other Java project to your .project file:\n\nRelevant sections from .project:\n<buildSpec>\n <buildCommand>\n <name>org.eclipse.jdt.core.javabuilder</name>\n <arguments>\n </arguments>\n </buildCommand>\n</buildSpec>\n<natures>\n <nature>org.eclipse.jdt.core.javanature</nature>\n</natures>\n\nThen from Project>Properties>Java Build Path>Source add your source folders (and possible libraries).\nEdit: Added the conversion to Java project." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Write git commit message before 'git commit'\nI'm learning Git coming from Perforce.\nAs far as I can tell you must write the commit message in the same step as when you commit. Or am I missing how I might write the message earlier and have it hang around until I'm ready to commit.\nI really liked the workflow in perforce where you can edit the changelist description at any time, and then checkin when you're ready. Personally, I like to open the description many times and document as I code, or as I think of noteworthy things to point out.\nPossible with Git?" }, { "role": "assistant", "content": "Have a look at the -t <file> flag with git commit\nThis lets you specify a file to use as the basis for the commit message. The editor is still invoked but at least you can use a commit message which you create in advance.\nAlternatively, there is another workflow that you can use with git that might better suit your way of working:\nWith git you can work on a separate branch from the main line and make lots of small commits with their own messages. Although each of these commits by themselves may not solve the problem that you are working on, they do provide a way of saving the intermediate states of your work with the same sort of messages that you may have been updating in your commit message file.\nOnce you are ready to commit the sum of your work, you can use the rebase command and squash these commits together. Your editor will then be invoked with the all the individual messages that you used for the smaller commits which you can then edit together into a single message.\nThis is a lot easier than it sounds here, and is IMHO a more git-like approach." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Git repository broken after computer died\nMy computer went dead and now one of my git repositories is broken. When I try to checkout master it tells me:\nwarning: ignoring broken ref refs/heads/master.\nerror: Your local changes to the following files would be overwritten by checkout:\n com.vainolo.jdraw2d.releng.p2/pom.xml\nPlease, commit your changes or stash them before you can switch branches.\nAborting\n\nWhen I execute git stash I get:\nfatal: bad revision 'HEAD'\nfatal: bad revision 'HEAD'\nfatal: Needed a single revision\nYou do not have the initial commit yet\n\nSo... what can I do?\nUpdate\nOutput of git reflog:\nfatal: bad default revision 'HEAD'\n\nNot very promising... Output of git fsck:\nerror: Invalid HEAD\nChecking object directories: 100% (256/256), done.\nerror: unable to unpack 59551f96b4e87a1c14293c19eb548ce6fa1f196f header\nerror: inflateEnd: stream consistency error (no message)\nfatal: loose object 59551f96b4e87a1c14293c19eb548ce6fa1f196f (stored in .git/objects/59/551f96b4e87a1c14293c19eb548ce6fa1f196f) is corrupt" }, { "role": "assistant", "content": "I managed to recover through:\nrm .git/refs/remotes/origin/HEAD\ngit fetch --all" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Git pull command from different user\nI am working with my friend on a project the code of which is on Git. If I need to pull the changes from my friend's machine, can I pull it from my username/password using the following command without any issue?\ngit pull https://[email protected]/abc/theproject.git" }, { "role": "assistant", "content": "This command will help to pull from the repository as the different user:\ngit pull https://[email protected]/projectfolder/projectname.git master\n\nIt is a workaround, when you are using same machine that someone else used before you, and had saved credentials" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-cat-file - Provide contents or details of repository objects -t" }, { "role": "assistant", "content": "Instead of the content, show the object type identified by <object> ." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-log - Show commit logs --clear-decorations" }, { "role": "assistant", "content": "When specified, this option clears all previous --decorate-refs or --decorate-refs-exclude options and relaxes the default\ndecoration filter to include all references. This option is\nassumed if the config value log.initialDecorationSet is set to all ." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Changing file names in a Git repository\nHow does Git handle filename changes?\nWill a file name change be detected as a modification or will there be a \"lost\" file which needs to be removed and the new file needs to then be added with git add?" }, { "role": "assistant", "content": "It will automatically be detected as a modification and the \"new\" file will be added to the index, so you only need one command:\n$ git mv application.py newApplication.py\n$ git status\n# On branch buildServer\n# Changes to be committed:\n# (use \"git reset HEAD <file>...\" to unstage)\n#\n# renamed: application.py -> newApplication.py\n\nAnd a commit of course..." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-diff - Show changes between commits, commit and working tree, etc diff.renameLimit" }, { "role": "assistant", "content": "The number of files to consider in the exhaustive portion of\ncopy/rename detection; equivalent to the git diff option -l . If not set, the default value is currently 1000. This\nsetting has no effect if rename detection is turned off." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "What is the difference between `git fetch origin` and `git remote update origin`?\nIn response to a question about pulling one commit at a time from a git repository, I was recommended to use git remote update instead of git fetch. I have read both man pages but cannot say I understood either in its entirety.\nCan anyone explain to me how git fetch origin and get remote update origin behave differently?" }, { "role": "assistant", "content": "It makes no difference when used like this.\nremote update is a very high-level command - it supports grouped remotes (remotes.<group> = <list>), and updating all remotes (except those with remote.<name>.skipDefaultUpdate set), but not any of the more specific options of fetch. Under the hood, though, it does the exact same thing as fetch with the default options. \nThe answer recommending remote update instead of git fetch was actually recommending it without a remote name, just for the sake of fetching all, not just the one named as an argument. This is equivalent to git fetch --all.\nI should add the caveat that fetch and remote update didn't actually use the same codepath until v1.6.6.1 (released December 23 2009). Even before that, though, they did essentially the same thing, just using different code (possibly behaving slightly differently in corner cases, but I can't think of any off the top of my head)." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-mergetool - Run merge conflict resolution tools to resolve merge conflicts mergetool.<vimdiff variant>.layout" }, { "role": "assistant", "content": "Configure the split window layout for vimdiff’s <variant> , which is any of vimdiff , nvimdiff , gvimdiff .\nUpon launching git mergetool with --tool=<variant> (or without --tool if merge.tool is configured as <variant> ), Git will consult mergetool.<variant>.layout to determine the tool’s layout. If the\nvariant-specific configuration is not available, vimdiff 's is used as\nfallback. If that too is not available, a default layout with 4 windows\nwill be used. To configure the layout, see the BACKEND SPECIFIC HINTS section." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Git diff: is it possible to show ONLY changed lines\nI'm trying to get only new version of lines which have changed and not all the other info which git diff shows.\nFor:\ngit diff HEAD --no-ext-diff --unified=0 --exit-code -a --no-prefix\n\nIt shows:\ndiff --git file1 file2\nindex d9db605..a884b50 100644\n--- file1\n+++ file2\n@@ -16 +16 @@ bla bla bla\n-old text\n+new text\n\nwhat I want to see is only:\nnew text\n\nIs it possible?" }, { "role": "assistant", "content": "Only added lines does not make sense in all cases. If you replaced some block of text and you happend to include a single line which was there before, git has to match and guess. - Usually the output of git diff could be used as input for patch afterwards and is therefore meaningful. Only the added lines are not precisely defined as git has to guess in some cases.\nIf you nevertheless want it, you cannot trust a leading + sign alone. Maybe filtering all the green line is better:\ngit diff --color=always|perl -wlne 'print $1 if /^\\e\\[32m\\+\\e\\[m\\e\\[32m(.*)\\e\\[m$/'\n\nfor only deleted lines filter for all the red lines:\ngit diff --color=always|perl -wlne 'print $1 if /^\\e\\[31m-(.*)\\e\\[m$/'\n\nto inspect the color codes in the output you could use:\ngit diff --color=always|ruby -wne 'p $_'" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "TortoiseGit save user authentication / credentials\n\nIs there a way to save GITHUB's user credentials with TortoiseGit?\nIt prompts me the below dialog every time whenever I do a push/pull.\nI would like to save my user credential information somewhere like how I did with TortoiseSVN." }, { "role": "assistant", "content": "For TortoiseGit 1.8.1.2 or later, there is a GUI to switch on/off credential helper.\nIt supports git-credential-wincred and git-credential-winstore.\nTortoiseGit 1.8.16 add support for git-credential-manager (Git Credential Manager, the successor of git-credential-winstore)\nFor the first time you sync you are asked for user and password, you enter them and they will be saved to Windows credential store. It won't ask for user or password the next time you sync.\nTo use: Right click → TortoiseGit → Settings → Git → Credential. Select Credential helper: wincred - this repository only / wincred - current Windows user" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-diff - Show changes between commits, commit and working tree, etc --numstat" }, { "role": "assistant", "content": "Similar to --stat , but shows number of added and\ndeleted lines in decimal notation and pathname without\nabbreviation, to make it more machine friendly. For\nbinary files, outputs two - instead of saying 0 0 ." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "kubernetes pods/nodes is forbidden\n\nI'm using kubernetes on-prem\nWhile I build gitlab using kubernetes has some problem.\nI think it's related with serviceaccount or role-binding.\nbut couldn't find correct way\nI found these posts\nKubernetes log, User \"system:serviceaccount:default:default\" cannot get services in the namespace\nhttps://github.com/kubernetes/kops/issues/3551\nmy error logs\n==> /var/log/gitlab/prometheus/current <==\n2018-12-24_03:06:08.88786 level=error ts=2018-12-24T03:06:08.887812767Z caller=main.go:240 component=k8s_client_runtime err=\"github.com/prometheus/prometheus/discovery/kubernetes/kubernetes.go:372: Failed to list *v1.Node: nodes is forbidden: User \\\"system:serviceaccount:default:default\\\" cannot list resource \\\"nodes\\\" in API group \\\"\\\" at the cluster scope\"\n2018-12-24_03:06:08.89075 level=error ts=2018-12-24T03:06:08.890719525Z caller=main.go:240 component=k8s_client_runtime err=\"github.com/prometheus/prometheus/discovery/kubernetes/kubernetes.go:320: Failed to list *v1.Pod: pods is forbidden: User \\\"system:serviceaccount:default:default\\\" cannot list resource \\\"pods\\\" in API group \\\"\\\" at the cluster scope\"" }, { "role": "assistant", "content": "The issue is due to your default service account doesn't have the permission to get the nodes or pods at the cluster scope. The minimum cluster role and cluster role binding to resolve that is:\napiVersion: rbac.authorization.k8s.io/v1beta1\nkind: ClusterRole\nmetadata:\n name: prom-admin\nrules:\n# Just an example, feel free to change it\n- apiGroups: [\"\"]\n resources: [\"pods\", \"nodes\"]\n verbs: [\"get\", \"watch\", \"list\"]\n\n---\napiVersion: rbac.authorization.k8s.io/v1beta1\nkind: ClusterRoleBinding\nmetadata:\n name: prom-rbac\nsubjects:\n- kind: ServiceAccount\n name: default\nroleRef:\n kind: ClusterRole\n name: prom-admin\n apiGroup: rbac.authorization.k8s.io\n\nThe above cluster role provide permission to default service account to access any pods or nodes in any namespace.\nYou can change the cluster role to provide more permission to service account, if you want to grant access all permission to default service account then, replace resources: [\"*\"] in prom-admin\nHope this helps." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Latest Update brings Github error on pull, push, or sync\n\nIn Visual Studio 2019, we have been using the GitHub extension successfully since before release. Now, all of the sudden, when we push, pull, or sync, we receive the following in the Output window:\nWarning: 'C:\\ProgramData/Git/config' has a dubious owner: '(unknown)'.\nFor security reasons, it is therefore ignored.\nTo fix this, please transfer ownership to an admininstrator." }, { "role": "assistant", "content": "You should check if 'C:\\ProgramData/Git/config' actually exists. If it doesn't you can just create it and paste the following into the file:\n[core]\n symlinks = false\n autocrlf = true\n fscache = true\n[color]\n diff = auto\n status = auto\n branch = auto\n interactive = true\n[help]\n format = html\n[rebase]\n autosquash = true\n\nThis worked for me." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-rev-list - Lists commit objects in reverse chronological order --no-walk[=(sorted|unsorted)]" }, { "role": "assistant", "content": "Only show the given commits, but do not traverse their ancestors.\nThis has no effect if a range is specified. If the argument unsorted is given, the commits are shown in the order they were\ngiven on the command line. Otherwise (if sorted or no argument\nwas given), the commits are shown in reverse chronological order\nby commit time.\nCannot be combined with --graph ." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "AWS CodePipeline not able to access Organization's repositories\n\nI am trying to setup Continuous deployments pipelines in AWS Codepipeline.\nWhile creating a pipeline I provide \"Source provider\" as GitHub and then connect to GitHub. \nI am able to see my public repositories in \"Repository\" drop-down in create Pipeline page. But I am not able to see my Organization's private repositories in this drop-down.\nI have write access in Organization.\nHow can I make AWS Codepipeline have access to my organizations repositories." }, { "role": "assistant", "content": "On Github, follow this path.\n\nGo to your user profile (click the Avatar/icon).\nSettings.\nApplication from the menu.\nAuthorized OAuth Apps tab.\nSelect CodePipeline\nGrant Organization Access to it.\n\n***As of 2021" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Cannot launch Git GUI using Cygwin on Windows\nI used to launch Git GUI within my Cygwin console without any problems, but since I updated Cygwin I've got the following error message:\n$ git gui\nApplication initialization failed: no display name and no $DISPLAY environment variable\nError in startup script: invalid command name \"tk_messageBox\"\n while executing\n\"tk_messageBox -icon error -type ok -title \"git-gui: fatal error\" -message $err\"\n invoked from within\n\"if {[catch {package require Tcl 8.4} err]\n || [catch {package require Tk 8.4} err]\n} {\n catch {wm withdraw .}\n tk_messageBox \\\n -icon error \\\n -typ...\"\n (file \"/usr/lib/git-core/git-gui\" line 34)\n\nHow can I solve this?" }, { "role": "assistant", "content": "Cygwin's gitk and Git GUI require X11. This means you need to install some of the Cygwin X11 packages and set them up to be able to open the GUI.\nThis should get you up and running:\n\nRun the Cygwin installer again (download the relevant setup-*.exe again if you need to).\nAt the package list, select to install \"xinit\" under the X11 category. Click next, accept all the dependencies, and install.\nIn the Windows Start menu, you should have a new group: Cygwin-X. From there, run XWin Server.\nIn your Cygwin shell, run export DISPLAY=:0.0.\n\nYou'll need to repeat step 3 every time you reboot your computer, and step 4 every time you open a new Cygwin shell (or just run echo \"export DISPLAY=:0.0\" >>~/.profile to have it run automatically whenever you create a new shell).\nIn the comments, it seems some people are getting errors stating 'couldn't connect to display \":0.0\"'. If you get that, mouse over the X that should have appeared in your system tray (you may need to click the little up icon if the X icon has been hidden); the pop-up title should say something like \"Cygwin/X Server:1.0\". Use that \":1.0\" (or whatever you see) as the value for DISPLAY in step 4, rather than \":0.0\", making sure to include the colon.\nIf you have any other problems starting the X server, you will probably find you have a file called ~/.xsession-errors; check out the contents of that for what's going wrong. Also check whether you have a ~/.startxwinrc file, and try deleting it and seeing if that fixes the problem.\nFor the interested, the reason the X11 packages aren't installed automatically is that they're not technically needed: it's possible through somewhat convoluted means to use a different X11 server than the one Cygwin installs when you install the \"xinit\" package." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-diff - Show changes between commits, commit and working tree, etc no" }, { "role": "assistant", "content": "Do not ignore whitespace when performing move detection." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Git submodule inside of a submodule (nested submodules)\nIs it possible for a git submodule to be made of several other git submodules, and the super git repo to fetch the contents for each submodule?\nI have tried to do this using the obvious/naive approach of creating a git repo holding several submodules.\nThen adding this git repo to another git repo as a submodule.\nThen attempting to pull from the root directory of the super git repo by git submodule init and then git submodule update. But this fails to fetch the sub-submodules." }, { "role": "assistant", "content": "As mentioned in Retrospectively add --recursive to a git repo\ngit submodule update --init --recursive\n\nshould work." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Github for windows - ssh-agent.exe using high CPU + 100% disk?\n\nI've just installed Github for Windows on my Windows 8.1 machine and it appears to work fine except that my machine performance drops down dramatically.\nLooking at task manager I see that ssh-agent.exe is using a constant 25% CPU (no doubt 100% of one of my cores) and the disk usage is at 100%.\nI have had a look on the Internet but can't find any reference to what might be causing this.\nAny ideas what might be causing this and how to resolve it?\nUPDATE:\nI can kill the process and GitHub for Windows appears to keep working but the ssh-agent.exe process starts up again as soon as I close and restart Github for Windows." }, { "role": "assistant", "content": "Further to moggizx's comment in one of the other answers, I found this was influenced by SourceTree too.\nThe instance of ssh-agent.exe with the high CPU actually gets terminated when you close SourceTree. Restarting SourceTree does cause another ssh-agent process to be spawned, but the CPU is then idle." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-count-objects - Count unpacked number of objects and their disk consumption" }, { "role": "assistant", "content": "SYNOPSIS git count-objects [-v] [-H | --human-readable]" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-log - Show commit logs -X[<param1,param2,…​>] --dirstat[=<param1,param2,…​>]" }, { "role": "assistant", "content": "Output the distribution of relative amount of changes for each\nsub-directory. The behavior of --dirstat can be customized by\npassing it a comma separated list of parameters.\nThe defaults are controlled by the diff.dirstat configuration\nvariable (see git-config ).\nThe following parameters are available: changes Compute the dirstat numbers by counting the lines that have been\nremoved from the source, or added to the destination. This ignores\nthe amount of pure code movements within a file. In other words,\nrearranging lines in a file is not counted as much as other changes.\nThis is the default behavior when no parameter is given. lines 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. files Compute the dirstat numbers by counting the number of files changed.\nEach changed file counts equally in the dirstat analysis. This is\nthe computationally cheapest --dirstat behavior, since it does\nnot have to look at the file contents at all. cumulative Count changes in a child directory for the parent directory as well.\nNote that when using cumulative , the sum of the percentages\nreported may exceed 100%. The default (non-cumulative) behavior can\nbe specified with the noncumulative parameter. <limit> An integer parameter specifies a cut-off percent (3% by default).\nDirectories contributing less than this percentage of the changes\nare not shown in the output. Example: The following will count changed files, while ignoring\ndirectories with less than 10% of the total amount of changed files,\nand accumulating child directory counts in the parent directories: --dirstat=files,10,cumulative ." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-rev-parse - Pick out and massage parameters --sq" }, { "role": "assistant", "content": "Usually the output is made one line per flag and\nparameter. This option makes output a single line,\nproperly quoted for consumption by shell. Useful when\nyou expect your parameter to contain whitespaces and\nnewlines (e.g. when using pickaxe -S with git diff-* ). In contrast to the --sq-quote option,\nthe command input is still interpreted as usual." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-config - Get and set repository or global options rerere.enabled" }, { "role": "assistant", "content": "Activate recording of resolved conflicts, so that identical\nconflict hunks can be resolved automatically, should they be\nencountered again. By default, git-rerere is\nenabled if there is an rr-cache directory under the $GIT_DIR , e.g. if \"rerere\" was previously used in the\nrepository." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-apply - Apply a patch to files and/or to the index --apply" }, { "role": "assistant", "content": "If you use any of the options marked \"Turns off apply \" above, git apply reads and outputs the\nrequested information without actually applying the\npatch. Give this flag after those flags to also apply\nthe patch." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git - the stupid content tracker GIT_TRACE_CURL" }, { "role": "assistant", "content": "Enables a curl full trace dump of all incoming and outgoing data,\nincluding descriptive information, of the git transport protocol.\nThis is similar to doing curl --trace-ascii on the command line.\nSee GIT_TRACE for available trace output options." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to merge remote master to local branch\nI have a local branch of a project (\"configUpdate\") that I've forked from somebody else's project and I've done a load of changes on it and would like to merge the changes they've made in to my local branch.\nI've tried \ngit pull --rebase origin configUpdate\n\nbut it hasn't grabbed the latest changes - how can I merge the two? (also for bonus points what did I do with the pull --rebase command?)" }, { "role": "assistant", "content": "From your feature branch (e.g configUpdate) run:\ngit fetch\ngit rebase origin/master\n\nOr the shorter form:\ngit pull --rebase\n\n\nWhy this works:\n\ngit merge branchname takes new commits from the branch branchname, and adds them to the current branch. If necessary, it automatically adds a \"Merge\" commit on top.\ngit rebase branchname takes new commits from the branch branchname, and inserts them \"under\" your changes. More precisely, it modifies the history of the current branch such that it is based on the tip of branchname, with any changes you made on top of that.\ngit pull is basically the same as git fetch; git merge origin/master.\ngit pull --rebase is basically the same as git fetch; git rebase origin/master.\n\nSo why would you want to use git pull --rebase rather than git pull? Here's a simple example:\n\nYou start working on a new feature.\nBy the time you're ready to push your changes, several commits have been pushed by other developers.\nIf you git pull (which uses merge), your changes will be buried by the new commits, in addition to an automatically-created merge commit.\nIf you git pull --rebase instead, git will fast forward your master to upstream's, then apply your changes on top." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-log - Show commit logs %gE" }, { "role": "assistant", "content": "reflog identity email (respecting .mailmap, see git-shortlog or git-blame )" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to convert a file tracked by git to git-lfs?\nHow do I convert a single file (e.g. a png) which is already committed as a regular object to git-lfs?\nI do not want to migrate the whole repo and I also do not want to rewrite the history of the repo." }, { "role": "assistant", "content": "git lfs track will begin tracking a new file or an existing file that is already checked in to your repository. When you run git lfs track and then commit that change, it will update the file, replacing it with the LFS pointer contents.\nHere I have a repository with a PNG checked in \"normally\" (without using LFS):\nC:\\Temp\\LFS>dir\n Volume in drive C is Windows\n Volume Serial Number is A442-238A\n\n Directory of C:\\Temp\\LFS\n\n11/09/2017 11:12 AM <DIR> .\n11/09/2017 11:12 AM <DIR> ..\n10/20/2017 01:22 PM 48,517 VSTS.png\n 1 File(s) 48,517 bytes\n 2 Dir(s) 284,988,436,480 bytes free\n\nC:\\Temp\\LFS>git status\nOn branch master\nnothing to commit, working tree clean\n\nI don't need to make any changes to the PNG, I can simply git lfs track it:\nC:\\Temp\\LFS>git lfs track VSTS.png\nTracking \"VSTS.png\" \n\nAnd git-lfs has done everything it needs to - it's set up the tracking information in the .gitattributes, and now git knows that VSTS.png is modified:\nC:\\Temp\\LFS>git status\nOn branch master\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: VSTS.png\n\nUntracked files:\n (use \"git add <file>...\" to include in what will be committed)\n\n .gitattributes\n\nno changes added to commit (use \"git add\" and/or \"git commit -a\")\n\nNow if we git add the file, it will add the LFS object to the repository, and we can commit the changes. What will actually be done is that git-lfs will enqueue that file for LFS storage, and replace the file in the repository with a pointer file, telling LFS where to find the actual blob, which we can see if we inspect the contents of the repository's stage:\nC:\\Temp\\LFS>git add VSTS.png\n\nC:\\Temp\\LFS>git cat-file blob :0:VSTS.png\nversion https://git-lfs.github.com/spec/v1\noid sha256:6075cd5130bdbe29a037cba93dc22158d1443b22b2ffb6acb0d1d541838f26b9\nsize 48517\n\n(That's the actual LFS metadata, instead of the PNG file.)\nNow when you commit and push these changes, the file will be in LFS. This is not retroactive however - you are not rewriting the repository's history, so previous versions of the PNG will still be in the repository directly (not in LFS) and will still be taking up space.\nIf you did want to rewrite the history, I would recommend using the BFG Repo Cleaner." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git - the stupid content tracker" }, { "role": "assistant", "content": "SECURITY Some configuration options and hook files may cause Git to run arbitrary\nshell commands. Because configuration and hooks are not copied using git clone , it is generally safe to clone remote repositories with\nuntrusted content, inspect them with git log , and so on. However, it is not safe to run Git commands in a .git directory (or\nthe working tree that surrounds it) when that .git directory itself\ncomes from an untrusted source. The commands in its config and hooks\nare executed in the usual way. By default, Git will refuse to run when the repository is owned by\nsomeone other than the user running the command. See the entry for safe.directory in git-config . While this can help protect\nyou in a multi-user environment, note that you can also acquire\nuntrusted repositories that are owned by you (for example, if you\nextract a zip file or tarball from an untrusted source). In such cases,\nyou’d need to \"sanitize\" the untrusted repository first. If you have an untrusted .git directory, you should first clone it\nwith git clone --no-local to obtain a clean copy. Git does restrict\nthe set of options and hooks that will be run by upload-pack , which\nhandles the server side of a clone or fetch, but beware that the\nsurface area for attack against upload-pack is large, so this does\ncarry some risk. The safest thing is to serve the repository as an\nunprivileged user (either via git-daemon , ssh, or using\nother tools to change user ids). See the discussion in the SECURITY section of git-upload-pack ." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to pull NPM dependency from private GitLab Git repo during GitLab CI build\n\nI have a job in my .gitlab-ci.yml file which does an npm install like so:\ntest:\n image: node:10\n script:\n - npm install\n - npm test\n\nThe problem is that I'm referencing a private GitLab repo in my package.json:\n\"dependencies\": {\n \"internal-dep\": \"git+https://gitlab.com/Company/internal-dep.git\",\n ...\n\nThe npm install command works locally, since I'm already authed against GitLab, but fails on GitLab CI. How do I get internal-dep to resolve successfully on GitLab CI?" }, { "role": "assistant", "content": "There are two approaches I've found that allow Git to auth successfully against GitLab during the npm install step (which uses Git under the hood to access this dependency).\nFirst approach, as shown in this .gitlab-ci.yml job:\ntest:\n image: node:10\n script:\n - echo -e \"machine gitlab.com\\nlogin gitlab-ci-token\\npassword ${CI_JOB_TOKEN}\" > ~/.netrc\n - npm install\n - npm test\n\nSecond approach, which also seems to work:\ntest:\n image: node:10\n script:\n - git config --global url.\"https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.com/\".insteadOf https://gitlab.com/\n - npm install\n - npm test" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-update-index - Register file contents in the working tree to the index" }, { "role": "assistant", "content": "USING --REFRESH --refresh does not calculate a new sha1 file or bring the index\nup to date for mode/content changes. But what it does do is to\n\"re-match\" the stat information of a file with the index, so that you\ncan refresh the index for a file that hasn’t been changed but where\nthe stat entry is out of date. For example, you’d want to do this after doing a git read-tree , to link\nup the stat index details with the proper files." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-diff-index - Compare a tree to the working tree or index --raw" }, { "role": "assistant", "content": "Generate the diff in raw format.\nThis is the default." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Using Git how do I find changes between local and remote\nHere are two different questions but I think they are related.\n\nWhen using Git, how do I find which changes I have committed locally, but haven't yet pushed to a remote branch? I'm looking for something similar to the Mercurial command hg outgoing.\nWhen using Git, how do I find what changes a remote branch has prior to doing a pull? I'm looking for something similar to the Mercurial command hg incoming.\n\nFor the second: is there a way to see what is available and then cherry-pick the changes I want to pull?" }, { "role": "assistant", "content": "Starting with Git 1.7.0, there is a special syntax that allows you to generically refer to the upstream branch: @{u} or @{upstream}.\nTo mimic hg incoming:\ngit log ..@{u}\n\nTo mimic hg outgoing:\ngit log @{u}..\n\nI use the following incoming and outgoing aliases to make the above easier to use:\ngit config --global alias.incoming '!git remote update -p; git log ..@{u}'\ngit config --global alias.outgoing 'log @{u}..'" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-config - Get and set repository or global options imap.preformattedHTML" }, { "role": "assistant", "content": "A boolean to enable/disable the use of html encoding when sending\na patch. An html encoded patch will be bracketed with <pre>\nand have a content type of text/html. Ironically, enabling this\noption causes Thunderbird to send the patch as a plain/text,\nformat=fixed email. Default is false ." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Unlink of file failed [duplicate]\nThis question already has answers here:\n \n \n\n\n\n\nUnlink of file Failed. Should I try again?\n\n (40 answers)\n \n\nClosed 2 years ago.\n\n\n\nI'm trying to do a git pull and I get the following error:\n\nUnlink of file 'lib/xxx.jar' failed. Should I try again? (y/n)\n\nNo matter if I select y or n it's not possible to get to a state where I can pull or push." }, { "role": "assistant", "content": "That usually means a process is still using that specific file (still has an handle on it)\n(on Windows, ProcessExplorer is good at tracking that kind of process)\nTry closing your other programs, and try again your git pull.\nNote that you have an alternative with the GIT_ASK_YESNO variable.\n\nUpdate January 2019:\nThat should be even more fixed, with Git 2.21 (Q1 2019), as \"git gc\" and \"git repack\" did not close the open packfiles that they found unneeded before removing them, which didn't work on a platform incapable of removing an open file.\nThis has been corrected.\nSee commit 5bdece0 (15 Dec 2018) by Johannes Schindelin (dscho).\n(Merged by Junio C Hamano -- gitster -- in commit 5104f8f, 18 Jan 2019) \n\ngc/repack: release packs when needed\nOn Windows, files cannot be removed nor renamed if there are still handles held by a process.\n To remedy that, we introduced the close_all_packs() function.\nEarlier, we made sure that the packs are released just before git gc is spawned, in case that gc wants to remove no-longer needed packs.\nBut this developer forgot that gc itself also needs to let go of packs, e.g. when consolidating all packs via the --aggressive option.\nLikewise, git repack -d wants to delete obsolete packs and therefore needs to close all pack handles, too.\n\n\nUpdate January 2016\nThat should be fixed in Git 2.8 (March 2016) (and see Git 2.19, Q3 2018 below)\nSee commit d562102, commit dcacb1b, commit df617b5, commit 0898c96 (13 Jan 2016) by Johannes Schindelin (dscho).\n(Merged by Junio C Hamano -- gitster -- in commit 3c80940, 26 Jan 2016) \n\nfetch: release pack files before garbage-collecting\nBefore auto-gc'ing, we need to make sure that the pack files are released in case they need to be repacked and garbage-collected. \nMany codepaths that run \"gc --auto\" before exiting kept packfiles mapped and left the file descriptors to them open, which was not friendly to systems that cannot remove files that are open.\n They now close the packs before doing so.\n\nThat fixes git-for-widows issue 500.\nLooking at the test used to validate that new approach, a possible workaround (since Git 2.8 is not yet out) would be to raise artificially gc.autoPackLimit.\ngit config gc.autoPackLimit 10000\ngit fetch\ngit config gc.autoPackLimit 50 # default value\n\n\ngit 2.8.4 (June 2016) does mention issue 755 which should also alleviate the issue (commit 2db0641):\n\nMake sure temporary file handles are not inherited by child processes\n\n\nActually, git-for-windows issue 500 mentioned above is really fixed with Git 2.19, Q3 2018.\nSee \"Git - Unlink of file .idx and .pack failed (The only process owned handle to this file is git.exe)\"" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-log - Show commit logs --cherry-pick" }, { "role": "assistant", "content": "Omit any commit that introduces the same change as\nanother commit on the “other side” when the set of\ncommits are limited with symmetric difference. For example, if you have two branches, A and B , a usual way\nto list all commits on only one side of them is with --left-right (see the example below in the description of\nthe --left-right option). However, it shows the commits that were\ncherry-picked from the other branch (for example, “3rd on b” may be\ncherry-picked from branch A). With this option, such pairs of commits are\nexcluded from the output." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-branch - List, create, or delete branches branch.autoSetupRebase" }, { "role": "assistant", "content": "When a new branch is created with git branch , git switch or git checkout that tracks another branch, this variable tells Git to set\nup pull to rebase instead of merge (see \"branch.<name>.rebase\").\nWhen never , rebase is never automatically set to true.\nWhen local , rebase is set to true for tracked branches of\nother local branches.\nWhen remote , rebase is set to true for tracked branches of\nremote-tracking branches.\nWhen always , rebase will be set to true for all tracking\nbranches.\nSee \"branch.autoSetupMerge\" for details on how to set up a\nbranch to track another branch.\nThis option defaults to never." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-log - Show commit logs --invert-grep" }, { "role": "assistant", "content": "Limit the commits output to ones with a log message that do not\nmatch the pattern specified with --grep=<pattern> ." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Why doesn't git commit -a add new files?\nI'm a bit new to git, and I fail to understand why git commit -a only stages changed and deleted files but not new files.\nCan anyone explain why is it like this, and why there is no other commit flag to enable adding files and committing in one command?\nBTW, hg commit -A adds both new and deleted files to the commit" }, { "role": "assistant", "content": "Git is about tracking changes. It relies on you to tell it which files are important enough to track. You can achieve the desired affect like so: \ngit add . ;git commit -a\n\nMake sure your .gitignore file is updated." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git - the stupid content tracker git-verify-tag" }, { "role": "assistant", "content": "Check the GPG signature of tags" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-apply - Apply a patch to files and/or to the index" }, { "role": "assistant", "content": "DESCRIPTION Reads the supplied diff output (i.e. \"a patch\") and applies it to files.\nWhen running from a subdirectory in a repository, patched paths\noutside the directory are ignored.\nWith the --index option, the patch is also applied to the index, and\nwith the --cached option, the patch is only applied to the index.\nWithout these options, the command applies the patch only to files,\nand does not require them to be in a Git repository. This command applies the patch but does not create a commit. Use git-am to create commits from patches generated by git-format-patch and/or received by email." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Is there a way to put multiple projects in a git repository? [closed]\nClosed. This question is opinion-based. It is not currently accepting answers.\n \n \n\n\n\n\n\n\n\n\n\n\n\nWant to improve this question? Update the question so it can be answered with facts and citations by editing this post.\n\n\nClosed 5 years ago.\n\n\n\n\n\n\n\n Improve this question\n \n\n\n\nFor some reason, I only have one repository to use.\nBut I have multiple projects including java projects, PHP scripts and Android apps projects.\nNow my problem is, I have to put them to different sub-folders inside the repository\nI use different IDEs, You know, each IDE can have a workspace of itself.\nIs there a simple way (say, by design and not by opinion) to solve the problem?" }, { "role": "assistant", "content": "While most people will tell you to just use multiple repositories, I feel it's worth mentioning there are other solutions.\nSolution 1\nA single repository can contain multiple independent branches, called orphan branches. Orphan branches are completely separate from each other; they do not share histories.\ngit checkout --orphan BRANCHNAME\n\nThis creates a new branch, unrelated to your current branch. Each project should be in its own orphaned branch.\nNow for whatever reason, git needs a bit of cleanup after an orphan checkout.\nrm .git/index\nrm -r *\n\nMake sure everything is committed before deleting\nOnce the orphan branch is clean, you can use it normally.\nSolution 2\nAvoid all the hassle of orphan branches. Create two independent repositories, and push them to the same remote. Just use different branch names for each repo.\n# repo 1\ngit push origin master:master-1\n\n# repo 2\ngit push origin master:master-2" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-rebase - Reapply commits on top of another base tip --keep-base" }, { "role": "assistant", "content": "Set the starting point at which to create the new commits to the\nmerge base of <upstream> and <branch> . Running git rebase --keep-base <upstream> <branch> is equivalent to\nrunning git rebase --reapply-cherry-picks --no-fork-point --onto <upstream>...<branch> <upstream> <branch> . This option is useful in the case where one is developing a feature on\ntop of an upstream branch. While the feature is being worked on, the\nupstream branch may advance and it may not be the best idea to keep\nrebasing on top of the upstream but to keep the base commit as-is. As\nthe base commit is unchanged this option implies --reapply-cherry-picks to avoid losing commits. Although both this option and --fork-point find the merge base between <upstream> and <branch> , this option uses the merge base as the starting\npoint on which new commits will be created, whereas --fork-point uses\nthe merge base to determine the set of commits which will be rebased. See also INCOMPATIBLE OPTIONS below." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "README extension for Python projects\n\nPython packaging tools expect that our readme file should be named README or README.txt. But if we follow this convention, GitHub displays it as plain text in the project page which is not pretty. (unlike the beautiful HTML version when named as README.rst)\nIs there any technique to make both PyPI and GitHub happy about README." }, { "role": "assistant", "content": "PyPI has no requirement that the file is called README or README.txt, so just call it README.rst. In fact, PyPI will not as far as I'm aware look in your package at all (although I could be wrong there, I haven't studied the code or anything), the text that ends up ion the front is the long_description parameter.\nThen in your setup.py, you do something like this:\nsetup(name='Your module name',\n version=\"1.0\",\n description=\"Whatever, dude.\",\n long_description=open('docs/README.rst', 'rt').read()\n)" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How do you annotate a branch?\nIs there any way to annotate a branch? It would be nice to be able to do something like:\n\n$ git notes add branch-name -m 'This branch is for whatever'\n\nbut that of course is not terribly helpful, since the note applies to the current head of the branch rather than the branch itself. \nAn easy workaround is to drop a README.branch-name in the repository, but that seems clumsy. Slightly more elegant is to have an orphaned branch containing nothing but README.branch-names. I'm looking for a way to record what the purpose of the branch is other than just putting it in the commit message for the \"first\" commit of the branch. I put \"first\" in quotes because it's not always clear what is meant by that, which is the reason it is inconvenient to put the discussion in a commit message. It's often difficult to find the commit in which such a message is recorded." }, { "role": "assistant", "content": "This would be a totally different approach than git note but you could use git config for this functionality.\n$ git config branch.<branch-name>.note 'This is what this branch is for'\n\nThis can be aliased to make the interface simpler (I'm guessing this can be improved but this is what I use):\n$ git config alias.branch-note '!git config branch.$(git symbolic-ref --short HEAD).note $( if [ $# -gt 0 ]; then $1; fi)'\n\nThis allows you to set the branch note like so (make sure you quote the note):\n$ git branch-note 'This is what this branch is for'\n\nYou can then retrieve the current branches note like this:\n$ git branch-note\nThis is what this branch is for\n\nAs an added benefit, config entries defined under the branch.<branch-name> namespace will follow branch renames and be automatically cleaned up if you delete the branch later. These superfluous config entries will only persist as long as the branch exists, at which time they will be automatically deleted.\nA downside to this approach is that you can only store one \"note\" per branch. Subsequent branch-note calls with an argument will overwrite the previous branch-note. You also don't get the benefit of storing the message in a trackable git object but maybe it will suffice for your purposes." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-diff - Show changes between commits, commit and working tree, etc -I<regex> --ignore-matching-lines=<regex>" }, { "role": "assistant", "content": "Ignore changes whose all lines match <regex>. This option may\nbe specified more than once." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Git: Cherry-Pick to working copy without commit\nI have several branches where I keep certain commits that I want to apply to my working copy every now and then. Initially I tried cherry-picking but I do not want to have the commit in the target branch later. \nSo I did cherry-pick + reset HEAD~1 --soft\nIs there something simpler like cherry-picking to working copy only?" }, { "role": "assistant", "content": "Use '-n' flag with the cherry-picking which is \"no commit\"\nSee here: http://git-scm.com/docs/git-cherry-pick\ngit cherry-pick -n <HASH>\n\nTo then unstage the staged changes\ngit reset" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "In git, how do I sync my tags against a remote server?\nIs there a way to keep my local git tags in lockstep with a remote's tags? That is -- not only get new tags when created (as usual, when fetch-ing/pull-ing), but also prune tags no longer on a remote and also delete existing tags when someone else git push -f's a tag.\nI know I can git fetch remotename followed by git remote prune remotename to achieve similar behaviour for branches." }, { "role": "assistant", "content": "...also prune tags no longer on a remote\n\ngit fetch gets with Git 2.17 (Q2 2018) an handy short-hand for getting\nrid of stale tags that are locally held.\nSee commit 6317972, commit 97716d2, commit e249ce0, commit 627a129, commit d0e0747, commit 2c72ed7, commit e1790f9, commit 59caf52, commit 82f34e0, commit 6fb23f5, commit ca3065e, commit bf16ab7, commit eca142d, commit 750d0da, commit 0711883, commit ce3ab21, commit aa59e0e (09 Feb 2018) by Ævar Arnfjörð Bjarmason (avar).\n(Merged by Junio C Hamano -- gitster -- in commit c1a7902, 06 Mar 2018)\n\nfetch: add a --prune-tags option and fetch.pruneTags config\n\n\nAdd a --prune-tags option to git-fetch, along with fetch.pruneTags config option and a -P shorthand (-p is --prune).\nThis allows for doing any of:\ngit fetch -p -P\ngit fetch --prune --prune-tags\ngit fetch -p -P origin\ngit fetch --prune --prune-tags origin\n\nOr simply:\ngit config fetch.prune true &&\ngit config fetch.pruneTags true &&\ngit fetch\n\nInstead of the much more verbose:\ngit fetch --prune origin 'refs/tags/*:refs/tags/*' '+refs/heads/*:refs/remotes/origin/*'\n\nBefore this feature it was painful to support the use-case of pulling\nfrom a repo which is having both its branches and tags deleted\nregularly, and have our local references to reflect upstream.\nAt work we create deployment tags in the repo for each rollout, and\nthere's lots of those, so they're archived within weeks for\nperformance reasons.\nWithout this change it's hard to centrally configure such repos in\n/etc/gitconfig (on servers that are only used for working with\nthem). You need to set fetch.prune=true globally, and then for each\nrepo:\ngit -C {} config --replace-all remote.origin.fetch \"refs/tags/*:refs/tags/*\" \"^\\+*refs/tags/\\*:refs/tags/\\*$\"\n\nNow I can simply set fetch.pruneTags=true in /etc/gitconfig as well,\nand users running \"git pull\" will automatically get the pruning\nsemantics I want.\n\n\nUpdate Apr. 2021, Git for Windows 2.30.1 and GitHub Desktop 2.8\nIt works if you have set prune and pruneTags options:\ncd C:\\path\\to\\local\\repo\ngit config fetch.prune true\ngit config fetch.pruneTags true\n\nThen click on Fetch origin in GitHub Deskop: the logs will show:\n2021-04-28T20:25:21.244Z - info: [ui] Executing fetch: \n git -c credential.helper= -c protocol.version=2 fetch --progress --prune origin (took 2.986s)\n\n... and any local tag not present in the remote will be gone!" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Git Clone from GitHub over https with two-factor authentication\nI recently began using two-factor authentication on GitHub, and I am now unable to use git over https on private repos in the usual way:\npeter@computer:~$ git clone https://github.com/[...]/MyPrivateRepo\nCloning into 'MyPrivateRepo'...\nUsername for 'https://github.com': [...]\nPassword for 'https://[...]@github.com': \nremote: Invalid username or password.\nfatal: Authentication failed for 'https://github.com/[...]/MyPrivateRepo/'\n\nIf I disable two-factor authentication I can use it as before:\npeter@computer:~$ git clone https://github.com/[...]/MyPrivateRepo\nCloning into 'MyPrivateRepo'...\nUsername for 'https://github.com': [...]\nPassword for 'https://[...]@github.com': \nremote: Counting objects: 147, done.\nremote: Total 147 (delta 0), reused 0 (delta 0), pack-reused 147\nReceiving objects: 100% (147/147), 22.70 KiB | 0 bytes/s, done.\nResolving deltas: 100% (87/87), done.\nChecking connectivity... done.\n\nI know I can use SSH and everything works, but is there a way I can keep two-factor authentication while still being able to use GitHub over HTTPS, for example by sending an auth token with my request?" }, { "role": "assistant", "content": "Find out how to fix this here:\nhttps://github.com/blog/1614-two-factor-authentication#how-does-it-work-for-command-line-git\n\nHow does it work for command-line Git?\nIf you are using SSH for Git authentication, rest easy: you don't need to do anything. If you are using HTTPS Git, instead of entering your password, enter a personal access token. These can be created by going to your personal access tokens page." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-rebase - Reapply commits on top of another base tip rebase.rebaseMerges" }, { "role": "assistant", "content": "Whether and how to set the --rebase-merges option by default. Can\nbe rebase-cousins , no-rebase-cousins , or a boolean. Setting to\ntrue or to no-rebase-cousins is equivalent to --rebase-merges=no-rebase-cousins , setting to rebase-cousins is\nequivalent to --rebase-merges=rebase-cousins , and setting to false is\nequivalent to --no-rebase-merges . Passing --rebase-merges on the\ncommand line, with or without an argument, overrides any rebase.rebaseMerges configuration." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "gitmodules - Defining submodule properties submodule.<name>.url" }, { "role": "assistant", "content": "Defines a URL from which the submodule repository can be cloned.\nThis may be either an absolute URL ready to be passed to git-clone or (if it begins with ./ or ../ ) a location\nrelative to the superproject’s origin repository." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "List all developers on a project in Git\nIs it possible to list all users that contributed to a project (users that have done commits) in Git?\nAny additional statistics?" }, { "role": "assistant", "content": "To show all users & emails, and the number of commits in the CURRENT branch:\ngit shortlog --summary --numbered --email\n\nOr simply:\ngit shortlog -sne\n\nTo show users from all branches (not only the ones in the current branch) you have to add --all flag:\ngit shortlog -sne --all" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How can I install from a git subdirectory with pip?\nI have a git repository with many folders, one of them being a python module installable with pip, like this:\nrepo.git/\nrepo.git/folder1/\nrepo.git/folder2/\nrepo.git/mymodule/\nrepo.git/mymodule/__init__.py\nrepo.git/mymodule/setup.py\nrepo.git/mymodule/...\n\nRight now I have to do the following to install:\ngit clone http://server/repo.git\ncd repo\npip install mymodule\ncd ..\nrm -rf repo\n\nIs it possible to install the module directly with pip without explicitly cloning ?\nI tried:\npip install git+https://server/repo.git/mymodule/\npip install git+https://server/repo.git:mymodule/\n\nBut I get:\nIOError: [Errno 2] No such file or directory: '/tmp/pip-88tlLm-build/setup.py'" }, { "role": "assistant", "content": "There is a pull request regarding this feature, and it seems to have been merged to develop branch a month ago. The syntax is the following:\npip install -e \"git+https://git.repo/some_repo.git#egg=$NAME_OF_PACKAGE&subdirectory=$SUBDIR_IN_REPO\" # install a python package from a repo subdirectory\n\nWe probably have to wait for a while until it gets merged to master and is distributed.\nUPDATE: This is now available and documented at https://pip.pypa.io/en/stable/cli/pip_install/#vcs-support as follows:\n\nFor projects where setup.py is not in the root of project,\n\"subdirectory\" component is used. Value of \"subdirectory\" component\nshould be a path starting from root of the project to where setup.py\nis located.\nSo if your repository layout is:\n- pkg_dir/\n - setup.py # setup.py for package ``pkg``\n - some_module.py\n- other_dir/\n - some_file\n- some_other_file\n\nYou'll need to use\npip install -e \"vcs+protocol://repo_url/#egg=pkg&subdirectory=pkg_dir\"\n\n\nNote: Make sure to surround it with quotes otherwise subdirectory won't work." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Git rebase loses history, then why rebase?\nI've been looking into rebasing with Git over the past couple days. Most of the arguments for rebasing say that it cleans up the history and makes it more linear. If you do plain merges (for example), you get a history that shows when the history diverged and when it was brought back together. As far as I can tell, rebasing removes all that history. Question is this: why wouldn't you want the repo history to reflect all the ways the code developed, including where and how it diverged?" }, { "role": "assistant", "content": "Imagine you are working on a Secret Project of World Domination. There are three masterminds on this conspiracy:\n\nThe Genius\nThe General\nThe Computer Hacker\n\nAnd they all agree to come to their secret base in 1 week each one with 1 detailed plan.\nThe computer hacker, being a pragmatic programmer, suggested that they use Git to store all the files of the plans. Each one will fork the initial project repo and they will merge all in one week.\nThey all agree and in the following days the story goes like this:\nThe Genius\nHe made a total of 70 commits, 10 each day.\nThe General\nHe spied on the repo of their comrades and made a strategy to beat them. He made 3 commits, all on the last day.\nThe Computer Hacker\nThis pragmatic programmer used branches. He made 4 different plans, each one on a branch. Each branch was rebased to be just one commit.\nSeven days passed and the group meet again to merge all the plans into one master piece. All of them were eager to start so all of them tried to merge all the stuff on his own.\nHere goes the story:\nThe Genius\nHe merged all the changes from the General's repo and then the Computer Hacker's one. And then, being a logic lover, he gave a look at the log. He expected to see a logical evolution of an idea, where the things were constructed upon the previous ideas-commits.\nBut what the logs shown, was a myriad of commits of different ideas all mixed in the time line. One reader could not really understand the evolution, the reasoning of the commits just by reading the commits time line.\nSo he ended with a mess, that even a genius could't understand.\nThe General\nThe General thought: Divide and conquer!\nAnd so he merged the repo of the Genius on his repo. He looked at the log and saw a bunch of commits from the Genius idea, which followed an understable progression, until the last day. The last day the ideas of the General and the Genius were mixed.\nHe was spying the The computer Hacker and knew about the Rebase solution. So he did a rebase of his own idea and tried the merge again.\nNow the log showed a logical progression every day.\nThe Computer Hacker\nThis pragmatic programmer created a integration branch for the Genius idea, another one for the General idea and another one for his own ideas. He did a rebase to each branch. And then he merged all in master.\nAnd all of his team mates saw that his log was great. It was simple. It was understable at first sight.\nIf an idea introduced a problem, it was clear in which commit was introduced, for there was just one.\nThey ended conquering all the world and they vanished the use of Subversion.\nAnd all were happy." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-rev-parse - Pick out and massage parameters :/<text> , e.g. :/fix nasty bug" }, { "role": "assistant", "content": "A colon, followed by a slash, followed by a text, names\na commit whose commit message matches the specified regular expression.\nThis name returns the youngest matching commit which is\nreachable from any ref, including HEAD.\nThe regular expression can match any part of the\ncommit message. To match messages starting with a string, one can use\ne.g. :/^foo . The special sequence :/! is reserved for modifiers to what\nis matched. :/!-foo performs a negative match, while :/!!foo matches a\nliteral ! character, followed by foo . Any other sequence beginning with :/! is reserved for now.\nDepending on the given text, the shell’s word splitting rules might\nrequire additional quoting." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-rev-list - Lists commit objects in reverse chronological order %aL" }, { "role": "assistant", "content": "author local-part (see %al ) respecting .mailmap, see git-shortlog or git-blame )" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to pull into not-the-current-branch?\nSay my current branch is myfeature. I want to get master up to date. Both git merge git pull always merge into the current branch, as far as I can tell.\nIs there a way to merge changes from a remote branch (eg, origin/master) into a branch I'm not currently on (master)? I can think of one way:\ngit stash\ngit checkout master\ngit pull origin/master\ngit checkout myfeature\ngit stash apply\n\nIs there a better one?\n(It's possibly my whole question is wrong: would git fetch automatically update master to match origin/master, if remote-tracking is enabled?)" }, { "role": "assistant", "content": "git fetch -u origin master:master\n\nMerge, update, and pull Git branches without using checkouts\ngit fetch -u <remote> <remoteBranch>:<localBranch>\n\nThe -u or --update-head-ok ensures that the command still works even if you have the given branch checked out, which otherwise gives the error:\n\nfatal: Refusing to fetch into current branch refs/heads/master of non-bare repository" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-config - Get and set repository or global options pack.window" }, { "role": "assistant", "content": "The size of the window used by git-pack-objects when no\nwindow size is given on the command line. Defaults to 10." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-restore - Restore working tree files -m --merge" }, { "role": "assistant", "content": "When restoring files on the working tree from the index,\nrecreate the conflicted merge in the unmerged paths.\nThis option cannot be used when checking out paths from a\ntree-ish (i.e. with the --source option)." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How does one change the language of the command line interface of Git?\nI’d like to change the language of git (to English) in my Linux installation without changing the language for other programs and couldn’t find the settings.\nHow to do it?" }, { "role": "assistant", "content": "Add these lines to your ~/.bashrc, ~/.bash_profile or ~/.zprofile to force git to display all messages in English:\n# Set Git language to English\n#alias git='LANG=en_US git'\nalias git='LANG=en_GB git'\n\nThe alias needs to override LC_ALL on some systems, when the environment variable LC_ALL is set, which has precedence over LANG. See the UNIX Specification - Environment Variables for further explanation.\n# Set Git language to English\n#alias git='LC_ALL=en_US git'\nalias git='LC_ALL=en_GB git'\n\nIn case you added these lines to ~/.bashrc the alias will be defined when a new interactive shell gets started. In case you added it to ~/.bash_profile the alias will be applied when logging in." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Does Bitbucket and GitHub have Work In Progress [WIP] pull requests feature?\nI know there is a Work In Progress (WIP) merge requests feature on GitLab. \nI find it very useful when you already want to show the code to your peers and want to prevent 'Accept' button to be pressed. Is there a similar feature on Bitbucket? Tried to use [WIP] prefix on Pull Request name in Bitbucket, but it did not work out. \nI am also curious if GitHub has a similar feature too or you still need a plugin for your browser?" }, { "role": "assistant", "content": "Bitbucket does not provide WIP PR status yet, but the enhancement is WIP 😊. You can vote here for this feature: https://bitbucket.org/site/master/issues/12503/add-additional-pull-request-states" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Python way to clone a git repository\nIs there a Python way without using a subprocess to clone a git repository? I'm up for using any sort of modules you recommend." }, { "role": "assistant", "content": "Using GitPython will give you a good python interface to Git.\nFor cloning a new repository you can use clone_from function:\nfrom git import Repo # pip install gitpython\n\nRepo.clone_from(git_url, repo_dir)\n\nSee the GitPython Tutorial for examples on using the Repo object.\nNote: GitPython requires git being installed on the system, and accessible via system's PATH." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "gitattributes - Defining attributes per path Set" }, { "role": "assistant", "content": "Built-in 3-way merge driver is used to merge the\ncontents in a way similar to merge command of RCS suite. This is suitable for ordinary text files." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-log - Show commit logs dimmed-zebra" }, { "role": "assistant", "content": "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": "git repo says it's up-to-date after pull but files are not updated\nI have 3 repos. A bare repo which I use as a master repo, a dev repo in which I make and test changes, and prod repo from which scripts are executed in the prod environment.\nAfter I have tested changes in the dev repo I push them to the bare repo and they are auto pulled down into the prod repo on a cronjob using a basic script (carrying out git pull command).\nI followed through the above procedure for a change, but the altered file will not update in the prod repo.\n\nThe change is checked in and pushed in the dev repo \nThe pull has been done to the prod repo\nThe git logs for all repos are identical and all show the checkin for this change\ngit branch gives me \"* master\" for all repos\ngit status for all repos gives me:\n # On branch master\n nothing to commit, working directory clean\ngit pull gives me \"Already up-to-date\" for the dev & prod repos\n\nUsing git extensions for a graphical view, it appears each repo is up to date and at the head.\nI've tried:\ngit checkout HEAD \ngit pull origin master \ngit reset --hard HEAD \ngit reset --hard origin/master \ngit reset origin/master \n\nCan anyone help here?" }, { "role": "assistant", "content": "Try this:\n git fetch --all\n git reset --hard origin/master\n\nExplanation:\ngit fetch downloads the latest from remote without trying to merge or rebase anything." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Check that git repository exists\nIs there any way how to check whether git repository exist just before perform git clone action? Something like git clone $REMOTE_URL --dry-run?\nI would like to implement fast checking method which will check existence before the clone action will be performed. I expect that connection might be slow and repository might be big even more than 1GB, so I don't want to rely on time extensive operation due to simple validation. The clone will be performed asynchronously in the background when validation passes.\nI found this https://superuser.com/questions/227509/git-ping-check-if-remote-repository-exists but it works from git repository context after initial clone action is done.\nMaybe there is some git call which works without git repository context and return \"some data\" if repository on destination exist or error if doesn't." }, { "role": "assistant", "content": "The answer that you linked does what you want it to do.\nTry running this in a folder without a repository in it:\ngit ls-remote https://github.com/git/git\n\nIt should show you the references on the remote, even though you haven't added a local repository with git init or done a git clone.\nSee more: https://www.kernel.org/pub/software/scm/git/docs/git-ls-remote.html" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-svn - Bidirectional operation between a Subversion repository and Git" }, { "role": "assistant", "content": "HANDLING OF SVN BRANCHES If git svn is configured to fetch branches (and --follow-branches\nis in effect), it sometimes creates multiple Git branches for one\nSVN branch, where the additional branches have names of the form branchname@nnn (with nnn an SVN revision number). These additional\nbranches are created if git svn cannot find a parent commit for the\nfirst commit in an SVN branch, to connect the branch to the history of\nthe other branches. Normally, the first commit in an SVN branch consists\nof a copy operation. git svn will read this commit to get the SVN\nrevision the branch was created from. It will then try to find the\nGit commit that corresponds to this SVN revision, and use that as the\nparent of the branch. However, it is possible that there is no suitable\nGit commit to serve as parent. This will happen, among other reasons,\nif the SVN branch is a copy of a revision that was not fetched by git\nsvn (e.g. because it is an old revision that was skipped with --revision ), or if in SVN a directory was copied that is not tracked\nby git svn (such as a branch that is not tracked at all, or a\nsubdirectory of a tracked branch). In these cases, git svn will still\ncreate a Git branch, but instead of using an existing Git commit as the\nparent of the branch, it will read the SVN history of the directory the\nbranch was copied from and create appropriate Git commits. This is\nindicated by the message \"Initializing parent: <branchname>\". Additionally, it will create a special branch named <branchname>@<SVN-Revision> , where <SVN-Revision> is the SVN revision\nnumber the branch was copied from. This branch will point to the newly\ncreated parent commit of the branch. If in SVN the branch was deleted\nand later recreated from a different version, there will be multiple\nsuch branches with an @ . Note that this may mean that multiple Git commits are created for a\nsingle SVN revision. An example: in an SVN repository with a standard\ntrunk/tags/branches layout, a directory trunk/sub is created in r.100.\nIn r.200, trunk/sub is branched by copying it to branches/. git svn\nclone -s will then create a branch sub . It will also create new Git\ncommits for r.100 through r.199 and use these as the history of branch sub . Thus there will be two Git commits for each revision from r.100\nto r.199 (one containing trunk/, one containing trunk/sub/). Finally,\nit will create a branch sub@200 pointing to the new parent commit of\nbranch sub (i.e. the commit for r.200 and trunk/sub/)." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Override git's choice of binary file to text\nI've seen several question asking how to make git treat a text file as binary, but haven't seen the opposite yet:\nHow do I change git's choice of treating a text file as binary? I have a text file where in some configuration strings an EOT and ETX is used to separate parts of the configuration parameters.\nFor example, the source code contains lines like this:\nINPUT 'ScrollRemote[EOT]no[ETX]NumDown[EOT]0[ETX]CalcWidth[EOT]no[ETX]MaxWidth[EOT]80[ETX]FetchOnReposToEnd[EOT]yes[ETX].....'\n\nI would like this file to be treated as text, not a binary, so that I can see a diff of line changes." }, { "role": "assistant", "content": "The way files are actually stored inside the Git repository is not relevant to how they are treated when displayed. So the git diff program, when asked to compare two files, first obtains both complete files from the repository and then runs a difference algorithm against them.\nNormally, git diff looks for non-printable characters in the files and if it looks like the file is likely to be a binary file, it refuses to show the difference. The rationale for that is binary file diffs are not likely to be human readable and will probably mess up your terminal if displayed.\nHowever, you can instruct git diff to always treat files as text using the --text option. You can specify this for one diff command:\ngit diff --text HEAD HEAD^ file.txt\n\nYou can make Git always use this option by setting up a .gitattributes file that contains:\nfile.txt diff\n\nThe diff attribute here means:\n\nA path to which the diff attribute is set is treated as text, even when they contain byte values that normally never appear in text files, such as NUL." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-svn - Bidirectional operation between a Subversion repository and Git log" }, { "role": "assistant", "content": "This should make it easy to look up svn log messages when svn\nusers refer to -r/--revision numbers. The following features from ‘svn log’ are supported: -r <n>[:<n>] --revision=<n>[:<n>] is supported, non-numeric args are not:\nHEAD, NEXT, BASE, PREV, etc …​ -v --verbose it’s not completely compatible with the --verbose\noutput in svn log, but reasonably close. --limit=<n> is NOT the same as --max-count, doesn’t count\nmerged/excluded commits --incremental supported New features: --show-commit shows the Git commit sha1, as well --oneline our version of --pretty=oneline Note SVN itself only stores times in UTC and nothing else. The regular svn\nclient converts the UTC time to the local time (or based on the TZ=\nenvironment). This command has the same behaviour. Any other arguments are passed directly to git log" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-grep - Print lines matching a pattern grep.fullName" }, { "role": "assistant", "content": "If set to true, enable --full-name option by default." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-write-tree - Create a tree object from the current index" }, { "role": "assistant", "content": "NAME git-write-tree - Create a tree object from the current index" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Can I pull a specific commit with composer?\nIs it possible to fetch a certain pull request with composer? Like a specific commit from a fork? What would the directive look like?\nedit: context This would be helpful so I don't have to wait for a new tag to be created.\n I am certain it will be merged, however I don't know if when then devs will get a chance and I'd rather not put off the work flow I am in...\nedit 2: now that I think about it, surely when developers make a fork of a public package they might need to test their own fork within a project or two before even pushing a pull request\nedit 3: example I'm trying to pull this https://github.com/valorin/dispatcher/commit/c566eb6902f378abd59943e7ea09f61e734c8960 to no avail, I tried:\n \"valorin/dispatcher\": \"develop#c566eb6902f378abd59943e7ea09f61e734c8960\"\n\nand\n \"indatus/dispatcher\": \"develop#c566eb6902f378abd59943e7ea09f61e734c8960\"\n\nedit 4: great success\n\"require\": {\n \"indatus/dispatcher\": \"dev-develop#c566eb6\"\n}\n\nadding the dev- prefix did the trick" }, { "role": "assistant", "content": "You can't reference a pull request directly, but you can always get hold of a specific commit. You just need to find the commit hash that the pull request introduces. (If you're using github it's in the commits tab).\nThen you'll need to use something like this in your composer.json - \n \"require\": {\n \"mysoftware/thesoftware\": \"dev-master#3f38376d\"\n}\n\nWhere mysoftware/thesoftware is the usual vendor/software name thing you would use, and the part after the '#' on the right-hand side is the specific commit hash you want." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-fetch - Download objects and refs from another repository --[no-]write-fetch-head" }, { "role": "assistant", "content": "Write the list of remote refs fetched in the FETCH_HEAD file directly under $GIT_DIR . This is the default.\nPassing --no-write-fetch-head from the command line tells\nGit not to write the file. Under --dry-run option, the\nfile is never written." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-count-objects - Count unpacked number of objects and their disk consumption" }, { "role": "assistant", "content": "NAME git-count-objects - Count unpacked number of objects and their disk consumption" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Add syntax highlighting to gh-pages\n\nIs there an easy way to add syntax highlighting to my various plugin's gh-pages using github's Pygments?\nI know that every page runs through the Jekyll engine and provides syntax highlighting (ref). But I don't want to install a blog. I just want syntax highlighting applied to the code blocks in my gh-pages.\nI guess I could always just include a different plugin with my gh-pages..." }, { "role": "assistant", "content": "Pages already does pygments, there's nothing to install. Just use it!\n---\nlayout: default\ntitle: Something with codes\n---\n\nHappy fun highlighting. \n[More details](https://github.com/mojombo/jekyll/wiki/liquid-extensions)\n\n{% highlight ruby %}\ndef foo\n puts 'foo'\nend\n{% endhighlight %}" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-diff - Show changes between commits, commit and working tree, etc diff.orderFile" }, { "role": "assistant", "content": "File indicating how to order files within a diff.\nSee the -O option to git-diff for details.\nIf diff.orderFile is a relative pathname, it is treated as\nrelative to the top of the working tree." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to remove file from Git history?\nSome time ago I added info(files) that must be private. Removing from the project is not problem, but I also need to remove it from git history.\nI use Git and Github (private account).\nNote: On this thread something similar is shown, but here is an old file that was added to a feature branch, that branch merged to a development branch and finally merged to master, since this, a lot of changes was done. So it's not the same and what is needed is to change the history, and hide that files for privacy." }, { "role": "assistant", "content": "I have found this answer and it helped:\ngit filter-branch --index-filter 'git rm -rf --cached --ignore-unmatch path_to_file' HEAD" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-log - Show commit logs --no-color-moved-ws" }, { "role": "assistant", "content": "Do not ignore whitespace when performing move detection. This can be\nused to override configuration settings. It is the same as --color-moved-ws=no ." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-svn - Bidirectional operation between a Subversion repository and Git -r <arg> --revision <arg>" }, { "role": "assistant", "content": "Used with the fetch command. This allows revision ranges for partial/cauterized history\nto be supported. $NUMBER, $NUMBER1:$NUMBER2 (numeric ranges),\n$NUMBER:HEAD, and BASE:$NUMBER are all supported. This can allow you to make partial mirrors when running fetch;\nbut is generally not recommended because history will be skipped\nand lost." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git diff with author filter\nI have a series of commits by different authors and I would like to see a git dff output between 2 commits but only considering the commits by one of the authors, something like, something like --author in git log.\nI am interested in the final summary diff and not the diffs of the individual commits.\nIs there a git trick for that?" }, { "role": "assistant", "content": "The problem here is that you can't do this in the general case. Suppose Alice changes a particular file, then Bob changes it - including parts that Alice changed - and finally Alice changes it again. How do you combine Alice's two diffs into a single diff? If you take them as two patches, the second simply won't apply without Bob's patch being applied first! But you also can't simply diff the final state against the original, because that will include Bob's changes.\nIf you prefer an example with git operations, this is like doing an interactive rebase, and just deleting random commits. Sure, sometimes it'll work, but sometimes it'll just completely fail, because one of those commits depended on one of the ones you took out.\nSo, I know you said you don't want individual commit diffs, but that's all you can really hope for:\ngit log -p --author=Alice\n\nOr if you're really desperate for a single diff, this will get it for you, but only in the cases where there's no patch interaction like I mentioned above:\ngit checkout -b temp first_commit\ngit log --reverse --pretty=%H --author=Alice first_commit..second_commit |\nwhile read commit; do\n git cherry-pick $commit || exit\ndone\n# or if you have a new version of git, cherry-pick works with multiple arguments:\n# git cherry-pick $(git log --reverse --pretty=%H --author=Alice first_commit..second_commit)\ngit diff first_commit temp\n\nThis does really require operations in the work tree, because there's absolutely no guarantee that any of the patches will apply once a commit has been skipped. You just have to try and see." } ]