messages
listlengths
3
3
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git - the stupid content tracker git-fast-import" }, { "role": "assistant", "content": "Backend for fast Git data importers" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "GitHub \"can't automatically merge\"?\n\nSometimes when i try to merge the head fork into my base fork, or my base fork into the head fork, I get the following message on GitHub: \n\n\"Can’t automatically merge. Don’t worry, you can still create the pull request.\" \n\nHow do I view the conflicts, if there are any for this?\nI have read about 10 different examples with various commands but I can't tell what the names in the examples apply to in my situation as different names for bases, forks, branches, etc, exist.\nAfter all of this, I can't believe there isn't a command you can type to see the conflicts, edit the conflicts and go on with merging. \nIf there is, I haven't found it yet." }, { "role": "assistant", "content": "Let's say there is your-branch and the master branch. You want to merge changes from your-branch into the master for others to see them, but someone else did conflicting changes to the master (e.g. merging their PR) in the meantime. It is often useful to merge master into your-branch (i.e. do the merge the other way round) before creating the PR.\nIn the command line, you can:\ngit checkout master\ngit pull\ngit checkout your-branch\ngit merge master\n\nNow you can see the list of conflicts. Follow the messages you get from git to resolve the conflicts. You can use your favorite tools, so it is way easier. Finally, you commit&push. When you re-create the PR, there should be no conflicts." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Creating git branch after many commits\n\nI have a repo on GitHub with a single branch master that I've been working on in my local repo. At some point I stopped pushing commits back up to master on GitHub because I was worried that they'd break things. Now I have lots of commits in my local repo that I want to push back up to GitHub.\nHowever, rather than pushing back up to master I would prefer to create a new branch on GitHub (development) and push all my local commits back up to that branch (which I will merge back into master only after they've been better tested).\nWhat is the simple way to do this?" }, { "role": "assistant", "content": "on master:\ngit checkout -b newbranch or as suggested below, simply do a git branch newbranch to create the new branch without switching to it.\nThis will create a branch that is at your current commit at master. Once done:\ngit checkout master\nfollowed by:\ngit reset --hard <commit_hash>\nWhere <commit_hash> should be replaced by the commit ID you want master rolled back to.\nNow you can switch to your new branch and push it out to the remote.\ngit checkout newbranch\ngit push origin newbranch" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git - the stupid content tracker gitrepository-layout" }, { "role": "assistant", "content": "Git Repository Layout" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "giteveryday - A useful minimum set of commands for Everyday Git Clone the upstream and work on it. Feed changes to upstream." }, { "role": "assistant", "content": "$ git clone git://git.kernel.org/pub/scm/.../torvalds/linux-2.6 my2.6\n$ cd my2.6\n$ git switch -c mine master (1) $ edit/compile/test; git commit -a -s (2) $ git format-patch master (3) $ git send-email --to=\"person <[email protected]>\" 00*.patch (4) $ git switch master (5) $ git pull (6) $ git log -p ORIG_HEAD.. arch/i386 include/asm-i386 (7) $ git ls-remote --heads http://git.kernel.org/.../jgarzik/libata-dev.git (8) $ git pull git://git.kernel.org/pub/.../jgarzik/libata-dev.git ALL (9) $ git reset --hard ORIG_HEAD (10) $ git gc (11) checkout a new branch mine from master. repeat as needed. extract patches from your branch, relative to master, and email them. return to master , ready to see what’s new git pull fetches from origin by default and merges into the\ncurrent branch. immediately after pulling, look at the changes done upstream\nsince last time we checked, only in the\narea we are interested in. check the branch names in an external repository (if not known). fetch from a specific branch ALL from a specific repository\nand merge it. revert the pull. garbage collect leftover objects from reverted pull." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Git pull from another repository\nI have a repository called Generic, which is a generic application. I have forked it into a repository called Acme, which just builds upon the application stored Generic repository and adds Acme Co branding to it.\nIf I make changes to the core functionality in Generic, I want to update the Acme repository with the latest changes I have made to the core functionality in Generic. How would I do that?\nAs far as I can tell, I am essentially trying to merge the changes made in an upstream repository into the current fork.\nIf it means anything, I'm trying to do this because I have a generic application that I then build upon and brand for individual clients (like Acme in this example). If there is a cleaner way of doing this, let me know." }, { "role": "assistant", "content": "Issue the following command in your Acme repo. It adds a new remote repository named upstream that points to the Generic repo.\ngit remote add upstream https://location/of/generic.git\n\nYou can then merge any changes made to Generic into the current branch in Acme with the following command:\ngit pull upstream\n\nIf you just want it to download the changes without automatically merging, use git fetch instead of git pull.\nIf you want to disable pushing to that repository, set the push URL to an invalid URL using something like\ngit config remote.upstream.pushurl \"NEVER GONNA GIVE YOU UP\"\n\nGit will now yell at you about not being able to find a repo if you try to push to upstream (and sorry about the Rickroll, but it was the first random string that popped into my head)." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Going back to a previous commit in Github Desktop\n\nI am trying to use GitHub Desktop (i.e. the GUI application - NOT command line) to go back to a previous commit (on the same branch). Something that I would have thought is a core feature, since it's the primary reason for using source control in the first place.\nI can see that it's possible to revert a commit, but this is not really what I want as it creates a new commit. I would just simply like to go back with the option of going forward again, in the same way that I can just hop to a different branch.\nIs this possible or is it a limitation of github desktop and I need to use the cmd line for that?" }, { "role": "assistant", "content": "In general, you can go back to a commit in your history with git reset.\n\nThis is not possible with GitHub Desktop. GitHub Desktop is more of a tool to synchronize your repositories and not a full featured GUI client.\nBut that doesn't mean you have to use the command line, since there are alternatives. You can find a list here. To mention a few (that support git reset):\n\nTortoiseGit (Windows)\nSourceTree (Mac, Windows)\n\n\nHere is how you do it on command line. Most clients provide this in their UI using the same vocabulary (usually, you are able to select a commit and reset to it via context menu).\nYou will go back to the previous commit with\ngit reset HEAD^\n\nor some more commits (for example 3) by\ngit reset HEAD^3\n\nor to a specific commit by\ngit reset f7823ab\n\nHave in mind that, by default, the option --mixed is passed to git reset. So, all changes made, since that commit you reset to, will still be there.\nTo get the original state of the commit that you want to 'revert', you have to pass --hard. For example:\ngit reset f7823ab --hard" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git tag delete and re-add\nOn git hub I re-added the tag by doing: \ngit tag -d 12.15\ngit push origin :refs/tags/12.15\ngit tag -a 12.15 -m '12.15'\ngit push --tags\n\nThe tag is still referring to the old tag on github, but locally it is done right.\nUPDATE: It seems github is listing the last commit wrong, but downloading it correctly." }, { "role": "assistant", "content": "The reference is https://stackoverflow.com/a/5480292/1317035\nYou just need to push an 'empty' reference to the remote tag name:\ngit push origin :tagname\n\nOr, more expressively, use the --delete option:\ngit push --delete origin tagname\n\nPushing a branch, tag, or other ref to a remote repository involves specifying \"push where, what source, what destination?\"\ngit push where-to-push source-ref:destination-ref\n\nA real world example where you push your master branch to the origin's master branch is:\ngit push origin refs/heads/master:refs/heads/master\n\nWhich because of default paths, can be shortened to:\ngit push origin master:master\n\nTags work the same way:\ngit push refs/tags/release-1.0:refs/tags/release-1.0\n\nBy omitting the source ref (the part before the colon), you push 'nothing' to the destination, deleting the ref on the remote end." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-diff - Show changes between commits, commit and working tree, etc --find-copies-harder" }, { "role": "assistant", "content": "For performance reasons, by default, -C option finds copies only\nif the original file of the copy was modified in the same\nchangeset. This flag makes the command\ninspect unmodified files as candidates for the source of\ncopy. This is a very expensive operation for large\nprojects, so use it with caution. Giving more than one -C option has the same effect." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-pull - Fetch from and integrate with another repository or a local branch --no-rebase" }, { "role": "assistant", "content": "This is shorthand for --rebase=false." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Multiple GitHub accounts on the same computer?\nTrying to work on both my actual \"work\" repos, and my repos on GitHub, from my computer.\nThe work account was set up first, and everything works flawlessly.\nMy account, however, cannot seem to push to my repo, which is set up under a different account/email.\nI've tried copying my work key up to my account, but that throws an error because of course a key can only be attached to one account.\nHow can I push/pull to and from both accounts with their respective GitHub credentials?" }, { "role": "assistant", "content": "All you need to do is configure your SSH setup with multiple SSH keypairs.\n\nThis link is easy to follow (Thanks Eric):\nhttp://code.tutsplus.com/tutorials/quick-tip-how-to-work-with-github-and-multiple-accounts--net-22574\n\nGenerating SSH keys (Win/msysgit):\nhttps://help.github.com/articles/generating-an-ssh-key/\n\n\nRelevant steps from the first link:\n\nGenerate an SSH-key:\nssh-keygen -t ed25519 -C \"[email protected]\"\n\nFollow the prompts and decide a name, e.g. id_ed25519_example_company.\n\nCopy the SSH public-key to GitHub from ~/.ssh/id_ed25519_doe_company.pub and tell ssh about the key:\nssh-add ~/.ssh/id_ed25519_doe_company\n\n\nCreate a config file in ~/.ssh with the following contents:\nHost github-doe-company\n HostName github.com\n User git\n IdentityFile ~/.ssh/id_ed25519_doe_company\n\n\nAdd your remote:\ngit remote add origin git@github-doe-company:username/repo.git\n\nor change using:\ngit remote set-url origin git@github-doe-company:username/repo.git\n\n\n\n\nAlso, if you're working with multiple repositories using different personas, you need to make sure that your individual repositories have the user settings overridden accordingly:\nSetting user name, email and GitHub token – Overriding settings for individual repos\nhttps://help.github.com/articles/setting-your-commit-email-address-in-git/\nNote:\nSome of you may require different emails to be used for different repositories, from git 2.13 you can set the email on a directory basis by editing the global config file found at: ~/.gitconfig using conditionals like so:\n[user]\n name = Default Name\n email = [email protected]\n\n[includeIf \"gitdir:~/work/\"]\n path = ~/work/.gitconfig\n\nAnd then your work-specific config ~/work/.gitconfig would look like this:\n[user]\n name = Pavan Kataria\n email = [email protected]\n\nThank you @alexg for informing me of this in the comments." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-restore - Restore working tree files" }, { "role": "assistant", "content": "EXAMPLES The following sequence switches to the master branch, reverts the Makefile to two revisions back, deletes hello.c by mistake, and gets\nit back from the index. $ git switch master\n$ git restore --source master~2 Makefile (1) $ rm -f hello.c\n$ git restore hello.c (2) take a file out of another commit restore hello.c from the index If you want to restore all C source files to match the version in\nthe index, you can say $ git restore '*.c' Note the quotes around *.c . The file hello.c will also be\nrestored, even though it is no longer in the working tree, because the\nfile globbing is used to match entries in the index (not in the\nworking tree by the shell). To restore all files in the current directory $ git restore . or to restore all working tree files with top pathspec magic (see gitglossary ) $ git restore :/ To restore a file in the index to match the version in HEAD (this is\nthe same as using git-reset ) $ git restore --staged hello.c or you can restore both the index and the working tree (this is the same\nas using git-checkout ) $ git restore --source=HEAD --staged --worktree hello.c or the short form which is more practical but less readable: $ git restore -s@ -SW hello.c" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Avoid orphaned .orig files after resolving conflicts from a Git merge\nAfter I perform a Git merge and resolve the conflicts, there are leftover .orig versions of the conflicting files. How can I automatically delete those after the conflict is successfully resolved?" }, { "role": "assistant", "content": "It's the git mergetool that produces these files, you can disable them with this command:\ngit config --global mergetool.keepBackup false\n\nSee the git-config manpage:\nhttp://man.he.net/man1/git-config" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Ignore specific changes to a file in git, but not the entire file\nI have a file in a git repository that has a local change on it. I want to have git ignore the local change forever, but not the file. In particular,\n\nIf the file isn't touched besides this change, git add . should never stage it.\nLikewise, git commit -a shouldn't commit it.\nIf I ever make an additional change to the file, I should be able to stage and commit that change - but the change I'm ignoring should not be staged and committed.\n\nIs there a way to do this? Doing some research, I read about \"smudge/clean cycles,\" where, if I read correctly,\n\nthe file would be marked as unchanged,\nthe change I made would be overwritten when I checkout,\nand then a script would automatically reapply the change and then mark the file as unchanged again.\n\nI am very new to git and scripting, though (I'm an intern with C# and Java experience), so if that's what I need to do, can you please post detailed directions or a link to a tutorial on how to set a smudge/clean cycle up?\nBackground: I want my working branch to be out of sync with the trunk. There is a low priority bug that only affects development machines, so rather than fix it, we're just commenting out the offending code. Obviously, we don't want this code to be removed from production, where it works just fine." }, { "role": "assistant", "content": "You can use the skip-worktree bit. Turn it on with:\ngit update-index --skip-worktree <file>\n\nAfter that, git will never stage local changes for <file> and will fail (loudly) if git itself has to write to <file> (say, in a merge or a checkout).\nIf you ever want to stage a future change, you can turn it off, stage the new change, and then turn it back on:\ngit update-index --no-skip-worktree <file>\ngit add -p <file>\ngit update-index --skip-worktree <file>\n\nWhile not perfect, this might be good enough. It will be up to you to notice that <file> has unstaged changes, since git will no longer tell you that\nNote: My original suggestion was to use assume-unchanged. As explained in Git - Difference Between 'assume-unchanged' and 'skip-worktree', it is really skip-worktree that you want. In particular, assume-unchanged is a promise to Git that you won't change the file, and if you violate that promise Git is allowed to erase your changes or commit them! In contrast, Git will not erase or commit your skip-worktree changes." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Difference between \"git add -A\" and \"git add .\"\nWhat is the difference between git add [--all | -A] and git add .?" }, { "role": "assistant", "content": "This answer only applies to Git version 1.x. For Git version 2.x, see other answers.\n\nSummary:\n\ngit add -A stages all changes\n\ngit add . stages new files and modifications, without deletions (on the current directory and its subdirectories).\n\ngit add -u stages modifications and deletions, without new files\n\n\n\nDetail:\ngit add -A is equivalent to git add .; git add -u.\nThe important point about git add . is that it looks at the working tree and adds all those paths to the staged changes if they are either changed or are new and not ignored, it does not stage any 'rm' actions.\ngit add -u looks at all the already tracked files and stages the changes to those files if they are different or if they have been removed. It does not add any new files, it only stages changes to already tracked files.\ngit add -A is a handy shortcut for doing both of those.\nYou can test the differences out with something like this (note that for Git version 2.x your output for git add . git status will be different):\ngit init\necho Change me > change-me\necho Delete me > delete-me\ngit add change-me delete-me\ngit commit -m initial\n\necho OK >> change-me\nrm delete-me\necho Add me > add-me\n\ngit status\n# Changed but not updated:\n# modified: change-me\n# deleted: delete-me\n# Untracked files:\n# add-me\n\ngit add .\ngit status\n\n# Changes to be committed:\n# new file: add-me\n# modified: change-me\n# Changed but not updated:\n# deleted: delete-me\n\ngit reset\n\ngit add -u\ngit status\n\n# Changes to be committed:\n# modified: change-me\n# deleted: delete-me\n# Untracked files:\n# add-me\n\ngit reset\n\ngit add -A\ngit status\n\n# Changes to be committed:\n# new file: add-me\n# modified: change-me\n# deleted: delete-me" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Re-doing a reverted merge in Git\nI have run into a bit of a problem here: I had a problem-specific branch 28s in Git, that I merged in the general develop branch. Turns out I had done it too fast, so I used git-revert to undo the merge. Now, however, the time has come to merge 28s into develop, but git-merge command sees the original merge, and happily announces that all is well and branches have been already merged. What do I do now? Create a 'Revert \"Revert \"28s -> develop\"\" ' commit? Doesn't seem to be a good way to do it, but I can't imagine any other at the moment.\nWhat the tree structure looks like:" }, { "role": "assistant", "content": "You have to \"revert the revert\". Depending on you how did the original revert, it may not be as easy as it sounds. Look at the official document on this topic.\n---o---o---o---M---x---x---W---x---Y\n /\n ---A---B-------------------C---D\n\nto allow:\n---o---o---o---M---x---x-------x-------*\n / /\n ---A---B-------------------C---D\n\n\nBut does it all work? Sure it does. You can revert a merge, and from a\n purely technical angle, git did it very naturally and had no real\n troubles.\n It just considered it a change from \"state before merge\" to\n \"state after merge\", and that was it.\n Nothing complicated, nothing odd,\n nothing really dangerous. Git will do it without even thinking about it.\nSo from a technical angle, there's nothing wrong with reverting a merge,\n but from a workflow angle it's something that you generally should try to\n avoid.\nIf at all possible, for example, if you find a problem that got merged\n into the main tree, rather than revert the merge, try really hard to:\n\nbisect the problem down into the branch you merged, and just fix it, \nor try to revert the individual commit that caused it.\n\nYes, it's more complex, and no, it's not always going to work (sometimes\n the answer is: \"oops, I really shouldn't have merged it, because it wasn't\n ready yet, and I really need to undo all of the merge\"). So then you\n really should revert the merge, but when you want to re-do the merge, you\n now need to do it by reverting the revert." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Git pull error: unable to create file (Invalid argument)\nI am trying to sync remote repo with local repo but getting following errors. Some files (which have not extention) are not getting sync with local repo on WINDOWS machine, but I could sync successfully on MAC machine.\nIs there any configuration settings in WINDOWS to handle such case?\n\nUsing TortoiseGit\nWindows 7 64 bit machine\n\nERROR DETAILS\ngit.exe clone --progress -v \"https://github.com/xxxx/xxxxx.git\" \"C:\\Data\\GitHub\\simility\\vishesh-common\"\n\nCloning into 'C:\\Data\\GitHub\\simility\\vishesh-common'...\nPOST git-upload-pack (200 bytes)\nremote: Counting objects: 3912, done.\nremote: Compressing objects: 100% (487/487), done.\nReceiving objects: 100% (3912/3912), 2.70 MiB | 567.00 KiB/s, done.\nResolving deltas: 100% (1578/1578), done.\nremote: Total 3912 (delta 409), reused 0 (delta 0)\nChecking connectivity... error: unable to create file kickstarter/parsers/data/kickstarter/campaigndetails/_projects_1030050305_fantasy-trilogy-spin?ref=users (Invalid argument)\nerror: unable to create file kickstarter/parsers/data/kickstarter/campaigndetails/_projects_1030295038_laser-dogs?ref=users (Invalid argument)\nerror: unable to create file kickstarter/parsers/data/kickstarter/campaigndetails/_projects_1030315317_arizona-native-bird-painting-series?ref=users (Invalid argument)\nerror: unable to create file kickstarter/parsers/data/kickstarter/campaigndetails/_projects_1030315317_native-birds-ii?ref=users (Invalid argument)\nerror: unable to create file kickstarter/parsers/data/kickstarter/campaigndetails/_projects_1030552097_ikeyboard-0?ref=users (Invalid argument)\nerror: unable to create file kickstarter/parsers/data/kickstarter/campaigndetails/_projects_1030552097_ikeyboard?ref=users (Invalid argument)\nerror: unable to create file kickstarter/parsers/data/kickstarter/campaigndetails/_projects_1030552097_only-you-can-prevent-computercide?ref=users (Invalid argument)\nerror: unable to create file kickstarter/parsers/data/kickstarter/campaigndetails/_projects_1030552097_vector-cupholder-protect-your-laptop-and-your-lap?ref=users (Invalid argument)\nerror: unable to create file kickstarter/parsers/data/kickstarter/campaigndetails/_projects_103055429_death-of-an-angel?ref=users (Invalid argument)\nerror: unable to create file kickstarter/parsers/data/kickstarter/campaigndetails/_projects_1030650665_rachel-vanslyke-making-a-new-record-together-we-ca?ref=users (Invalid argument)\nerror: unable to create file kickstarter/parsers/data/kickstarter/campaigndetails/_projects_1030835091_russian-trucks-of-world-war-two?ref=users (Invalid argument)\nerror: unable to create file kickstarter/parsers/data/kickstarter/campaigndetails/_projects_1031873800_prop-expansion-next-level?ref=users (Invalid argument)\nerror: unable to create file kickstarter/parsers/data/kickstarter/campaigndetails/_projects_1031873800_prop-project-expansion?ref=users (Invalid argument)\nerror: unable to create file kickstarter/parsers/data/kickstarter/campaigndetails/_projects_1099860912_yaw-clock?ref=users (Invalid argument)\nerror: unable to create file kickstarter/parsers/data/kickstarter/campaigndetails/_projects_1099992656_heavenly-sight-a-vision-out-of-blindness?ref=users (Invalid argument)\nfatal: unable to checkout working tree\nwarning: Clone succeeded, but checkout failed.\nYou can inspect what was checked out with 'git status' and retry the checkout with 'git checkout -f HEAD'\n\ngit did not exit cleanly (exit code 128) (21746 ms @ 29-09-2014 13:32:13)" }, { "role": "assistant", "content": "I ran into the same problem, but wasn't willing to rename or delete these files. So here's a workaround in case you can live without accessing those files using a sparse-checkout:\nGo to the .git folder in your repo and open the file config. (You can also edit your configuration using tortoise-git, but I havn't got it installed here.) In the [core]section add the line\nsparsecheckout = true\n\nthen go to the folder .git/info and create the file sparse-checkout. Add something like\n*\n!kickstarter/parsers/data/kickstarter/campaigndetails/*\n\nThe first line includes everything, while the second excludes all files in kickstarter/parsers/data/kickstarter/campaigndetails/. You should now be able to checkout the repo. Using wild-cards you can probably do more sophisticated excludes." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Why is a git 'pull request' not called a 'push request'?\n\nThe terminology used to merge a branch with an official repository is a 'pull request'. This is confusing, as it appears that I am requesting to push my changes to the official repository.\nWhy is it called a pull request and not a push request?" }, { "role": "assistant", "content": "If you have a code change in your repository, and want to move it to a target repository, then:\n\n\"Push\" is you forcing the changes being present in the target repository (git push). \n\"Pull\" is the target repository grabbing your changes to be present there (git pull from the other repo).\n\nA \"pull request\" is you requesting the target repository to please grab your changes. \nA \"push request\" would be the target repository requesting you to push your changes." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Is it possible to push a git stash to a remote repository?\nIn git, is it possible to create a stash, push the stash to a remote repository, retrieve the stash on another computer, and apply the stash? \nOr are my options:\n\nCreate a patch and copy the patch to the other computer, or\nCreate a minor branch and commit the incomplete work to that branch?" }, { "role": "assistant", "content": "Note: I've just rewritten this answer with 24 hours more git-fu under my belt :)\nIn my shell history, the whole shebang is now three one-liners. However, I've uncondensed them for your convenience. \nThis way, I hope you will be able to see how I did things, instead of just having to blindly copy/paste stuff.\n\nHere is step by step.\nAssume is source in ~/OLDREPO containing stashes. Create a TEST clone containing no stashes:\ncd ~/OLDREPO\ngit clone . /tmp/TEST\n\nPush all the stashes as temp branches:\ngit send-pack /tmp/TEST $(for sha in $(git rev-list -g stash); \\\n do echo $sha:refs/heads/stash_$sha; done)\n\nLoop on the receiving end to transform back into stashes:\ncd /tmp/TEST/\nfor a in $(git rev-list --no-walk --glob='refs/heads/stash_*'); \ndo \n git checkout $a && \n git reset HEAD^ && \n git stash save \"$(git log --format='%s' -1 HEAD@{1})\"\ndone\n\nCleanup your temporary branches if you will\ngit branch -D $(git branch|cut -c3-|grep ^stash_)\n\nDo a git stash list and you will something like this:\nstash@{0}: On (no branch): On testing: openmp import\nstash@{1}: On (no branch): On testing: zfsrc\nstash@{2}: On (no branch): WIP on sehe: 7006283 fixed wrong path to binary in debianized init script (reported as part of issue\nstash@{3}: On (no branch): WIP on debian-collab: c5c8037 zfs_pool_alert should be installed by default\nstash@{4}: On (no branch): WIP on xattrs: 3972694 removed braindead leftover -O0 flag\nstash@{5}: On (no branch): WIP on testing: 3972694 removed braindead leftover -O0 flag\nstash@{6}: On (no branch): WIP on testing: db9f77e fuse_unmount_all could be starved for the mtx lock\nstash@{7}: On (no branch): WIP on xattrs: db9f77e fuse_unmount_all could be starved for the mtx lock\nstash@{8}: On (no branch): WIP on testing: 28716d4 fixed implicit declaration of stat64\nstash@{9}: On (no branch): WIP on emmanuel: bee6660 avoid unrelated changes\n\nOn the original repository, the same looked like\nstash@{0}: WIP on emmanuel: bee6660 avoid unrelated changes\nstash@{1}: WIP on testing: 28716d4 fixed implicit declaration of stat64\nstash@{2}: WIP on xattrs: db9f77e fuse_unmount_all could be starved for the mtx lock\nstash@{3}: WIP on testing: db9f77e fuse_unmount_all could be starved for the mtx lock\nstash@{4}: WIP on testing: 3972694 removed braindead leftover -O0 flag\nstash@{5}: WIP on xattrs: 3972694 removed braindead leftover -O0 flag\nstash@{6}: WIP on debian-collab: c5c8037 zfs_pool_alert should be installed by default\nstash@{7}: WIP on sehe: 7006283 fixed wrong path to binary in debianized init script (reported as part of issue #57)\nstash@{8}: On testing: zfsrc\nstash@{9}: On testing: openmp import" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to Run Terminal as Administrator on Mac Pro\nI am using a Mac for the first time and need to run Terminal as an admin. I have installed NodeJs and Git and want to download Phone Gap/Corova but when I try to install Cordova, it comes back with an error saying I should be an admin when running the terminal. How do I open a command prompt in terminal as an admin to the Mac Pro?" }, { "role": "assistant", "content": "This is not Windows, you do not \"run the Terminal as admin\". What you do is you run commands in the terminal as admin, typically using sudo:\n$ sudo some command here" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-bundle - Move objects and refs by archive" }, { "role": "assistant", "content": "SPECIFYING REFERENCES Revisions must be accompanied by reference names to be packaged in a\nbundle. More than one reference may be packaged, and more than one set of prerequisite objects can\nbe specified. The objects packaged are those not contained in the\nunion of the prerequisites. The git bundle create command resolves the reference names for you\nusing the same rules as git rev-parse --abbrev-ref=loose . Each\nprerequisite can be specified explicitly (e.g. ^master~10 ), or implicitly\n(e.g. master~10..master , --since=10.days.ago master ). All of these simple cases are OK (assuming we have a \"master\" and\n\"next\" branch): $ git bundle create master.bundle master\n$ echo master | git bundle create master.bundle --stdin\n$ git bundle create master-and-next.bundle master next\n$ (echo master; echo next) | git bundle create master-and-next.bundle --stdin And so are these (and the same but omitted --stdin examples): $ git bundle create recent-master.bundle master~10..master\n$ git bundle create recent-updates.bundle master~10..master next~5..next A revision name or a range whose right-hand-side cannot be resolved to\na reference is not accepted: $ git bundle create HEAD.bundle $(git rev-parse HEAD)\nfatal: Refusing to create empty bundle.\n$ git bundle create master-yesterday.bundle master~10..master~5\nfatal: Refusing to create empty bundle." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-tag - Create, list, delete or verify a tag object signed with GPG -m <msg> --message=<msg>" }, { "role": "assistant", "content": "Use the given tag message (instead of prompting).\nIf multiple -m options are given, their values are\nconcatenated as separate paragraphs.\nImplies -a if none of -a , -s , or -u <key-id> is given." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git - the stupid content tracker git-cherry-pick" }, { "role": "assistant", "content": "Apply the changes introduced by some existing commits" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-rev-list - Lists commit objects in reverse chronological order --topo-order" }, { "role": "assistant", "content": "Show no parents before all of its children are shown, and\navoid showing commits on multiple lines of history\nintermixed. For example, in a commit history like this: ---1----2----4----7\n\t\\\t \\\n\t 3----5----6----8--- where the numbers denote the order of commit timestamps, git\nrev-list and friends with --date-order show the commits in the\ntimestamp order: 8 7 6 5 4 3 2 1. With --topo-order , they would show 8 6 5 3 7 4 2 1 (or 8 7 4 2 6 5\n3 1); some older commits are shown before newer ones in order to\navoid showing the commits from two parallel development track mixed\ntogether." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Git/Sourcetree basic branching and merging\nNewbie question alert!!! I am just starting to get into using Git, and particularly Sourcetree which seems like a good application for visualizing it. On my first test it went along pretty well, branching and merging (see the top diagram). I know this structure means I'm using the development and master branch the wrong way round, but that's fine because at least it worked.\nOn my second try though, I couldn't seem to visualise any branches, even though work was being done in both of them they seem to appear in one single branch (with a '7 ahead' note), and when I try and merge nothing seems to happen. Hopefully the second screenshot is enough for someone to tell me what is happening here? If not I will try and give some more info. \nI'm just playing around at the moment, so still getting to grips with proper workflow, just trying to get the basic branching and merging actions to take place in a consistent manner through Sourcetree. Any help will be appreciated." }, { "role": "assistant", "content": "In the second picture there are branches. Locally you have 2 branches, master & develop. Both branches are resting at the same commit though. If you want to 'see branches' as in the first picture you can make a commit on develop, however the graph will still apear to be linear. You'll be able to merge develop into master at that point if you want.\nIf you want to see the graph diverge, try putting a commit on master as well. Then you will start to see something more like the first picture.\nTo get an idea of how git works with a visualization program like this, I suggest you do actions like I suggested above, and take a look at the graph at each intermediate step." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How gitlab runner concurrency works?\n\nQ1: Whats the difference between\nconcurrent = 3\n\n[[runners]]\n ..\n executor = \"shell\"\n\nand\nconcurrent = 3\n\n[[runners]]\n ...\n executor = \"shell\"\n\n[[runners]]\n ...\n executor = \"shell\"\n\n[[runners]]\n ...\n executor = \"shell\"\n\nQ2: Does it makes sense, to...\nhave 3 executors (workers) of same type on a single runner with global concurrent = 3? Or can single executor with global concurrent = 3 do multiple jobs in parallel safely?\nQ3: How they're related...\nrunners.limit with runners.request_concurrency and concurrent\nThanks" }, { "role": "assistant", "content": "Gitlab's documentation on runners describes them as:\n\n(...) isolated (virtual) machines that pick up jobs through the coordinator API of GitLab CI\n\nTherefore, each runner is an isolated process responsible for picking up requests for job executions and for dealing with them according to pre-defined configurations. As an isolated process, each runner have the capability of creating 'sub-processes' (also called machines) in order to run jobs.\nWhen you define in your config.toml a [[runner]] section, you're configuring a runner and setting how it should deal with job execution requests.\nIn your questions, you mentioned two of those \"how to deal with job execution request\"' settings:\n\nlimit: \"Limit how many jobs can be handled concurrently\". In other words, how many 'sub-processes' can be created by a runner in order to execute jobs simultaneously;\nrequest_concurrency: \"Limit number of concurrent requests for new jobs from GitLab\". In other words, how many job execution requests can a runner take from GitLab CI job queue simultaneously.\n\nAlso, there are some settings that apply to a machine globally. In your question you mentioned one of them:\n\nconcurrent: \"Limit how many jobs globally can be run concurrently. This is the most upper limit of number of jobs using all defined runners\". In other words, it limits the maximum amount of 'sub-processes' that can run jobs simultaneously.\n\nThus, keeping in mind the difference between a runner its sub-processes and also the difference between specific runner settings and global machine settings:\nQ1:\nThe difference is that in your 1st example you have one runner and in your 2nd example you have three runners. It's worth mentioning that in both examples your machine would only allow running 3 jobs simultaneously.\nQ2:\nNot only a single runner can run multiple jobs concurrently safely but also is possible to control how many jobs you want it to handle (using the aforementioned limit setting).\nAlso, there is no problem to have similar runners running in the same machine. How you're going to define your runner's configurations is up to you and your infrastructure capabilities.\nAlso, please notice that an executor only defines how to run your job. It isn't the only thing that defines a runner and it isn't a synonymous for \"worker\". The ones working are your runners and their sub-processes.\nQ3:\nTo summarize: You can define one or many workers at the same machine. Each one is an isolated process. A runner's limit is how many sub-processes of a runner process can be created to run jobs concurrently. A runner's request_concurrency is how many requests can a runner handle from the Gitlab CI job queue. Finally, setting a value to concurrent will limit how many jobs can be executed at your machine at the same time in the one or more runners running in the machine.\nReferences\nFor better understanding, I really recommend you read about Autoscaling algorithm and parameters. \nFinally, I think you might find this question on how to run runners in parallel on the same server useful." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Transfer gist repo to github\n\nI am working on a small project with gist and since it is growing I would like to put it on github. \nLet's suppose that:\n\nmy gist repo is at: https://gist.github.com/1234\nmy new (empty) repo is at: https://github.com/ChrisJamesC/myNewProject\n\nThe ideal solution would be one that pushes my changes on both the gist and the github repository." }, { "role": "assistant", "content": "You can add the github repository as a remote to your checked out gist repository.\ngit clone [email protected]:1234.git\ngit remote add github [email protected]:ChrisJamesC/myNewProject.git\n\nPush it to initialize the git on github\ngit push -u github master\n\n\nIf your github repo wasn't quite empty (you created it with a README, license, etc. which you don't mind losing) you will have to do a force overwrite on your push\ngit push -f -u github master\n\nIf you don't want to lose the exiting commits and files, see https://stackoverflow.com/a/40408059/117471\n\nThis will also change the upstream of the branch, so github will be default.\nYou now can rename the remote of gist:\ngit remote rename origin gist\n\nEach time you make changes (or pull changes from github/gist), you can do:\ngit push # To github\ngit push gist master # To gist\n\nThis will also push back your changes to the gist and not only the github repo." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to manage signing keystore in Gitlab CI for android\n\nDear stackoverflow community, once more I turn to you :)\nI've recently come across the wonder of Gitlab and their very nice bundled CI/CD solution. It works gallantly however, we all need to sign our binaries don't we and I've found no way to upload a key as I would to a Jenkins server for doing this.\nSo, how can I, without checking in my keys and secrets sign my android (actually flutter) application when building a release?\nFrom what I see, most people define the build job with signing settings referring to a non-committed key.properties file specifying a local keystore.jks. This works fine when building APKs locally but if I would like to build and archive them as a part of the CI/CD job, how do I?\nFor secret keys, for example the passwords to the keystore itself, I've found that I can simply store them as protected variables but the actual keystore file itself. What can I do about that?\nAny ideas, suggestions are dearly welcome.\nCheers\nEdit:\nI apologise for never marking a right answer here and as @IvanP proposed the solution of writing individual values to a file was what I used for a long time. But as @VonC added later, Gitlab now has the capability to data as actual files which simplifies this so I am marking that as the correct answer." }, { "role": "assistant", "content": "Usually I store keystore file (as base64 string), alias and passwords to Gitlab's secrets variables.\nIn the .gitlab-ci.yml do something like:\ncreate_property_files:\n stage: prepare\n only:\n - master\n script:\n - echo $KEYSTORE | base64 -d > my.keystore\n - echo \"keystorePath=my.keystore\" > signing.properties\n - echo \"keystorePassword=$KEYSTORE_PASSWORD\" >> signing.properties\n - echo \"keyAlias=$ALIAS\" >> signing.properties\n - echo \"keyPassword=$KEY_PASSWORD\" >> signing.properties\n artifacts:\n paths:\n - my.keystore\n - signing.properties\n expire_in: 10 mins\n\nAnd, finally, in your build gradle:\nsigningConfigs {\n release {\n file(\"../signing.properties\").with { propFile ->\n if (propFile.canRead()) {\n def properties = new Properties()\n properties.load(new FileInputStream(propFile))\n\n storeFile file(properties['keystorePath'])\n storePassword properties['keystorePassword']\n keyAlias properties['keyAlias']\n keyPassword properties['keyPassword']\n } else {\n println 'Unable to read signing.properties'\n }\n }\n }\n}" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git - the stupid content tracker git-cherry-pick" }, { "role": "assistant", "content": "Apply the changes introduced by some existing commits" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Can I make fast forwarding be off by default in Git?\nI can't really ever think of a time when I would use git merge rather than git rebase and not want to have a commit show up. Is there any way to configure Git to have fast forwarding off by default?\nThe fact that there's an --ff option would seem to imply that there's a way, but I can't seem to find it in the documentation." }, { "role": "assistant", "content": "It seems there is still a pending question in the thread: How to do it globally (i.e. for all branches) ? For the records, we can use the following:\ngit config --add merge.ff false\n\n...to make it apply to all branches in the current repository. To make it apply to all branches in all repositories where someone has not run it without the --global option (local settings override global) run this:\ngit config --global --add merge.ff false\n\nFrom the documentation:\n\nmerge.ff\nBy default, git does not create an extra merge commit when merging a commit that is a descendant of the current commit. Instead, the tip of the current branch is fast-forwarded. When set to false, this variable tells git to create an extra merge commit in such a case (equivalent to giving the --no-ff option from the command line). When set to only, only such fast-forward merges are allowed (equivalent to giving the --ff-only option from the command line)." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How do I get git diff with full context?\nHow do I create a patch with full context?\nI tried --unified=2000, which gives 2000 lines of context:\ngit diff --unified=2000 branch master --no-prefix > patch\n\nHow do I include all the lines in the file without having to specify the maximum number of lines?" }, { "role": "assistant", "content": "This seems to work pretty nicely:\ngit diff --no-prefix -U1000\n\nWith the caveat:\n\nThe -U flag specifies lines of context. You might need to increase this if there are more than 1000 lines between your changes." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Is there anyway to programmatically fetch a zipball of private github repo?\nWe got a necessity to fetch a zipball of a private repo. For public ones it's pretty easy either through GitHub API or manually (https://github.com/user/repo/zipball/master). But what about private repos? Not exactly obvious how to do it even having oAuth token." }, { "role": "assistant", "content": "New Alternative\nBecause the given accepted answer does not work anymore, I thought I would explain how I was able to do it with the new changes in the github API.\nThe new Download Api Link\nFirst, I found information about downloading the archive here:\nhttps://developer.github.com/v3/repos/contents/#get-archive-link\nPublic Repo\nIf it's a public repo then it is very easy... you can do:\ncurl -L https://api.github.com/repos/pengwynn/octokit/tarball > octokit.tar.gz\n\nPrivate Repo\nIf it's it is a private repo, you need to create an oAuth token by going to your settings and then selecting \"Developer settings\" / \"Personal access tokens\".\nI created a personal token.\nThen using the instructions on the following page I found out how to get private repo that you have permission to:\nhttps://developer.github.com/v3/#authentication\nFull Code\ncurl -H \"Authorization: token ab499f3b...\" \\\n-L https://api.github.com/repos/godzilla/my_priv_repo/tarball > wut.tar.gz\n\nBe sure to replace ab499f3b... with your actual token." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Still requiring login after SSH authentication\n\nI followed everything in the GitHub tutorial: https://help.github.com/articles/generating-ssh-keys\nI did all the commands in the directory of my repository.\nI reached the end of tutorial successfully and got the message: \"Hi username! You've successfully authenticated, but GitHub does not # provide shell access.\"\nHowever when I tried to do things such as push it still requested for my username and password." }, { "role": "assistant", "content": "Check your remotes via git remote -v. \nhttps:// URLs will always ask for a password, unless you configure a credential helper. More info on that in this question.\nThe simplest solution for password-less git access would be to use the git remote set-url command and set an SSH url for the existing repo.\nIn your case, git remote set-url origin [email protected]:name/repo.\nThen you should be able to git push origin <branch> without being asked for a password." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git pull displays \"fatal: Couldn't find remote ref refs/heads/xxxx\" and hangs up\nI created a branch called 6796, then I pushed it to remote, checked it out on another machine, made other edits, pushed it, then merged it with master, and deleted it locally and remotely on the other machine (git push :6796). Now, when I run git pull:\nfatal: Couldn't find remote ref refs/heads/6796\nuser@host:~/path/to/repo$ fatal: The remote end hung up unexpectedly\n\nbut git pull origin master works normally. It seems to me that there is a 6796 reference somewhere... how to resolve this?" }, { "role": "assistant", "content": "There are probably some commands to resolve it, but I would start by looking in your .git/config file for references to that branch, and removing them." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "fatal: 'origin' does not appear to be a git repository\nI've a repository moodle on my Github account which I forked from the official repository.\nI then cloned it on my local machine. It worked fine. I created several branches (under the master branch). I made several commits and it worked fine. \nI don't know how I'm getting the following error when I do : git push origin master\nfatal: 'origin' does not appear to be a git repository\nfatal: The remote end hung up unexpectedly\n\nHow do I resolve the error without effecting my repository on Github?\nI'm using Ubuntu 12.10\nThe contents of my .git/config after doing cat $(git rev-parse --show-toplevel)/.git/config gives:\n[core]\n repositoryformatversion = 0\n filemode = true\n bare = false\n logallrefupdates = true\n[branch \"master\"]\n[branch \"MOODLE_23_STABLE\"]\n[branch \"MOODLE_24_STABLE\"]\n[remote \"upstream\"]\n url = git://git.moodle.org/moodle.git\n fetch = +refs/heads/*:refs/remotes/upstream/*" }, { "role": "assistant", "content": "$HOME/.gitconfig is your global config for git.\nThere are three levels of config files.\n cat $(git rev-parse --show-toplevel)/.git/config\n\n(mentioned by bereal) is your local config, local to the repo you have cloned.\nyou can also type from within your repo:\ngit remote -v\n\nAnd see if there is any remote named 'origin' listed in it.\nIf not, if that remote (which is created by default when cloning a repo) is missing, you can add it again:\ngit remote add origin url/to/your/fork\n\n\nThe OP mentions:\n\nDoing git remote -v gives: \n\nupstream git://git.moodle.org/moodle.git (fetch) \nupstream git://git.moodle.org/moodle.git (push)\n\nSo 'origin' is missing: the reference to your fork.\nSee \"What is the difference between origin and upstream in github\"" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "What do you do with your branch after a pull request on GitHub?\n\nMy team is experimenting with using GitHub pull requests for code reviews. My only question is what do you do with the branch after you're done? I would think you'd want to delete the branch, but since GitHub hides branches that have been merged into your current branch, it seemed like maybe I should keep it.\nJust curious on what your thoughts on best practices for this are." }, { "role": "assistant", "content": "The rule of thumb that we use (which is here some where on Stack Overflow) is \"branches are for work, tags are for history\".\nWhenever a branch is merged (most likely into master) we tag the merge point using the name of the branch with the prefix \"branch\" (e.g. branch-topic). Then delete the branch. If we need to resurrect work at the branch point we have the tag to be able to do that.\nThere are of course exceptions. We have long running branches that we use for various kinds of continuing work. But in general, topic branches are deleted after merging.\nOn that note, those merges are always done with\nmerge --no-ff <branch>\n\nThis ensures that there is a merge point and a record of the merge occurring." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-pull - Fetch from and integrate with another repository or a local branch --log[=<n>] --no-log" }, { "role": "assistant", "content": "In addition to branch names, populate the log message with\none-line descriptions from at most <n> actual commits that are being\nmerged. See also git-fmt-merge-msg .\nOnly useful when merging. With --no-log do not list one-line descriptions from the\nactual commits being merged." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "gitlab-ci SSH key invalid format\n\nI would like run deploy script with gitlab-ci, but step ssh-add $SSH_PRIVATE_KEY return an error :\necho \"$SSH_PRIVATE_KEY\" | ssh-add -\nError loading key \"(stdin)\": invalid format\n\nYou can see my .gitlab-ci.yml :\ndeploy:\n image: node:9.11.1-alpine\n stage: deploy\n before_script:\n # Install ssh-agent if not already installed, it is required by Docker.\n # (change apt-get to yum if you use a CentOS-based image)\n - 'which ssh-agent || ( apk add --update openssh )'\n\n # Add bash\n - apk add --update bash\n\n # Add git\n - apk add --update git\n\n # Run ssh-agent (inside the build environment)\n - eval $(ssh-agent -s)\n\n # Add the SSH key stored in SSH_PRIVATE_KEY variable to the agent store\n - echo \"$SSH_PRIVATE_KEY\"\n - echo \"$SSH_PRIVATE_KEY\" | ssh-add -\n\n # For Docker builds disable host key checking. Be aware that by adding that\n # you are suspectible to man-in-the-middle attacks.\n # WARNING: Use this only with the Docker executor, if you use it with shell\n # you will overwrite your user's SSH config.\n - mkdir -p ~/.ssh\n - '[[ -f /.dockerenv ]] && echo -e \"Host *\\n\\tStrictHostKeyChecking no\\n\\n\" > ~/.ssh/config'\n # In order to properly check the server's host key, assuming you created the\n # SSH_SERVER_HOSTKEYS variable previously, uncomment the following two lines\n # instead.\n # - mkdir -p ~/.ssh\n # - '[[ -f /.dockerenv ]] && echo \"$SSH_SERVER_HOSTKEYS\" > ~/.ssh/known_hosts'\n script:\n - npm i -g pm2\n - pm2 deploy ecosystem.config.js production\n # only:\n # - master\n\nOn my project setting, i've been add SSH_PRIVATE_KEY variable, with the id_rsa from my production server cat ~/.ssh/id_rsa.pub.\nAnyone can help me ?" }, { "role": "assistant", "content": "In my case, it was because I had made my SSH_PRIVATE_KEY variable protected. When I disabled the Protected state, it worked without any error." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Gitlab cross-reference project\n\nI am trying to find the best way to document my project in Gitlab. And I found two different alternatives:\n\nMarkdown in the actual repository (my-repo.git)\nWiki using markdown (my-repo/wiki.git)\n\nNote that the suffix .git indicates that these are two different git repositories.\nI like the approach to simply modify the Wiki using markdown from the webpage (for everyones simplicity), but I am missing how to link between them or any other project in Gitlab.\nIn the documentation is provided some information to link (issues, commits, etc...) to other projects but not link files like the README.md and other documentation.\nIs there such functionality?" }, { "role": "assistant", "content": "I also don't know if I am 100% getting your question, but Gitlab does support special syntax for referencing other projects/commits/etc..\nYou can reference other project like so,\nnamespace/project>\n\nIt doesn't support referencing files in other projects (as far as I can tell), but you can reference files in the same project:\n[README](doc/README.md)\n\nAnd to specify a line number:\n[README](doc/README.md#L13)" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Git create branch from range of previous commits?\nI have a bunch of commits for an OS project and I want to pull out just the last say 20 commits into another branch so I can pull request.\nHow could I do this? The reason being is I have maybe 150 commits, but most of those are for a much larger contribute, which isn't ready yet. But the next version is being released soon.\nThanks!" }, { "role": "assistant", "content": "You can do this with cherry-pick. If your history of long_branch looks like this:\nA-B <-- master\n \\\n C-D-E-F-G-H <-- long_branch\n\nand you want to move the contents of, say, F through H to a different branch, say, short_branch, which is based off of master:\ngit checkout master -b short_branch\n\nwhich gives\nA-B <-- master, short_branch\n \\\n C-D-E-F-G-H <-- long_branch\n\nthen... (note that the commit range is E..H; the left side is non-inclusive for the range)\ngit cherry-pick E..H\n\nwhich gives:\n F'-G'-H' <-- short_branch\n /\nA-B <-- master\n \\\n C-D-E-F-G-H <-- long_branch\n\nNote that I'm referring to the new commits as F', G', H' - this is because while they will contain the same effective changes as F, G, and H, they won't be the actual same commits (due to different parents + commit times)." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-rev-parse - Pick out and massage parameters" }, { "role": "assistant", "content": "DESCRIPTION Many Git porcelainish commands take a mixture of flags\n(i.e. parameters that begin with a dash - ) and parameters\nmeant for the underlying git rev-list command they use internally\nand flags and parameters for the other commands they use\ndownstream of git rev-list . This command is used to\ndistinguish between them." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-log - Show commit logs -a --text" }, { "role": "assistant", "content": "Treat all files as text." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "What does git push -u mean?\nI have two different versions of git.\nIn the 1.6.2 version, git push does not have the -u option. It only appears in the 1.7.x version.\nFrom the docs, the -u is related to the variable\nbranch.<name>.merge\n\nin git config. This variable is described below:\nDefines, together with branch.<name>.remote, the upstream branch \nfor the given branch. It tells git fetch/git pull which branch to merge.\n\nWhat is an upstream branch ?" }, { "role": "assistant", "content": "\"Upstream\" would refer to the main repo that other people will be pulling from, e.g. your GitHub repo. The -u option automatically sets that upstream for you, linking your repo to a central one. That way, in the future, Git \"knows\" where you want to push to and where you want to pull from, so you can use git pull or git push without arguments. A little bit down, this article explains and demonstrates this concept." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Do I ever need to run git gc on a bare repo?\nman git-gc doesn't have an obvious answer in it, and I haven't had any luck with Google either (although I might have just been using the wrong search terms).\nI understand that you should occasionally run git gc on a local repository to prune dangling objects and compress history, among other things -- but is a shared bare repository susceptible to these same issues?\nIf it matters, our workflow is multiple developers pulling from and pushing to a bare repository on a shared network drive. The \"central\" repository was created with git init --bare --shared." }, { "role": "assistant", "content": "As Jefromi commented on Dan's answer, git gc should be called automatically called during \"normal\" use of a bare repository.\nI just ran git gc --aggressive on two bare, shared repositories that have been actively used; one with about 38 commits the past 3-4 weeks, and the other with about 488 commits over roughly 3 months. Nobody has manually run git gc on either repository.\nSmaller repository\n$ git count-objects\n333 objects, 595 kilobytes\n\n$ git count-objects -v\ncount: 333\nsize: 595\nin-pack: 0\npacks: 0\nsize-pack: 0\nprune-packable: 0\ngarbage: 0\n\n$ git gc --aggressive\nCounting objects: 325, done.\nDelta compression using up to 4 threads.\nCompressing objects: 100% (323/323), done.\nWriting objects: 100% (325/325), done.\nTotal 325 (delta 209), reused 0 (delta 0)\nRemoving duplicate objects: 100% (256/256), done.\n\n$ git count-objects -v\ncount: 8\nsize: 6\nin-pack: 325\npacks: 1\nsize-pack: 324\nprune-packable: 0\ngarbage: 0\n\n$ git count-objects\n8 objects, 6 kilobytes\n\nLarger repository\n$ git count-objects\n4315 objects, 11483 kilobytes\n\n$ git count-objects -v\ncount: 4315\nsize: 11483\nin-pack: 9778\npacks: 20\nsize-pack: 15726\nprune-packable: 1395\ngarbage: 0\n\n$ git gc --aggressive\nCounting objects: 8548, done.\nDelta compression using up to 4 threads.\nCompressing objects: 100% (8468/8468), done.\nWriting objects: 100% (8548/8548), done.\nTotal 8548 (delta 7007), reused 0 (delta 0)\nRemoving duplicate objects: 100% (256/256), done.\n\n$ git count-objects -v\ncount: 0\nsize: 0\nin-pack: 8548\npacks: 1\nsize-pack: 8937\nprune-packable: 0\ngarbage: 0\n\n$ git count-objects\n0 objects, 0 kilobytes\n\nI wish I had thought of it before I gced these two repositories, but I should have run git gc without the --aggressive option to see the difference. Luckily I have a medium-sized active repository left to test (164 commits over nearly 2 months).\n$ git count-objects -v\ncount: 1279\nsize: 1574\nin-pack: 2078\npacks: 6\nsize-pack: 2080\nprune-packable: 607\ngarbage: 0\n\n$ git gc\nCounting objects: 1772, done.\nDelta compression using up to 4 threads.\nCompressing objects: 100% (1073/1073), done.\nWriting objects: 100% (1772/1772), done.\nTotal 1772 (delta 1210), reused 1050 (delta 669)\nRemoving duplicate objects: 100% (256/256), done.\n\n$ git count-objects -v\ncount: 0\nsize: 0\nin-pack: 1772\npacks: 1\nsize-pack: 1092\nprune-packable: 0\ngarbage: 0\n\n$ git gc --aggressive\nCounting objects: 1772, done.\nDelta compression using up to 4 threads.\nCompressing objects: 100% (1742/1742), done.\nWriting objects: 100% (1772/1772), done.\nTotal 1772 (delta 1249), reused 0 (delta 0)\n\n$ git count-objects -v\ncount: 0\nsize: 0\nin-pack: 1772\npacks: 1\nsize-pack: 1058\nprune-packable: 0\ngarbage: 0\n\nRunning git gc clearly made a large dent in count-objects, even though we regularly push to and fetch from this repository. But upon reading the manpage for git config, I noticed that the default loose object limit is 6700, which we apparently had not yet reached.\nSo it appears that the conclusion is no, you don't need to run git gc manually on a bare repo;* but with the default setting for gc.auto, it might be a long time before garbage collection occurs automatically.\n\n* Generally, you shouldn't need to run git gc. But sometimes you might be strapped for space and you should run git gc manually or set gc.auto to a lower value. My case for the question was simple curiosity, though." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-log - Show commit logs --shortstat" }, { "role": "assistant", "content": "Output only the last line of the --stat format containing total\nnumber of modified files, as well as number of added and deleted\nlines." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-config - Get and set repository or global options url.<base>.insteadOf" }, { "role": "assistant", "content": "Any URL that starts with this value will be rewritten to\nstart, instead, with <base>. In cases where some site serves a\nlarge number of repositories, and serves them with multiple\naccess methods, and some users need to use different access\nmethods, this feature allows people to specify any of the\nequivalent URLs and have Git automatically rewrite the URL to\nthe best alternative for the particular user, even for a\nnever-before-seen repository on the site. When more than one\ninsteadOf strings match a given URL, the longest match is used. Note that any protocol restrictions will be applied to the rewritten\nURL. If the rewrite changes the URL to use a custom protocol or remote\nhelper, you may need to adjust the protocol.*.allow config to permit\nthe request. In particular, protocols you expect to use for submodules\nmust be set to always rather than the default of user . See the\ndescription of protocol.allow above." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-config - Get and set repository or global options commit.template" }, { "role": "assistant", "content": "Specify the pathname of a file to use as the template for\nnew commit messages." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to get git-status of a single subfolder?\nWhen I do git status in a subfolder of my repository it includes the status of parent folders also.\nIs there a way to constrain git-status to just a particular folder?" }, { "role": "assistant", "content": "git status .\n\nwill show the status of the current directory and subdirectories.\nFor instance, given files (numbers) in this tree:\na/1\na/2\nb/3\nb/4\nb/c/5\nb/c/6\n\nfrom subdirectory \"b\", git status shows new files in the whole tree:\n% git status\n# On branch master\n#\n# Initial commit\n#\n# Changes to be committed:\n# (use \"git rm --cached <file>...\" to unstage)\n#\n# new file: ../a/1\n# new file: ../a/2\n# new file: 3\n# new file: 4\n# new file: c/5\n# new file: c/6\n#\n\nbut git status . just shows files in \"b\" and below.\n% git status .\n# On branch master\n#\n# Initial commit\n#\n# Changes to be committed:\n# (use \"git rm --cached <file>...\" to unstage)\n#\n# new file: 3\n# new file: 4\n# new file: c/5\n# new file: c/6\n#\n\nJust this subdirectory, not below\ngit status . shows all files below \"b\" recursively. To show just the files in the \"b\" but not below, you need to pass a list of just the files (and not directories) to git status. This is a bit fiddly, depending on your shell.\nZsh\nIn zsh you can select ordinary files with the \"glob qualifier\" (.). For example:\n% git status *(.)\nOn branch master\n\nInitial commit\n\nChanges to be committed:\n (use \"git rm --cached <file>...\" to unstage)\n\n new file: 3\n new file: 4\n\nBash\nBash doesn't have glob qualifiers but you can use GNU find to select ordinary files and then pass them along to git status like so:\nbash-3.2$ find . -type f -maxdepth 1 -exec git status {} +\nOn branch master\n\nInitial commit\n\nChanges to be committed:\n (use \"git rm --cached <file>...\" to unstage)\n\n new file: 3\n new file: 4\n\nThis uses -maxdepth which is a GNU find extension. POSIX find doesn't have -maxdepth, but you can do this:\nbash-3.2$ find . -path '*/*' -prune -type f -exec git status {} +\nOn branch master\n\nInitial commit\n\nChanges to be committed:\n (use \"git rm --cached <file>...\" to unstage)\n\n new file: 3\n new file: 4" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "how to import your own github forked library into android studio\n\nI found a nice open library on GitHub, I imported it into my Android Studio project using Gradle dependencies, but then I realized I need to make little modifications on it.\nSo I forked the library on my GitHub, done the modifications and asked for a pull request, but I can't wait until they approve and merge my modifications with the original code.\nIs there a way to use dependencies to import my forked library (in my Github) into my Android Studio project, rather than the original library?" }, { "role": "assistant", "content": "There is actually a really easy way to do this nowadays: jitpack.io\nAll you need to do is.\n\nadd in your root build.gradle at the end of allprojects repositories:\nallprojects {\nrepositories {\n...\nmaven { url 'https://jitpack.io' }\n}\n}\n\nAdd the dependency in your app build.gradle:\ndependencies {\nimplementation 'com.github.User:Repo:Tag'\n}\n\n\nIf you don't have any releases/tags, you can also just do com.github.User:Repo:branchname-SNAPSHOT to build from the latest commit on that branch." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Files not updating using 'git pull'\nI am using Git to cooperate with other users, but today I cannot get the latest change on some files using \"git pull\", and I cannot see the changes in \"git log\".\nWhat could be the issue?" }, { "role": "assistant", "content": "what worked for me is ,\n\nremove .git folder\ncopy .git from other repo\nnow git checkout\n\nBefore Removing , You can try\ngit fetch --all \ngit reset --hard origin/master\n\nYou will need to replace master with the appropriate branch, which now defaults to main." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git pull *after* git rebase?\nI have a feature branch, and a master branch.\nMaster branch has evolved and I mean to have those updates to diverging as little as possible from master branch.\nSo I git pull in both branches, git checkout feature/branch and finally git rebase master.\nNow here I either expect everything to work smoothly or conflicts showing up that I need to resolve before continuing rebase until all master commits are re-applied successfully on feature branch.\nNow what really happened in my case is something I do not understand:\n$>git rebase master\nFirst, rewinding head to replay your work on top of it...\nApplying: myFirstCommitDoneOnTheBranch\nApplying: myOtherCommitDoneOnTheBranch\n$>git status\nOn branch feature/branch\nYour branch and 'origin/feature/feature' have diverged,\nand have 27 and 2 different commits each, respectively.\n (use \"git pull\" to merge the remote branch into yours)\nnothing to commit, working tree clean\n$>git pull\n*load of conflicts*\n\nNow, as much as I can understand he load of conflicts after the pull; I do not understand the need for a pull. Logically, it should rollback to master when it got branched, save the commits made on the branch, forward to latest commit on master and then apply the saved commits.\nI do not understand to what the Applying message refers to: what is applying the commits on which version?" }, { "role": "assistant", "content": "tl;dr You should update both master and feature with git pull and git pull --rebase before rebasing feature on top of master. There is no need to do a git pull after you have rebased your feature branch on top of master.\nWith your current workflow, the reason why git status is telling you this:\n\nYour branch and 'origin/feature' have diverged,\nand have 27 and 2 different commits each, respectively.\n\nis because your rebased feature branch now has 25 new commits that aren't reachable from origin/feature (since they came from the rebase on master) plus 2 commits that are reachable from origin/feature but have different commit IDs. Those commits contain the same changes (i.e. they're patch equivalent) but they have different SHA-1 hashes because they are based off of a different commit in origin/feature than the one you rebased them on in your local repository.\nHere's an example. Let's assume that this is your history before doing git pull on master:\nA - B - C (master)\n \\\n D - E (feature)\n\nAfter git pull, master got commit F:\nA - B - C - F (master, origin/master)\n \\\n D - E (feature)\n\nAt that point, you rebase feature on top of master, which applies D and E:\nA - B - C - F (master, origin/master)\n \\\n D' - E' (feature)\n\nIn the meantime, the remote branch origin/feature is still based off of commit C:\nA - B - C - F (master, origin/master)\n \\ \\\n \\ D' - E' (feature)\n \\\n D - E (origin/feature)\n\nIf you do a git status on feature, Git will tell you that your feature branch has diverged from origin/feature with 3 (F, D', E') and 2 (D, E) commits, respectively.\n\nNote that D' and E' contain the same changes as D and E but have different commit IDs because they have been rebased on top of F.\n\nThe solution is to do git pull on both master and feature before rebasing feature on master. However, since you may have commits on feature that you haven't yet pushed to origin, you would want to do:\ngit checkout feature && git pull --rebase\n\nto avoid creating a merge commit between origin/feature and your local feature.\nUpdate on the consequences of rebasing:\nIn light of this comment, I expanded on the diverging branches. The reason why git status reports that feature and origin/feature diverge after the rebase is due to the fact that rebasing brings in new commits to feature, plus it rewrites the commits that were previously pushed to origin/feature.\nConsider the situation after the pull but before the rebase:\nA - B - C - F (master)\n \\\n D - E (feature, origin/feature)\n\nAt this point, feature and origin/feature point to the same commit E—in other words, they're in \"sync\". After rebasing feature on top of master, history will look like this:\nA - B - C - F (master)\n \\ \\\n \\ D' - E' (feature)\n \\\n D - E (origin/feature)\n\nAs you can see, feature and origin/feature have diverged, their common ancestor being commit C. This is because feature now contains the new commit F from master plus D' and E' (read as \"D prime\" and \"E prime\") which are commits D and E applied on top of F. Even though they contain the same changes, Git considers them to be different because they have different commit IDs. Meanwhile, origin/feature still references D and E.\nAt this point, you've rewritten history: you've modified existing commits by virtue of rebasing them, effectively creating \"new\" ones.\nNow, if you were to run git pull on feature this is what would happen:\nA - B - C - F (master)\n \\ \\\n \\ D' - E'- M (feature)\n \\ /\n D - E - (origin/feature)\n\nSince git pull does git fetch + git merge, this would result in the creation of the merge commit M, whose parents are E' and E.\nIf, instead, you ran git pull --rebase (that is, git fetch + git rebase) then Git would:\n\nMove feature to commit C (the common ancestor of feature and origin/feature)\nApply D and E from origin/feature\nApply F, D' and E'\n\nHowever, noticing that D' and E' contain the same changes as D and E, Git would just discard them, resulting in a history looking like this:\nA - B - C - F (master)\n \\ \n D - E - F' (feature)\n ^\n (origin/feature)\n\nNotice how commit F, previously reachable from feature, got applied on top of origin/feature resulting in F'. At this point, git status would tell you this:\n\nYour branch is ahead of 'origin/feature' by 1 commit.\n\nThat commit being, of course, F'." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Git: Stop git push\nI'm pushing a large file to git, but have a very slow connection. What is the safest way to terminate this push (mid-push), and resume it when I have a better connection?" }, { "role": "assistant", "content": "Killing the client (Ctrl+C or any other method) won't cause the data on the server to be corrupted, if that's what you mean by \"safe\". The server doesn't update anything until all the blobs are transferred successfully, then it updates the refs to point to the new blobs.\nGit doesn't have any facilities to resume an interrupted transfer though, so you'll probably have to transfer the big blob again when you have a faster connection." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Why is `git push --force-with-lease` failing with \"rejected ... stale info\" even when my local repo is up to date with remote?\nI'm trying to force push a rebase of a feature branch to a remote repository. To be a bit safer, I'm trying to use --force-with-lease to make sure no other changes have happened in the branch since I last fetched it.\nThis is failing for reasons I don't understand:\n$ git branch\n* my-branch\n master\n\n$ git push --force-with-lease origin my-branch -u\nTo gitlab.com:example/my-project.git\n ! [rejected] my-branch -> my-branch (stale info)\nerror: failed to push some refs to '[email protected]:example/my-project.git'\n\nI tried a fetch to see if my local cache had somehow gotten out of sync:\n$ git fetch\n\n$ git push --force-with-lease origin my-branch -u\nTo gitlab.com:example/my-project.git\n ! [rejected] my-branch -> my-branch (stale info)\nerror: failed to push some refs to '[email protected]:example/my-project.git'\n\nI tried simplifying the push command a bit:\n$ git push --force-with-lease\nTo gitlab.com:example/my-project.git\n ! [rejected] my-branch -> my-branch (stale info)\nerror: failed to push some refs to '[email protected]:example/my-project.git'\n\nI tried limiting the check to my branch:\n$ git push --force-with-lease=my-branch:origin/my-branch\nTo gitlab.com:example/my-project.git\n ! [rejected] my-branch -> my-branch (stale info)\nerror: failed to push some refs to '[email protected]:example/my-project.git'\n\nAs you can see, it fails the same way every time.\nWhy is my push failing, and how do I fix it?" }, { "role": "assistant", "content": "In my case a plain git fetch followed by the push again solved the problem." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-config - Get and set repository or global options rebase.autoSquash" }, { "role": "assistant", "content": "If set to true, enable the --autosquash option of git-rebase by default for interactive mode.\nThis can be overridden with the --no-autosquash option." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git - the stupid content tracker --work-tree=<path>" }, { "role": "assistant", "content": "Set the path to the working tree. It can be an absolute path\nor a path relative to the current working directory.\nThis can also be controlled by setting the GIT_WORK_TREE\nenvironment variable and the core.worktree configuration\nvariable (see core.worktree in git-config for a\nmore detailed discussion)." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Pull in changes from a Github fork\nSomeone forked a Github project of mine and made some changes. How can I merge the changes back in to my upstream version? \nAlso, is it possible to pull in just a specific commit?\nWhat I'm looking is if there is a way to pull a specific commit instead of the entire branch." }, { "role": "assistant", "content": "Pulling in a single commit would be a cherry-pick and would rewrite the commit ID (and mark you as the committer while retaining the author). The process is pretty straightforward, though:\ngit fetch git://github.com/user/project.git\ngit cherry-pick <SHA-COMMIT-ID>\n\nYou get the SHA from the repository log, for example:\ngit log --oneline\n\nb019cc0 Check whether we have <linux/compiler.h>.\n0920898 Include <linux/compiler.h> before including <linux/usbdevice_fs.h>.\ncbf0ba1 Add DLT_DBUS, for raw D-Bus messages.\n77ed5cd Libnl 2.x returns its own error codes, not errnos; handle that.\n\nWith git cherry-pick 0920898 you bring the respective commit to your current branch." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-clone and post-checkout hook\nAccording to the manual, the post-checkout hook is run after a git checkout (just as expected) but also after a git clone (unless you pass --no-checkout).\nVery well, now, considering the following:\n\nyou don't have a local repository before a git clone\nhooks are not synced between remotes\nhooks stored in a custom template directory used with --template are copied non-executable and therefore not executed after git clone (that is actually not true as stated by Jefromi in his answer, but the hook is still not executed)\n\nIt seems impossible that a post-checkout hook ever gets executed after a git clone. Still, the githooks man page at http://git-scm.com/docs/githooks explicitely states a way to avoid it being executed, and also parameters passed in case it is executed, which would indicate it is possible to execute a custom hook after a git-clone.\nSo, how is it possible? I am obviously missing something here.\nTurns out" }, { "role": "assistant", "content": "I suppose you could make a custom installation - rename the hooks in .../share/git-core/templates/hooks to remove the .sample suffix.\nYou could also make a template directory full of symlinks to a hooks directory inside the repository, (e.g. post-checkout -> ../../hooks/post-checkout). Then if the cloned repo contained that particular hook, it'd get executed.\nYou're right, though, in most cases it will not happen.\nEdit: I just tested it, and the --template option does appear to preserve permissions, so that's a much more straight-forward way to make it happen. What'd you see to indicate that it stripped that bit?\nThe final say on versions: You're looking at documentation online for a newer version of git than you're using. This feature was added in dfa7a6c (clone: run post-checkout hook when checking out); git describe says this wasn't included until v1.6.2-rc2." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to checkout submodule in GitHub action?\n\nI've got a repository with a submodule and I'm creating a build when I push to certain branches or tags. The problem I have is that my checkout step cannot access my submodule. The setup is:\n\nBoth repositories are on GitHub.\nI'm the owner of both repositories.\nBoth repositories are private.\nThe repositories are only accessible with ssh (https disabled).\n\nI've tried using the GitHub Action actions/checkout@v2 to no avail. As can be seen below I've tried using the 'ssh-key' option where I've added the public key to the the submodules repositories deploy keys and the private key to the secrets of the repository where I run the action. I get the following error messages:\nFetching the repository\n /usr/bin/git -c protocol.version=2 fetch --no-tags --prune --progress --no-recurse-submodules --depth=1 origin __myrepo__\n ERROR: Repository not found.\n Error: fatal: Could not read from remote repository.\n \n Please make sure you have the correct access rights\n and the repository exists.\n The process '/usr/bin/git' failed with exit code 128\n Waiting 13 seconds before trying again\n /usr/bin/git -c protocol.version=2 fetch --no-tags --prune --progress --no-recurse-submodules --depth=1 origin __myrepo__\n ERROR: Repository not found.\n Error: fatal: Could not read from remote repository.\n \n Please make sure you have the correct access rights\n and the repository exists.\n The process '/usr/bin/git' failed with exit code 128\n Waiting 19 seconds before trying again\n /usr/bin/git -c protocol.version=2 fetch --no-tags --prune --progress --no-recurse-submodules --depth=1 origin __myrepo__\n ERROR: Repository not found.\n Error: fatal: Could not read from remote repository.\n \n Please make sure you have the correct access rights\n and the repository exists.\n Error: The process '/usr/bin/git' failed with exit code 128\n\nI've tried with and without the ssh-key as well as with true and recursive option on submodules. The destination of the submodule is in a directory called src. The checkout step in my workflow is the following:\nStep-01:\n runs-on: ubuntu-18.04\n steps:\n - name: Checkout repository\n uses: actions/checkout@v2\n with:\n submodules: 'true'\n ssh-key: ${{ secrets.PRIVATE_KEY_FOR_DEPLOY_KEY_IN_SUBMODULE }}\n\nThe .gitmodules is:\n[submodule \"name\"]\n path = src/name\n url = [email protected]:user/repository.git\n branch = master\n\nI'm very new to GitHub Actions (CI/CD overall) and not super comfortable with submodules so I may very well have made some basic mistakes." }, { "role": "assistant", "content": "I finally got it working, completely thanks to this.\nTo clarify the situation SAML SSO is enforced. So instead of using SSH to try and access the submodule I used a personal access token (PAT) where the SSO has been authorized.\nWhat I did:\n\nI generated a PAT in account settings.\nI enabled SSO and authorized it.\nI added the token in the repository (that wants to access the submodule) secrets.\nI updated the workflow to the following (just change the ssh-key line).\n\n\nStep-01:\n runs-on: ubuntu-18.04\n steps:\n - name: Checkout repository\n uses: actions/checkout@v2\n with:\n submodules: 'true'\n token: ${{ secrets.PAT_TOKEN }}" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-reflog - Manage reflog information --all" }, { "role": "assistant", "content": "Process the reflogs of all references." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Git hook to indicate repository is deprecated\n\nWe have a repository (hosted on a GitLab instance) which a handful of projects still reference, but has been deprecated in favor of another solution.\nIs there any way to mark a repository as \"deprecated\"?\nIdeally, every fetch from this repository (as part of a git submodule update) would cause a giant message to be printed during the fetch. I was expecting to add a simple Git hook that would print this deprecated message. However, there doesn't seem to be a \"run this on every fetch\" hook.\nAlso, I see nothing in GitLab that would enable this." }, { "role": "assistant", "content": "Gitlab has feature called \"Broadcast messages\" since 6.3. On the screenshot they shows message with the same color as header and many users could simply not notice it.\nHowever, it is possible to choose color for these messages since 6.5. For example, administrators at my work once made blue message and it was very hard not to notice the message.\nSo you may\n\nMake bright and visible broadcast message telling that this instance of Gitlab is deprecated and that everyone should use something else because at day X write access will be closed.\nAt day X make everyone read-only.\nLeave this instance of Gitlab so old links won't be broke and so on." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Cygwin/Git error cygheap base mismatch detected\nI have installed two Windows servers with the latest versions of Cygwin and Git,\nand I am trying to clone the git repository from S1 to S2.\nI can successfully ssh from S2 to S1 using RSA keys, but when I do this :\ngit clone \"ssh://root@S1/path/to/my/repo\"\n\nit throws back this output:\nCloning into /cygdrive/c/program files/apache software foundation/apache2.2/…\n 2 [main] git 2004 C:/cygwin/lib/git-core/git.exe *** fatal error\n - cygheap base mismatch detected - 0x61242860/0x6123790.\nThis problem is probably due to using incompatible versions of the cygwin DLL.\nSearch for cygwin1.dll using the Windows Start->Find/Search facility\nand delete all but the most recent version. The most recent version *should*\nreside in x:\\cygwin\\bin, where 'x' is the drive on which you have\ninstalled the cygwin distribution. Rebooting is also suggested if you\nare unable to find another cygwin DLL.\n\n--5 more errors like that one --\n\nremote: Counting objects: 3275, done.\nremote: Compressing objects: 100% (3106/3106), done.\n fatal: write error: Broken pipe\n\nSo I followed the suggested instructions, but no luck.\nAny suggestions?" }, { "role": "assistant", "content": "I had the same problem.\nI just restarted my PC and it worked again.\nIt doesn't help to find reason of problem but at least you can keep on to work." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "You are on a branch yet to be born\nIm have strange problem:\n$ cd ~/htdocs\n\n$ mkdir test\n\n$ cd test\n\n$ git init\nInitialized empty Git repository in /home/deep/htdocs/test/.git/\n\n$ git checkout master\nerror: pathspec 'master' did not match any file(s) known to git.\n\n$ git checkout -b master\nfatal: You are on a branch yet to be born\n\n$ git checkout origin/master\nerror: pathspec 'origin/master' did not match any file(s) known to git.\n\n$ git branch -a\n(empty this)\n\nBut this is new local empty repo. Where is master branch?" }, { "role": "assistant", "content": "As ever, Git is right, it just has a quirky way of saying it: when you create a repository, the master branch actually doesn't exist yet because there's nothing for it to point to.\nHave you tried committing something after your git init? Adding a remote and pulling from it will also work, of course." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Exclude .svn folders within git\nI'm trying to exclude subversion's folders from being tracked by git. I tried a couple different setups for .git/info/exclude, but it doesn't seem to work. I would use git-svn, but it's a pain to request access to get that to work, so I'd rather just work around this by excluding the folders.\nI want to exclude \".svn/entries\"\nI've tried adding the following lines to .git/info/exlude:\n.svn\nentries\n.svn/entries\nentries\nsvn\nNo matter what I try, .svn entries shows up when I run git status" }, { "role": "assistant", "content": "I think you want to use a .gitignore file in your top-level directory. This will work if you put \".svn/entries\" on a line in that file. You might just put \".svn\" instead of \".svn/entries\" as well.\nEDIT: See comments. If they files are already being tracked by git, they'll always show up in git status." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-diff-index - Compare a tree to the working tree or index --output=<file>" }, { "role": "assistant", "content": "Output to a specific file instead of stdout." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git - the stupid content tracker GIT_TERMINAL_PROMPT" }, { "role": "assistant", "content": "If this Boolean environment variable is set to false, git will not prompt\non the terminal (e.g., when asking for HTTP authentication)." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-diff - Show changes between commits, commit and working tree, etc ignore-space-at-eol" }, { "role": "assistant", "content": "Ignore changes in whitespace at EOL." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Different default remote (tracking branch) for git pull and git push\nIs there a way to set up a git repository, so that git pull defaults to one remote and git push defaults to another? I know I can set both by changing the value of the remote variable in branch section of .git/config, but how to do it for each direction separately?" }, { "role": "assistant", "content": "Since Git version 1.7.0, you can set this with:\ngit remote set-url --push origin https://your.push.com/blah/" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Why does git diff on Windows warn that the \"terminal is not fully functional\"?\nI'm using msysgit 1.7.7.1 on Windows. I get an error when using git diff. What is causing this? Is there no diff tool included in msysgit? What should I do?\n\nWARNING: terminal is not fully functional" }, { "role": "assistant", "content": "If you are having issues in cmd.exe, for instance, see the warning here:\n\nThen simply set your environment variables and include TERM=msys. After that, each time you open a cmd.exe, your variable will be set correctly.\n\nNOW YOU MUST RESTART YOUR SHELL (CMD.EXE). Just run a new one. And from there, you should have no more issues. Again:" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to generate ssh keys (for github)\n\nQuestion: How do I generate ssh private and public keys (to be used in GitHub/GitLab) using command line.\nThe command below generates the error\nsh.exe\": syntax error near unexpected token '('\n\nI am using Windows XP.\n$ ssh-keygen -t rsa -C \"[email protected]\"\nGenerating public/private rsa key pair.\nEnter file in which to save the key (/c/Users/xxxx/.ssh/id_rsa):\nEnter passphrase (empty for no passphrase):\nEnter same passphrase again:\nYour identification has been saved in /c/Users/xxxx/.ssh/id_rsa.\nYour public key has been saved in /c/Users/xxxx/.ssh/id_rsa.pub.\nThe key fingerprint is:\n01:0f:f4:3b:ca:85:d6:17:a1:7d:f0:68:9d:f0:a2:db [email protected]" }, { "role": "assistant", "content": "The command to run is only \nssh-keygen -t rsa -C \"[email protected]\"\n\nAll the rest beginning with line 2 of your script is the output of ssh-keygen.\nAnd replace [email protected] with your email address.\nHave a look at the manual for ssh-keygen to look for additional options. You should probably use a longer key by adding -b 4096 to the option list." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-svn - Bidirectional operation between a Subversion repository and Git -F <filename> --file=<filename>" }, { "role": "assistant", "content": "Take the commit message from the given file. This option\ndisables the --edit option." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-log - Show commit logs --cherry-mark" }, { "role": "assistant", "content": "Like --cherry-pick (see below) but mark equivalent commits\nwith = rather than omitting them, and inequivalent ones with + ." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Git gist - Markdown does not work\nI am not able to get Markdown work in a gist. My post is available here.\nNotice that the same Markdown works when I add a comment.\nWhat did I miss?" }, { "role": "assistant", "content": "Github uses file extension to recognize file type. In order to use Markdown in your gist it should have appropriate .markdown (or .md) extension. See this." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-log - Show commit logs minimal" }, { "role": "assistant", "content": "Spend extra time to make sure the smallest possible diff is\nproduced." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Why does 'git commit' not save my changes?\n\nI did a git commit -m \"message\" like this:\n> git commit -m \"save arezzo files\"\n# On branch master\n# Changes not staged for commit:\n# (use \"git add <file>...\" to update what will be committed)\n# (use \"git checkout -- <file>...\" to discard changes in working directory)\n#\n# modified: arezzo.txt\n# modified: arezzo.jsp\n#\nno changes added to commit (use \"git add\" and/or \"git commit -a\")\n\nBut afterwards, when I do git status it shows the same modified files:\n> git status\n# On branch master\n# Changes not staged for commit:\n# (use \"git add <file>...\" to update what will be committed)\n# (use \"git checkout -- <file>...\" to discard changes in working directory)\n#\n# modified: arezzo.txt\n# modified: arezzo.jsp\n#\nno changes added to commit (use \"git add\" and/or \"git commit -a\")\n\nWhat am I doing wrong?" }, { "role": "assistant", "content": "As the message says:\n\nno changes added to commit (use \"git add\" and/or \"git commit -a\")\n\nGit has a \"staging area\" where files need to be added before being committed, you can read an explanation of it here.\n\nFor your specific example, you can use:\ngit commit -am \"save arezzo files\"\n\n(note the extra a in the flags, can also be written as git commit -a -m \"message\" - both do the same thing)\nAlternatively, if you want to be more selective about what you add to the commit, you use the git add command to add the appropriate files to the staging area, and git status to preview what is about to be added (remembering to pay attention to the wording used).\nYou can also find general documentation and tutorials for how to use git on the git documentation page which will give more detail about the concept of staging/adding files.\n\nOne other thing worth knowing about is **[interactive staging](https://git-scm.com/book/en/v2/Git-Tools-Interactive-Staging)** - this allows you to add _parts of a file_ to the staging area, so if you've made three distinct code changes (for related but different functionality), you can use interactive mode to split the changes and add/commit each part in turn. Having smaller specific commits like this can be helpful." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Github: How do I add my own projects to an \"organization\" account?\n\nI have started collaborating on a series of projects with several developers on github, and we recently created an organization with it's own \"organization\" type account on github. I see that I can fork repositories of my collaborators into the organization account using the usual fork menu, but of course I cannot fork my own account. \nWhat is the expected workflow to import my existing repositories into the organizational account? (I presume I could fork projects hosted by the other members, but not my own?)" }, { "role": "assistant", "content": "Navigate to the Settings tab of your repository:\n\n\n\nScroll down to the Danger Zone and click Transfer:\n\n\n\nAfter reading the warnings, provide the name of the repository that you want to transfer and the specific organisation that the repository is going to be transferred to and click I understand, transfer this repository:\n\n\n\nDone! You 'll then be notified that you action will take effect in a few minutes:\n\n\nFor more details, you can always refer to the official documentation.\nWarning: once this is done, make sure you also update any local repository references using the following command git remote set-url origin <new-origin>." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Can git be integrated with Xcode?\nIs there any way to use a git repository with the built in SCM functions of Xcode?" }, { "role": "assistant", "content": "Xcode 4 supports git natively (Developer Tools State of the Union Address at WWDC 2010)\nLearn more here: What's new in Xcode 4\nThe documentation from Apple is lengthy, but a good read." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "gitglossary - A Git Glossary exclude" }, { "role": "assistant", "content": "After a path matches any non-exclude pathspec, it will be run\nthrough all exclude pathspecs (magic signature: ! or its\nsynonym ^ ). If it matches, the path is ignored. When there\nis no non-exclude pathspec, the exclusion is applied to the\nresult set as if invoked without any pathspec." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-show - Show various types of objects %>>( <N> ) , %>>|( <M> )" }, { "role": "assistant", "content": "similar to %>( <N> ) , %>|( <M> ) respectively, except that if the next\nplaceholder takes more spaces than given and\nthere are spaces on its left, use those\nspaces" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "What does `git checkout ...` do?\nI occasionally accidentally write git checkout ..., which puts me into a detached head state. I was wondering why. Here's the \"dot story\":\n> git checkout .\n# checks out current directory\n> git checkout ..\n# Checks out parent directory, if in repository.\n> git checkout ...\n# Puts into detached head state?\n> git checkout ....\nerror: pathspec '....' did not match any file(s) known to git." }, { "role": "assistant", "content": "This is a degenerate form of this syntax, described in the gitrevisions(7) man page:\n <rev1>...<rev2>\n Include commits that are reachable from either <rev1> or <rev2> but\n exclude those that are reachable from both. When either <rev1> or\n <rev2> is omitted, it defaults to HEAD.\n\nNote that last bit, \"When either <rev1> or <rev2> is omitted, it defaults to HEAD\". That means that writing ... is equivalent to HEAD...HEAD. When used in git checkout this ends up evaluating to the commit id of HEAD. That is, you're just doing:\ngit checkout HEAD^{commit}" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-grep - Print lines matching a pattern -z --null" }, { "role": "assistant", "content": "Use \\0 as the delimiter for pathnames in the output, and print\nthem verbatim. Without this option, pathnames with \"unusual\"\ncharacters are quoted as explained for the configuration\nvariable core.quotePath (see git-config )." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to cherry-pick the last sha from another branch in Git with 1 command?\nI find myself doing this a lot when cherry-picking a commit from another branch.\n$ git log -1 another_branch\ncommit <commit_sha>\n// copy <commit_sha>\n$ git cherry-pick <commit_sha>\n\nCan I do all of this in one command, if so, what is it?" }, { "role": "assistant", "content": "Just go with:\n$ git cherry-pick another_branch\n\nThis will cherry-pick the last commit from another_branch.\nBranches in git are just references to the last commit in that branch, you can use them instead of commit SHAs in your commands." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Copy a git repo without history\n\nI have a private repository on GitHub that I want to make public. However, some of the initial commits contain information that I don't want to publicize (hard-coded credentials, etc).\nWhat is the easiest route to make the latest commit public (I don't really need or want the previous commits in the public repository) without including some or all of the commit history?" }, { "role": "assistant", "content": "You can limit the depth of the history while cloning:\n--depth <depth>\nCreate a shallow clone with a history truncated to the specified \nnumber of revisions.\n\nUse this if you want limited history, but still some." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "DAG vs. tree using Git?\nI've often read that Git uses the directed acyclic graph (DAG) data structure, with each commit as a node, and things like branches and tags as pointers to nodes.\nBut when I try to visualize my commit history using tools like gitk, it looks more like a tree than a graph since every parent-child relationship is directed one way.\nSo, what's the difference between a DAG and a tree, specifically with regards to Git?" }, { "role": "assistant", "content": "But when I try to visualize my commit history using tools like gitk, it looks more like a tree than a graph since every parent-child relationship is directed one way.\n\nA DAG, like a tree, can be laid out such that all parent-child relationships are one-way. The difference between them is that nodes in a DAG can have multiple parents. The most common case of this in Git is when you do a merge. A merge commit will have all of the commits that were merged as parents. A tree doesn't allow nodes to have multiple parents.\n\n(Image source)\nNotice how the merge commit C6 has two parents, C4 and C5." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to reset or change the passphrase for a GitHub SSH key?\nI have forgoten my passphrase in Git. How do I reset it? I found two solutions on Stack Overflow, but I want to know what process to follow to reset it or to get it." }, { "role": "assistant", "content": "If you had generate a SSH-key with passphrase and then you forget your passphrase for this SSH-key,there's no way to recover it, You'll need to generate a brand new SSH keypair or switch to HTTPS cloning so you can use your GitHub password instead.\nBUT,there are exceptions\nIf you configured your SSH passphrase with the OS X Keychain, you may be able to recover it.\n\nIn Finder, search for the Keychain Access app.\nIn Keychain Access, search for SSH.\nDouble click on the entry for your SSH key to open a new dialog box.\nKeychain access dialogIn the lower-left corner, select Show password.\nYou'll be prompted for your administrative password. Type it into the \"Keychain Access\" dialog box.\nYour password will be revealed.\n\nRefer to Github help - How do I recover my SSH key passphrase?" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-config - Get and set repository or global options fetch.parallel" }, { "role": "assistant", "content": "Specifies the maximal number of fetch operations to be run in parallel\nat a time (submodules, or remotes when the --multiple option of git-fetch is in effect). A value of 0 will give some reasonable default. If unset, it defaults to 1. For submodules, this setting can be overridden using the submodule.fetchJobs config setting." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-show - Show various types of objects none" }, { "role": "assistant", "content": "Disable word diff again." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Should composer.lock be committed to version control?\nI'm a little confused with composer.lock used in an application with a repository.\nI saw many people saying that we should not .gitignore composer.lock from the repository.\nIf I update my libraries in my dev environment, I will have a new composer.lock but I will not be able to update them into production, will I ?\nWon't it generate conflicts on this file ?" }, { "role": "assistant", "content": "If you update your libs, you want to commit the lockfile too. It basically states that your project is locked to those specific versions of the libs you are using.\nIf you commit your changes, and someone pulls your code and updates the dependencies, the lockfile should be unmodified. If it is modified, it means that you have a new version of something.\nHaving it in the repository assures you that each developer is using the same versions." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-bisect - Use binary search to find the commit that introduced a bug" }, { "role": "assistant", "content": "EXAMPLES Automatically bisect a broken build between v1.2 and HEAD: $ git bisect start HEAD v1.2 -- # HEAD is bad, v1.2 is good\n$ git bisect run make # \"make\" builds the app\n$ git bisect reset # quit the bisect session Automatically bisect a test failure between origin and HEAD: $ git bisect start HEAD origin -- # HEAD is bad, origin is good\n$ git bisect run make test # \"make test\" builds and tests\n$ git bisect reset # quit the bisect session Automatically bisect a broken test case: $ cat ~/test.sh\n#!/bin/sh\nmake || exit 125 # this skips broken builds\n~/check_test_case.sh # does the test case pass?\n$ git bisect start HEAD HEAD~10 -- # culprit is among the last 10\n$ git bisect run ~/test.sh\n$ git bisect reset # quit the bisect session Here we use a test.sh custom script. In this script, if make fails, we skip the current commit. check_test_case.sh should exit 0 if the test case passes,\nand exit 1 otherwise. It is safer if both test.sh and check_test_case.sh are\noutside the repository to prevent interactions between the bisect,\nmake and test processes and the scripts. Automatically bisect with temporary modifications (hot-fix): $ cat ~/test.sh\n#!/bin/sh\n\n# tweak the working tree by merging the hot-fix branch\n# and then attempt a build\nif\tgit merge --no-commit --no-ff hot-fix &&\n\tmake\nthen\n\t# run project specific test and report its status\n\t~/check_test_case.sh\n\tstatus=$?\nelse\n\t# tell the caller this is untestable\n\tstatus=125\nfi\n\n# undo the tweak to allow clean flipping to the next commit\ngit reset --hard\n\n# return control\nexit $status This applies modifications from a hot-fix branch before each test run,\ne.g. in case your build or test environment changed so that older\nrevisions may need a fix which newer ones have already. (Make sure the\nhot-fix branch is based off a commit which is contained in all revisions\nwhich you are bisecting, so that the merge does not pull in too much, or\nuse git cherry-pick instead of git merge .) Automatically bisect a broken test case: $ git bisect start HEAD HEAD~10 -- # culprit is among the last 10\n$ git bisect run sh -c \"make || exit 125; ~/check_test_case.sh\"\n$ git bisect reset # quit the bisect session This shows that you can do without a run script if you write the test\non a single line. Locate a good region of the object graph in a damaged repository $ git bisect start HEAD <known-good-commit> [ <boundary-commit> ... ] --no-checkout\n$ git bisect run sh -c '\n\tGOOD=$(git for-each-ref \"--format=%(objectname)\" refs/bisect/good-*) &&\n\tgit rev-list --objects BISECT_HEAD --not $GOOD >tmp.$$ &&\n\tgit pack-objects --stdout >/dev/null <tmp.$$\n\trc=$?\n\trm -f tmp.$$\n\ttest $rc = 0'\n\n$ git bisect reset # quit the bisect session In this case, when git bisect run finishes, bisect/bad will refer to a commit that\nhas at least one parent whose reachable graph is fully traversable in the sense\nrequired by git pack objects . Look for a fix instead of a regression in the code $ git bisect start\n$ git bisect new HEAD # current commit is marked as new\n$ git bisect old HEAD~10 # the tenth commit from now is marked as old or: $ git bisect start --term-old broken --term-new fixed\n$ git bisect fixed\n$ git bisect broken HEAD~10 Getting help Use git bisect to get a short usage description, and git bisect\nhelp or git bisect -h to get a long usage description." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-grep - Print lines matching a pattern grep.patternType" }, { "role": "assistant", "content": "Set the default matching behavior. Using a value of basic , extended , fixed , or perl will enable the --basic-regexp , --extended-regexp , --fixed-strings , or --perl-regexp option accordingly, while the\nvalue default will use the grep.extendedRegexp option to choose\nbetween basic and extended ." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-am - Apply a series of patches from a mailbox -n --no-verify" }, { "role": "assistant", "content": "By default, the pre-applypatch and applypatch-msg hooks are run.\nWhen any of --no-verify or -n is given, these are bypassed.\nSee also githooks ." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-archive - Create an archive of files from a named tree --exec=<git-upload-archive>" }, { "role": "assistant", "content": "Used with --remote to specify the path to the git-upload-archive on the remote side." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-add - Add file contents to the index revert" }, { "role": "assistant", "content": "This has a very similar UI to update , and the staged\ninformation for selected paths are reverted to that of the\nHEAD version. Reverting new paths makes them untracked." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Git says \"Warning: Permanently added to the list of known hosts\"\nEvery time I use git to interact with a remote, such as when pulling or pushing, I am shown the following message:\n\nWarning: Permanently added '...' (RSA) to the list of known hosts.\n\nHow can I prevent this annoying message from displaying? It is only an annoyance—everything functions properly." }, { "role": "assistant", "content": "Create a ~/.ssh/config file and insert the line:\nUserKnownHostsFile ~/.ssh/known_hosts\n\nYou will then see the message the next time you access Github, but after that you'll not see it anymore because the host is added to the known_hosts file. This fixes the issue, rather than just hiding the log message.\nThis problem was bugging me for quite some time. The problem occurs because the OpenSSH client compiled for Windows doesn't check the known_hosts file in ~/.ssh/known_hosts\nssh -vvv [email protected]\ndebug3: check_host_in_hostfile: filename /dev/null\ndebug3: check_host_in_hostfile: filename /etc/ssh/ssh_known_hosts\ndebug3: check_host_in_hostfile: filename /dev/null\ndebug3: check_host_in_hostfile: filename /etc/ssh/ssh_known_hosts\nWarning: Permanently added 'github.com,207.97.227.239' (RSA) to the list of known hosts." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-diff-index - Compare a tree to the working tree or index --ita-invisible-in-index" }, { "role": "assistant", "content": "By default entries added by \"git add -N\" appear as an existing\nempty file in \"git diff\" and a new file in \"git diff --cached\".\nThis option makes the entry appear as a new file in \"git diff\"\nand non-existent in \"git diff --cached\". This option could be\nreverted with --ita-visible-in-index . Both options are\nexperimental and could be removed in future." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "What does \"fatal: bad revision\" mean?\nIn the context: \ngit revert HEAD~2 myFile\nfatal: bad revision '/Users/rose/gitTest/myFile'\n\nI'm sure HEAD~2 exists.\nEDIT Amber is correct. I meant to use reset instead of revert." }, { "role": "assistant", "content": "If you only want to revert a single file to its state in a given commit, you actually want to use the checkout command:\ngit checkout HEAD~2 myFile\n\n\nThe revert command is used for reverting entire commits (and it doesn't revert you to that commit; it actually just reverts the changes made by that commit - if you have another commit after the one you specify, the later commit won't be reverted)." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Differences between Git merge --squash and --no-commit\nAs the title says, I am not really clear about the differences between a git merge --squash and a git merge --no-commit.\nAs far as I understand the help page for git merge, both commands would leave me in an updated working-tree, where it is still possible to edit and then to do a final commit (or multiple commits).\nCould someone clarify the differences of those 2 options? When would I use one instead of the other?" }, { "role": "assistant", "content": "git merge --no-commit\n\nThis is just like a normal merge but doesn't create a merge-commit. This commit will be a merge commit: when you look at the history, your commit will appear as a normal merge.\ngit merge --squash\n\nThis will merge the changes into your working tree without creating a merge commit. When you commit the merged changes, it will look like a new \"normal\" commit on your branch: without a merge commit in the history. It's almost like you did a cherry-pick on all the merged changes." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How can I force GitLab to carry out a garbage collection (and permanently remove a file)\n\nOne of our developers checked in (and pushed) a secure file.\nI removed the file from their history, and did a push --force, in order to get the new history out there, which now doesn't include the file.\nHowever, the orphaned check-in from before is still referenced in the project \"Activity\", and if I click on the hash then I can still see it that checkin, and the file.\nBecause it's no longer referenced by the master/head, I assume this orphan checkin will vanish the next time that GitLab carries out a garbage collection. But I'd like that to happen now, so that the secure file is no longer accessible.\nHow can I force this to happen?" }, { "role": "assistant", "content": "Running housekeeping should solve your problem. When running housekeeping Gitlab will run a git repack or git gc (depending on the admin settings).\nSee https://docs.gitlab.com/ee/administration/housekeeping.html for more info." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-log - Show commit logs remerge, r" }, { "role": "assistant", "content": "Remerge two-parent merge commits to create a temporary tree\nobject—​potentially containing files with conflict markers\nand such. A diff is then shown between that temporary tree\nand the actual merge commit. The output emitted when this option is used is subject to change, and\nso is its interaction with other options (unless explicitly\ndocumented)." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Gitlab merge two branches\n\nWe have created 'dev' branch from the 'master' and have been working on the 'dev' branch. We have not merged the 'dev' to 'master' yet. Also at the same time we have created 'preprod' branch from the 'master' and working on the 'preprod' branch changes. We have not merged the 'preprod' to 'master' yet. \nNow what we are trying to achieve is to merge the 'preprod' changes alone to 'dev'. I tried this by creating a merge request through Gitlab and approved it. What I found is the changes in the 'dev' code was also moved to 'preprod' and vice versa. I do not want the 'dev' changes to be moved to the 'preprod' by any chance. How can i accomplish this ?" }, { "role": "assistant", "content": "If you got changes on both, it is likely that your merge request told gitlab to merge the two branches into each other, which is sometimes desirable. Depending on your development process, you may find it easier to use git itself (or a gui for it, for example git extensions or sourcetree) to do your merges. GUI versions do a good job of visually showing your branches and past merges, which makes it a lot easier to figure out which commands to run.\nFrom the command line, after you revert to a commit before the gitlab merge, check out the dev branch and merge preprod into it:\ngit checkout dev\ngit merge preprod\n\nThe preprod changes will be made on dev but not vice versa (don't forget to push dev). The git merge command's effect is to merge changes from the named branch in the command (preprod) INTO the CURRENT branch (in this case dev, but you can verify the current branch running \"git branch\" or \"git status\").\nLinks to the git tools I mentioned:\ngit extensions: https://sourceforge.net/projects/gitextensions/\nSourceTree: https://www.sourcetreeapp.com/" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-verify-pack - Validate packed Git archive files --" }, { "role": "assistant", "content": "Do not interpret any more arguments as options." } ]