messages
listlengths
3
3
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git - the stupid content tracker" }, { "role": "assistant", "content": "Configuration Mechanism Git uses a simple text format to store customizations that are per\nrepository and are per user. Such a configuration file may look\nlike this: #\n# A '#' or ';' character indicates a comment.\n#\n\n; core variables\n[core]\n\t; Don't trust file modes\n\tfilemode = false\n\n; user identity\n[user]\n\tname = \"Junio C Hamano\"\n\temail = \"[email protected]\" Various commands read from the configuration file and adjust\ntheir operation accordingly. See git-config for a\nlist and more details about the configuration mechanism." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-fsck - Verifies the connectivity and validity of the objects in the database --lost-found" }, { "role": "assistant", "content": "Write dangling objects into .git/lost-found/commit/ or\n.git/lost-found/other/, depending on type. If the object is\na blob, the contents are written into the file, rather than\nits object name." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-diff - Show changes between commits, commit and working tree, etc --cumulative" }, { "role": "assistant", "content": "Synonym for --dirstat=cumulative" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "What is the difference between IntelliJ's Shelve and Git stash? [duplicate]\nThis question already has answers here:\n \n \n\n\n\n\nGit Stash vs Shelve in IntelliJ IDEA/Netbeans\n\n (6 answers)\n \n\nClosed 10 months ago.\n\n\n\nIntelliJ supports git stashes as well as its own built in shelve command. These seem to be almost identical in purpose and utility. What is the difference between them?" }, { "role": "assistant", "content": "From the IntelliJ documentation:\n\nIn the Git integration, in addition to shelving and unshelving, \"stashing\" and \"unstashing\" are supported respectively. These features have much in common, the only difference is in the way patches are generated and applied.\n\nPatches with stashed changes are generated by Git itself. To apply them later, you do not need IntelliJ IDEA.\nPatches with shelved changes are generated by IntelliJ IDEA. Normally, they are also applied through the IDE. Applying shelved changes outside IntelliJ IDEA is also possible but requires additional steps." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git - the stupid content tracker git-whatchanged" }, { "role": "assistant", "content": "Show logs with differences each commit introduces" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Git diff --stat explanation\nGit's pull output has been explained here fairly well. In spite of this I'm still unsure exactly what the text graph relates to. \nFor example:\ngit diff --stat master HEAD^\nOutputs (truncated):\nSite/index.php | 118 ++--\nWhile the number of lines modified is clearly displayed as 118, the text graph is a little harder to interpret. \nCould this relate to the ratio of added and removed lines?" }, { "role": "assistant", "content": "Yes it's the ratio of added and removed lines.\nSee also:\nman diffstat" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-for-each-ref - Output information on each ref exclude=<pattern>" }, { "role": "assistant", "content": "Do not consider tags matching the given glob(7) pattern,\nexcluding the \"refs/tags/\" prefix; see the corresponding option\nin git-describe for details." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Git fails when pushing commit to github\nI cloned a git repo that I have hosted on github to my laptop. I was able to successfully push a couple of commits to github without problem. However, now I get the following error: \nCompressing objects: 100% (792/792), done.\nerror: RPC failed; result=22, HTTP code = 411\nWriting objects: 100% (1148/1148), 18.79 MiB | 13.81 MiB/s, done.\nTotal 1148 (delta 356), reused 944 (delta 214)\n\nFrom here it just hangs and I finally have to CTRL + C back to the terminal." }, { "role": "assistant", "content": "I had the same issue and believe that it has to do with the size of the repo (edited- or the size of a particular file) you are trying to push.\nBasically I was able to create new repos and push them to github. But an existing one would not work.\nThe HTTP error code seems to back me up it is a 'Length Required' error. So maybe it is too large to calc or greated that the max. Who knows.\nEDIT\n\nI found that the problem may be\nfiles that are large. I had one update\nthat would not push even though I had\nsuccessful pushes up to that point.\nThere was only one file in the commit\nbut it happened to be 1.6M\nSo I added the following config change\ngit config http.postBuffer 524288000\n\nTo allow up to the file size 500M and\nthen my push worked. It may have been\nthat this was the problem initially\nwith pushing a big repo over the http\nprotocol.\n\nEND EDIT\nthe way I could get it to work (EDIT before I modified postBuffer) was to tar up my repo, copy it to a machine that can do git over ssh, and push it to github. Then when you try to do a push/pull from the original server it should work over https. (since it is a much smaller amount of data than an original push)." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-log - Show commit logs -F --fixed-strings" }, { "role": "assistant", "content": "Consider the limiting patterns to be fixed strings (don’t interpret\npattern as a regular expression)." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-rev-parse - Pick out and massage parameters @{-<n>} , e.g. @{-1}" }, { "role": "assistant", "content": "The construct @{-<n>} means the <n>th branch/commit checked out\nbefore the current one." } ]
[ { "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": "git-log - Show commit logs format.pretty" }, { "role": "assistant", "content": "Default for the --format option. (See Pretty Formats above.)\nDefaults to medium ." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Creating branches on an empty project in git\nLet's say I am about to implement 3 different features in 3 different files (fileA, fileB an fileC) for a new project of mine.\nI thought I'd just need to add my (currently empty) project to git:\ngit init\n\nand then create 3 different branches:\ngit branch file1_branch\ngit branch file2_branch\ngit branch file3_branch\n\nbut this doesn't work:\n\nfatal: Not a valid object name: 'master'.\n\nWhy is this?\nMaybe the problem could be related that even the master branch wasn't created at this point? I tried doing a git branch. It yielded nothing.\nI then thought about doing an \"empty\" commit to oblige git to create the master branch:\ngit commit -m `initial_commit`\n\nbut as I didn't add any files to the staging area it doesn't work. \nKeep in mind I'm just about to start my project, so at this point I don't have any files to add to the commit!\nHow to solve this issue? Am I doing something wrong?\nThanks" }, { "role": "assistant", "content": "Git represents branches as pointers to the latest commit in that branch. If you haven't created a commit yet, there's nothing for that branch to point to. So you can't really create branches until you have at least one commit.\nGit represents commits as reference to one or more parent commits (or an all-zeros parent if this is the initial commit), a commit message and some other metadata, and a tree reference. A tree is basically a manifest of what is in each file in each directory. If your directory is empty, there is nothing to put in the tree. Now, it is actually possible to create an empty commit as your first commit; you can run git commit --allow-empty -m \"initial commit\". But that is not really a common way of using Git.\nIn Git, you're expected not to use branches unless you need them. There's no need to create several branches until you have some content to branch. If you create three branches at the very beginning of development, will you have no common ancestry between them? In that case, why not just create three repos? Or are you going to be updating all three of them in sync until they start to diverge? That seems like a lot of extra work to keep all of them up to date; you should just wait to create them until they need to diverge.\nBut if you want to use this workflow, you can run git commit --allow-empty -m \"initial commit\" to create an empty initial commit." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "\"You are on a branch yet to be born\" when adding git submodule\nI am attempting to add a few submodules to my .vim/bundles directory, and when I attempt to add this particular repo Git gives me a strange error I've never seen before:\n$ git submodule add -f git://github.com/derekwyatt/vim-scala.git .vim/bundle/vim-scala\nfatal: You are on a branch yet to be born\nUnable to checkout submodule '.vim/bundle/vim-scala'\n\nAny idea what can cause this?\nIf I clone the same repo to a test directory (not through the submodule command), it works fine, and creates the expected files." }, { "role": "assistant", "content": "To fix that error, you should delete the folder with the same path to the submodule inside .git/modules/ directory. This error can occurs when url was incorrect for submodule for the first-time when submodule was added." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-svn - Bidirectional operation between a Subversion repository and Git svn-remote.<name>.pushurl" }, { "role": "assistant", "content": "Similar to Git’s remote.<name>.pushurl , this key is designed\nto be used in cases where url points to an SVN repository\nvia a read-only transport, to provide an alternate read/write\ntransport. It is assumed that both keys point to the same\nrepository. Unlike commiturl , pushurl is a base path. If\neither commiturl or pushurl could be used, commiturl takes precedence." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Github Push Error: RPC failed; result=22, HTTP code = 413\nstupid issue with Github going on right now. I have a decent amount of changes (~120MB in size), when I attempt to push, this is what happens:\nerror: RPC failed; result=22, HTTP code = 413\nfatal: The remote end hung up unexpectedly \nfatal: The remote end hung up unexpectedly\n\nI've already done \ngit config http.postBuffer 524288000, so that doesn't seem to be the issue. What could it be?" }, { "role": "assistant", "content": "If you get error 413, then the issue doesn't lie with git but with your web server.\nIt's your web server that is blocking big upload files.\nSolution for nginx\nJust load your nginx.conf and add client_max_body_size 50m; ( changing the value to your needs ) in the http block.\nReload nginx to accept the new config by executing sudo service nginx reload and try again to push your commit over http.\nSolution for Apache\nIn your httpd.conf add LimitRequestBody 52428800 ( changing the value to your needs ) inside a <Directory /> block. Doing this you can limit the request of the whole server filesystem, just a single Virtual Host or a directory." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Referencing repository files at a given commit in gitlab wiki\n\nGitlab Markdown has support for references to files in the repository structure, like:\n[README](doc/README)\nor\n[README](doc/README#L13)\nBut are there ways to reference files and lines in these files, but from a given commit, at least in the Wiki ? \nMaybe something like:\n[README](1ab3fa71:doc/README#L13)\nor using the file hash id like:\n[README](9a27b101#L13)" }, { "role": "assistant", "content": "To use relative links from wiki to the repository (or wise versa) is not supported officially according to Gitlab's documentation (cited from v11.5, still valid for v15.3):\n\nNote: Relative links do not allow referencing project files in a wiki page or wiki page in a project file. The reason for this is that, in GitLab, wiki is always a separate Git repository. For example, I'm a reference-style link will point the link to wikis/style when the link is inside of a wiki markdown file.\n\nThere is, however, a syntax which seems to work currently:\n[[README|/../blob/1ab3fa71/doc/README#L13]]\n\nBut be aware: all text of the same paragraph will just be lost!\nI work around that by phrasing like this, which renders like expected for Gitlab CE v11.3.0 at least:\nHere you see xyz:\n* [[README|/../blob/1ab3fa71/doc/README#L13]]\n\nThe root-anchored link (/../blob/<version>/<path-to-file>) ensures that it works from every Wiki page independently from their nesting depth.\nFor sure this syntax also works for branch names or any other relative link like /../tree/1ab3fa71/doc for example." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How do you stop tracking a remote branch in Git?\nHow do you stop tracking a remote branch in Git?\nI am asking to stop tracking because in my concrete case, I want to delete the local branch, but not the remote one. Deleting the local one and pushing the deletion to remote will delete the remote branch as well:\n\nHow do I delete a Git branch both locally and in GitHub?\n\nCan I just do git branch -d the_branch, and it won't get propagated when I later git push? \nWill it only propagate if I were to run git push origin :the_branch later on?" }, { "role": "assistant", "content": "As mentioned in Yoshua Wuyts' answer, using git branch:\ngit branch --unset-upstream\n\nOther options:\nYou don't have to delete your local branch.\nSimply delete the local branch that is tracking the remote branch:\ngit branch -d -r origin/<remote branch name>\n\n-r, --remotes tells git to delete the remote-tracking branch (i.e., delete the branch set to track the remote branch). This will not delete the branch on the remote repo!\nSee \"Having a hard time understanding git-fetch\"\n\nthere's no such concept of local tracking branches, only remote tracking branches.\n So origin/master is a remote tracking branch for master in the origin repo\n\nAs mentioned in Dobes Vandermeer's answer, you also need to reset the configuration associated to the local branch:\ngit config --unset branch.<branch>.remote\ngit config --unset branch.<branch>.merge\n\n\nRemove the upstream information for <branchname>.\n If no branch is specified it defaults to the current branch.\n\n(git 1.8+, Oct. 2012, commit b84869e by Carlos Martín Nieto (carlosmn))\nThat will make any push/pull completely unaware of origin/<remote branch name>." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Change old commit message using `git rebase`\nI was trying to edit an old commit message as explained here.\nThe thing is that now, when I try to run rebase -i HEAD~5 it says interactive rebase already started.\nSo then I try: git rebase --continue but got this error:\nerror: Ref refs/heads/master is at 7c1645b447a8ea86ee143dd08400710c419b945b but expected c7577b53d05c91026b9906b6d29c1cf44117d6ba\nfatal: Cannot lock the ref 'refs/heads/master'.\n\nAny ideas?" }, { "role": "assistant", "content": "As Gregg Lind suggested, you can use reword to be prompted to only change the commit message (and leave the commit intact otherwise):\ngit rebase -i HEAD~n\n\nHere, n is the list of last n commits. \nFor example, if you use git rebase -i HEAD~4, you may see something like this:\npick e459d80 Do xyz\npick 0459045 Do something\npick 90fdeab Do something else\npick facecaf Do abc\n\nNow replace pick with reword for the commits you want to edit the messages of:\npick e459d80 Do xyz\nreword 0459045 Do something\nreword 90fdeab Do something else\npick facecaf Do abc\n\nExit the editor after saving the file, and next you will be prompted to edit the messages for the commits you had marked reword, in one file per message. Note that it would've been much simpler to just edit the commit messages when you replaced pick with reword, but doing that has no effect.\nLearn more on GitHub's page for Changing a commit message." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to stop github from adding new commits to existing pull request\n\nI have created a pull request from my master branch to upstream and now every new commit on that branch automatically attaches itself to this pull request.\nThere was a \"Change commits\" button on pull request page at the time of creation but it seems to disappear after request is created. Can I do it some other way now ?" }, { "role": "assistant", "content": "In GitHub a Pull Request denotes the request to merge one branch with another. When either branch is updated, the pull-request is updated too and the merge is re-evaluated.\nThus, when you push new changes to a branch that has an outstanding pull request linked to it, the pull request will be updated to include the new changes.\nTo reset your pull request to a previous state you can:\n git switch branch-you-want-to-fix\n git branch backup-of-later-changes\n git reset --hard hash-of-desired-changes\n git push --force\n\nThis will create a new local branch with your later changes and will remove those changes from the branch on github.\nThe pull-request will be re-evaluated (one of its sides has been updated with your force push), and you can create a new pull request from your backup-of-later-changes branch.\nAs long as the new commits aren't pushed to the pr-branch, they won't automatically appear in it, even if these changes are based on top of your original pr-branch." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "github actions get URL of test build\n\nI can't seem to find out how to get the URL of a test workflow anywhere in the docs. I have a simple job which runs tests and on fail it needs to post the URL of the failed job to another web service.\nI was expecting this to be in the default env vars but apparently not.\nThanks," }, { "role": "assistant", "content": "Here's how you construct the URL:\n${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-submodule - Initialize, update or inspect submodules <path>…​" }, { "role": "assistant", "content": "Paths to submodule(s). When specified this will restrict the command\nto only operate on the submodules found at the specified paths.\n(This argument is required with add)." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-log - Show commit logs %cN" }, { "role": "assistant", "content": "committer name (respecting .mailmap, see git-shortlog or git-blame )" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Syntax for Git aliases with multiple commands [duplicate]\nThis question already has answers here:\n \n \n\n\n\n\nGit Alias - Multiple Commands and Parameters\n\n (13 answers)\n \n\nClosed 2 years ago.\n\n\n\nI want to create a Git alias to perform multiple commands, but I cant find documentation on how this is done.\n\nWhat is the syntax for Git aliases with multiple commands? \nWhere is this documented?\n\nFrom 'man git-config'\n\n alias.*\n\nCommand aliases for the git(1) command wrapper - e.g. after defining \"alias.last = cat-file commit HEAD\", the invocation \"git\n last\" is equivalent to \"git cat-file commit HEAD\". To avoid confusion\n and\n troubles with script usage, aliases that hide existing Git commands are ignored. Arguments are split by spaces, the usual shell\n quoting and escaping is supported. quote pair and a backslash can be\n used\n to quote them.\nIf the alias expansion is prefixed with an exclamation point, it will be treated as a shell command. For example, defining\n \"alias.new = !gitk --all --not ORIG_HEAD\", the invocation \"git new\" is\n equivalent to running the shell command \"gitk --all --not ORIG_HEAD\". Note that shell commands will be executed from the\n top-level directory of a repository, which may not necessarily be the\n current\n directory. GIT_PREFIX is set as returned by running git rev-parse --show-prefix from the original current directory. See\n git-rev-parse(1)." }, { "role": "assistant", "content": "$ git config alias.q '!echo a; echo b'\n\n$ git q\n\nOutput:\na\nb\n\nI think this is (rudimentarily) documented in man git-config under alias.*\nNote that git commands should include git, unlike in normal aliases. It is caused by fact that it is treated as a shell command, not as a git command (see manpage quoted in the question). For example to chain\ngit init\n\nand\ngit commit --allow-empty -m \"empty initial commit\"\n\nit is necessary to create \n\"!git init; git commit --allow-empty -m \\\"empty initial commit\\\"\"\n\nalias." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-pull - Fetch from and integrate with another repository or a local branch --shallow-exclude=<revision>" }, { "role": "assistant", "content": "Deepen or shorten the history of a shallow repository to\nexclude commits reachable from a specified remote branch or tag.\nThis option can be specified multiple times." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Can you see who is watching a repo on GitHub?\n\nIt looks like there is an API call to view the users that watch a repo from [GithubDeveloper]:(https://developer.github.com/v3/activity/watching/#list-watchers)\nList watchers\nGET /repos/:owner/:repo/subscribers\n\nIs there any way to see this list on the site? \nAm I interpreting the API correctly? Is watching equal to subscribing?" }, { "role": "assistant", "content": "When on a repo's page, you'll see links on the right side in the \"About\" column that give you this information:\n\nOr go to this URL directly:\nhttps://github.com/{user}/{project}/watchers" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-diff - Show changes between commits, commit and working tree, etc git diff [<options>] <blob> <blob>" }, { "role": "assistant", "content": "This form is to view the differences between the raw\ncontents of two blob objects." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git - the stupid content tracker --icase-pathspecs" }, { "role": "assistant", "content": "Add \"icase\" magic to all pathspec. This is equivalent to setting\nthe GIT_ICASE_PATHSPECS environment variable to 1 ." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Can I search github labels with logical operator OR?\n\nI'm trying to filter all my issues on github like this:\nlabel:bug OR label:enhancement\n\nBut obviously that does not work. I found this page\nhttps://help.github.com/articles/searching-issues/\nand i thought it must be written there, but I cannot figure out how to do it. \nCould it really be that one cannot filter issues of two labels? I mean that would be such a basic task, wouldn't it?\nWell if anyone could give me a hint upon that matter I'd be glad to hear it." }, { "role": "assistant", "content": "Since Aug. 2021, yes.\nHowever, it has not yet been propagated to GitHub Enterprise (Oct. 2021)\nIt is also in GHE .3.3 (Dec 2021)\nSee:\n\nSearch issues by label using logical OR \nYou can now search issues by label using logical OR.\nSimply use a comma to separate the labels.\nFor example:\nlabel:\"good first issue\",bug \n\nwill list all issues with a label good first issue or bug." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-fetch - Download objects and refs from another repository *" }, { "role": "assistant", "content": "for a successfully fetched new ref;" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-diff - Show changes between commits, commit and working tree, etc --cumulative" }, { "role": "assistant", "content": "Synonym for --dirstat=cumulative" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-show - Show various types of objects" }, { "role": "assistant", "content": "SYNOPSIS git show [<options>] [<object>…​]" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "I can't checkout a specific branch, \"detached HEAD state\"\n\nMe and my friend has a repo which he created. He then created a branch called \"lexer\" for us to work on.\nThe problem is that while he can switch forth and back between master and lexer it does not work at all for me.\nEventually I just started over (rm -rf repo and then cloned the repo) but it's still impossible to checkout the lexer branch?\nOn a freshly cloned repo:\ngit branch gives:\n$ git branch\n* master\n\ngit checkout lexer gives:\n$ git checkout lexer\n$ git status\nOn branch master\nYour branch is up-to-date with 'origin/master'.\n\nI CAN checkout origin/lexer but I end up in a detached HEAD state?\n$ git checkout origin/lexer master\nNote: checking out 'origin/lexer'.\n\nYou are in 'detached HEAD' state. You can look around, make experimental\nchanges and commit them, and you can discard any commits you make in this\nstate without impacting any branches by performing another checkout.\n\nIt is possible for me to push to the lexer branch by doing\ngit push origin HEAD:lexer\n\nbut well, I really would like to sort this mess out. It's so weird that it works for him but not for me? He says that he hasn't got any local changes from the git repo either...\nAnyone have any clue?" }, { "role": "assistant", "content": "I'm going to venture a guess that you have a directory named lexer at the top level. Since git checkout is used both to switch branches and to reset files in the tree, it's probably detecting that you don't have a branch called lexer but you do have a path and selects the second mode.\nIt works for your friend because he already has a lexer branch.\nEasiest workaround is probably to create the branch using git branch instead.\ngit branch --track lexer origin/lexer\n\nshould do that for you. You can then use git checkout to switch to it.\nAnother option might be to use the -- flag to git checkout. I haven't tried it but I think it should work:\ngit checkout lexer --\n\nWhen you add --, the word before it is always considered a branch/commit/tree and the word after a path." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-diff - Show changes between commits, commit and working tree, etc git-diff-index --cached <tree-ish>" }, { "role": "assistant", "content": "compares the <tree-ish> and the index." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "What happens to a github student account's repositories at the end of 2 years?\n\nI just got upgraded to a free github micro plan using my university email address. I'm planning to use the private repositories for some class projects this semester, but I'm wondering what will happen to those repositories at the end of 2 years when my free student upgrade expires. I'm assuming it's the same thing that happens when you downgrade from a micro to a free account.\nWill my repositories disappear, become public, or just become read-only? I've searched around a bit and haven't been able to find an answer." }, { "role": "assistant", "content": "(Disclosure: I work at GitHub)\nSo long as you're still a student, you're eligible for the academic discount. Once your coupon expires, you can re-apply for the student discount.\nWhen you re-apply, be sure you've added your school-issued email address to your account, that will expedite the approval process.\nYou will receive a notification email before your discount expires. When the discount does expire, your account will be locked which means that you won't be able to access your private repositories. Your private repositories will not be deleted and they will not be made public.\nOf course, if you ever have any troubles, you can always email [email protected]." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-rev-parse - Pick out and massage parameters ^<rev> (caret) Notation" }, { "role": "assistant", "content": "To exclude commits reachable from a commit, a prefix ^ notation is used. E.g. ^r1 r2 means commits reachable\nfrom r2 but exclude the ones reachable from r1 (i.e. r1 and\nits ancestors)." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git - the stupid content tracker GIT_PAGER" }, { "role": "assistant", "content": "This environment variable overrides $PAGER . If it is set\nto an empty string or to the value \"cat\", Git will not launch\na pager. See also the core.pager option in git-config ." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "gitglossary - A Git Glossary reflog" }, { "role": "assistant", "content": "A reflog shows the local \"history\" of a ref. In other words,\nit can tell you what the 3rd last revision in this repository\nwas, and what was the current state in this repository,\nyesterday 9:14pm. See git-reflog for details." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-log - Show commit logs --show-notes-by-default" }, { "role": "assistant", "content": "Show the default notes unless options for displaying specific\nnotes are given." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "is it possible to `git status` only modified files?\nIs it possible to have git status only show the modified files due, in my case, to having too many staged files?" }, { "role": "assistant", "content": "You can't do this with git status, but you could use git ls-files -m to show all modified files." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Why does \"git push main\" work on GitHub when \"git push master\" does not? Also what is difference between \"Main branch\" and \"Master branch\"?\n\nI tried git push on my master branch, but it just shows that I have a new pull request. When I click on the new pull request, it takes me to the comparing changes view, but doesn't show any option to add those changes into repository. It only shows the changes I made:\n\n\nWhen I entered the command\ngit push origin main\n\nall files where added to my repository.\nbut when I do\ngit push origin master\n\nit doesn't work.\nWhy is that? I heard they are replacing master with main. So in the future are they going to remove master?" }, { "role": "assistant", "content": "From the ZDNet article, GitHub to replace \"master\" with alternative term to avoid slavery references:\n\nGitHub is working on replacing the term \"master\" on its service with a neutral term like \"main\" to avoid any unnecessary references to slavery,\n\nAbout renaming your branch from master to main, there are a lot of guidelines. For example:\ngit branch -m master main \\\ngit push -u origin main \\\ngit remote set-head origin main" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "List all commits (across all branches) for a given file\nThis question is closely related to List all commits for a specific file however it is different. I want to find out which commits, across all branches, had modified a given file.\nTo make it more complex, the given file may or may not be in the working tree." }, { "role": "assistant", "content": "Try this:\ngit log --all -- path" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-config - Get and set repository or global options -e --edit" }, { "role": "assistant", "content": "Opens an editor to modify the specified config file; either --system , --global , --local (default), --worktree , or --file <config-file> ." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-config - Get and set repository or global options receive.denyDeletes" }, { "role": "assistant", "content": "If set to true, git-receive-pack will deny a ref update that deletes\nthe ref. Use this to prevent such a ref deletion via a push." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-config - Get and set repository or global options refSyntax" }, { "role": "assistant", "content": "Shown when the user provides an illegal ref name, to\ntell the user about the ref syntax documentation." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to Git stash pop specific stash in 1.8.3?\nI just upgraded Git. I'm on Git version 1.8.3.\nThis morning I tried to unstash a change 1 deep in the stack.\nI ran git stash pop stash@{1} and got this error.\n\nfatal: ambiguous argument 'stash@1': unknown revision or path not in\n the working tree.\n Use '--' to separate paths from revisions, like this:\n 'git [...] -- [...]'\n\nI've tried about 20+ variations on this as well as using apply instead of pop with no success. What's changed? Anyone else encounter this?" }, { "role": "assistant", "content": "git stash apply n\n\nworks as of git version 2.11\nOriginal answer, possibly helping to debug issues with the older syntax involving shell escapes:\nAs pointed out previously, the curly braces may require escaping or quoting depending on your OS, shell, etc.\nSee \"stash@{1} is ambiguous?\" for some detailed hints of what may be going wrong, and how to work around it in various shells and platforms.\ngit stash list\ngit stash apply stash@{n}\n\ngit stash apply version" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-merge - Join two or more development histories together subtree[=<path>]" }, { "role": "assistant", "content": "This option is a more advanced form of subtree strategy, where\nthe strategy makes a guess on how two trees must be shifted to\nmatch with each other when merging. Instead, the specified path\nis prefixed (or stripped from the beginning) to make the shape of\ntwo trees to match." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git - the stupid content tracker git-bisect" }, { "role": "assistant", "content": "Use binary search to find the commit that introduced a bug" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How do I do a 'git status' so it doesn't display untracked files without using .gitignore?\nHow do I do a git status so it doesn't display untracked files without using .gitignore? I want to get modification status information on tracked files only." }, { "role": "assistant", "content": "Use this:\ngit status -uno\n\nwhich is equivalent to:\ngit status --untracked-files=no\n\nIt's a bit hidden in the manuals, but the manpage for status says \"supports the same options as git-commit\", so that's where you'd have to look." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Is there a way to tell git to only include certain files instead of ignoring certain files?\nMy programs generally generate huge output files (~1 GB) which I do not want to be backing up to the git repository. So instead of being able to do\ngit add .\n\nI have to do something like\ngit add *.c *.cc *.f *.F *.C *.h *.cu\n\nwhich is a little bit cumbersome...\nI feel fairly confident I could write a quicky perl script ls the directory contents into .gitignore and then remove files based on a .gitinclude (or some similar name) file, but that seems a little too hackish. Is there a better way?" }, { "role": "assistant", "content": "I haven't had need to try this myself, but from my reading of TFM it looks like a negated pattern would do what you want. You can override entries in .gitignore with later negated entries. Thus you could do something like:\n*.c\n!frob_*.c\n!custom.c\n\nTo have it ignore all .c files except custom.c and anything starting with \"frob_\"" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Checkout part of a branch in Azure DevOps Pipelines (GetSources)\nMy repository in my organisation's devops project contains a lot of .net solutions and some unity projects as well. When I run my build pipeline, it fails due to several of these:\n\nError MSB3491: Could not write lines to file \"obj\\Release\\path\\to\\file\". There is not enough space on the disk.\n\nI would like the pipeline to only checkout and fetch parts of the repository that are required for a successful build. This might also help with execution time of the pipeline since it currently also fetches the whole of my unity projects with gigabytes of resources which takes forever.\nI would like to spread my projects across multiple repositories but the admin won't give me more than the one I already have. It got a lot better when I configured git fetch as shallow (--depth=1) but I still get the error every now and then.\nThis is how I configured the checkout:\nsteps:\n- checkout: self\n clean: true\n # shallow fetch\n fetchDepth: 1\n lfs: false\n submodules: false\n\nThe build is done using VSBuild@1 task.\nI can't find a valid solution to my problem except for using multiple repositories, which is not an option right now.\nEdit: Shayki Abramczyk's solution #1 works perfectly. Here is my full implementation.\nGitSparseCheckout.yml:\nparameters:\n access: ''\n repository: ''\n sourcePath: ''\n\nsteps:\n- checkout: none\n\n- task: CmdLine@2\n inputs:\n script: |\n ECHO ##[command] git init\n git init\n ECHO ##[command] git sparse-checkout: ${{ parameters.sourcePath }}\n git config core.sparsecheckout true\n echo ${{ parameters.sourcePath }} >> .git/info/sparse-checkout\n ECHO ##[command] git remote add origin https://${{ parameters.repository }}\n git remote add origin https://${{ parameters.access }}@${{ parameters.repository }}\n ECHO ##[command] git fetch --progress --verbose --depth=1 origin master\n git fetch --progress --verbose --depth=1 origin master\n ECHO ##[command] git pull --progress --verbose origin master\n git pull --progress --verbose origin master\n\nCheckout is called like this (where template path has to be adjusted):\n- template: ../steps/GitSparseCheckout.yml\n parameters:\n access: anything:<YOUR_PERSONAL_ACCESS_TOKEN>\n repository: dev.azure.com/organisation/project/_git/repository\n sourcePath: path/to/files/" }, { "role": "assistant", "content": "In Azure DevOps you don't have option to get only part of the repository, but there is a workaround:\nDisable the \"Get sources\" step and get only the source you want by manually executing the according git commands in a script.\nTo disable the default \"Get Sources\" just specify none in the checkout statement:\n- checkout: none\n\nIn the pipeline add a CMD/PowerShell task to get the sources manually with one of the following 2 options:\n1. Get only part of the repo with git sparse-checkout.\nFor example, get only the directories src_1 and src_2 within the test folder (lines starting with REM ### are just the usual batch comments):\n- script: |\n REM ### this will create a 'root' directory for your repo and cd into it\n mkdir myRepo\n cd myRepo\n REM ### initialize Git in the current directory\n git init\n REM ### set Git sparsecheckout to TRUE\n git config core.sparsecheckout true\n REM ### write the directories that you want to pull to the .git/info/sparse-checkout file (without the root directory)\n REM ### you can add multiple directories with multiple lines\n echo test/src_1/ >> .git/info/sparse-checkout\n echo test/src_2/ >> .git/info/sparse-checkout\n REM ### fetch the remote repo using your access token\n git remote add -f origin https://[email protected]/repo\n REM ### pull the files from the source branch of this build, using the build-in Azure DevOps variable for the branch name\n git pull origin $(Build.SourceBranch)\n displayName: 'Get only test/src_1 & test/src_2 directories instead of entire repository'\n\nNow in the builds task make myRepo the working directory.\nFetching the remote repo using an access token is necessary, since using checkout: none will prevent your login credentials from being used.\nIn the end of the pipeline you may want to add step to clean the myRepo directory.\n2. Get parts of the repo with Azure DevOps Rest API (Git - Items - Get Items Batch)." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git diff renamed file\nI have a file a.txt.\ncat a.txt\n> hello\n\nThe contents of a.txt is \"hello\".\nI make a commit.\ngit add a.txt\ngit commit -m \"first commit\"\n\nI then move a.txt into a test dir.\nmkdir test\nmv a.txt test\n\nI then make my second commit.\ngit add -A\ngit commit -m \"second commit\"\n\nFinally, I edit a.txt to say \"goodbye\" instead.\ncat a.txt\n> goodbye\n\nI make my last commit.\ngit add a.txt\ngit commit -m \"final commit\"\n\nNow here is my question:\nHow do I diff the contents of a.txt between my last commit and my first commit? \nI've tried:\n git diff HEAD^^..HEAD -M a.txt, but that didn't work. git log --follow a.txt properly detects the rename, but I can't find an equivalent for git diff. Is there one?" }, { "role": "assistant", "content": "The issue with the difference between HEAD^^ and HEAD is that you have an a.txt in both commits, so just considering those two commits (which is what diff does), there is no rename, there is a copy and a change.\nTo detect copies, you can use -C:\ngit diff -C HEAD^^ HEAD\n\nResult:\nindex ce01362..dd7e1c6 100644\n--- a/a.txt\n+++ b/a.txt\n@@ -1 +1 @@\n-hello\n+goodbye\ndiff --git a/a.txt b/test/a.txt\nsimilarity index 100%\ncopy from a.txt\ncopy to test/a.txt\n\nIncidentally, if you restrict your diff to just one path (as you do in git diff HEAD^^ HEAD a.txt you aren't ever going to see the renames or copies because you've excluded the everything apart from a single path and renames or copies - by definition - involve two paths." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "The remote end hung up unexpectedly while git cloning\nMy git client repeatedly fails with the following error after trying to clone the repository for some time.\nWhat could be the issue here? \nNote: I have registered my SSH key with the GIT hosting provider\nReceiving objects: 13% (1309/10065), 796.00 KiB | 6 KiB/s\nfatal: The remote end hung up unexpectedly" }, { "role": "assistant", "content": "Quick solution:\nWith this kind of error, I usually start by raising the postBuffer size by:\ngit config --global http.postBuffer 524288000\n\n(some comments below report having to double the value):\ngit config --global http.postBuffer 1048576000\n\n(For npm publish, Martin Braun reports in the comments setting it to no more than 50 000 000 instead of the default 1 000 000)\nMore information:\nFrom the git config man page, http.postBuffer is about:\n\nMaximum size in bytes of the buffer used by smart HTTP transports when POSTing data to the remote system.\nFor requests larger than this buffer size, HTTP/1.1 and Transfer-Encoding: chunked is used to avoid creating a massive pack file locally. Default is 1 MiB, which is sufficient for most requests.\n\nEven for the clone, that can have an effect, and in this instance, the OP Joe reports:\n\n[clone] works fine now\n\n\nNote: if something went wrong on the server side, and if the server uses Git 2.5+ (Q2 2015), the error message might be more explicit.\nSee \"Git cloning: remote end hung up unexpectedly, tried changing postBuffer but still failing\".\n\nKulai (in the comments) points out to this Atlassian Troubleshooting Git page, which adds:\n\nError code 56 indicates a curl receive the error of CURLE_RECV_ERROR which means there was some issue that prevented the data from being received during the cloning process.\nTypically this is caused by a network setting, firewall, VPN client, or anti-virus that is terminating the connection before all data has been transferred.\n\nIt also mentions the following environment variable, order to help with the debugging process.\n# Linux\nexport GIT_TRACE_PACKET=1\nexport GIT_TRACE=1\nexport GIT_CURL_VERBOSE=1\n\n#Windows\nset GIT_TRACE_PACKET=1\nset GIT_TRACE=1\nset GIT_CURL_VERBOSE=1\n\n\nWith Git 2.25.1 (Feb. 2020), you know more about this http.postBuffer \"solution\".\nSee commit 7a2dc95, commit 1b13e90 (22 Jan 2020) by brian m. carlson (bk2204).\n(Merged by Junio C Hamano -- gitster -- in commit 53a8329, 30 Jan 2020)\n(Git Mailing list discussion)\n\ndocs: mention when increasing http.postBuffer is valuable\nSigned-off-by: brian m. carlson\n\n\nUsers in a wide variety of situations find themselves with HTTP push problems.\nOftentimes these issues are due to antivirus software, filtering proxies, or other man-in-the-middle situations; other times, they are due to simple unreliability of the network.\nHowever, a common solution to HTTP push problems found online is to increase http.postBuffer.\nThis works for none of the aforementioned situations and is only useful in a small, highly restricted number of cases: essentially, when the connection does not properly support HTTP/1.1.\nDocument when raising this value is appropriate and what it actually does, and discourage people from using it as a general solution for push problems, since it is not effective there.\n\nSo the documentation for git config http.postBuffer now includes:\n\nhttp.postBuffer\n\n\nMaximum size in bytes of the buffer used by smart HTTP transports when POSTing data to the remote system.\nFor requests larger than this buffer size, HTTP/1.1 and Transfer-Encoding: chunked is used to avoid creating a massive pack file locally.\nDefault is 1 MiB, which issufficient for most requests.\nNote that raising this limit is only effective for disabling chunked transfer encoding and therefore should be used only where the remote server or a proxy only supports HTTP/1.0 or is noncompliant with the HTTP standard.\nRaising this is not, in general, an effective solution for most push problems, but can increase memory consumption significantly since the entire buffer is allocated even for small pushes." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git - the stupid content tracker git-bugreport" }, { "role": "assistant", "content": "Collect information for user to file a bug report" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-svn - Bidirectional operation between a Subversion repository and Git find-rev" }, { "role": "assistant", "content": "When given an SVN revision number of the form rN , returns the\ncorresponding Git commit hash (this can optionally be followed by a\ntree-ish to specify which branch should be searched). When given a\ntree-ish, returns the corresponding SVN revision number. -B --before Don’t require an exact match if given an SVN revision, instead find\nthe commit corresponding to the state of the SVN repository (on the\ncurrent branch) at the specified revision. -A --after Don’t require an exact match if given an SVN revision; if there is\nnot an exact match return the closest match searching forward in the\nhistory." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to fix \"Filename too long error\" during git clone\n\nI am trying to take a git clone from a particular branch of my bitbucket repository using the below command:\ngit clone <url> --branch <branchname>.\nHowever, I am getting the below error while taking the clone:\n\nerror:unable to create file foldername/nodemodules/......: Filename\n too long.\n\nI tried resolving this by running the below command in my git cmd\ngit config --system core.longpaths true.\nBut I am getting:\n\nerror: could not lock config file c://.gitconfig: Permission denied\n error: could not lock config file c://.gitconfig: Invalid argument.\n\nHow do I solve these two errors?" }, { "role": "assistant", "content": "Start Git Bash as Administrator\nRun command git config --system core.longpaths true\n\nAnother way (only for this clone):\ngit clone -c core.longpaths=true <repo-url>" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-config - Get and set repository or global options pushRefNeedsUpdate" }, { "role": "assistant", "content": "Shown when git-push rejects a forced update of\na branch when its remote-tracking ref has updates that we\ndo not have locally." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Git - Store branches in separate local directories\n\nI'm rather new to git, and am trying to set up my repository the right way.\nBasically my app is a platform of sorts, so implementations of this platform are based on the master branch, but have some small modifications to those files as well as some additional files.\nI tried setting it up as branches, so I have a master branch, implementation_1 and implementation_2.\nBut as far as I can tell, that would mean that locally all the branches are stored in one directory, with their separation being only through git.\nWhat I would like is to have 3 local directories, master,imp_1, and imp_2. If I make a change to one of the core files in the imp_1 directory, I want to be able to merge that change into the master branch and from there into imp_2.\nI'm beginning to think these need to be 3 different repositories (the implementations being forks of the core). Is that the way to go? In that case, how would I go about handling the above scenario?" }, { "role": "assistant", "content": "Branches are first class citizens in Git. They are not \"emulated\" as branches like in older VCS such SVN, CVS, etc.\nIf you really need three different directories, because you want to have three distinct development environment, make 3 clones:\n\none in a directory called master\none in a directory called imp_1\none in a directory called imp_2\n\nBut to really understand branches, you can read \"Pros and cons of different branching models in DVCS\".\n\nOr, since Git 2.5 (July 2015, 4 years after the OP's question), as I detailed in Multiple working directories with Git?, use git worktree. \nThat will be one clone, multiple folders (one per branch).\nWith Git 2.7+, you can then list those folders:\n$ git worktree list\n/path/to/bare-source (bare)\n/path/to/linked-worktree abcd1234 [master]\n/path/to/other-linked-worktree 1234abc (detached HEAD)" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Continuous integration and continuous delivery with git-flow\nWe have been doing continuous integration and continuous delivery since a while with Subversion commits as the pipelines triggers. Recently, we started using git in some projects with git-flow and we are trying to decide which of the branches of git-flow should we use to trigger the continuous integration and continous delivery pipelines.\nHere are two approaches:\n1. Use develop branch\nProblem: With git-flow we are supposed to deploy the release (or master) branch in production, so we would have to build two different pipelines, one for continuous integration (branch develop) and one for continuous delivery (branch master). This could introduce bugs in production because the version in production will not be the same that the one in other environments (integration, test, staging).\n2. Use master branch: \nProblem: This way, we would not have a truly continuous integration, since changes to these branches are pushed not very frequently.\nWhich is the rigth branch to use in the pipelines?" }, { "role": "assistant", "content": "Git-flow and continuous integration are, by definition, incompatible. Branches are a mechanism for delaying integration: when you commit to a branch other than master (or trunk, if you come from Subversion), you are avoiding continuous integration. Doing continuous integration is simple, but not easy." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "change xcrun developer path for Android Studio/IntelliJ\nI'm using GIT and am trying to push my code and getting the following error when using the Terminal. I don't use XCode, I'm using Android Studio.\nThe command I tried using was: \n\ngit branch Networking\n\nError:\n\nxcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun`\n\nI am running on El Capitan Beta 4 update if that helps in any way.\n\n\nUpdate: This also happens for IntelliJ users, and for MacOS\n Catalina update" }, { "role": "assistant", "content": "I ran into the same problem, however with svn. I found that by installing El Capitan, Xcode was \"uninstalled\". I reinstalled Xcode from the App Store and then reinstalled Xcode Command Line Tools via Terminal with\nxcode-select --install\n\nAfter installation, my /Library/Developer/CommandLineTools/usr/bin directory reappeared and svn started working again." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "remove branches not on remote\n==> git branch -a\n* master\n test\n remotes/origin/master\n remotes/origin/test\n\nwhen someone delete the remotes/origin/test,I still can see it on my computer.\nI know I can do this and remove the test\n==> git remote prune\n==> git branch -d test\n==> git branch -a\n* master\n remotes/origin/master\n\nBut if I have more local branch, and they are not on remote, so how can I remove them quickly?" }, { "role": "assistant", "content": "This is how I remove local branches that are not longer relevant:\ngit branch --merged origin/master | xargs git branch -d\n\nYou may need to tweak it according to your specific configuration (e.g. see comments below to exclude particular branches), but the first command here before the pipe should give you a list of all your local branches that have been merged into your master branch." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to get build status from GitLab CI?\n\nI want to add in cap deploy scenario checking build status from GitLab CI.\nIs it possible? \nDoes GitLab CI has some API to get build/pipeline status by commit SHA?" }, { "role": "assistant", "content": "Now you can get the badge from this url:\nhttps://gitlab.com/[namespace]/[project]/badges/[branch]/pipeline.svg" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-log - Show commit logs -b --ignore-space-change" }, { "role": "assistant", "content": "Ignore changes in amount of whitespace. This ignores whitespace\nat line end, and considers all other sequences of one or\nmore whitespace characters to be equivalent." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-stash - Stash the changes in a dirty working directory away -q --quiet" }, { "role": "assistant", "content": "This option is only valid for apply , drop , pop , push , save , store commands. Quiet, suppress feedback messages." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git - the stupid content tracker" }, { "role": "assistant", "content": "DESCRIPTION Git is a fast, scalable, distributed revision control system with an\nunusually rich command set that provides both high-level operations\nand full access to internals. See gittutorial to get started, then see giteveryday for a useful minimum set of\ncommands. The Git User’s Manual has a more\nin-depth introduction. After you mastered the basic concepts, you can come back to this\npage to learn what commands Git offers. You can learn more about\nindividual Git commands with \"git help command\". gitcli manual page gives you an overview of the command-line command syntax. A formatted and hyperlinked copy of the latest Git documentation\ncan be viewed at https://git.github.io/htmldocs/git.html or https://git-scm.com/docs ." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-diff - Show changes between commits, commit and working tree, etc diff.suppressBlankEmpty" }, { "role": "assistant", "content": "A boolean to inhibit the standard behavior of printing a space\nbefore each empty output line. Defaults to false." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-log - Show commit logs %ae" }, { "role": "assistant", "content": "author email" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How do I undo 'git reset'?\nHow do I undo this command?\ngit reset HEAD~" }, { "role": "assistant", "content": "Short answer:\ngit reset 'HEAD@{1}'\n\nLong answer:\nGit keeps a log of all ref updates (e.g., checkout, reset, commit, merge). You can view it by typing:\ngit reflog\n\nSomewhere in this list is the commit that you lost. Let's say you just typed git reset HEAD~ and want to undo it. My reflog looks like this:\n$ git reflog\n3f6db14 HEAD@{0}: HEAD~: updating HEAD\nd27924e HEAD@{1}: checkout: moving from d27924e0fe16776f0d0f1ee2933a0334a4787b4c\n[...]\n\nThe first line says that HEAD 0 positions ago (in other words, the current position) is 3f6db14; it was obtained by resetting to HEAD~. The second line says that HEAD 1 position ago (in other words, the state before the reset) is d27924e. It was obtained by checking out a particular commit (though that's not important right now). So, to undo the reset, run git reset HEAD@{1} (or git reset d27924e).\nIf, on the other hand, you've run some other commands since then that update HEAD, the commit you want won't be at the top of the list, and you'll need to search through the reflog.\nOne final note: It may be easier to look at the reflog for the specific branch you want to un-reset, say master, rather than HEAD:\n$ git reflog show master\nc24138b master@{0}: merge origin/master: Fast-forward\n90a2bf9 master@{1}: merge origin/master: Fast-forward\n[...]\n\nThis should have less noise it in than the general HEAD reflog." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Finding most changed files in Git\nHow can I show files in Git which change most often?" }, { "role": "assistant", "content": "You could do something like the following:\ngit log --pretty=format: --name-only | sort | uniq -c | sort -rg | head -10\n\nThe log just outputs the names of the files that have been changed in each commit, while the rest of it just sorts and outputs the top 10 most frequently appearing filenames." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to get tags on current commit\nI have a repository which has multiple tags on the same commit. For example:\ncommit #3 <--- TAG1 / TAG2 / TAG3\n\n |\n\ncommit #2 <--- TAG4/ TAG5\n\n |\n\ncommit #1 <--- TAG6/ TAG7\n\nI'd like to find out what tags are on a particular commit. For example, if I check commit 1, I'd like to get tag 6 and tag 7.\nI have tried:\ngit checkout <commit 1> \ngit tag --contains\n\nwhich displayed tags 1-7.\ngit checkout <commit 1>\ngit describe --tags HEAD\n\ndisplayed tag 6 only.\nWhat is the proper way to do this in Git?" }, { "role": "assistant", "content": "For completion (thanks to Ciro Santili answer), git tag has got the option --points-at that does exactly what OP is asking.\ngit tag --points-at HEAD\n\nIt does not have the effect of also listing the tags put on forward commits (as Jonathan Hartley stated in his comment regarding git tag --contains)." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Change GitHub Account username\n\nI want to change my account's user name on GitHub, but I can't find how to do it. Is this possible at all? To clarify, I'm not talking about the user.name parameter in a git repository, but the username of the actual GitHub account." }, { "role": "assistant", "content": "Yes, it's possible. But first read, \"What happens when I change my username?\"\nTo change your username, click your profile picture in the top right corner, then click Settings. On the left side, click Account. Then click Change username.\nSee the pictures below:\nSettings\nChange username\nConfirm changing username\nType the new username\nConfirm the new username" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Examining a changeset in HG\nHow can I examine a changeset in mercurial without looking up its parent? In mercurial, what's the equivalent of\ngit show HEAD^\n\nGit-show gives the changeset metadata and the diff as well." }, { "role": "assistant", "content": "Your question has two parts. First, how to get the metadata and diff for a changeset all at once:\nhg log --patch --rev tip\n\nYou can shorten the options:\nhg log -pr tip\n\nThe second part of the question is how to say \"the parent changeset of X\" without looking it up. For that you can use the parentrevspec extension Martin mentioned.\nOnce you enable the extension you can do:\nhg log -pr tip^\n\nYou could add an alias to your ~/.hgrc file if you don't want to retrain your fingers from git's command:\n[alias]\nshow = log -pr\n\nThen you could use:\nhg show tip^" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "What do the values for gitlab's predefiner variable CI_PIPELINE_SOURCE mean?\n\nIn the gitlab documentation you find a list of predefined variables HERE, where the variable CI_PIPELINE_SOURCE is explained to have the possible values \"push, web, schedule, api, external, chat, webide, merge_request_event, external_pull_request_event, parent_pipeline, trigger, or pipeline.\"\nHowever, it is not explained, what they mean.\n\npush: When you push something to a branch?\nweb: When you trigger a pipeline from the web GUI?\nschedule: When a pipeline is triggered by a schedule\napi: When the pipeline is triggered by an API request\nexternal: ???\nchat: ???\nwebide: ???\nmerge_request_event: Seems to be triggered when a merge request is created. Does not trigger when a change is actually merged\nexternal_pull_request_event: ???\nparent_pipeline: ???\ntrigger: ???\npipeline: another pipeline?\n\nIf someone knows where the documentation for that is hiding, I appreciate if you can let me know where to find it.\nIn addition, how can I figure out when some changes are actually merged into a branch? How can I trigger a pipeline in that event?" }, { "role": "assistant", "content": "Regarding your first set of questions, i have to point you forward to the gitlab CI Documentation and the rules:if section. They have their a good explanation of the states and also some addtion https://docs.gitlab.com/ee/ci/jobs/job_control.html#common-if-clauses-for-rules - i am just screenshoting this, so people can relate to it in the future if the link gets outdated:\n\nRegarding your additional question:\nA merge is a push. We do not check on some branches for CI_PIPELINE_SOURCE but for the branch name and do checks simply against that like:\n rules:\n - if: '$CI_COMMIT_BRANCH == \"master\"'\n - if: '$CI_COMMIT_BRANCH == \"develop\"'\n - if: '$CI_COMMIT_BRANCH =~ /^release.*$/i'\n - if: '$CI_PIPELINE_SOURCE == \"merge_request_event\"'\n\nThis works eg perfectly in our case for gitflow. But you can vary your rules and easily define them to your own needs - the rules documentation gives a lot of good examples see: https://docs.gitlab.com/ee/ci/jobs/job_control.html#common-if-clauses-for-rules" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Setup a Git server with msysgit on Windows [closed]\nClosed. This question is seeking recommendations for software libraries, tutorials, tools, books, or other off-site resources. It does not meet Stack Overflow guidelines. It is not currently accepting answers.\n \n \n\n\n\n\n\n\n\n\n\n\n\n We don’t allow questions seeking recommendations for software libraries, tutorials, tools, books, or other off-site resources. You can edit the question so it can be answered with facts and citations.\n\n\nClosed 6 years ago.\n\n\n\n\n\n\n\n Improve this question\n \n\n\n\nMy friends and I are trying to setup Git for Windows using the tutorial Git Server: Gitosis and Cygwin on Windows, but we just keep running into problems. \nWhat would a \"Setup Git Server\" guide for Windows using msysgit be like?\nThere is a comment in the tutorial above suggesting it can't be done with msysgit because gitosis requires the use of an SSH Server and Bash? What is a step by step guide (as there is not one available)?\n\nInstall mysisgit\n?" }, { "role": "assistant", "content": "I found this post and I have just posted something on my blog that might help.\nSee Setting up a Msysgit Server with copSSH on Windows. It's long, but I have successfully got this working on Windows 7 Ultimate x64." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Search all of Git history for a string [duplicate]\nThis question already has answers here:\n \n \n\n\n\n\nHow can I grep Git commits for a certain word?\n\n (9 answers)\n \n\nClosed 10 years ago.\n\n\n\nI have a code base which I want to push to GitHub as open source. In this Git-controlled source tree, I have certain configuration files which contain passwords. I made sure not to track this file and I also added it to the .gitignore file. However, I want to be absolutely positive that no sensitive information is going to be pushed, perhaps if something slipped in-between commits or something. I doubt I was careless enough to do this, but I want to be positive.\nIs there a way to \"grep\" all of Git? I know that sounds weird, but by \"all\" I mean every version of every file that ever existed. I guess if there is a command that dumps the diff file for every commit, that might work?" }, { "role": "assistant", "content": "Git can search diffs with the -S option (it's called pickaxe in the docs)\ngit log -S password\n\nThis will find any commit that added or removed the string password. Here a few options:\n\n-p: will show the diffs. If you provide a file (-p file), it will generate a patch for you.\n-G: looks for differences whose added or removed line matches the given regexp, as opposed to -S, which \"looks for differences that introduce or remove an instance of string\".\n--all: searches over all branches and tags; alternatively, use --branches[=<pattern>] or --tags[=<pattern>]" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-fetch - Download objects and refs from another repository fetch.pruneTags" }, { "role": "assistant", "content": "If true, fetch will automatically behave as if the refs/tags/*:refs/tags/* refspec was provided when pruning,\nif not set already. This allows for setting both this option\nand fetch.prune to maintain a 1=1 mapping to upstream\nrefs. See also remote.<name>.pruneTags and the PRUNING\nsection of git-fetch ." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git commit - setting timestamps into the future\nI need to make some commits using Git but I would like the timestamp in git-log to be in the future.\nHow can I do a commit in git that causes a future timestamp to register in the git-log?" }, { "role": "assistant", "content": "You should wait a bit.\nOr you can do this:\n/tmp/x 604% env GIT_AUTHOR_DATE='Wed Dec 19 15:14:05 2029 -0800' git commit -m 'future!'\n[master]: created 6348548: \"Future!\"\n 1 files changed, 1 insertions(+), 0 deletions(-)\n\n/tmp/x 605% git log \n\nAuthor: Dustin Sallings <[email protected]>\nDate: Wed Dec 19 15:14:05 2029 -0800\n\n Future!\n\nNote that there's both an author date and a committer date, so be sure to set the right one (or both)." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-daemon - A really simple server for Git repositories --inetd" }, { "role": "assistant", "content": "Have the server run as an inetd service. Implies --syslog (may be\noverridden with --log-destination= ).\nIncompatible with --detach, --port, --listen, --user and --group\noptions." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Is there a way of having git show lines added, lines changed and lines removed?\ngit diff --stat and git log --stat show output like:\n$ git diff -C --stat HEAD c9af3e6136e8aec1f79368c2a6164e56bf7a7e07\napp/controllers/application_controller.rb | 34 +++-------------------------\n1 files changed, 4 insertions(+), 30 deletions(-)\n\nBut what really happened in that commit was that 4 lines were changed and 26 lines were deleted which is different than adding 4 lines and deleting 30.\nIs there any way of getting the delta LOCs (26 in this case)? I don't really care about differentiating between lines added or removed." }, { "role": "assistant", "content": "For per-file numerical diff information:\ngit diff --numstat\n\nFor aggregated numerical diff information:\ngit diff --shortstat\n\nAs far as separating modification from an add and remove pair, --word-diff might help. You could try something like this:\nMOD_PATTERN='^.+(\\[-|\\{\\+).*$' \\\nADD_PATTERN='^\\{\\+.*\\+\\}$' \\\nREM_PATTERN='^\\[-.*-\\]$' \\\ngit diff --word-diff --unified=0 | sed -nr \\\n -e \"s/$MOD_PATTERN/modified/p\" \\\n -e \"s/$ADD_PATTERN/added/p\" \\\n -e \"s/$REM_PATTERN/removed/p\" \\\n | sort | uniq -c\n\nIt's a little long-winded so you may want to parse it in your own script instead." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to see the changes between two commits without commits in-between?\nHow do you make git diff only show the difference between two commits, excluding the other commits in-between?" }, { "role": "assistant", "content": "you can simply pass the 2 commits to git diff like :\n-> git diff 0da94be 59ff30c > my.patch\n-> git apply my.patch" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "What is gitlab runner\n\nI think I'm fundamentally missing something. I'm new to CI/CD and trying to set up my first pipeline ever with gitlab.\nThe project is a pre-existing PHP project.\nI don't want to clean it up just yet, at the moment I've pushed the whole thing into a docker container and it's running fine talking to google cloud's mysql databases etc as it should locally and also on a remote google cloud testing VM.\nThe dream is to be able to push to the development branch, and then merge the dev banch into the test branch which then TRIGGERS automated tests (easy part), and also causes the remote test VM (hosted on google cloud), to PULL the newest changes, rebuild the image from the latest docker file (or pull the latest image from gitlab image register)... and then rebuild the container with the newest image.\nI'm playing around with gitlab's runner but I'm not understanding what it's actually for, despite looking through almost all the online content for it.\nDo I just install it in the google cloud VM, and then when I push to gitlab from my development machine.. the repo will 'signal' the runner (which is running on the VM, to execute a bunch of scripts (which might include git pull on the newest changes?).\nBecause I already pre-package my app into a container locally (and push the image to the image registry) do I need to use docker as my executor on the runner? or can i just use shell and shell the commands in?\nWhat am I missing?\nTLDR and extra:\nQuestions:\n\nWhat is runner actually for,\nwhere is it meant to be installed?\nDoes it care which directory it is run in?\nIf it doesn't care which directory it's run,\nwhere does it execute it's script commands? At root?\nIf I am locally building my own images and uploading them to gitlab's registry,\n\nDo I need to set my executor to docker? Shouldn't I just set it to shell, pull the image, and build it? (Assuming the runner is runing on the remote VM)." }, { "role": "assistant", "content": "What is runner actually for?\n\nYou have your project along with a .gitlab-ci.yml file. .gitlab-ci.yml defines what stages your CI/CD pipeline has and what to do in each stage. This typically consists of a build,test,deploy stages. Within each stage you can define multiple job. For example in build stage you may have 3 jobs to build on debian, centos and windows (in GitLab glossary build:debian, build:centos, build:windows). A GitLab runner clones the project read the gitlab-ci.yaml file and do what he is instructed to do. So basically GitLab runner is a Golang process that executes some instructed tasks.\n\nwhere is it meant to be installed?\n\nYou can install a runner in your desired environment listed here. https://docs.gitlab.com/runner/install/\nor\nyou can use a shared runner that is already installed on GitLab's infrastructure.\n\nDoes it care which directory it is run in?\n\nYes. Every task executed by runner is relativly to CI_PROJECT_DIR defined in https://gitlab.com/help/ci/variables/README. But you can alter this behaviour.\n\nwhere does it execute it's script commands? At root?\nDo I need to set my executor to docker? Shouldn't I just set it to shell, pull the image, and build it?\n\nA runner can have mutiple executors such as docker, shell, virtualbox etc but docker being the most common one. If you use docker as the executor you can pull any image from docker hub or your configured registry and you can do loads of stff with docker images. In a docker environment normally you run them as the root user.\nhttps://docs.gitlab.com/runner/executors/README.html" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Why does git-bisect have to be run from the top-level directory of the working tree?\nIf one tries to run any of the git bisect commands from anywhere other than the root directory of the repository, one is told:\n\nYou need to run this command from the toplevel of the working tree.\n\nWhy is that? I know of no other git command that has this requirement, and I see no obvious reason that bisect should be special. The man page makes no mention of this restriction, either.\nIt's really not a big deal. I'm mostly just curious." }, { "role": "assistant", "content": "Looking at some commits in the project, I see one by Marcel M. Cary ([email protected])\nHe says in a commit (it happens to be about git-pull but I think it is relevant)\n\n\"git pull\" fails because POSIX shells have a notion of current working\n directory that is different from getcwd(). The shell stores this path\n in PWD. As a result, \"cd ../\" can be interpreted differently in a\n shell script than chdir(\"../\") in a C program. The shell interprets\n \"../\" by essentially stripping the last textual path component from\n PWD, whereas C chdir() follows the \"..\" link in the current directory\n on the filesystem. When PWD is a symlink, these are different\n destinations. As a result, Git's C commands find the correct\n top-level working tree, and shell scripts do not.\nhttps://github.com/git/git/commit/08fc0608657ee91bc85276667804c36a93138c7d\n\nSO I'd say part of the reason is because git-bisect is a shell script which can't be trusted to find the toplevel on its own (when symlinks are involved)." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Why does git status show branch is up-to-date when changes exist upstream?\nChanges exist upstream in a tracked branch, but when I type git status it indicates that my local branch is up-to-date. Is this new behavior, did I change a config setting, or is something wrong?\nubuntu@host:/my/repo# git status\nOn branch master\nYour branch is up-to-date with 'origin/master'.\n\nnothing to commit, working directory clean\n\n\nubuntu@host:/my/repo# git pull\nremote: Counting objects: 11, done.\nremote: Compressing objects: 100% (11/11), done.\nremote: Total 11 (delta 6), reused 0 (delta 0)\nUnpacking objects: 100% (11/11), done.\nFrom bitbucket.org:my/repo\n 1234567..abcdefg master -> origin/master\nUpdating 1234567..abcdefg\nFast-forward\n file1 | 1 -\n file2 | 43 +++++++++++++++++++++++++++++++++++++++++++\n file3 | 21 ++++++++++++---------\n file4 | 21 ++++++++++++---------\n 4 files changed, 67 insertions(+), 19 deletions(-)\n create mode 100644 file5" }, { "role": "assistant", "content": "What the status is telling you is that you're behind the ref called origin/master which is a local ref in your local repo. In this case that ref happens to track a branch in some remote, called origin, but the status is not telling you anything about the branch on the remote. It's telling you about the ref, which is just a commit ID stored on your local filesystem (in this case, it's typically in a file called .git/refs/remotes/origin/master in your local repo).\ngit pull does two operations; first it does a git fetch to get up to date with the commits in the remote repo (which updates the origin/master ref in your local repo), then it does a git merge to merge those commits into the current branch.\nUntil you do the fetch step (either on its own or via git pull) your local repo has no way to know that there are additional commits upstream, and git status only looks at your local origin/master ref.\nWhen git status says up-to-date, it means \"up-to-date with the branch that the current branch tracks\", which in this case means \"up-to-date with the local ref called origin/master\". That only equates to \"up-to-date with the upstream status that was retrieved last time we did a fetch\" which is not the same as \"up-to-date with the latest live status of the upstream\".\nWhy does it work this way? Well the fetch step is a potentially slow and expensive network operation. The design of Git (and other distributed version control systems) is to avoid network operations when unnecessary, and is a completely different model to the typical client-server system many people are used to (although as pointed out in the comments below, Git's concept of a \"remote tracking branch\" that causes confusion here is not shared by all DVCSs). It's entirely possible to use Git offline, with no connection to a centralized server, and the output of git status reflects this.\nCreating and switching branches (and checking their status) in Git is supposed to be lightweight, not something that performs a slow network operation to a centralized system. The assumption when designing Git, and the git status output, was that users understand this (too many Git features only make sense if you already know how Git works). With the adoption of Git by lots and lots of users who are not familiar with DVCS this assumption is not always valid." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Is it possible to cherry-pick a commit from another git repository?\nI'm working with a git repository that needs a commit from another git repository that knows nothing of the first.\nTypically I would cherry-pick using the HEAD@{x} in the reflog, but because this .git knows nothing of this reflog entry (different physical directory), how can I cherry-pick this, or can I?\nI'm using git-svn. My first branch is using git-svn of the trunk of a Subversion repo, and the next branch is using git-svn on a Subversion branch." }, { "role": "assistant", "content": "The answer, as given, is to use format-patch but since the question was how to cherry-pick from another folder, here is a piece of code to do just that:\n$ git --git-dir=../<some_other_repo>/.git \\\nformat-patch -k -1 --stdout <commit SHA> | \\\ngit am -3 -k\n\nExplanation from Cong Ma comment Aug 28 '14\n\ngit format-patch command creates a patch from some_other_repo's commit\nspecified by its SHA (-1 for one single commit alone). This patch is\npiped to git am, which applies the patch locally (-3 means trying the\nthree-way merge if the patch fails to apply cleanly)." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-config - Get and set repository or global options url.<base>.pushInsteadOf" }, { "role": "assistant", "content": "Any URL that starts with this value will not be pushed to;\ninstead, it will be rewritten to start with <base>, and the\nresulting URL will be pushed to. In cases where some site serves\na large number of repositories, and serves them with multiple\naccess methods, some of which do not allow push, this feature\nallows people to specify a pull-only URL and have Git\nautomatically use an appropriate URL to push, even for a\nnever-before-seen repository on the site. When more than one\npushInsteadOf strings match a given URL, the longest match is\nused. If a remote has an explicit pushurl, Git will ignore this\nsetting for that remote." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to know if latest commit to master has been pushed to the remote?\n\nI have merged a branch in to master and now I can see that in my git log\nSome time has passed and now I want to know whether I previously also pushed master (with that commit) to the remote. How can I tell if it has been pushed?\nI can think of a few workaround such as recloning the repository elsewhere, or resetting and checking and then re-merging but I feel that there's probably a somewhat simpler answer.\nfyi this is different from How can I know in git if a branch has been already merged into master? as I know it has been merged, just don't know about the remote push." }, { "role": "assistant", "content": "Do\n> git status\n\nIf the output is\n# On branch master\nnothing to commit, working directory clean\n\nThen you have pushed the current commit.\nIf the output instead begins with \n# On branch master\n# Your branch is ahead of 'origin/master' by 1 commit.\n# (use \"git push\" to publish your local commits)\n\nThen you have a local commit that has not yet been pushed. You see this because the remote branch, origin/master, points to the commit that was last pushed to origin. However, your branch is ahead of 'origin/master', meaning that you have a local commit that has been created after the last pushed commit.\nIf the commit you are interested in is not the latest, then you can do\n> git log --decorate --oneline\n\nto find out if the commit in question is before or after the commit pointed to by origin/master.\nIf the commit is after (higher up in the log than) origin/master, then it has not been pushed." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "What is the difference between \"git branch\" and \"git checkout -b\"?\nI used git checkout -b to create a new branch. I think that git branch does the same thing.\nHow do these two commands differ, if they differ at all?" }, { "role": "assistant", "content": "git checkout -b BRANCH_NAME creates a new branch and checks out the new branch while git branch BRANCH_NAME creates a new branch but leaves you on the same branch.\nIn other words git checkout -b BRANCH_NAME does the following for you.\ngit branch BRANCH_NAME # create a new branch\ngit switch BRANCH_NAME # then switch to the new branch" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "pip install from git repo branch\nTrying to pip install a repo's specific branch. Google tells me to\npip install https://github.com/user/repo.git@branch\n\nThe branch's name is issue/34/oscar-0.6 so I did pip install https://github.com/tangentlabs/django-oscar-paypal.git@/issue/34/oscar-0.6 but its returning a 404.\nHow do I install this branch?" }, { "role": "assistant", "content": "Prepend the url prefix git+ (See VCS Support):\npip install git+https://github.com/tangentlabs/django-oscar-paypal.git@issue/34/oscar-0.6\n\nAnd specify the branch name without the leading /." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-show - Show various types of objects --no-color" }, { "role": "assistant", "content": "Turn off colored diff.\nIt is the same as --color=never ." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git - the stupid content tracker gitworkflows" }, { "role": "assistant", "content": "An overview of recommended workflows with Git" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-hash-object - Compute object ID and optionally create an object from a file" }, { "role": "assistant", "content": "DESCRIPTION Computes the object ID value for an object with specified type\nwith the contents of the named file (which can be outside of the\nwork tree), and optionally writes the resulting object into the\nobject database. Reports its object ID to its standard output.\nWhen <type> is not specified, it defaults to \"blob\"." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": ".gitignore file for java eclipse project\nI have java project that uses the Eclipse IDE.\nThe Eclipse workspace is pointing to this directory:\n/home/srvimgprd/BUSPROJ/code_development/dime/executables/clientcode/java_axis/Eclipse\n\nI have placed a .gitignore file in the workspace directory \"Eclipse\". See below.\nWhat I need to do is to be able to download the items from the Eclipse directory onto a new machine and then compile with no issue.\nAre there any concrete steps to accomplish this task? When using the .gitignore file below, nothing shows up on the target machine.\n\nCONTENTS OF ECLIPSE DIRECTORY (on source machine):\n/home/srvimgprd/BUSPROJ/code_development/dime/executables/clientcode/java_axis/Eclipse\n\njava_axis/Eclipse> ls -lart\ntotal 48\ndrwxr-xr-x 2 imgdev development 4096 2013-09-09 04:53 RemoteSystemsTempFiles\ndrwxr-xr-x 4 imgdev development 4096 2013-09-09 04:55 Servers\ndrwxr-xr-x 4 imgdev development 4096 2013-09-09 04:58 .metadata\ndrwxr-xr-x 6 imgdev development 4096 2013-09-09 05:06 Axis2ClientDimeServer\ndrwxr-xr-x 5 imgdev development 4096 2013-09-10 08:30 ..\n-rw-r--r-- 1 imgdev development 307 2013-09-10 08:31 .gitignore\ndrwxr-xr-x 6 imgdev development 4096 2013-09-10 08:31 .\n\n\nCONTENTS OF .gitignore FILE\n\n*target*\n*.jar\n*.war\n*.ear\n*.class\n\n# eclipse specific git ignore\n*.pydevproject\n.project\n.metadata\nbin/**\ntmp/**\ntmp/**/*\n*.tmp\n*.bak\n*.swp\n*~.nib\nlocal.properties\n.classpath\n.settings/\n.loadpath\n\n# External tool builders\n.externalToolBuilders/\n\n# Locally stored \"Eclipse launch configurations\"\n*.launch" }, { "role": "assistant", "content": "put .gitignore in your main catalog\ngit status (you will see which files you can commit)\ngit add -A\ngit commit -m \"message\"\ngit push" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Managing user configuration files across multiple computers\nI commonly work on multiple computers. I have various configuration files, eg, .bashrc, .gitconfig, .irbrc, .vimrc and configuration folders, eg, .vim/ that contain valuable customizations.\nSometimes I want small variations in configuration between the different computers.\nI want to use version control to manage these different files.\n\ndo others use version control to manage their configuration files?\nwhat are some hints that might make this easier?\nwhat's the most elegant way of dealing with variations between the computers?\nI'm comfortable with git; any other suggestions?" }, { "role": "assistant", "content": "I keep a folder at ~/config/ which is a bzr repository. I push/pull the repository between my various computers to sync it up. I have an install script which I use to make symlinks to my home directory:\n#! /bin/sh\n# link all files to the home directory, asking about overwrites\ncd `dirname $0`\nSCRIPT_DIR=`pwd`\nSCRIPT_NAME=`basename $0`\nFILES=`bzr ls --versioned --non-recursive`\n\ncd $HOME\nfor FILE in $FILES; do\n ln --symbolic --interactive $SCRIPT_DIR/$FILE\ndone\nrm $TARGET_DIR/$SCRIPT_NAME\n\nIf you want to use git instead of bzr, you can instead use:\nFILES=`git ls-tree --name-only HEAD`\n\n(I had to ask SO to figure that out)\nEDIT: I don't actually do this anymore, now I have a dotfiles repo on github, with a nice rake install script that someone else wrote." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Ways to improve git status performance\nI have a repo of 10 GB on a Linux machine which is on NFS. The first time git status takes 36 minutes and subsequent git status takes 8 minutes. Seems Git depends on the OS for caching files. Only the first git commands like commit, status that involves pack/repack the whole repo takes a very long time for a huge repo. I am not sure if you have used git status on such a large repo, but has anyone come across this issue?\nI have tried git gc, git clean, git repack but the time taken is still/almost the same.\nWill sub-modules or any other concepts like breaking the repo into smaller ones help? If so which is the best for splitting a larger repo. Is there any other way to improve time taken for git commands on a large repo?" }, { "role": "assistant", "content": "To be more precise, git depends on the efficiency of the lstat(2) system call, so tweaking your client’s “attribute cache timeout” might do the trick.\nThe manual for git-update-index — essentially a manual mode for git-status — describes what you can do to alleviate this, by using the --assume-unchanged flag to suppress its normal behavior and manually update the paths that you have changed. You might even program your editor to unset this flag every time you save a file.\nThe alternative, as you suggest, is to reduce the size of your checkout (the size of the packfiles doesn’t really come into play here). The options are a sparse checkout, submodules, or Google’s repo tool.\n(There’s a mailing list thread about using Git with NFS, but it doesn’t answer many questions.)" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-checkout - Switch branches or restore working tree files -l" }, { "role": "assistant", "content": "Create the new branch’s reflog; see git-branch for\ndetails." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-log - Show commit logs %ar" }, { "role": "assistant", "content": "author date, relative" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-blame - Show what revision and author last modified each line of a file --root" }, { "role": "assistant", "content": "Do not treat root commits as boundaries. This can also be\ncontrolled via the blame.showRoot config option." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Including js from raw.github.com\n\nI have a github.com demo page that is linking to https://raw.github.com/.../master/.../file.js so that I don't need to always copy the .js file over to the gh-pages branch every time it's changed. This works in every browser except IE which complains:\n\nSEC7112: Script from https://raw.github.com/cwolves/jQuery-iMask/master/dist/jquery-imask-min.js was blocked due to mime type mismatch\n\nThis complaint is coming from the fact that the file is transferred with:\nX-Content-Type-Options: nosniff\nContent-Type: text/plain\n\nwhich I can't change.\nAnyone have any ideas how to accomplish this same thing? Somehow allowing me to link to the file in the master branch without having to always push it to the gh-pages branch?\nActual page: http://cwolves.github.com/jQuery-iMask/\n(Minor update -- I changed the gh-pages in this exact instance to include the .js file, so IE is no longer broken, but would still like any feedback :))" }, { "role": "assistant", "content": "You can try using https://rawgit.com/ service.\nJust replace raw.github.com with rawgit.com\nUPDATE \nThe Rawgit service (former Rawgithub) has been shutdown. \n\nRawGit has reached the end of its useful life\n October 8, 2018\nGitHub repositories that served content through RawGit within the last month will continue to be served until at least October of 2019. URLs for other repositories are no longer being served.\nIf you're currently using RawGit, please stop using it as soon as you can." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Difference between git checkout --track origin/branch and git checkout -b branch origin/branch\nDoes anybody know the difference between these two commands to switch and track a remote branch?\ngit checkout -b branch origin/branch\ngit checkout --track origin/branch\n\nI think both keep track of the remote branch so I can push my changes to the branch on origin, right?\nAre there any practical differences?" }, { "role": "assistant", "content": "The two commands have the same effect (thanks to Robert Siemer’s answer for pointing it out). \nThe practical difference comes when using a local branch named differently:\n\ngit checkout -b mybranch origin/abranch will create mybranch and track origin/abranch\ngit checkout --track origin/abranch will only create 'abranch', not a branch with a different name.\n\n(That is, as commented by Sebastian Graf, if the local branch did not exist already.\nIf it did, you would need git checkout -B abranch origin/abranch)\n\nNote: with Git 2.23 (Q3 2019), that would use the new command git switch:\ngit switch -c <branch> --track <remote>/<branch>\n\n\nIf the branch exists in multiple remotes and one of them is named by the checkout.defaultRemote configuration variable, we'll use that one for the purposes of disambiguation, even if the <branch> isn't unique across all remotes.\n Set it to e.g. checkout.defaultRemote=origin to always checkout remote branches from there if <branch> is ambiguous but exists on the 'origin' remote.\n\nHere, '-c' is the new '-b'.\n\nFirst, some background: Tracking means that a local branch has its upstream set to a remote branch:\n# git config branch.<branch-name>.remote origin\n# git config branch.<branch-name>.merge refs/heads/branch\n\n\ngit checkout -b branch origin/branch will:\n\ncreate/reset branch to the point referenced by origin/branch.\ncreate the branch branch (with git branch) and track the remote tracking branch origin/branch. \n\n\nWhen a local branch is started off a remote-tracking branch, Git sets up the branch (specifically the branch.<name>.remote and branch.<name>.merge configuration entries) so that git pull will appropriately merge from the remote-tracking branch.\n This behavior may be changed via the global branch.autosetupmerge configuration flag. That setting can be overridden by using the --track and --no-track options, and changed later using git branch --set-upstream-to.\n\n\nAnd git checkout --track origin/branch will do the same as git branch --set-upstream-to):\n # or, since 1.7.0\n git branch --set-upstream upstream/branch branch\n # or, since 1.8.0 (October 2012)\n git branch --set-upstream-to upstream/branch branch\n # the short version remains the same:\n git branch -u upstream/branch branch\n\nIt would also set the upstream for 'branch'.\n(Note: git1.8.0 will deprecate git branch --set-upstream and replace it with git branch -u|--set-upstream-to: see git1.8.0-rc1 announce)\n\nHaving an upstream branch registered for a local branch will:\n\ntell git to show the relationship between the two branches in git status and git branch -v. \ndirects git pull without arguments to pull from the upstream when the new branch is checked out.\n\nSee \"How do you make an existing git branch track a remote branch?\" for more." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Git clone without .git directory\nIs there a flag to pass to git when doing a clone, say don't clone the .git directory? If not, how about a flag to delete the .git directory after the clone?" }, { "role": "assistant", "content": "Use\ngit clone --depth=1 --branch=master git://someserver/somerepo dirformynewrepo\nrm -rf ./dirformynewrepo/.git\n\n\nThe depth option will make sure to copy the least bit of history possible to get that repo.\nThe branch option is optional and if not specified would get the default branch.\nThe second line will make your directory dirformynewrepo not a Git repository any more.\nIf you're doing recursive submodule clone, the depth and branch parameter don't apply to the submodules." } ]