messages
listlengths
3
3
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git push fails: `refusing to update checked out branch: refs/heads/master`\nI want to store my local modifications to JBoss config in git. For this, I have set up the following structure:\nlrwxrwxrwx 1 jboss jboss 19 Jan 24 11:53 current -> jboss-as-7.1.0.CR1b\ndrwxr-xr-x 11 jboss jboss 4096 Jan 24 12:13 jboss-as-7.1.0.CR1b\n-rw-r--r-- 1 jboss jboss 108211143 Jan 23 16:02 jboss-as-7.1.0.CR1b.tar.gz\ndrwxr-xr-x 6 jboss jboss 4096 Jan 24 11:36 local\n\nlocal is the git repository which shall be the \"origin\". The idea is that I want to be able to easily update my JBoss distribution once an update is available. I want to store all local modifications to the distributed JBoss package in git.\nSo, currently I do this:\njboss@tpl0:~/jboss-as-7.1.0.CR1b$ git init\nInitialized empty Git repository in /opt/jboss/jboss-as-7.1.0.CR1b/.git/\njboss@tpl0:~/jboss-as-7.1.0.CR1b$ git remote add origin ../local/ \njboss@tpl0:~/jboss-as-7.1.0.CR1b$ git pull origin master \nFrom ../local\n * branch master -> FETCH_HEAD\n\nSo far so good, all my local modifications are there where I want them.\nHowever, once I have local modifications and want to bush them back to the local repository, I get an error:\njboss@tpl0:~/jboss-as-7.1.0.CR1b$ vim standalone/configuration/standalone.xml \njboss@tpl0:~/jboss-as-7.1.0.CR1b$ git commit -a -m \"renamed database to project2_core, to distinguish from other projects\"\n[master 3e54f34] renamed database to project2_core, to distinguish from other projects\nCommitter: jboss <jboss@tpl0.(none)>\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\njboss@tpl0:~/jboss-as-7.1.0.CR1b$ git push origin master \nCounting objects: 9, done.\nCompressing objects: 100% (4/4), done.\nWriting objects: 100% (5/5), 447 bytes, done.\nTotal 5 (delta 3), reused 0 (delta 0)\nUnpacking objects: 100% (5/5), done.\nremote: error: refusing to update checked out branch: refs/heads/master\nremote: error: By default, updating the current branch in a non-bare repository\nremote: error: is denied, because it will make the index and work tree inconsistent\nremote: error: with what you pushed, and will require 'git reset --hard' to match\nremote: error: the work tree to HEAD.\nremote: error: \nremote: error: You can set 'receive.denyCurrentBranch' configuration variable t\nremote: error: 'ignore' or 'warn' in the remote repository to allow pushing int\nremote: error: its current branch; however, this is not recommended unless you\nremote: error: arranged to update its work tree to match what you pushed in som\nremote: error: other way.\nremote: error: \nremote: error: To squelch this message and still keep the default behaviour, se\nremote: error: 'receive.denyCurrentBranch' configuration variable to 'refuse'.\nTo ../local/\n ! [remote rejected] master -> master (branch is currently checked out)\nerror: failed to push some refs to '../local/'\n\nWhat can I do about this? Any help is greatly appreciated!\nEDIT\nHere's what I did, which solved the problem:\ncd ~/current\ngit init\nvim .gitignore # set up a basic .gitignore file\ngit add .gitignore\ngit commit -a -m \"initial commit\"\ncd ~/local\ngit clone ~/current\ngit branch -m master current # rename master branch to 'current'\ngit branch repo\ngit checkout repo\n\nNow, the branch current in directory ~/local is always up-to-date, but it's not cheked out, so that i can push into it." }, { "role": "assistant", "content": "Pushing is meant for bare repos. For non-bare repos you should pull into them.\nIf you want to force this through anyway, you can do as the error message states and set receive.denyCurrentBranch to ignore. SSH to the location of the repo you are pushing to and run:\ngit config receive.denyCurrentBranch ignore" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-send-email - Send a collection of patches as emails sendemail.smtpReloginDelay" }, { "role": "assistant", "content": "Seconds to wait before reconnecting to the smtp server.\nSee also the --relogin-delay option of git-send-email ." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to output git log with the first line only?\nI am trying to customize the format for git log. I want all commits to be shown in one line. Each line should only show the first line of the commit message.\nI found out that git log --pretty=short should do the trick but on my computer it shows the full log as git log does (besides the time stamp).\nFurther, I tried to use the placeholders as defined in the man page. Though, I could not find a command to shorten the log message. I tried this line git log --pretty=format:'%h : %s' which shows the shorted hash %hand the full message %s in one line.\nI am using git version 1.7.3.1.msysgit.0 on Vista.\n\nMaybe it has something to do with the way I write my commit messages. Here is an example:\nAdded some functionality.\n+ Added print function in Foo class.\n+ Added conversion from foo to baz.\n\nSo, with the example given I only want to be output Added some functionality. prepended by the shortend hash." }, { "role": "assistant", "content": "Have you tried this?\ngit log --oneline \n\nIt's an alias for git log --pretty=oneline --abbrev-commit, and displays the \"short sha\" and \"short description\", for example:\n9bee8857 Write more code\n831fdd6e Write some code Second line of message\n\nThe problem is that you are missing an empty line after the first line of your commit message. The command above usually works for me, but I just tested on a commit without empty second line. I got the same result as you: the whole message on one line.\nEmpty second line is a standard in git commit messages. The behaviour you see was probably implemented on purpose.\nThe first line of a commit message is meant to be a short description. If you cannot make it in a single line you can use several, but git considers everything before the first empty line to be the \"short description\". oneline prints the whole short description, so all your 3 rows." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-log - Show commit logs --cc" }, { "role": "assistant", "content": "Produce dense combined diff output for merge commits.\nShortcut for --diff-merges=dense-combined -p ." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-cherry-pick - Apply the changes introduced by some existing commits --skip" }, { "role": "assistant", "content": "Skip the current commit and continue with the rest of the\nsequence." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git pull analogous to / opposite of git push -f? [duplicate]\nThis question already has answers here:\n \n \n\n\n\n\nGit pull after forced update\n\n (5 answers)\n \n\nClosed 9 years ago.\n\n\n\nSometimes, esp. when I'm the only one working on a remote repository, I like rewriting the history with git rebase -i and git push origin master -f.\nHow do I do a forced git pull origin master without a merge? I tried it with the -f option, but that didn't work. I just want to rewrite the history of my local git repo to match that of the remote (origin)." }, { "role": "assistant", "content": "git fetch\ngit reset --hard origin/master" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-branch - List, create, or delete branches" }, { "role": "assistant", "content": "DESCRIPTION If --list is given, or if there are no non-option arguments, existing\nbranches are listed; the current branch will be highlighted in green and\nmarked with an asterisk. Any branches checked out in linked worktrees will\nbe highlighted in cyan and marked with a plus sign. Option -r causes the\nremote-tracking branches to be listed,\nand option -a shows both local and remote branches. If a <pattern> is given, it is used as a shell wildcard to restrict the output to\nmatching branches. If multiple patterns are given, a branch is shown if\nit matches any of the patterns. Note that when providing a <pattern> , you must use --list ; otherwise the command may be interpreted\nas branch creation. With --contains , shows only the branches that contain the named commit\n(in other words, the branches whose tip commits are descendants of the\nnamed commit), --no-contains inverts it. With --merged , only branches\nmerged into the named commit (i.e. the branches whose tip commits are\nreachable from the named commit) will be listed. With --no-merged only\nbranches not merged into the named commit will be listed. If the <commit>\nargument is missing it defaults to HEAD (i.e. the tip of the current\nbranch). The command’s second form creates a new branch head named <branchname>\nwhich points to the current HEAD , or <start-point> if given. As a\nspecial case, for <start-point>, you may use \"A...B\" as a shortcut for\nthe merge base of A and B if there is exactly one merge base. You\ncan leave out at most one of A and B , in which case it defaults to HEAD . Note that this will create the new branch, but it will not switch the\nworking tree to it; use \"git switch <newbranch>\" to switch to the\nnew branch. When a local branch is started off a remote-tracking branch, Git sets up the\nbranch (specifically the branch.<name>.remote and branch.<name>.merge configuration entries) so that git pull will appropriately merge from\nthe remote-tracking branch. This behavior may be changed via the global branch.autoSetupMerge configuration flag. That setting can be\noverridden by using the --track and --no-track options, and\nchanged later using git branch --set-upstream-to . With a -m or -M option, <oldbranch> will be renamed to <newbranch>.\nIf <oldbranch> had a corresponding reflog, it is renamed to match\n<newbranch>, and a reflog entry is created to remember the branch\nrenaming. If <newbranch> exists, -M must be used to force the rename\nto happen. The -c and -C options have the exact same semantics as -m and -M , except instead of the branch being renamed, it will be copied to a\nnew name, along with its config and reflog. With a -d or -D option, <branchname> will be deleted. You may\nspecify more than one branch for deletion. If the branch currently\nhas a reflog then the reflog will also be deleted. Use -r together with -d to delete remote-tracking branches. Note, that it\nonly makes sense to delete remote-tracking branches if they no longer exist\nin the remote repository or if git fetch was configured not to fetch\nthem again. See also the prune subcommand of git-remote for a\nway to clean up all obsolete remote-tracking branches." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-ls-files - Show information about files in the index and the working tree R" }, { "role": "assistant", "content": "tracked file with unstaged removal/deletion" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "gitattributes - Defining attributes per path Set" }, { "role": "assistant", "content": "The path has the attribute with special value \"true\";\nthis is specified by listing only the name of the\nattribute in the attribute list." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-svn - Bidirectional operation between a Subversion repository and Git - --stdin" }, { "role": "assistant", "content": "Only used with the set-tree command. Read a list of commits from stdin and commit them in reverse\norder. Only the leading sha1 is read from each line, so git rev-list --pretty=oneline output can be used." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How can I set up an editor to work with Git on Windows?\nI'm trying out Git on Windows. I got to the point of trying \"git commit\" and I got this error:\n\nTerminal is dumb but no VISUAL nor\n EDITOR defined. Please supply the\n message using either -m or -F option.\n\nSo I figured out I need to have an environment variable called EDITOR. No problem. I set it to point to Notepad. That worked, almost. The default commit message opens in Notepad. But Notepad doesn't support bare line feeds. I went out and got Notepad++, but I can't figure out how to get Notepad++ set up as the %EDITOR% in such a way that it works with Git as expected.\nI'm not married to Notepad++. At this point I don't mind what editor I use. I just want to be able to type commit messages in an editor rather than the command line (with -m).\nThose of you using Git on Windows: What tool do you use to edit your commit messages, and what did you have to do to make it work?" }, { "role": "assistant", "content": "Update September 2015 (6 years later)\nThe last release of git-for-Windows (2.5.3) now includes:\n\nBy configuring git config core.editor notepad, users can now use notepad.exe as their default editor.\n Configuring git config format.commitMessageColumns 72 will be picked up by the notepad wrapper and line-wrap the commit message after the user edits it.\n\nSee commit 69b301b by Johannes Schindelin (dscho).\nAnd Git 2.16 (Q1 2018) will show a message to tell the user that it is waiting for the user to finish editing when spawning an editor, in case the editor\nopens to a hidden window or somewhere obscure and the user gets\nlost.\nSee commit abfb04d (07 Dec 2017), and commit a64f213 (29 Nov 2017) by Lars Schneider (larsxschneider).\nHelped-by: Junio C Hamano (gitster).\n(Merged by Junio C Hamano -- gitster -- in commit 0c69a13, 19 Dec 2017)\n\nlaunch_editor(): indicate that Git waits for user input\nWhen a graphical GIT_EDITOR is spawned by a Git command that opens\n and waits for user input (e.g. \"git rebase -i\"), then the editor window\n might be obscured by other windows.\n The user might be left staring at\n the original Git terminal window without even realizing that s/he needs\n to interact with another window before Git can proceed. To this user Git\n appears hanging.\nPrint a message that Git is waiting for editor input in the original\n terminal and get rid of it when the editor returns, if the terminal\n supports erasing the last line\n\n\nOriginal answer\nI just tested it with git version 1.6.2.msysgit.0.186.gf7512 and Notepad++5.3.1\nI prefer to not have to set an EDITOR variable, so I tried:\ngit config --global core.editor \"\\\"c:\\Program Files\\Notepad++\\notepad++.exe\\\"\"\n# or\ngit config --global core.editor \"\\\"c:\\Program Files\\Notepad++\\notepad++.exe\\\" %*\"\n\nThat always gives:\nC:\\prog\\git>git config --global --edit\n\"c:\\Program Files\\Notepad++\\notepad++.exe\" %*: c:\\Program Files\\Notepad++\\notepad++.exe: command not found\nerror: There was a problem with the editor '\"c:\\Program Files\\Notepad++\\notepad++.exe\" %*'.\n\nIf I define a npp.bat including:\n\"c:\\Program Files\\Notepad++\\notepad++.exe\" %*\n\nand I type:\nC:\\prog\\git>git config --global core.editor C:\\prog\\git\\npp.bat\n\nIt just works from the DOS session, but not from the git shell.\n(not that with the core.editor configuration mechanism, a script with \"start /WAIT...\" in it would not work, but only open a new DOS window)\n\nBennett's answer mentions the possibility to avoid adding a script, but to reference directly the program itself between simple quotes. Note the direction of the slashes! Use / NOT \\ to separate folders in the path name!\ngit config --global core.editor \\\n\"'C:/Program Files/Notepad++/notepad++.exe' -multiInst -notabbar -nosession -noPlugin\"\n\nOr if you are in a 64 bit system:\ngit config --global core.editor \\\n\"'C:/Program Files (x86)/Notepad++/notepad++.exe' -multiInst -notabbar -nosession -noPlugin\"\n\nBut I prefer using a script (see below): that way I can play with different paths or different options without having to register again a git config.\n\nThe actual solution (with a script) was to realize that:\nwhat you refer to in the config file is actually a shell (/bin/sh) script, not a DOS script.\nSo what does work is:\nC:\\prog\\git>git config --global core.editor C:/prog/git/npp.bat\n\nwith C:/prog/git/npp.bat:\n#!/bin/sh\n\"c:/Program Files/Notepad++/notepad++.exe\" -multiInst \"$*\"\n\nor\n#!/bin/sh\n\"c:/Program Files/Notepad++/notepad++.exe\" -multiInst -notabbar -nosession -noPlugin \"$*\"\n\nWith that setting, I can do 'git config --global --edit' from DOS or Git Shell, or I can do 'git rebase -i ...' from DOS or Git Shell.\nBot commands will trigger a new instance of notepad++ (hence the -multiInst' option), and wait for that instance to be closed before going on.\nNote that I use only '/', not \\'. And I installed msysgit using option 2. (Add the git\\bin directory to the PATH environment variable, but without overriding some built-in windows tools)\nThe fact that the notepad++ wrapper is called .bat is not important.\nIt would be better to name it 'npp.sh' and to put it in the [git]\\cmd directory though (or in any directory referenced by your PATH environment variable).\n\nSee also:\n\nHow do I view ‘git diff’ output with visual diff program? for the general theory\nHow do I setup DiffMerge with msysgit / gitk? for another example of external tool (DiffMerge, and WinMerge)\n\n\nlightfire228 adds in the comments:\n\nFor anyone having an issue where N++ just opens a blank file, and git doesn't take your commit message, see \"Aborting commit due to empty message\": change your .bat or .sh file to say:\n\n\"<path-to-n++\" .git/COMMIT_EDITMSG -<arguments>. \n\n\nThat will tell notepad++ to open the temp commit file, rather than a blank new one." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Pull request without forking?\n\nHere are steps of code contribution from the topic \"How do I contribute to other's code in GitHub?\"\n\nFork the project\nMake one or more well commented and clean commits to the repository. You can make a new branch here if you are modifying more than one part or feature.\nPerform a pull request in github's web interface.\n\nIs it possible to make a pull request without forking a repo?\nIt's quite sad to see more than 20 repos in my account which were forked for some pull requests. They have no activity then and zero stars / followers. Looks like I'm just copying somebody's code for a black day." }, { "role": "assistant", "content": "With create branch permissions you can create a PR without forking. If you do not, there is no way to create a pull request without forking." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-bugreport - Collect information for user to file a bug report --no-diagnose --diagnose[=<mode>]" }, { "role": "assistant", "content": "Create a zip archive of supplemental information about the user’s\nmachine, Git client, and repository state. The archive is written to the\nsame output directory as the bug report and is named git-diagnostics-<formatted-suffix> . Without mode specified, the diagnostic archive will contain the default set of\nstatistics reported by git diagnose . An optional mode value may be specified\nto change which information is included in the archive. See git-diagnose for the list of valid values for mode and details\nabout their usage." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How do I convert a git repository to mercurial?\nI've been developing a java application using git as source code repository. I'd like to share the project with other java developers and hg seems to be most used by them. \nMy question is how do I convert a git repository to hg?\nIf I tried googling \"convert git to hg\" and every search hit is about converting from hg to git. I'm also using TortoiseHg." }, { "role": "assistant", "content": "The hg convert utility isn't on by default after installation. In order to set it as such add the following to your .hgrc file.\n[extensions]\nhgext.convert=\n\nIf you're using TortoiseHg on Windows then this file resides in your home directory as mercurial.ini. After this setting change you will be able to use the hg convert utility." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-commit - Record changes to the repository RFC 2822" }, { "role": "assistant", "content": "The standard date format as described by RFC 2822, for example Thu, 07 Apr 2005 22:13:13 +0200 ." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-diff-index - Compare a tree to the working tree or index no" }, { "role": "assistant", "content": "Do not ignore whitespace when performing move detection." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Git - remote: Repository not found\nI have SourceTree with local working copy. And all operations work good, I can simple fetch, push, pull and etc via SourceTree. I just needed to make force push which does not exist in SourceTree.\nI opened terminal made git push -f\nremote: Repository not found.\nfatal: repository 'https://github.com/MyRepo/project.git/' not found\n\nI am not sure what can be an issue." }, { "role": "assistant", "content": "Remove all the github.com credential details from the system.\nFor mac\nDelete the github.com password from the Keychain Access.\nFor windows\nDelete the credentials from Credential Manager." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-fsck - Verifies the connectivity and validity of the objects in the database --strict" }, { "role": "assistant", "content": "Enable more strict checking, namely to catch a file mode\nrecorded with g+w bit set, which was created by older\nversions of Git. Existing repositories, including the\nLinux kernel, Git itself, and sparse repository have old\nobjects that trigger this check, but it is recommended\nto check new projects with this flag." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "What is the way to remove a git submodule as of git version 1.9.3?\n\nas of git version 1.9.3 (Apple Git-50) on mac how do i remove a git submodule? I am reading alot of outdated information with many developers telling me they wont work. What is the current way ?\n will git deinit pathToSubModule do the trick ?\nThe steps i thought would work are here but comments say they wont. \nLet me explain my current situation and what i need accomplished. I've installed the Quick repository and added it to as submodule to my project. This code is already checked in and others are using it. What i now need to do is fork the same Quick repository and host it on a more secure github that my company has (so a completely other private github). After forking it i want to add that fork as a gitSubmodule and let it replace the current Quick submodule i had installed previously. \nupdate: i've read that the following is the correct way on latest git version please confirm?\nTo remove a submodule added using:\n\ngit submodule add [email protected]:repos/blah.git lib/blah\nRun:\n\ngit rm lib/blah\nThat's it.\n\nFor old versions of git (circa ~1.8.5) use:\n\ngit submodule deinit lib/blah\ngit rm lib/blah\ngit config -f .gitmodules --remove-section submodule.lib/blah" }, { "role": "assistant", "content": "You have the git submodule deinit\ngit submodule deinit <asubmodule> \ngit rm <asubmodule>\n# Note: asubmodule (no trailing slash)\n# or, if you want to leave it in your working tree\ngit rm --cached <asubmodule>\nrm -rf .git/modules/<asubmodule>\n\n\ndeinit\n\nUn-register the given submodules, i.e. remove the whole submodule.$name\n section from .git/config together with their work tree. \nFurther calls to git submodule update, git submodule foreach and git submodule sync will skip any unregistered submodules until they are initialized again, so use this command if you don’t want to have a local checkout of the submodule in your work tree anymore. \nIf you really want to remove a submodule from the repository and commit that use git rm instead.\nIf --force is specified, the submodule’s work tree will be removed even if it contains local modifications." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git - the stupid content tracker git-diff-tree" }, { "role": "assistant", "content": "Compares the content and mode of blobs found via two tree objects" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git - the stupid content tracker gitnamespaces" }, { "role": "assistant", "content": "Git namespaces" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-config - Get and set repository or global options core.preferSymlinkRefs" }, { "role": "assistant", "content": "Instead of the default \"symref\" format for HEAD\nand other symbolic reference files, use symbolic links.\nThis is sometimes needed to work with old scripts that\nexpect HEAD to be a symbolic link." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-am - Apply a series of patches from a mailbox keep" }, { "role": "assistant", "content": "An empty commit will be created, with the contents of the e-mail\nmessage as its log." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Rollback to last git commit\nI just did a \ngit commit -m \"blah\"\n\nthen I added some files, how do I rollback and remove what is in my current files that have not yet been added/committed?" }, { "role": "assistant", "content": "Edited Answer - edited over time to be more helpful\nCaveat Emptor - Destructive commands ahead.\nMitigation - git reflog can save you if you need it.\n\n\nUNDO local file changes and KEEP your last commit\ngit reset --hard\n\nUNDO local file changes and REMOVE your last commit\ngit reset --hard HEAD^\n\nKEEP local file changes and REMOVE your last commit\ngit reset --soft HEAD^" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Transfer git repositories from GitLab to GitHub - can we, how to and pitfalls (if any)?\nCan one transfer repositories from GitLab to GitHub if the need be. If so, how exactly can I go about doing the same?\nAlso, are there any pitfalls in doing so or precautionary measures that I need to keep in mind before doing so given that I may decide to eventually move them to GitHub (as it has more features at the moment that I might find handy for my project)." }, { "role": "assistant", "content": "You can transfer those (simply by adding a remote to a GitHub repo and pushing them)\n\ncreate an empty repo on GitHub\ngit remote add github https://[email protected]/yourLogin/yourRepoName.git\ngit push --mirror github\n\nThe history will be the same.\nBut you will lose the access control (teams defined in GitLab with specific access rights on your repo)\nIf you face any issue with the https URL of the GitHub repo:\nThe requested URL returned an error: 403\n\nAll you need to do is to enter your GitHub password, but the OP suggests:\n\nThen you might need to push it the ssh way. You can read more on how to do it here.\n\nSee \"Pushing to Git returning Error Code 403 fatal: HTTP request failed\".\n\nNote that mike also adds in the comments:\n\nGitLab can also be set to push mirror to downstream repositories, and there are specific instructions for push mirroring to GitHub.\nThis can use a GitHub Personal Access Token and also be set to periodically push.\nYou might use this option to share on GitHub, but keep your main development activity in your GitLab instance.\n\n\ntswaehn suggests in the comments the tool piceaTech/node-gitlab-2-github\n\nIt is possible to migrate issues, labels, ... with this tool github.com/piceaTech/node-gitlab-2-github: I tested it, not bad.\nBut had issues when transferring attachments of the issues itself.\nStill worth a try, maybe.\n\nFrotz notes in the comments that:\n\nI've since discovered that there's a wait option available to use in the user-editable settings.ts file that's not documented anywhere.\nI discovered it while implementing my own quick-and-dirty delay, which did work in stopping the \"Abuse detected\" slowdowns\n\n\n\nDoes this mean that when I want to push new changes I would have to do git push github [branch_name] instead of using origin?\n\nNo, you can:\n\ndelete origin, (git remote remove origin),\nrename github remote as origin (git remote rename github origin), and\ngo on git push (to origin, which is now GitHub): the transfer from GitLab to GitHub is complete." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-log - Show commit logs --[no-]mailmap --[no-]use-mailmap" }, { "role": "assistant", "content": "Use mailmap file to map author and committer names and email\naddresses to canonical real names and email addresses. See git-shortlog ." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git push says \"everything up-to-date\" even though I have local changes\nI have a remote gitosis server and a local git repository, and each time I make a big change in my code, I'll push the changes to that server too. \nBut today I find that even though I have some local changes and commit to local repository, when running git push origin master it says 'Everything up-to-date', but when I use git clone to checkout files on the remote server, it doesn't contain latest changes. And I have only one branch named \"master\" and one remote server named \"origin\".\nPS:\nThis is what git displays when running ls-remote, I'm not sure whether it helps\n$ git ls-remote origin\ndf80d0c64b8e2c160d3d9b106b30aee9540b6ece HEAD\ndf80d0c64b8e2c160d3d9b106b30aee9540b6ece refs/heads/master\n$ git ls-remote .\n49c2cb46b9e798247898afdb079e76e40c9f77ea HEAD\ndf80d0c64b8e2c160d3d9b106b30aee9540b6ece refs/heads/master\ndf80d0c64b8e2c160d3d9b106b30aee9540b6ece refs/remotes/origin/master\n3a04c3ea9b81252b0626b760f0a7766b81652c0c refs/tags/stage3" }, { "role": "assistant", "content": "Are you working with a detached head by any chance?\nAs in:\n\nindicating that your latest commit is not a branch head.\nWarning: the following does a git reset --hard: make sure to use git stash first if you want to save your currently modified files.\n$ git log -1\n# note the SHA-1 of latest commit\n$ git checkout master\n# reset your branch head to your previously detached commit\n$ git reset --hard <commit-id>\n\n\nAs mentioned in the git checkout man page (emphasis mine):\n\nIt is sometimes useful to be able to checkout a commit that is not at the tip of one of your branches.\nThe most obvious example is to check out the commit at a tagged official release point, like this:\n\n$ git checkout v2.6.18\n\n\nEarlier versions of git did not allow this and asked you to create a temporary branch using the -b option, but starting from version 1.5.0, the above command detaches your HEAD from the current branch and directly points at the commit named by the tag (v2.6.18 in the example above).\nYou can use all git commands while in this state.\nYou can use git reset --hard $othercommit to further move around, for example.\nYou can make changes and create a new commit on top of a detached HEAD.\nYou can even create a merge by using git merge $othercommit.\nThe state you are in while your HEAD is detached is not recorded by any branch (which is natural --- you are not on any branch).\nWhat this means is that you can discard your temporary commits and merges by switching back to an existing branch (e.g. git checkout master), and a later git prune or git gc would garbage-collect them.\nIf you did this by mistake, you can ask the reflog for HEAD where you were, e.g.\n$ git log -g -2 HEAD\n\n\n\nWhile git push says \"everything up-to-date\", you still can technically push a detached HEAD, as noted in the comments by Jonathan Benn\n git push origin HEAD:main\n\nYou have to specify the destination branch, since the source is not a branch, and does not have an upstream target branch." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-log - Show commit logs --tags[=<pattern>]" }, { "role": "assistant", "content": "Pretend as if all the refs in refs/tags are listed\non the command line as <commit> . If <pattern> is given, limit\ntags to ones matching given shell glob. If pattern lacks ? , * ,\nor [ , /* at the end is implied." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-format-patch - Prepare patches for e-mail submission --from --from=<ident>" }, { "role": "assistant", "content": "Use ident in the From: header of each commit email. If the\nauthor ident of the commit is not textually identical to the\nprovided ident , place a From: header in the body of the\nmessage with the original author. If no ident is given, use\nthe committer ident. Note that this option is only useful if you are actually sending the\nemails and want to identify yourself as the sender, but retain the\noriginal author (and git am will correctly pick up the in-body\nheader). Note also that git send-email already handles this\ntransformation for you, and this option should not be used if you are\nfeeding the result to git send-email ." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git diff sees whole file as changed when it's not [duplicate]\nThis question already has answers here:\n \n \n\n\n\n\ndiff returning entire file for identical files\n\n (6 answers)\n \n\nClosed 10 years ago.\n\n\n\nThe git diff engine is seeing a whole file as changed when it has not. For example, take this commit: https://github.com/etiago/phpvirtualbox/commit/626e09958384f479f94011ac3b8301bd497aec51\nHere we see that the file lib/vboxconnector.php has 2807 additions and 2778 deletions. Additionally, from doing a manual git diff I find that indeed, the whole file is taken in as a deletion (marked with minus) and a whole new file is taken as an addition. However, the files have a lot in common which Git simply ignored.\nI've looked at diff returning entire file for identical files but it does not seem to be the case as no white space changes exist between the two commits.\nFurthermore, taking the two commits of the file (the one in 626e09958384f479f94011ac3b8301bd497aec51 and 626e09958384f479f94011ac3b8301bd497aec51^1) and diff'ing them using Meld, I get the right diff analysis.\nI've uploaded the two commits of the file to my Dropbox for convenience: commit_1 commit_2." }, { "role": "assistant", "content": "In vboxconnector.php_1, every line is terminated by a CR LF sequence.\nIn vboxconnector.php_2, every line is terminated by just LF.\nThus every line of the file has changed.\nTry using git diff --ignore-space-at-eol.\nYou may also find some useful information in the answers to this question." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-describe - Give an object a human readable name based on an available ref" }, { "role": "assistant", "content": "DESCRIPTION The command finds the most recent tag that is reachable from a\ncommit. If the tag points to the commit, then only the tag is\nshown. Otherwise, it suffixes the tag name with the number of\nadditional commits on top of the tagged object and the\nabbreviated object name of the most recent commit. The result\nis a \"human-readable\" object name which can also be used to\nidentify the commit to other git commands. By default (without --all or --tags) git describe only shows\nannotated tags. For more information about creating annotated tags\nsee the -a and -s options to git-tag . If the given object refers to a blob, it will be described\nas <commit-ish>:<path> , such that the blob can be found\nat <path> in the <commit-ish> , which itself describes the\nfirst commit in which this blob occurs in a reverse revision walk\nfrom HEAD." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-diff - Show changes between commits, commit and working tree, etc diff.relative" }, { "role": "assistant", "content": "If set to true , git diff does not show changes outside of the directory\nand show pathnames relative to the current directory." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "gitglossary - A Git Glossary rebase" }, { "role": "assistant", "content": "To reapply a series of changes from a branch to a\ndifferent base, and reset the head of that branch\nto the result." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "gitglossary - A Git Glossary octopus" }, { "role": "assistant", "content": "To merge more than two branches ." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Multiple heroku accounts\nI'm having trouble when working with multiple Heroku accounts on my computer.\nThe thing is that it's worked great before by switching accounts with the heroku gem. But now (even though I've generated new SSH keys) it wont work.\nWhen I do a git push heroku master it just says:\n\n[email protected] not authorized to access my_app_name\n\nDoes anyone have any advice on how I could solve this?" }, { "role": "assistant", "content": "You need to ensure that you are using the correct ssh key.\nThe way to do this (and the way the heroku accounts plugin prompts you) is to add a section to your ssh config file in ~/.ssh/config. For instance, for my work heroku account I have this in my ssh config:\nHost heroku.work\n HostName heroku.com\n IdentityFile ~/.ssh/id_heroku_work_rsa\n IdentitiesOnly yes\n\nNow, and this is crucial, you need to make sure that your git remote is set up to use that same named host. In this case it is heroku.work. Normally it would be heroku.com if you were using heroku with only a single account.\nSo you'll need to edit the git remote (you can do this in the .git/config file of your repo on your machine). Change the file to look like:\n [remote \"heroku\"]\n url = [email protected]:<appname>.git\n\nNote the heroku.work, not heroku.com, and replace <appname> with the name of your app (aka your repo name) on heroku." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "What is `git merge` doing?\nI want to know an exact algorithm (or near that) behind git merge. The answers at least to these sub-questions will be helpful:\n\nHow does Git detect the context of a particular non-conflicting change?\nHow does Git find out that there is a conflict in these exact lines?\nWhich things does Git automatically merge?\nHow does Git perform when there is no common base for merging branches?\nHow does Git perform when there are multiple common bases for merging branches?\nWhat happens when I merge multiple branches at once?\nWhat the a difference between merge strategies?\n\nBut the description of a whole algorithm will be much better." }, { "role": "assistant", "content": "You might be best off looking for a description of a 3-way merge algorithm. A high-level description would go something like this:\n\nFind a suitable merge base B - a version of the file that is an ancestor of both of the new versions (X and Y), and usually the most recent such base (although there are cases where it will have to go back further, which is one of the features of gits default recursive merge)\nPerform diffs of X with B and Y with B.\nWalk through the change blocks identified in the two diffs. If both sides introduce the same change in the same spot, accept either one; if one introduces a change and the other leaves that region alone, introduce the change in the final; if both introduce changes in a spot, but they don't match, mark a conflict to be resolved manually.\n\nThe full algorithm deals with this in a lot more detail, and even has some documentation (https://github.com/git/git/blob/master/Documentation/technical/trivial-merge.txt for one, along with the git help XXX pages, where XXX is one of merge-base, merge-file, merge, merge-one-file and possibly a few others). If that's not deep enough, there's always source code..." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "cloning laravel project from github\n\nI'm new to GitHub and I found this site very useful for a lot of us. I came upon storing my Laravel project here in GitHub, but there's a problem every time I will clone it to be able to go to production, when I'm about to clone it at first, it always shows this error.\nWarning: require(C:\\xampp\\htdocs\\tourismPortal\\bootstrap/../vendor/autoload.php): failed to open stream: No such file or directory in C:\\xampp\\htdocs\\tourismPortal\\bootstrap\\autoload.php on line 17\n\nFatal error: require(): Failed opening required 'C:\\xampp\\htdocs\\tourismPortal\\bootstrap/../vendor/autoload.php' (include_path='.;C:\\xampp\\php\\PEAR') in C:\\xampp\\htdocs\\tourismPortal\\bootstrap\\autoload.php on line 17\n\nI know this will be solved by using composer update on it, but is there any way to prevent this error so that every time I clone it, I will go to production without encountering this error? Thanks, by the way, I'm using tortoisegit to clone, pull and push." }, { "role": "assistant", "content": "Clone your project\nGo to the folder application using cd command on your cmd or terminal\nRun composer install on your cmd or terminal\nCopy .env.example file to .env on the root folder. You can type copy .env.example .env if using command prompt Windows or cp .env.example .env if using terminal, Ubuntu\nOpen your .env file and change the database name (DB_DATABASE) to whatever you have, username (DB_USERNAME) and password (DB_PASSWORD) field correspond to your configuration.\nRun php artisan key:generate\nRun php artisan migrate\nRun php artisan serve\nGo to http://localhost:8000/" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-commit - Record changes to the repository" }, { "role": "assistant", "content": "NAME git-commit - Record changes to the repository" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "fatal: A branch named 'gh-pages' already exists\n\nI made a template sale website (gatsby / react). I cloned my template GitHub repo and changed the remote origin to a new private repo, pushing to which works fine.\nI deploy to gh-pages with npm srcipt \"deploy\": \"gatsby build --prefix-paths && gh-pages -d public\"\nThe first time I ran this command it seemed to stall so I control c'd out of it. Now, when I try to deploy I get the error \"fatal: A branch named 'gh-pages' already exists.\"\ngit branch -a shows:\nremotes/origin/HEAD -> origin/master\nremotes/origin/gh-pages\nremotes/origin/master \nBut there is not a gh-pages branch on gitHub.\nI tried rm -rf node_modules/gh-pages/.cache didn't work.\nAlso, git push origin --delete gh-pages which gave\n\"error: unable to delete 'gh-pages': remote ref does not exist\".\nI uninstalled and reinstalled gh-pages." }, { "role": "assistant", "content": "I had to manually remove the folder node_modules/.cache/gh-pages to get the deployment to work.\nPrior to this I had tried git fetch --prune, which removed remotes/origin/gh-page. I don't know if pruning the branches was a necessary step or not." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git - the stupid content tracker git-diff-tree" }, { "role": "assistant", "content": "Compares the content and mode of blobs found via two tree objects" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Github Action Status check missing from the list of checks in Protected branch settings\n\nI have the following github action setup that triggers fine on creation of Pull Request. But it does not show up in the status checks list of protected branch (main). I'm not sure what I'm doing wrong.\n\nname: Python application\n\non:\n pull_request:\n branches: [ main ]\n\njobs:\n build:\n\n runs-on: ubuntu-latest\n\n steps:\n - uses: actions/checkout@v1\n - name: Set up Python 3.7\n uses: actions/setup-python@v1\n with:\n python-version: 3.7\n - name: Install dependencies\n run: |\n python -m pip install --upgrade pip\n - name: Lint with flake8\n run: |\n pip install flake8\n # stop the build if there are Python syntax errors or undefined names\n flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics\n # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide\n flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics\n - name: GitHub Action for pylint\n uses: cclauss/[email protected]\n - name: Github Action for pytest\n run: python3 testing.py\n\nI've also tried the same setting with:\non: [ pull_request ]\n\nEdit:\nScreenshot of the check missing:" }, { "role": "assistant", "content": "Finally figured this out. I did not set a name for the job, so it defaulted to the property, build, in this case. I was searching by workflow name. Once I added the job name, I was able to search for it correctly. Later I also verified that searching for \"build\" brings up the check name in the list too.\njobs:\n build:\n name: python test\n..." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-worktree - Manage multiple working trees repair [<path>…​]" }, { "role": "assistant", "content": "Repair worktree administrative files, if possible, if they have become\ncorrupted or outdated due to external factors. For instance, if the main worktree (or bare repository) is moved, linked\nworktrees will be unable to locate it. Running repair in the main\nworktree will reestablish the connection from linked worktrees back to the\nmain worktree. Similarly, if the working tree for a linked worktree is moved without\nusing git worktree move , the main worktree (or bare repository) will be\nunable to locate it. Running repair within the recently-moved worktree\nwill reestablish the connection. If multiple linked worktrees are moved,\nrunning repair from any worktree with each tree’s new <path> as an\nargument, will reestablish the connection to all the specified paths. If both the main worktree and linked worktrees have been moved manually,\nthen running repair in the main worktree and specifying the new <path> of each linked worktree will reestablish all connections in both\ndirections." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-log - Show commit logs -B[<n>][/<m>] --break-rewrites[=[<n>][/<m>]]" }, { "role": "assistant", "content": "Break complete rewrite changes into pairs of delete and\ncreate. This serves two purposes: It affects the way a change that amounts to a total rewrite of a file\nnot as a series of deletion and insertion mixed together with a very\nfew lines that happen to match textually as the context, but as a\nsingle deletion of everything old followed by a single insertion of\neverything new, and the number m controls this aspect of the -B\noption (defaults to 60%). -B/70% specifies that less than 30% of the\noriginal should remain in the result for Git to consider it a total\nrewrite (i.e. otherwise the resulting patch will be a series of\ndeletion and insertion mixed together with context lines). When used with -M, a totally-rewritten file is also considered as the\nsource of a rename (usually -M only considers a file that disappeared\nas the source of a rename), and the number n controls this aspect of\nthe -B option (defaults to 50%). -B20% specifies that a change with\naddition and deletion compared to 20% or more of the file’s size are\neligible for being picked up as a possible source of a rename to\nanother file." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git - the stupid content tracker git-shortlog" }, { "role": "assistant", "content": "Summarize git log output" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Is it possible to install a package from a repository on Gitlab using Composer?\n\nI am trying to get composer to download a library from my repository on Gitlab, however, it does not have a composer.json file in it so I'm not sure if this is possible.\n \"require\": {\n \"username/repository-name\"\n },\n \"repositories\": [{\n \"type\": \"package\",\n \"package\": {\n \"version\": \"dev-master\",\n \"name\": \"username/repository-name\",\n \"source\": {\n \"url\": \"https://gitlab.com/username/repository.git\",\n \"type\": \"git\",\n \"reference\": \"master\"\n }\n }\n }]," }, { "role": "assistant", "content": "I found the answer and it works for me here (the last answer, not the accepted answer):\nUsing Composer and Private Repository on GIthub using VCS on Build Server\nThis is what I make it works:\n \"repositories\": [\n {\n \"type\": \"package\",\n \"package\": {\n \"name\": \"username/repository\",\n \"version\": \"0.1.0\",\n \"type\": \"package\",\n \"source\": {\n \"url\": \"[email protected]:username/repository.git\",\n \"type\": \"git\",\n \"reference\": \"master\"\n }\n }\n }\n ],\n \"require\": { \n \"username/repository\": \"*\"\n }," } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Gitlab Ldap Authentication Settings\n\nCurrent Environment:\n\nGitlab Server: Centos 6.5\nActive Directory: Windows Server 2008 R2\n\nCould anyone check these fictitious settings for Ldap authentication in Gitlab 7.1.1?\ngitlab_rails['ldap_enabled'] = true\ngitlab_rails['ldap_host'] = 'myserver.dom.com.net'\ngitlab_rails['ldap_port'] = 389\ngitlab_rails['ldap_uid'] = 'sAMAccountName'\ngitlab_rails['ldap_method'] = 'plain' # 'ssl' or 'plain'\ngitlab_rails['ldap_bind_dn'] = 'OU=Users,DC=dom,DC=com,DC=net'\ngitlab_rails['ldap_password'] = '????'\ngitlab_rails['ldap_allow_username_or_email_login'] = true\ngitlab_rails['ldap_base'] = 'DC=dom,DC=com,DC=net'\n\nWhich ldap_bind_dn has to be set in order to Gitlab works (user account equivalent)?\nWhich ldap_password has to be set in order to Gitlab works?\nI followed suggestions from: @metaDiego and @heinglandreas. Both were in the right path. So I modified my settings in the lines:\nSolution\ngitlab_rails['ldap_bind_dn'] = 'CN=the_allowed_user_for_access_ldap,OU=Users,DC=dom,DC=com,DC=net'\ngitlab_rails['ldap_password'] = 'the_password_of_allowed_user'\n\nThe ldap_bind_dn may vary according to the AD structure and the current level where the allowed user is located.\nMy company AD doesn't allow anonymous Ldap queries. So adding those parameters were mandatory.\nSearch help in the domain administrators, for getting those parameters. \nUseful article from gitlabhq at Github\nIf gitlab_rails['ldap_allow_username_or_email_login'] = true, the login user could be with email format or only domain user." }, { "role": "assistant", "content": "The ldap_bind_dn has to be the DN of a user that has read access to the LDAP. As far as I can see you are pointing to a directory structure with OU=Users,DC=dom,DC=com,DC=net. You will have to use that users password as ```\nSo ldap_bind_dn should read something like uid=userid,OU=Users,DC=com,DC=com,DC=net and ldap_password should then be userids password.\nOn some LDAP-Servers ldap_bind_dn can be left empty as they allow anonymous bind. In that case the ldap_password has to be left empty also. \nDoes that make sense? Otherwise feel free to comment!" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-show - Show various types of objects %aD" }, { "role": "assistant", "content": "author date, RFC2822 style" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Is there a way to cause git-reflog to show a date alongside each entry?\nThe git-reflog command doesn't by default show a date alongside each entry, which strikes me as a strange oversight; I think this would be very helpful.\nAre there any command-line options, or other tweaks, which can be employed to cause it to show when each reflog entry was added? The manpage isn't forthcoming..." }, { "role": "assistant", "content": "Per the man page, you can use git log options, e.g.,\ngit reflog --pretty=short\n\ngit reflog --date=iso" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to list only newly added files between two branches\nHow can I list newly created (added) files between two branches? I can list all files that have been changed with:\ngit diff --color --name-only branch1..branch2\n\nBut that also contains files, that just changed their content, not necessarily new files. Is there some Git command for this, or do I have to checkout each branch and compare the files, e.g. with bash?" }, { "role": "assistant", "content": "You can use --diff-filter option of git diff:\ngit diff --color --name-only --diff-filter=A branch1 branch2" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-checkout-index - Copy files from the index to the working tree --prefix=<string>" }, { "role": "assistant", "content": "When creating files, prepend <string> (usually a directory\nincluding a trailing /)" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "different push/pull urls for git submodule\n\nI'm using the git superproject pattern in a large project which is deployed by a Teamcity build agent which does not have a repository account, however the repository is set up to allow anonymous cloning. For this reason I have set up the submodules with their http:// url rather than their git url. The issue with this is that the repository rejects http pushes:\nTotal 0 (delta 0), reused 0 (delta 0)\nerror: RPC failed; result=22, HTTP code = 401\nfatal: The remote end hung up unexpectedly\nfatal: The remote end hung up unexpectedly\n\nSo every time I update the submodules when switching branches, I have to do a git remote add-url --push to add the git:// url.\nIs there any way to set up the submodules in the superproject such that they already use the http:// url for pulling and the git:// url for pushing?" }, { "role": "assistant", "content": "The LibreOffice project also uses submodules and includes:\n\nBy default you submodules repository is in a state called 'detached HEAD' that means that the commit checked-out -- which is the one that the super-project (core) need -- is not associated with a local branch name.\nDon't forget to add a correct pushurl for the submodule you are working on or you will not be able to commit.\n\n$ editor .git/modules/submodule/config\n\n\nAnd in the section [remote \"origin\"] add:\n\npushurl = ssh://logerrit/submodule\n\n(similar to soulseekah's comment) (in your case, use a git:// address)\nYou can also do it through (within a submodule)\ngit config remote.origin.pushurl git://...\n\nIf you don't, as illulstrated in this project, you would get a:\nfatal: The remote end hung up unexpectedly" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Cannot ignore .idea/workspace.xml - keeps popping up\nUsing PHPStorm, I am trying to ignore the workspace.xml which pops up every-time I try to make a git commit.\nMy .gitignore looks like:\n/.idea/\n.idea/workspace.xml\n\nBecause at a point the file was committed, I've also executed:\ngit rm --cached .idea/workspace.xml and then committed the removal, pushed to a bare repo.\nBut the file keeps popping up later when I do changes in the project.\nAny ideas on what I am missing?" }, { "role": "assistant", "content": "I was facing the same issue, and it drove me up the wall. The issue ended up to be that the .idea folder was ALREADY commited into the repo previously, and so they were being tracked by git regardless of whether you ignored them or not. I would recommend the following, after closing RubyMine/IntelliJ or whatever IDE you are using:\nmv .idea ../.idea_backup\nrm .idea # in case you forgot to close your IDE\ngit rm -r .idea \ngit commit -m \"Remove .idea from repo\"\nmv ../.idea_backup .idea\n\nAfter than make sure to ignore .idea in your .gitignore\nAlthough it is sufficient to ignore it in the repository's .gitignore, I would suggest that you ignore your IDE's dotfiles globally. \nOtherwise you will have to add it to every .gitgnore for every project you work on. Also, if you collaborate with other people, then its best practice not to pollute the project's .gitignore with private configuation that are not specific to the source-code of the project." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-log - Show commit logs --color[=<when>]" }, { "role": "assistant", "content": "Show colored diff. --color (i.e. without =<when> ) is the same as --color=always . <when> can be one of always , never , or auto ." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How do I show the \"up\" and \"down\" arrow keyboard key in GitHub markdown?\n\nHow do I show the \"up\" and \"down\" arrow keyboard keys (←, ↑, → and ↓) in GitHub markdown? So far I am able to show up and down. But how do I show the arrow symbol instead the text \"up\" and \"down\"?" }, { "role": "assistant", "content": "As mentioned in \"Unicode in Github markdown\", you need to use the decimal value of the characters you want.\nIn your case, the arrow symbols, as shown here:\n\nleft arrow: ← &#8592;\nupward arrow: ↑ &#8593;\nright arrow: → &#8594;\ndownward arrow: ↓ &#8595;" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How can I upload fresh code at github?\nI have a directory with all my coding projects. \nI want to upload (correct terminology?) it to GitHub using the command line.\nI have already looked at Old question.\nI know how to clone an existing project, and how to push it after making any changes.\nBut in this case, I want to make a new project and add files to that. \nHow can I accomplish this using the command line?" }, { "role": "assistant", "content": "git init\ngit add .\ngit commit -m \"Initial commit\"\n\nAfter this, make a new GitHub repository and follow on-screen instructions." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to integrate UML diagrams into GitLab or GitHub\nI want to publish some programming documentation I have in a public available repository. This documentation has formatted text, some UML diagrams, and a lot of code examples. I think that GitHub or GitLab are good places to publish this.\nTo publish the UML diagrams, I would like to have some easy way to keep them updated into the repository and visible as images in the wiki. I don't want to keep the diagrams in my computer (or on the cloud), edit them, generate an image, and then publish it every time.\nIs there a way to put the diagrams in the repository (in PlantUML syntax would be ideal), link them in the markdown text, and make the images auto-update every time the diagram is updated?" }, { "role": "assistant", "content": "Edit: Alternative with Proxy service\nThis way is significantly different and simpler than the answer below; it uses the PlantUML proxy service:\nhttp://www.plantuml.com/plantuml/proxy?cache=no&src=https://raw.github.com/plantuml/plantuml-server/master/src/main/webapp/resource/test2diagrams.txt\n\nThe GitHub markdown for this would be:\n![alternative text](http://www.plantuml.com/plantuml/proxy?cache=no&src=https://raw.github.com/plantuml/plantuml-server/master/src/main/webapp/resource/test2diagrams.txt)\n\nThis method suffers from not being able to specify the SVG format (it defaults to PNG), and it is perhaps not possible to work-around the caching bug mentioned in the comments.\n\nAfter trying the other answer, I discovered the service to be slow and seemingly not up to the latest version of PlantUML.\nI've found a different way that's not quite as straightforward, but it works via PlantUML.com's server (in the cloud). As such, it should work anywhere you can hotlink to an image.\nIt exploits the !includeurl function and is essentially an indirection. The markdown file links to a PlantUML source that includes the diagram's source. This method allows modifying the source in GitHub, and any images in the GitHub markdown files will automatically update. But it requires a tricky step to create the URL to the indirection.\n\n\nGet the URL to the raw PlantUML source, e.g., https://raw.githubusercontent.com/linux-china/plantuml-gist/master/src/main/uml/plantuml_gist.puml (using the example in the joanq's answer)\n\nGo to http://plantuml.com/plantuml/form (or PlantText.com) and create a one-line PlantUML source that uses the !includeurl URL-TO-RAW-PLANTUML-SOURCE-ON-GITHUB operation. Continuing with the example URL, the PlantUML (meta)source is:\n!includeurl https://raw.githubusercontent.com/linux-china/plantuml-gist/master/src/main/uml/plantuml_gist.puml\n\n\nCopy the image URL from PlantUML.com's image, e.g., http://plantuml.com:80/plantuml/png/FSfB2e0m303Hg-W1RFPUHceiDf36aWzwVEl6tOEPcGGvZXBAKtNljW9eljD9NcCFAugNU15FU3LWadWMh2GPEcVnQBoSP0ujcnS5KnmaWH7-O_kEr8TU and paste it into your GitHub markdown file. This URL won't change.\n![PlantUML model](http://plantuml.com:80/plantuml/png/3SNB4K8n2030LhI0XBlTy0YQpF394D2nUztBtfUHrE0AkStCVHu0WP_-MZdhgiD1RicMdLpXMJCK3TC3o2iEDwHSxvNVjWNDE43nv3zt731SSLbJ7onzbyeF)\n\n\n\nBonus: You can even get access to the SVG format by modifying the plantuml/png/ part of the URL to be plantuml/svg/ as follows\n![PlantUML model](http://plantuml.com:80/plantuml/svg/3SNB4K8n2030LhI0XBlTy0YQpF394D2nUztBtfUHrE0AkStCVHu0WP_-MZdhgiD1RicMdLpXMJCK3TC3o2iEDwHSxvNVjWNDE43nv3zt731SSLbJ7onzbyeF)\n\nExample on GitHub\nhttps://github.com/fuhrmanator/course-activity-planner/blob/master/ooad/overview.md\nCaveat with private repos\nAs davidbak pointed out in a comment, the raw file in a private repo will have a URL with token=<LONGSTRINGHERE> in it, and this token changes as the source file updates. Unfortunately, the markdown breaks when this happens, so you have to update the Readme file after you commit the file to GitHub, which is not a great solution." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "find (and remove) member from all GitLab projects (that I own)\n\nIs there a way to search all GitLab groups and associated projects (that I own or administer) for a specific user (with the intent of removing that user)? I know how if they are a member of the group itself, but if the group has many projects and some projects have users added individually, then it's tedious to search each project one-by-one." }, { "role": "assistant", "content": "I have not found such functionality in GitLab UI, so I developed python script using GitLab API.\nHere is the link to repo with source code of my script and docs: https://gitlab.com/CVisionLab/gitlab-tools/\nJust download the gitlab-delete-members.py script and run in bash command line. Usage example:\n$ gitlab-delete-members.py --query johndoe123 --token Abcdefg123\n💬 Auth at https://gitlab.com\nProject \"MyGroupSpam / my-project-foo\" (id=11111111) : no users to delete\nProject \"MyGroupSpam / my-project-bar\" (id=11111112) : delete johndoe123 (id=3333333) : 🟢 ok\nProject \"NotMyGroupEggs / not-my-project-baz\" (id=11111113) : delete johndoe123 (id=3333333) : 🔴 fail\n💬 1 members deleted in 2 repositories\n\nJust in case I provide full source of the script here:\n#!/usr/bin/env python3\n\n# -*- coding: utf-8 -*-\n\n\"\"\"Handy script for searching and deleting members from Gitlab projects.\nBuilt on top of GitLab Python API: https://python-gitlab.readthedocs.io/\n\"\"\"\n\nimport argparse\nimport gitlab\n\n\ndef parse_args():\n parser = argparse.ArgumentParser(\n description='Delete member from all accessible gitlab projects.')\n parser.add_argument('--query', required=True,\n help='Gitlab query string that defines users '\n 'to be deleted (username is recommended)')\n parser.add_argument('--token', required=True,\n help='Gitlab token of your user')\n parser.add_argument('--url', default='https://gitlab.com',\n help='Gitlab URL')\n parser.add_argument('--visibility', default='private',\n help='Gitlab projects visibility')\n parser.add_argument('--dry', action='store_true',\n help='dry run')\n return parser.parse_args()\n\n\ndef print_ok():\n print('🟢 ok')\n\n\ndef print_fail():\n print('🔴 fail')\n\n\ndef print_skip():\n print('🟡 skip')\n\n\ndef main():\n # Greeting and args parsing.\n args = parse_args()\n\n # Initialize Gitlab API.\n print(f'💬 Auth to {args.url} : ', end='')\n gl = gitlab.Gitlab(args.url, private_token=args.token)\n try:\n gl.auth()\n print_ok()\n except: # noqa\n print_fail()\n return\n\n # Iterate over projects.\n projects = gl.projects.list(all=True, visibility=args.visibility)\n del_members_count = 0\n del_projects_count = 0\n for p in projects:\n print(f'Project \"{p.name_with_namespace}\" (id={p.id}) :',\n end='')\n\n # Query members.\n members = p.members.list(query=args.query)\n\n # Delete members.\n if len(members) == 0:\n print(' no users to delete')\n else:\n del_projects_count += 1\n for m in members:\n print(f' delete {m.username} (id={m.id}) : ', end='')\n if not args.dry:\n try:\n m.delete()\n print_ok()\n del_members_count += 1\n except: # noqa\n print_fail()\n else:\n print_skip()\n\n # Statistics.\n print(f'💬 {del_members_count} members deleted '\n f'in {del_projects_count} repositories')\n\n\nif __name__ == '__main__':\n main()\n\n\nIf you want to know which GitLab API functions are used, here is the short list:\n\ngl = gitlab.Gitlab(...) – create API object\ngl.auth() - authenticate\nprojects = gl.projects.list(...) - get list of projects\nmembers = p.members.list(...) - list members of the certain project that matches query\nm.delete() - delete member from project" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-add - Add file contents to the index --renormalize" }, { "role": "assistant", "content": "Apply the \"clean\" process freshly to all tracked files to\nforcibly add them again to the index. This is useful after\nchanging core.autocrlf configuration or the text attribute\nin order to correct files added with wrong CRLF/LF line endings.\nThis option implies -u . Lone CR characters are untouched, thus\nwhile a CRLF cleans to LF, a CRCRLF sequence is only partially\ncleaned to CRLF." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Link to a specific (current) revision on GitHub\nHere is a sample project on github: http://github.com/ripper234/Test-grails-project\nI would like to capture the latest revision, and send a link to it to someone, so that even if the project changes later he will see the specific revision I was talking about. I guess forking could do that, but it's overkill.\nHow do I do that?" }, { "role": "assistant", "content": "Just press y and the URL will change automatically to reflect the current version. \nSource" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-diff - Show changes between commits, commit and working tree, etc --full-index" }, { "role": "assistant", "content": "Instead of the first handful of characters, show the full\npre- and post-image blob object names on the \"index\"\nline when generating patch format output." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Git - list all authors of a folder of files?\nHow can I list the author names of a particular folder that's versioned by git?\nI see that I can git blame a file and list the author of each line, but I can't do that for a folder, and I would also like only a unique list (each author listed only once)" }, { "role": "assistant", "content": "Actually, there is a native Git command for that, git shortlog:\ngit shortlog -n -s -- myfolder\n\nThe options do:\n\nOption -s just shows the number of commits per contributor. Without it, the command lists the individual commits per author.\nOption -n sorts the authors by number of commits (descending order) instead of alphabetical.\n\nIllustrative output example\nojdo@machine:someRepo$ git shortlog -n -s -- myFolder\n 37 John Doe\n 31 Eager Contributor\n 11 Jane Doe\n 10 Pipeline Fixer\n 5 Docs Specialist\n\nAnd in case you encounter \"duplicate\" entries, use a .mailmap file to group multiple entries to the same contributor. This is much saner than trying to rewrite the whole history of a repo, although there is a Q&A for that, too.\n\nWhat is -- good for?\nAnd just in case you have not encountered a loose -- in a git command yet: it is a separator option to mark that what follows cannot be a <revspec> (range of commits), but only a <pathspec> (file and folder names). That means: if you would omit the -- and by accident had a branch or tag named myfolder, the command git shortlog -n -s myfolder would not filter for the directory myfolder, but instead filter for history of branch or tag \"myfolder\". This separator is therefore useful (and necessary) in a number of git commands, like log or checkout, whenever you want to be clear whether what you specify is either a revision (commmit, branch, tag) or a path (folder or file name). And of course, this site already has a question on this." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "What is Repo and Why does Google use it?\nWhen I wanted to get Android source code, I knew that I have to use \"repo\". So what is repo? Why do they use repo and not just use GIT?, and is there a GUI for repo that enables me to pause/resume syncing, because every time I get disconnected occasionally it seems that repo starts syncing from the beginning!" }, { "role": "assistant", "content": "As is mentioned in the android webpage, repo does not replace git. It is just a tool over git and helps you to manage multiple git repositories. \nFor example, suppose I have a big project which has a lot of features and I have several teams working on each feature and I created one repository for each feature. For example suppose my repositories are wifi, telephony, power management, etc. This action has sense when your features have different life cycles. For example if I won't touch the wifi feature in my next release and but I will modify all the rest. So under this scenario, my project or product is distributed in several different git repositories.\nSo, to get a centralized photo of my project (one specific moment of my project, for example a milestone), I need to get the revision (git hash or tag) of each repository. Remember that we have one repository for each feature. Manually I could do it but could be very painful. So, with repo you can have one MANIFEST which links to all the revisions of each git repo (one for each feature) and have an specific picture of my whole project.\nSimply, I could say that is a way to manage centralized multiple git repositories which are decentralized.\nWith repo you have more features, not only to checkout at a specific point. For more info go to http://source.android.com/source/using-repo.html." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-log - Show commit logs %gs" }, { "role": "assistant", "content": "reflog subject" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-diff - Show changes between commits, commit and working tree, etc --src-prefix=<prefix>" }, { "role": "assistant", "content": "Show the given source prefix instead of \"a/\"." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How do I fix a merge conflict due to removal of a file in a branch?\nI have create a dialog branch and when I try to merge it to master branch. There are 2 conflicts. I don't know how to resolve CONFLICT (delete/modify). Can you please tell me what to do?\n$ git checkout master\n$ git merge dialog\nCONFLICT (delete/modify): res/layout/dialog_item.xml deleted in dialog and modified in HEAD. Version HEAD of res/layout/dialog_item.xml left in tree.\nAuto-merging src/com/DialogAdapter.java\nCONFLICT (content): Merge conflict in src/DialogAdapter.java\nAutomatic merge failed; fix conflicts and then commit the result.\n\nI have opened src/DialogAdapter.java, fixed the conflict and did a git add src/DialogAdapter.java. What else do I need to do?" }, { "role": "assistant", "content": "The conflict message:\n\nCONFLICT (delete/modify): res/layout/dialog_item.xml deleted in dialog and modified in HEAD\n\nmeans that res/layout/dialog_item.xml was deleted in the 'dialog' branch you are merging, but was modified in HEAD (in the branch you are merging to). \nSo you have to decide whether\n\nremove file using \"git rm res/layout/dialog_item.xml\"\n\nor\n\naccept version from HEAD (perhaps after editing it) with \"git add res/layout/dialog_item.xml\"\n\nThen you finalize merge with \"git commit\".\nNote that git will warn you that you are creating a merge commit, in the (rare) case where it is something you don't want. Probably remains from the days where said case was less rare." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Using redis with Gitlab CI\n\nI am currently using serverless framework and setting up gitlab ci using shared runner.\nFollowing is my gitlab-ci.yml:\nimage: node:latest\n\nservices:\n - redis\n\ncache:\n paths:\n - node_modules/\n - java/\n\nstages:\n - build\n - test\n - review\n - staging\n - production\n\nbuild:\n stage: build\n script:\n - npm install\n artifacts:\n paths:\n - node_modules/\n\ninstall:java:\n stage: build\n script:\n - apt-get update\n - apt-get install -y default-jre default-jdk openjdk-7-jre openjdk-7-jdk\n - apt-get update\n - sls dynamodb install\n artifacts:\n paths:\n - java/\n\nconnect:\n image: redis\n script:\n - redis-cli -h redis PING\n\nunit test:\n stage: test\n script:\n - sls dynamodb start\n - babel-node ./aws/createDB.js\n - npm run unit\n dependencies:\n - build\n - install:java\n\nunit test job requires redis and is not able to connect. Following error gets thrown, when unit test job starts: \n\nError while creating redis client: Error: Redis connection to\n 127.0.0.1:6379 failed - connect ECONNREFUSED 127.0.0.1:6379\n\nCan someone point out what's wrong with current config file, thanks!" }, { "role": "assistant", "content": "The host address of the redis service is redis not 127.0.0.1 or localhost.\nSo make sure you set the host for the redis service to redis in all of your scripts and configuration files." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to upload folders on GitHub\n\nHow can I upload folders to GitHub? I have all of my code in a folder, containing 98 files, on my desktop. I know how to upload files, but it there a way to upload the entire folder?" }, { "role": "assistant", "content": "This is Web GUI of a GitHub repository:\n\nDrag and drop your folder to the above area. When you upload too much folder/files, GitHub will notice you:\n\nYowza, that’s a lot of files. Try again with fewer than 100 files.\n\n\nand add commit message\n\nAnd press button Commit changes is the last step." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Continue working on a Git branch after making a pull request\nI've found myself in this situation a couple of times lately, and I'm not totally sure how best to handle it.\nSo I have a fork of a git repository that I'm contributing to. I keep my master branch synced with the upstream master branch.\nWhen I want to work on a new feature, bugfix, etc, I create a branch from my master and do any work. When I'm done, I merge in any changes that have been made to upstream master in the meantime, and then send a pull request from my feature/bugfix branch to the upstream master.\nNow, while I'm waiting for that pull request to be accepted, I want to work on something slightly different. However, the new feature work needs the bugfix/new feature that I just sent the pull request for. I need to build on it.\nHow do I branch/merge/handle branches in such a way that I can work on the continuation, while still being able to merge/pull request in my changes in a clean way once the first pull request is accepted into master?\nThis is all using Github, although I imagine the answer would be applicable to Git in general." }, { "role": "assistant", "content": "Create a new branch feature2 based on the last commit to feature1. feature1 will not move forward any more, and can be merged.\nfeature2 can then be merged later (some people would argue to rebase feature2 on the commit where feature1 was merged into upstream, but personally i dislike rebasing)." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-mergetool - Run merge conflict resolution tools to resolve merge conflicts" }, { "role": "assistant", "content": "BACKEND SPECIFIC HINTS vimdiff Description When specifying --tool=vimdiff in git mergetool Git will open Vim with a 4\nwindows layout distributed in the following way: ------------------------------------------\n| | | |\n| LOCAL | BASE | REMOTE |\n| | | |\n------------------------------------------\n| |\n| MERGED |\n| |\n------------------------------------------ LOCAL , BASE and REMOTE are read-only buffers showing the contents of the\nconflicting file in specific commits (\"commit you are merging into\", \"common\nancestor commit\" and \"commit you are merging from\" respectively) MERGED is a writable buffer where you have to resolve the conflicts (using the\nother read-only buffers as a reference). Once you are done, save and exit Vim as\nusual ( :wq ) or, if you want to abort, exit using :cq . Layout configuration You can change the windows layout used by Vim by setting configuration variable mergetool.vimdiff.layout which accepts a string where the following separators\nhave special meaning: + is used to \"open a new tab\" , is used to \"open a new vertical split\" / is used to \"open a new horizontal split\" @ is used to indicate the file containing the final version after\nsolving the conflicts. If not present, MERGED will be used by default. The precedence of the operators is as follows (you can use parentheses to change\nit): `@` > `+` > `/` > `,` Let’s see some examples to understand how it works: layout = \"(LOCAL,BASE,REMOTE)/MERGED\" This is exactly the same as the default layout we have already seen. Note that / has precedence over , and thus the parenthesis are not\nneeded in this case. The next layout definition is equivalent: layout = \"LOCAL,BASE,REMOTE / MERGED\" layout = \"LOCAL,MERGED,REMOTE\" If, for some reason, we are not interested in the BASE buffer. ------------------------------------------\n| | | |\n| | | |\n| LOCAL | MERGED | REMOTE |\n| | | |\n| | | |\n------------------------------------------ layout = \"MERGED\" Only the MERGED buffer will be shown. Note, however, that all the other\nones are still loaded in vim, and you can access them with the \"buffers\"\ncommand. ------------------------------------------\n| |\n| |\n| MERGED |\n| |\n| |\n------------------------------------------ layout = \"@LOCAL,REMOTE\" When MERGED is not present in the layout, you must \"mark\" one of the\nbuffers with an asterisk. That will become the buffer you need to edit and\nsave after resolving the conflicts. ------------------------------------------\n| | |\n| | |\n| | |\n| LOCAL | REMOTE |\n| | |\n| | |\n| | |\n------------------------------------------ layout = \"LOCAL,BASE,REMOTE / MERGED + BASE,LOCAL + BASE,REMOTE\" Three tabs will open: the first one is a copy of the default layout, while\nthe other two only show the differences between ( BASE and LOCAL ) and\n( BASE and REMOTE ) respectively. ------------------------------------------\n| <TAB #1> | TAB #2 | TAB #3 | |\n------------------------------------------\n| | | |\n| LOCAL | BASE | REMOTE |\n| | | |\n------------------------------------------\n| |\n| MERGED |\n| |\n------------------------------------------ ------------------------------------------\n| TAB #1 | <TAB #2> | TAB #3 | |\n------------------------------------------\n| | |\n| | |\n| | |\n| BASE | LOCAL |\n| | |\n| | |\n| | |\n------------------------------------------ ------------------------------------------\n| TAB #1 | TAB #2 | <TAB #3> | |\n------------------------------------------\n| | |\n| | |\n| | |\n| BASE | REMOTE |\n| | |\n| | |\n| | |\n------------------------------------------ layout = \"LOCAL,BASE,REMOTE / MERGED + BASE,LOCAL + BASE,REMOTE + (LOCAL/BASE/REMOTE),MERGED\" Same as the previous example, but adds a fourth tab with the same\ninformation as the first tab, with a different layout. ---------------------------------------------\n| TAB #1 | TAB #2 | TAB #3 | <TAB #4> |\n---------------------------------------------\n| LOCAL | |\n|---------------------| |\n| BASE | MERGED |\n|---------------------| |\n| REMOTE | |\n--------------------------------------------- Note how in the third tab definition we need to use parentheses to make , have precedence over / . Variants Instead of --tool=vimdiff , you can also use one of these other variants: --tool=gvimdiff , to open gVim instead of Vim. --tool=nvimdiff , to open Neovim instead of Vim. When using these variants, in order to specify a custom layout you will have to\nset configuration variables mergetool.gvimdiff.layout and mergetool.nvimdiff.layout instead of mergetool.vimdiff.layout (though the\nlatter will be used as fallback if the variant-specific one is not set). In addition, for backwards compatibility with previous Git versions, you can\nalso append 1 , 2 or 3 to either vimdiff or any of the variants (ex: vimdiff3 , nvimdiff1 , etc…​) to use a predefined layout.\nIn other words, using --tool=[g,n,]vimdiffx is the same as using --tool=[g,n,]vimdiff and setting configuration variable mergetool.[g,n,]vimdiff.layout to…​ x=1 : \"@LOCAL, REMOTE\" x=2 : \"LOCAL, MERGED, REMOTE\" x=3 : \"MERGED\" Example: using --tool=gvimdiff2 will open gvim with three columns (LOCAL,\nMERGED and REMOTE)." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Moving uncommitted changes to a new branch [duplicate]\nThis question already has answers here:\n \n \n\n\n\nClosed 11 years ago.\n\n\n\n\nPossible Duplicate:\nMove existing, uncommited work to a new branch in Git \n\nI have some code in branch ABC. \nAfter making some changes to it, i'd like to move all those uncommitted changes into a commit on a new branch ABC_1.\nHow can this be done please?" }, { "role": "assistant", "content": "Just create a new branch:\ngit checkout -b newBranch\n\nAnd if you do git status you'll see that the state of the code hasn't changed and you can commit it to the new branch." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git - the stupid content tracker git-checkout" }, { "role": "assistant", "content": "Switch branches or restore working tree files" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git - the stupid content tracker git-sparse-checkout" }, { "role": "assistant", "content": "Reduce your working tree to a subset of tracked files" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-log - Show commit logs %gE" }, { "role": "assistant", "content": "reflog identity email (respecting .mailmap, see git-shortlog or git-blame )" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-diff-index - Compare a tree to the working tree or index -D --irreversible-delete" }, { "role": "assistant", "content": "Omit the preimage for deletes, i.e. print only the header but not\nthe diff between the preimage and /dev/null . The resulting patch\nis not meant to be applied with patch or git apply ; this is\nsolely for people who want to just concentrate on reviewing the\ntext after the change. In addition, the output obviously lacks\nenough information to apply such a patch in reverse, even manually,\nhence the name of the option. When used together with -B , omit also the preimage in the deletion part\nof a delete/create pair." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-grep - Print lines matching a pattern" }, { "role": "assistant", "content": "NAME git-grep - Print lines matching a pattern" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-diff - Show changes between commits, commit and working tree, etc --output-indicator-new=<char> --output-indicator-old=<char> --output-indicator-context=<char>" }, { "role": "assistant", "content": "Specify the character used to indicate new, old or context\nlines in the generated patch. Normally they are + , - and\n' ' respectively." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-config - Get and set repository or global options guitool.<name>.prompt" }, { "role": "assistant", "content": "Specifies the general prompt string to display at the top of\nthe dialog, before subsections for argPrompt and revPrompt .\nThe default value includes the actual command." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-grep - Print lines matching a pattern --threads <num>" }, { "role": "assistant", "content": "Number of grep worker threads to use. See NOTES ON THREADS and grep.threads in CONFIGURATION for more information." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Where is the local repository located?\nFrom Wikipedia:\n\nWhere is said \"Local repository\" located physically (in the file system)?" }, { "role": "assistant", "content": "The Working Directory is wherever your files are on your local machine. The Local Repository is the .git/ subdirectory inside the Working Directory. The Index is a conceptual place that also physically resides in the .git/ subdirectory." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git log --full-diff, what does it do?\nThe git-log documentation explains the parameter --full-diff.\nIn detail:\n\nWithout this flag, git log -p ... shows commits that touch the specified paths, and diffs about the same specified paths. With this, the full diff is shown for commits that touch the specified paths; this means that \"…​\" limits only commits, and doesn’t limit diff for those commits.\nNote that this affects all diff-based output types, e.g. those produced by --stat, etc.\n\nI've no idea what it tries to explain, can someone give me an example maybe." }, { "role": "assistant", "content": "Sure. Let's say you have a commit C that makes changes to file A and file B.\nRegular git log -p -- A will show all commits that touch file A, and for those commits, it'll show the diffs to A.\nWith --full-diff, it'll show the same commits, but for each commit it'll show the diff of all files changed in that commit. In this case, commit C's diff will show diffs for files A and B." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-check-ignore - Debug gitignore / exclude files" }, { "role": "assistant", "content": "NAME git-check-ignore - Debug gitignore / exclude files" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "fatal: ssh variant 'simple' does not support setting port\nWhen I clone a remote GitLab project, I get the following error:\nerror fatal: ssh variant 'simple' does not support setting port\n\nI tried to re-install TortoiseGit, but this did not solve the issue." }, { "role": "assistant", "content": "The internal behavior of Git (>=2.16.0) for SSH tool detection changed and TortoiseGitPlink is not detected any more as ssh or plink compatible.\nThis only affects if the SSH URL contains a port or you have configured Git to use the Protocol version 2. For now, you need to set the environment variable GIT_SSH_VARIANT to ssh or configure it in Git settings using git config --global ssh.variant ssh.\nIn the next version of TortoiseGit 2.5.7 this will be done automatically when TortoiseGitPLink is invoked by TortoiseGit (cf. https://tortoisegit.org/issue/3139). If you use TortoiseGitPLink from CLI the setting is still needed).\nUpdate (TLDR):\n\nUpdate TortoiseGit to the latest stable version: https://tortoisegit.org/download/\nI f you use TortoiseGitPLink from Git CLI also issue git config --global ssh.variant ssh on CLI or set the environment variable GIT_SSH_VARIANT to ssh." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-am - Apply a series of patches from a mailbox am.threeWay" }, { "role": "assistant", "content": "By default, git am will fail if the patch does not apply cleanly. When\nset to true, this setting tells git am to fall back on 3-way merge if\nthe patch records the identity of blobs it is supposed to apply to and\nwe have those blobs available locally (equivalent to giving the --3way option from the command line). Defaults to false .\nSee git-am ." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Tag a remote git repository without cloning it\nIs there a way to tag a remote git repository without having cloned it locally?\nIn order to correlate a code repository with a config repository, I want to (as a CI build step) tag whatever is the current head of the config repository with build-n (where N is the current build number provided by jenkins).\nThe config repository isn't used as part of the build, I simply want an easy way to fetch the config revision as it was when for example version 1234 was built, and tagging it as \"build-1234\" seems like the simplest way to achieve this." }, { "role": "assistant", "content": "To have this as an answer: there is at the moment no way to do remote tagging with git, but if you have access in some way to the remote (bare) repository, you may be able to tag on the remote location.\nFor example, if you access the git repository via SSH, you can login using SSH, go to the (bare) repository and execute the tag command (git tag build-1234 master) in the (bare) repository.\n(I am not completely sure about the tool mentioned by @ruslan-kabalin)" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Why does Git have a tea time?\nIn the date.c file in Git's source code, I note the following structure of special time names:\nstatic const struct special {\n const char *name;\n void (*fn)(struct tm *, struct tm *, int *);\n} special[] = {\n { \"yesterday\", date_yesterday },\n { \"noon\", date_noon },\n { \"midnight\", date_midnight },\n { \"tea\", date_tea },\n { \"PM\", date_pm },\n { \"AM\", date_am },\n { \"never\", date_never },\n { \"now\", date_now },\n { NULL }\n};\n\nI understand the utility (somewhat) of most of these, but why have a \"tea\" time (it evaluates to 17:00 hours)? Is this just an Easter egg of sorts?" }, { "role": "assistant", "content": "This commit might give you a clue as to why it was included:\nhttps://github.com/git/git/commit/a8aca418d6484400d6804e22717bd49ca06c28e9\nI think it was suggested initially as a joke, but actually implemented to demonstrate the ability for users to include their own custom time/date periods:\nOn Fri, 18 Nov 2005, David Roundy wrote:\n> Don't forget \"high noon\"! (and perhaps \"tea time\"?) :)\n\n\nDone.\n\n [torvalds@g5 git]$ ./test-date \"now\" \"midnight\" \"high noon\" \"tea-time\"\n now -> bad -> Wed Dec 31 16:00:00 1969\n now -> Fri Nov 18 08:50:54 2005\n\n midnight -> bad -> Wed Dec 31 16:00:00 1969\n midnight -> Fri Nov 18 00:00:00 2005\n\n high noon -> bad -> Wed Dec 31 16:00:00 1969\n high noon -> Thu Nov 17 12:00:00 2005\n\n tea-time -> bad -> Wed Dec 31 16:00:00 1969\n tea-time -> Thu Nov 17 17:00:00 2005\n\nThanks for pointing out tea-time.\n\nThis is also written to easily extended to allow people to add their own\nimportant dates like Christmas and their own birthdays.\n\nSigned-off-by: Linus Torvalds <[email protected]>\nSigned-off-by: Junio C Hamano <[email protected]>" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Get all file names from a Github repo through the Github API\n\nIs it possible to get all the file names from repository using the GitHub API?\nI'm currently trying to tinker this using PyGithub, but I'm totally ok with manually doing the request as long as it works.\nMy algorithm so far is:\n\nGet the user repo names\nGet the user repo that matches a certain description\n??? get repo file names?" }, { "role": "assistant", "content": "You can use Github git trees\nhttps://api.github.com/repos/[USER]/[REPO]/git/trees/[BRANCH]?recursive=1\nRepo\nhttps://github.com/deeja/bing-maps-loader\nApi Call\nhttps://api.github.com/repos/deeja/bing-maps-loader/git/trees/master?recursive=1\nwhich returns\n{\nsha: \"55382e87889ccb4c173bc99a42cc738358fc253a\",\nurl: \"https://api.github.com/repos/deeja/bing-maps-loader/git/trees/55382e87889ccb4c173bc99a42cc738358fc253a\",\ntree: [\n{\npath: \"README.md\",\nmode: \"100644\",\ntype: \"blob\",\nsha: \"41ceefc1262bb80a25529342ee3ec2ec7add7063\",\nsize: 3196,\nurl: \"https://api.github.com/repos/deeja/bing-maps-loader/git/blobs/41ceefc1262bb80a25529342ee3ec2ec7add7063\"\n},\n{\npath: \"index.js\",\nmode: \"100644\",\ntype: \"blob\",\nsha: \"a81c94f70d1ca2a0df02bae36eb2aa920c7fb20e\",\nsize: 1581,\nurl: \"https://api.github.com/repos/deeja/bing-maps-loader/git/blobs/a81c94f70d1ca2a0df02bae36eb2aa920c7fb20e\"\n},\n{\npath: \"package.json\",\nmode: \"100644\",\ntype: \"blob\",\nsha: \"45f24dcb7a457b14fede4cb907e957600882b340\",\nsize: 595,\nurl: \"https://api.github.com/repos/deeja/bing-maps-loader/git/blobs/45f24dcb7a457b14fede4cb907e957600882b340\"\n}\n],\ntruncated: false\n}" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Adding Git credentials on Windows\n\nI am on a Windows 10 system and am trying to add my credentials to Git in Git Bash. I cannot find a way to store my password.\nI checked GitHub's documentation, which said just to enter the line git config --global credential.helper wincred, but that didn't seem to make sense, as there's not prompt to enter a password. I checked Git's documentation, which said to use command git credential-store --file ~/git.store store and fill in all prompts. The bash emulator wasn't able to read the credentials. \nFinally, I tried to add my password like I added my email, via git config --global user.password \"5ecre7\" but after running a sample git clone on a repository I made it responded that I didn't have the access rights. Is there a way to fix this?" }, { "role": "assistant", "content": "Ideally, you should enter:\ngit config --global credential.helper manager-core\n\n# Since Git 2.39+\ngit config --global credential.helper manager\n\nThis is from the Microsoft multi-platform credential manager GCM.\n(After Git 2.38.1, is called manager (no longer \"manager-core\"))\nThen your password (or rather a token is used nowadays) would be stored in the Windows Credential Manager.\nSee more at \"Unable to change git account\".\nOn the first push, a popup will appear asking for your credentials (username/password) for the target server (for instance github.com)\nIf not, that might means your credentials were already stored.\nIf they are incorrect, a simple printf \"protocol=https\\nhost=github.com\\nusername=xxx\"| git-credential-manager-core erase will remove them (on Windows, Linux or Mac)\n\nWith Git 2.29 (Q4 2020), the parser in the receiving end of the credential protocol is loosen to allow credential helper to terminate lines with CRLF line ending, as well as LF line ending.\nSee commit 356c473 (03 Oct 2020) by Nikita Leonov (nyckyta).\n(Merged by Junio C Hamano -- gitster -- in commit 542b3c2, 05 Oct 2020)\n\ncredential: treat CR/LF as line endings in the credential protocol\nSigned-off-by: Nikita Leonov\nSigned-off-by: Johannes Schindelin\n\n\nThis fix makes using Git credentials more friendly to Windows users: it allows a credential helper to communicate using CR/LF line endings (\"DOS line endings\" commonly found on Windows) instead of LF-only line endings (\"Unix line endings\").\nNote that this changes the behavior a bit: if a credential helper produces, say, a password with a trailing Carriage Return character, that will now be culled even when the rest of the lines end only in Line Feed characters, indicating that the Carriage Return was not meant to be part of the line ending.\nIn practice, it seems very unlikely that something like this happens. Passwords usually need to consist of non-control characters, URLs need to have special characters URL-encoded, and user names, well, are names.\nHowever, it does help on Windows, where CR/LF line endings are common: as unrecognized commands are simply ignored by the credential machinery, even a command like quit\\r (which is clearly intended to abort) would simply be ignored (silently) by Git.\nSo let's change the credential machinery to accept both CR/LF and LF line endings.\nWhile we do this for the credential helper protocol, we do not adjust git credential-cache--daemon(man) (which won't work on Windows, anyway, because it requires Unix sockets) nor git credential-store(man) (which writes the file ~/.git-credentials which we consider an implementation detail that should be opaque to the user, read: we do expect users not to edit this file manually)." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Delete a local development branch\nI have recently cloned a repo of our development code branch in my system:\ngit clone https://gitserver.com/product\n\nAfter the clone was successful I get the below status on query:\n$ git branch\n* develop\n\nI realized that now this branch needs to be deleted, hence:\n$ git checkout develop\nAlready on 'develop'\nYour branch is up-to-date with 'origin/develop'.\n\n$ git branch -d develop\nerror: Cannot delete branch 'develop' checked out at 'C:/work/test'\n\nI am not sure whether we should try a GIT command or Unix command 'rm -rf' to delete a local develop branch repository? Lastly why no one can delete 'develop' branch." }, { "role": "assistant", "content": "You cannot delete the branch you are currently on.\nTry creating a new branch \ngit checkout -b new-branch\n\nThen delete the develop branch\ngit branch -d develop" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Travis Could not authorize build request\n\nI'm getting this error for each and every project in my Github organization. \nCould not authorize build request myorg/myproject\n\nI searched everywhere but couldn't find any solutions or what causes this. \nHow to troubleshoot this issue/integration?" }, { "role": "assistant", "content": "'Could not authorize build request ...' usually occurs due to\n\nA plan is not selected. Travis will not select the free plan automatically. Select the free or paid plan for your organization manually.\nSelected plan become inactive. Go to settings and select the plan again.\nExpiration of your paid subscription.\nRan out of free trial build credits available for private repositories.\n\nTravis CI is always-free only for public repositories. The free plan also provides 10,000 build credits try out building private repositories. Read updated info on Billing FAQ." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "gitmodules - Defining submodule properties" }, { "role": "assistant", "content": "NOTES Git does not allow the .gitmodules file within a working tree to be a\nsymbolic link, and will refuse to check out such a tree entry. This\nkeeps behavior consistent when the file is accessed from the index or a\ntree versus from the filesystem, and helps Git reliably enforce security\nchecks of the file contents." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-instaweb - Instantly browse your working repository in gitweb" }, { "role": "assistant", "content": "CONFIGURATION You may specify configuration in your .git/config [instaweb]\n\tlocal = true\n\thttpd = apache2 -f\n\tport = 4321\n\tbrowser = konqueror\n\tmodulePath = /usr/lib/apache2/modules If the configuration variable instaweb.browser is not set, web.browser will be used instead if it is defined. See git-web--browse for more information about this." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How do I execute a Git command without being in the repository?\nIs there a way to execute Git commands against a repository without being in that repository?\nFor example something like this: git /home/repo log?\nPlease do not tell me to cd to it. I'm doing this via an exec call." }, { "role": "assistant", "content": "Use -C as the first argument to git:\ngit -C /home/repo log\n\nPer the docs, the effect of this is:\n\n-C <path>\nRun as if git was started in <path> instead of the current working directory. ...\n\nThis is almost equivalent to --git-dir and --work-tree without appending the usual .git folder. However, the options --git-dir and --work-tree do not exist to access the repository from outside the work tree; they are used to move the .git somewhere else, and they are much more complicated to use in some cases.\nFor instance, to get the log of /home/repo/subdir only:\ngit -C /home/repo/subdir log .\n\nor\ngit -C /home/repo log subdir\n\nIt is not possible to use log . with --git-dir or --work-tree. The path must be processed to extract the subpath relative to the top of the work tree, and even in that case, git will not recognize it as a path if you do not use the -- option, so the only possible way is:\ngit --git-dir /home/repo/.git log -- subdir\n\nFurthermore, --work-tree does not work at all with the log subcommand with my version (git 1.9.1). It is just ignored:\ngit --git-dir /home/repo/.git --work-tree /home/repo/subdir log -- subdir\ngit --git-dir /home/repo/.git --work-tree /home/repo/whatever log -- subdir\n\nI do not even understand if this is a bug or a feature... as usual with many git design choices." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-rev-list - Lists commit objects in reverse chronological order --simplify-merges" }, { "role": "assistant", "content": "First, build a history graph in the same way that --full-history with parent rewriting does (see above). Then simplify each commit C to its replacement C' in the final\nhistory according to the following rules: Set C' to C . Replace each parent P of C' with its simplification P' . In\nthe process, drop parents that are ancestors of other parents or that are\nroot commits TREESAME to an empty tree, and remove duplicates, but take care\nto never drop all parents that we are TREESAME to. If after this parent rewriting, C' is a root or merge commit (has\nzero or >1 parents), a boundary commit, or !TREESAME, it remains.\nOtherwise, it is replaced with its only parent. The effect of this is best shown by way of comparing to --full-history with parent rewriting. The example turns into: .-A---M---N---O\n\t / / /\n\tI B D\n\t \\ / /\n\t `---------' Note the major differences in N , P , and Q over --full-history : N 's parent list had I removed, because it is an ancestor of the\nother parent M . Still, N remained because it is !TREESAME. P 's parent list similarly had I removed. P was then\nremoved completely, because it had one parent and is TREESAME. Q 's parent list had Y simplified to X . X was then removed, because it\nwas a TREESAME root. Q was then removed completely, because it had one\nparent and is TREESAME." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-config - Get and set repository or global options remote.<name>.url" }, { "role": "assistant", "content": "The URL of a remote repository. See git-fetch or git-push ." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-diff - Show changes between commits, commit and working tree, etc allow-indentation-change" }, { "role": "assistant", "content": "Initially ignore any whitespace in the move detection, then\ngroup the moved code blocks only into a block if the change in\nwhitespace is the same per line. This is incompatible with the\nother modes." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "self signed certificate in certificate chain on github copilot\n\nI installed the GitHub copilot but the extension do not work, always show the following error :\n\n\nGitHub Copilot could not connect to server. Extension activation failed: \"self signed certificate in certificate chain\"\nSource: GitHub Copilot (Extension) Show Output log\n\nWhat could I do to solve this ?" }, { "role": "assistant", "content": "Copilot error: “GitHub Copilot could not connect to server. Extension activation failed: self-signed certificate in certificate chain” is generally caused using CoPilot behind a Corporate network.\n\nMost corporate networks have a ‘Man-in-the-middle’ appliance that dynamically breaks open all secure SSL traffic leaving home to enter the internet. This ensures they can inspected any traffic leaving, including your online banking. Usually automation scrubs the traffic looking for theft of company secrets or IP and raises alerts. It all gets logged and reviewed further if need be.\n\nThis action leaves behind a fake cert chain as a fingerprint. The cert for the called site is replaced with a fake, and one signed by the company’s own private CA authority. Hence the self-signed cert in the cert chain error.\n\nFrom any company device (Phones\\Laptop) the company CA is already installed as a trusted CA. So the local browsers and other desktop apps trust this faked cert chain - and so do not raise any concerns someone is snooping your secure network traffic (the company does own the network and the device).\n\nBy default VSCode is not trusting the installed desktop certs, and so it noticed that the GitHub cert is no longer signed by a trusted public CA authority.\n\nAs Rypox states above, the VSCode extension ‘Win-CA’ (must be set to ‘append’ mode) solves this issue. It tells VSCode to also trust the CA’s installed on the employees desktop. This makes VSCode happy again trusting the fake cert chain. No 'whitelisting' needed and not 'VPN' related. But certinly not that obvious either. An interesting CA trust issue.\n\nConfirming this does exist is easy from your browser. Go to any outside site (like Amazon) and review the sites “Cert” to see who the CA’s are (Certification Path). It should ‘not’ contain any reference to your company. Look at that same cert from outside the company network on your own personal laptop.\n\n\n… “bit of a glitch in the Matrix”, installing Win-CA helps hides it again and all looks back to normal." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Is there a script to list git branches created by me?\nI'm aware that branches don't really store creator information - and they're just a pointer to a commit. \nMy goal is to be able to clean out my old branches that have been merged back to the main branch, and list branches where this hasn't been done either. (A clean up). \nThis is different to \"finding unmerged branches\" because I want to find merged branches as well, and I want to do it by author. \nMy question is: Is there a script to list git branches created by me?" }, { "role": "assistant", "content": "This command lists all branches and their author names\ngit for-each-ref --format=' %(authorname) %09 %(refname)' --sort=authorname \n\nIf you are using github you can also visit https://github.com/author/repo/branches/yours to get all your branches\nIf you want to just delete all the already merged branches you can us the command\ngit branch --merged | grep -v \"\\*\" | grep -v master | grep -v dev | xargs -n 1 git branch -d\n\nFor more details of git for-each-ref visit here." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Is there a way to compare two diffs or patches?\nIs there a way to test if two diffs or patches are equivalent?\nLet's say you have the following git commit history, where features F and G are cleanly rebaseable to E:\n G\n /\nA--B--C--D--E\n \\\n F\n\nDue to limitations in our current deployment process, we have the following, somewhat related graph (it's not version controlled)\n G'\n /\n------------E'\n \\\n F'\n\nF' and G' will ultimately be applied to the head E', in some to be determined order, so it would end up like\n------------E'--G'--F'\n\nIs there a way to test that the diff from E' to G' is the same as the patch produced by the git commit of G from B?\nI fully realize that in an ideal world, revision control would solve this, and we're getting there, but that's not where we are currently.\nYou could essentially play both patches on separate checkouts and compare the outputs, but that seems kind of clunky. And comparing the diffs themselves, I'm assuming, wouldn't work because line numbers could change. Even if G' and F' were rebased to E', the patch for F' would ultimately be applied to G', making the diff context of the patch different." }, { "role": "assistant", "content": "diff <(git show COMMIT1SHA) <(git show COMMIT2SHA)" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-config - Get and set repository or global options --show-scope" }, { "role": "assistant", "content": "Similar to --show-origin in that it augments the output of\nall queried config options with the scope of that value\n(worktree, local, global, system, command)." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-shortlog - Summarize git log output --boundary" }, { "role": "assistant", "content": "Output excluded boundary commits. Boundary commits are\nprefixed with - ." } ]