messages
listlengths 3
3
|
---|
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-config - Get and set repository or global options checkout.defaultRemote"
},
{
"role": "assistant",
"content": "When you run git checkout <something> or git switch <something> and only have one\nremote, it may implicitly fall back on checking out and\ntracking e.g. origin/<something> . This stops working as soon\nas you have more than one remote with a <something> reference. This setting allows for setting the name of a\npreferred remote that should always win when it comes to\ndisambiguation. The typical use-case is to set this to origin . Currently this is used by git-switch and git-checkout when git checkout <something> or git switch <something> will checkout the <something> branch on another remote,\nand by git-worktree when git worktree add refers to a\nremote branch. This setting might be used for other checkout-like\ncommands or functionality in the future."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-rev-list - Lists commit objects in reverse chronological order --filter-provided-objects"
},
{
"role": "assistant",
"content": "Filter the list of explicitly provided objects, which would otherwise\nalways be printed even if they did not match any of the filters. Only\nuseful with --filter= ."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Why can't I use TortoiseMerge as my git merge tool on Windows?\nI'm trying to perform my first Git merge ever (exciting!), but can't get Git Gui (0.13.GITGUI from Git 1.7.4.msysgit.0) to recognize TortoiseMerge (1.6.11.20210 x64) on Windows 7. Based on an answer to a similar question, I've made the following configuration changes:\n$ git config --global merge.tool tortoisemerge\n$ git config --global mergetool.tortoisemerge.cmd 'TortoiseMerge.exe -base:\"$BASE\" -mine:\"$LOCAL\" -theirs:\"$REMOTE\" -merged:\"$MERGED\"'\n$ git config --global --list\n...snip...\nmerge.tool=tortoisemerge\nmergetool.tortoisemerge.cmd=TortoiseMerge.exe -base:\"$BASE\" -mine:\"$LOCAL\" -theirs:\"$REMOTE\" -merged:\"$MERGED\"\n$\n\nUnfortunately, when I start Git Gui and attempt to \"Run Merge Tool\", I receive the error Unsupported merge tool 'tortoisemerge'.\nCan anyone tell me what I've done wrong? Here's the relevant sections of my ~/.gitconfig:\n[merge]\n tool = tortoisemerge\n[mergetool \"tortoisemerge\"]\n cmd = TortoiseMerge.exe -base:\\\"$BASE\\\" -mine:\\\"$LOCAL\\\" -theirs:\\\"$REMOTE\\\" -merged:\\\"$MERGED\\\"\n\nUpdate\nTortoiseMerge works fine with the above config when running git mergetool from the command line. It seems that only Git Gui has problems with it. :-/"
},
{
"role": "assistant",
"content": "If you have the latest git, run this command line once:\ngit config merge.tool tortoisemerge\nImportant: Do not add a .exe extension to the command.\nIf that fails, or if you want to add a different merge tool that git doesn't know about, do this:\nOpen one of the following in an editor:\n\n64-bit git: C:\\Program Files\\Git\\mingw64\\share\\git-gui\\lib\\mergetool.tcl\n32-bit git: C:\\Program Files (x86)\\Git\\share\\git-gui\\lib\\mergetool.tcl\n\nAdd something like this to mergetool.tcl:\ntortoisemerge {\n set cmdline [list TortoiseMerge.exe -base:\"$BASE\" -mine:\"$LOCAL\" -theirs:\"$REMOTE\" -merged:\"$MERGED\"]\n}\n\nPut the new tortoisemerge entry above this other code:\ndefault {\n error_popup [mc \"Unsupported merge tool '%s'\" $tool]\n return\n}\n\nBonus example:\nTo use SourceGear diffmerge, add this to mergetool.tcl:\ndiffmerge {\n set cmdline [list \"C:/Program Files (x86)/SourceGear/DiffMerge/DiffMerge.exe\" --merge --result=$MERGED $LOCAL $BASE $REMOTE]\n}"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "'git diff' doesn't give any output\nIf I run git diff I would expect to see a list of changes of my working directory relative to whatever had been committed before (or a list of the working directory contents if it's a new repository with no commits). Try this example:\n$ mkdir temp\n$ cd temp\n$ git init\n$ echo \"first line\" > test.txt\n$ git status\n# On branch master\n# Untracked files:\n# (use \"git add <file>...\" to include in what will be committed)\n#\n# test.txt\nnothing added to commit but untracked files present (use \"git add\" to track)\n\nLet's see a diff of test.txt:\n$ git diff\n\nThis doesn't give any output!\nI would expect to see a diff like + first line, but instead I get nothing. It doesn't tell me what's going on. People on Stack Overflow tell me to git add some files so I do:\n$ git add .\n$ git diff\n\nStill nothing!\nGit GUI shows the changes.\ngit status -v shows the changes.\nBut for some reason git diff doesn't show anything.\nSo my questions are:\n\nHow, in plain English, does git diff work?\nHow can I show a diff of all the changes I've made (unstaged and staged)?\n\nSome people at my company are using Git, but the SVN crowd are going to point at this as a case of where Git is too confusing to be usable."
},
{
"role": "assistant",
"content": "Why do you get no git diff output before adding?\nGit does not treat files in the filesystem as automatically included in the version control system. You have to add things explicitly into the Git repository (as you are doing by adding the current directory with git add .).\nThere is no output to git diff because Git doesn't see any changes inside your repository, only files outside the repository, which it considers 'untracked' and so ignores when generating a diff.\nI found this one of the key differences to version control systems like SVN (along with staging and ignoring directories).\nIf you want the untracked files to be included, git add them.\nIf you don't want them in your repository, add them to your .gitignore (see git ignore --help). This is good for C object files or Python .pyc files.\nWhy don't I get git diff output after adding?!\nSo this is slightly different. If you do git status you will see the file is now in the staging area. This is the area for files that you are about to commit.\nWhen you git add a new file into the Git repository, it skips the working copy and goes straight into the staging area. This make sense in a way, and git add always moves files into staging area whether it is tracked or untracked.\nTo see the differences between the last check in and the staging area do git diff --cached.\nTo see the differences between the staging area and your working copy, do git diff. If there is nothing in the staging area then this is the same as doing a diff between the last check in and your working copy."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Change connected commit on release github\n\nHow you I change the connected commit on a github release?\n\nI want to change it to an earlier commit, because I created the release afterwards (after some commits to release 0.9)"
},
{
"role": "assistant",
"content": "When you consider the GitHub API for creating a release, you see a release needs:\n\na tag\na commit referenced by that tag\n\nSo you need to move your tag (locally first, then push it to your GitHub repo)\ngit tag -f -a <tagname> [<commit> | <object>]\n# or, to avoid an editor\ngit tag -m \"tag message\" -f -a <tagname> [<commit> | <object>]\n\ngit push -f <remotename> refs/tags/<tagname>\n\nfor Example:\ngit tag -m \"moving tag to new commit\" -f -a my_tag [commit hash]\ngit push -f origin refs/tags/my_tag\n\nThen see if that is enough for the release to be updated.\n(See \"How do you push a tag to a remote repository using Git?\")\nIf not, you might have to delete that release, and recreate it on the same tag (which will refer to the new commit)\n\nAfter doing this, if you get an error would clobber existing tag, then you need to sync local tags with remote using git fetch --tags -f and the push new commits."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Where should I place my global 'gitattributes' file?\nI gather there is (despite the lack of documentation) a way to set Git attributes globally; but I'm not clear where to place the necessary gitattributes file. The instructions say they belong in\n$(prefix)/etc/gitattributes\n\nBut where is $(prefix)? In particular, where would it be for OS X (with Git in /usr/local/git/bin/git)? Alternately (or in addition) would ~/.gitattributes work?"
},
{
"role": "assistant",
"content": "Global vs. system-wide settings\nThere is some ambiguity in your question's terminology.\nIn a Git context, \"global\" usually means \"user-level\"; in other words, a global setting affect all repositories for one specific user (the active one). In contrast, a system-wide setting affects all repositories for all users of a machine.\nRepository-level gitattributes\n(I'm only mentioning this for completeness.)\nAccording to the relevant section of the Pro Git book,\n\nIf you wish to affect only a single repository (i.e., to assign attributes to files that are particular to one user’s workflow for that repository), then attributes should be placed in the $GIT_DIR/info/attributes file. \n\n$GIT_DIR would typically expand to <path-to-repo-root-directory>/.git.\nGlobal (user-level) gitattributes\nAccording to the relevant section of the Pro Git book,\n\nAttributes that should affect all repositories for a single user should be placed in a file specified by the core.attributesfile configuration option [...]. Its default value is $XDG_CONFIG_HOME/git/attributes. If $XDG_CONFIG_HOME is either not set or empty, $HOME/.config/git/attributes is used instead. \n\nYou can also run the following command,\ngit config --global core.attributesfile <path>\n\nto point Git to a custom path <path> for your global gitattributes file, e.g. ~/.gitattributes.\nSystem-wide gitattributes\nAccording to the relevant section of the Pro Git book,\n\nAttributes for all users on a system should be placed in the $(prefix)/etc/gitattributes file.\n\nwhich naturally begs the question:\n\n[...] But where is $(prefix)?\n\nSee What is $(prefix) on $(prefix)/etc/gitconfig? for an answer. Unless you've assigned prefix a custom, non-empty value, $(prefix) expands to nothing by default; therefore, your system-wide gitattributes file should reside in /etc/."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Git Submodule - Permission Denied\nI am not able to clone the submodule existing within my private git repository. I do have access to entire repository, \nHave used the below commands but dint work, please help. What is the right way to clone the submodules in an existing repository? \ndjrecker$ git submodule update --init --recursive\nSubmodule 'Path' ([email protected]:Path) registered for path 'App'\nCloning into 'Path'...\nPermission denied (publickey).\nfatal: Could not read from remote repository."
},
{
"role": "assistant",
"content": "I was facing the same issue. The problem was on your github repo , you might be using some old ssh key. \nYou need to update the current ssh key.\nSteps involved are:\n\n1. vim ~/.ssh/id_rsa.pub\n2. copy the ssh key\n3. Go to the github settings\n4. Select the option ssh keys\n5. Remove the old ssh keys not used anymore.\n6. Add a new ssh key.\n7. Try running the \"git submodule update --recursive\"\n\nThis worked for me !!"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-push - Update remote refs along with associated objects -4 --ipv4"
},
{
"role": "assistant",
"content": "Use IPv4 addresses only, ignoring IPv6 addresses."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Exception in integrating gitlab with jenkins\n\nI have a project created and configured on private Gitlab v9.0 instance. I have imported this project on Jenkins v2.46.1, the connection with gitlab is successful. Afterwards, I tried to configure build trigger on push event from repo in gitlab. I have generated secret token for it on jenkins and added a webhook with Gitlab CI URL and secret token when I tried to test the webhook it returned me below exception\n\n\nHook executed successfully but returned HTTP 403 <html> <head> <meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"/> <title>Error 403 anonymous is missing the Job/Build permission</title> </head> <body><h2>HTTP ERROR 403</h2> <p>Problem accessing /project/tapp-builder-service. Reason: <pre> anonymous is missing the Job/Build permission</pre></p><hr><i><small>Powered by Jetty://</small></i><hr/> </body> </html>\n\n\n\nCan anyone please help me solving this?"
},
{
"role": "assistant",
"content": "You can either add a special user in Jenkins for this and configure the Webhook in GitLab accordingly or you can uncheck the checkbox \"Enable authentication for '/project' end-point\" in the GitLab section of the global Jenkins configuration. But this should be unchecked by default."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Git Submodule - Permission Denied\n\nI am not able to clone the submodule existing within my private git repository. I do have access to entire repository, \nHave used the below commands but dint work, please help. What is the right way to clone the submodules in an existing repository? \ndjrecker$ git submodule update --init --recursive\nSubmodule 'Path' ([email protected]:Path) registered for path 'App'\nCloning into 'Path'...\nPermission denied (publickey).\nfatal: Could not read from remote repository."
},
{
"role": "assistant",
"content": "I was facing the same issue. The problem was on your github repo , you might be using some old ssh key. \nYou need to update the current ssh key.\nSteps involved are:\n\n1. vim ~/.ssh/id_rsa.pub\n2. copy the ssh key\n3. Go to the github settings\n4. Select the option ssh keys\n5. Remove the old ssh keys not used anymore.\n6. Add a new ssh key.\n7. Try running the \"git submodule update --recursive\"\n\nThis worked for me !!"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-tag - Create, list, delete or verify a tag object signed with GPG --column[=<options>] --no-column"
},
{
"role": "assistant",
"content": "Display tag listing in columns. See configuration variable column.tag for option syntax. --column and --no-column without options are equivalent to always and never respectively. This option is only applicable when listing tags without annotation lines."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-rev-list - Lists commit objects in reverse chronological order --merges"
},
{
"role": "assistant",
"content": "Print only merge commits. This is exactly the same as --min-parents=2 ."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to attach file to a GitHub issue?\n\nI migrated with a project from Bitbucket to GitHub and I cannot find a way to attach a file to an issue (ex: screenshot, specs, etc).\nHow to do it?"
},
{
"role": "assistant",
"content": "You upload it somewhere and add the link in a comment. GitHub's Issues is rather primitive and doesn't allow attaching files.\nUpdate: You can post images to GitHub issues now. The easiest way is to copy the image (right click, Copy image) and then paste it into the text box where you describe the issue.\nOR\nJust drag and drop"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-config - Get and set repository or global options clean.requireForce"
},
{
"role": "assistant",
"content": "A boolean to make git-clean refuse to delete files unless -f\nis given. Defaults to true."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to delete remote branch (e.g. Github) from command line? [duplicate]\nThis question already has answers here:\n \n \n\n\n\n\nHow do I delete a Git branch locally and remotely?\n\n (41 answers)\n \n\nClosed 6 years ago.\n\n\n\nI have a git repository in my local machine:\nI add a new branch called test and add a few commits\nThen I checkout to master branch and add commits to it.\nSo I use git push --all github and continue working on master.\nAfter some time I decide to completely remove the test branch and use: git branch -d test and git branch -r -d github/test, but it only deletes the local branch used for tracking the actual test branch as git says:\nDeleted remote-tracking branch github/buggy (was acc5a58).\nI'm asking if there's a way to actually remove the test branch from github servers from command-line?"
},
{
"role": "assistant",
"content": "Local Branch\ngit branch -D local_branch\n\nRemote Branch\ngit push origin --delete remote_branch"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "gitattributes - Defining attributes per path String"
},
{
"role": "assistant",
"content": "3-way merge is performed using the specified custom\nmerge driver. The built-in 3-way merge driver can be\nexplicitly specified by asking for \"text\" driver; the\nbuilt-in \"take the current branch\" driver can be\nrequested with \"binary\"."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-show - Show various types of objects"
},
{
"role": "assistant",
"content": "Generating patch text with -p Running git-diff , git-log , git-show , git-diff-index , git-diff-tree , or git-diff-files with the -p option produces patch text.\nYou can customize the creation of patch text via the GIT_EXTERNAL_DIFF and the GIT_DIFF_OPTS environment variables\n(see git ), and the diff attribute (see gitattributes ). What the -p option produces is slightly different from the traditional\ndiff format: It is preceded by a \"git diff\" header that looks like this: diff --git a/file1 b/file2 The a/ and b/ filenames are the same unless rename/copy is\ninvolved. Especially, even for a creation or a deletion, /dev/null is not used in place of the a/ or b/ filenames. When a rename/copy is involved, file1 and file2 show the\nname of the source file of the rename/copy and the name of\nthe file that the rename/copy produces, respectively. It is followed by one or more extended header lines: old mode <mode>\nnew mode <mode>\ndeleted file mode <mode>\nnew file mode <mode>\ncopy from <path>\ncopy to <path>\nrename from <path>\nrename to <path>\nsimilarity index <number>\ndissimilarity index <number>\nindex <hash>..<hash> <mode> File modes are printed as 6-digit octal numbers including the file type\nand file permission bits. Path names in extended headers do not include the a/ and b/ prefixes. The similarity index is the percentage of unchanged lines, and\nthe dissimilarity index is the percentage of changed lines. It\nis a rounded down integer, followed by a percent sign. The\nsimilarity index value of 100% is thus reserved for two equal\nfiles, while 100% dissimilarity means that no line from the old\nfile made it into the new one. The index line includes the blob object names before and after the change.\nThe <mode> is included if the file mode does not change; otherwise,\nseparate lines indicate the old and the new mode. Pathnames with \"unusual\" characters are quoted as explained for\nthe configuration variable core.quotePath (see git-config ). All the file1 files in the output refer to files before the\ncommit, and all the file2 files refer to files after the commit.\nIt is incorrect to apply each change to each file sequentially. For\nexample, this patch will swap a and b: diff --git a/a b/b\nrename from a\nrename to b\ndiff --git a/b b/a\nrename from b\nrename to a Hunk headers mention the name of the function to which the hunk\napplies. See \"Defining a custom hunk-header\" in gitattributes for details of how to tailor this to\nspecific languages."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git - the stupid content tracker -h --help"
},
{
"role": "assistant",
"content": "Prints the synopsis and a list of the most commonly used\ncommands. If the option --all or -a is given then all\navailable commands are printed. If a Git command is named this\noption will bring up the manual page for that command. Other options are available to control how the manual page is\ndisplayed. See git-help for more information,\nbecause git --help ... is converted internally into git\nhelp ... ."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-fsck - Verifies the connectivity and validity of the objects in the database gitmodulesSymlink"
},
{
"role": "assistant",
"content": "(ERROR) .gitmodules is a symlink."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git diff between cloned and original remote repository\n\nI have cloned a github repository and made no changes locally. Github repository moved forward with commits on the same branch.\n\nHow do I find a diff between my local repository and the original github repository?\nHow do I find a diff between my working copy and the original github repository?\nHow do I find a diff between my local repository and another github repository of the same project?"
},
{
"role": "assistant",
"content": "1) Add any remote repositories you want to compare:\ngit remote add foobar git://github.com/user/foobar.git\n\n2) Update your local copy of a remote:\ngit fetch foobar\n\nFetch won't change your working copy.\n3) Compare any branch from your local repository to any remote you've added:\ngit diff master foobar/master"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Escape pound or number sign in Github issue tracker\n\nIf I type #1 when creating an Issue in Github, it will reference to Issue ID 1. Is there a way to avoid this by escaping the # sign? I just need it to be regular text."
},
{
"role": "assistant",
"content": "short answer\nchoose from this list:\n#⁠1 ⯇ # — <invisible character> — 1\n<span>#</span>1\n<i>#</i>1 ⯇ the number sign will be italic\n\\# 1\n#1 ⯇ you need to copy-paste this!\n # — <invisible character> — 1\n even works for commit messages.\n\nmore generic answer\nThese are the options you have:\n\nOption A: put any non-numeric ([0-9]+) UTF-8 character between # and the number\n\n\nusing the character itself (e.g. # 1) — this will even work in commit messages\nusing an HTML entity (e.g. # 1) — useful for characters not on your keyboard\n\nOption B: use formatting on either # or the number\n\n\nusing Markdown (e.g. #*1*)\nusing HTML tag (e.g. #<i>1</i>)\nNOTE that not all formatting variants, especially the Markdown ones, do always work!\n\n\n\nlong answer\n1 use a space character\nYou can put any kind of space character between # and the number.\n1.a word joiner — U+2060\nThis is the most unobtrusive solution:\n\n#⁠1 ⇒ #1\n\nIn this case the space character is written as ⁠, that's the numeric character reference for the WORD JOINER unicode character [3].\nThe word joiner (WJ) is a zero width non-breaking space; that is, it's not visible (zero width) [4] and prevents # and the number from being separated by an automatic line break (non-breaking) [5].\n1.b regular space — U+0020 / no-break space — U+00A0\nOf course you can use a \"normal\" space, which is faster to type than ⁠:\n\n\\# 1 ⇒ # 1\n\nThe backslash before the hash sign (\\#) prevents the line from becoming a heading in case \\# 1 is at the beginning of the line.\nThe \\# 1 solution uses a breaking space. To use a non-breaking space, type instead: # 1 (no backslash needed).\n1.c hint for advanced keyboard users\nIf you're using an ”advanced“ keyboard layout such as Colemak or Neo (german), you can use it to type special spaces — non-breaking spaces (NBSP) and narrow non-breaking spaces (NNBSP).\n\n\\# 1 ⇒ # 1 (NBSP)\n\\# 1 ⇒ # 1 (NNBSP)\n\n\n2 use formatting\nBesides the solution of putting an extra character between # and the number, you can use markdown or HTML formatting. Below I'm providing some examples. Some solutions are striked out because they do not work (anymore).\nPlease note that the functionality could change at any time in case GitHub changes its code.\n\nusing <span> (as stated by Sam Harwell)\n\n\n<span>#</span>1 ⇒ #1\n\nusing italic font:\n\n\n*#*1 ⇒ #1\n<i>#</i>1 ⇒ #1\n#*1* ⇒ #1\n#<i>1</i> ⇒ #1\n\nusing strong font:\n\n\n**#**1 ⇒ #1\n<b>#</b>1 ⇒ #1\n#**1** ⇒ #1\n#<b>1</b> ⇒ #1\n\nusing single backticks:\n\n\n`#1` ⇒ #1\n`#`1 ⇒ #1\n#`1` ⇒ #1"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git - the stupid content tracker GIT_REFLOG_ACTION"
},
{
"role": "assistant",
"content": "When a ref is updated, reflog entries are created to keep\ntrack of the reason why the ref was updated (which is\ntypically the name of the high-level command that updated\nthe ref), in addition to the old and new values of the ref.\nA scripted Porcelain command can use set_reflog_action\nhelper function in git-sh-setup to set its name to this\nvariable when it is invoked as the top level command by the\nend user, to be recorded in the body of the reflog."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git - the stupid content tracker git-cvsexportcommit"
},
{
"role": "assistant",
"content": "Export a single commit to a CVS checkout"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git - the stupid content tracker gitformat-chunk"
},
{
"role": "assistant",
"content": "Chunk-based file formats"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-branch - List, create, or delete branches --no-contains [<commit>]"
},
{
"role": "assistant",
"content": "Only list branches which don’t contain the specified commit\n(HEAD if not specified). Implies --list ."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Can I use GitHub's 2-Factor Authentication with TortoiseGit?\nWe like TortoiseGit, and want to take advantage of GitHub's 2-Factor Authentication...but the two don't seem to want to work together."
},
{
"role": "assistant",
"content": "To compliment Cupcake's answer, use the Personal Access token feature within GitHub.com while using TortoiseGit:\n\nSet up 2-step auth.\nSet up a personal access token - taking note of the generated token (use the Copy to clipboard button next to the generated token).\nSet TortoiseGit to remember your password as detailed here.\nNow perform a pull operation on GitHub.com, enter your username, but instead of using your normal password, use the token that was generated in step #2.\nPerform another pull operation on GitHub.com to ensure the token is remembered."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-update-index - Register file contents in the working tree to the index --index-version <n>"
},
{
"role": "assistant",
"content": "Write the resulting index out in the named on-disk format version.\nSupported versions are 2, 3, and 4. The current default version is 2\nor 3, depending on whether extra features are used, such as git add -N . With --verbose , also report the version the index\nfile uses before and after this command. Version 4 performs a simple pathname compression that reduces index\nsize by 30%-50% on large repositories, which results in faster load\ntime. Git supports it since version 1.8.0, released in October 2012,\nand support for it was added to libgit2 in 2016 and to JGit in 2020.\nOlder versions of this manual page called it \"relatively young\", but\nit should be considered mature technology these days."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How do I tell Git to ignore everything except a subdirectory?\nI want to ignore all files in my repository except those that occur in the bin subdirectory. I tried adding the following to my .gitignore:\n*\n!bin/*\n\nThis does not have the desired effect, however: I created a new file inside of bin/, but doing git status still shows nothing to commit (working directory clean).\nAny suggestions?"
},
{
"role": "assistant",
"content": "This ignores root files & root directories, then un-ignores the root bin directory:\n/*\n/*/\n!/bin/\n\nThis way you get all of the bin directory, including subdirectories and their files."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-config - Get and set repository or global options column.tag"
},
{
"role": "assistant",
"content": "Specify whether to output tag listings in git tag in columns.\nSee column.ui for details."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Support for password authentication was removed on August 13, 2021 [duplicate]\n\nThis question already has answers here:\n \n \n\n\n\n\nMessage \"Support for password authentication was removed.\"\n\n (51 answers)\n \n\nClosed 10 months ago.\n\n\n\nOver a long period of time I am using tortoise git, today I am not able to use the tortoise git and getting the below error.\n\ngit.exe pull --progress -v --no-rebase \"origin\" remote: Support for\npassword authentication was removed on August 13, 2021. Please use a\npersonal access token instead. remote: Please see\nhttps://github.blog/2020-12-15-token-authentication-requirements-for-git-operations/\nfor more information.\n\nI am using the latest tortoise git version.\n\nI understand about the git latest change. But I want to use tortoise git. Someone, please help me out this issue."
},
{
"role": "assistant",
"content": "Github Has Revoked the support for password authentication on 13 Aug 2021 and giving the below mentioned response:\nSupport for password authentication was removed on August 13, 2021\n\nIn order to fix the issue follow the below steps:\n\nGoto settings of Github account\nFind and Select Developer Settings\nFind and Select Personal access tokens\nGenerate a new token\nFill in any note and select the access scopes\nonce done click on generate token\n\nUse the generated token in place of a password to communicate with GitHub."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-config - Get and set repository or global options sendemail.smtpEncryption"
},
{
"role": "assistant",
"content": "See git-send-email for description. Note that this\nsetting is not subject to the identity mechanism."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Making a Git push from a detached head\nI am on a detached head and made some changes. I want to push up these changed to this detached head with Git. I do not want my changes to go onto the develop branch and certainly not on the master branch. I am working on a file with another individual.\nExample branches\n develop\n master\n *(HEAD detached at origin/49792_testMocha)\n\nHow do I push into head without affecting develop or master?"
},
{
"role": "assistant",
"content": "If you are on a detached head and you want to push to your remote branch\ngit push origin HEAD:name-of-your-branch\n\notherwise you can create a new branch and push to it ( it will be created automatically )\ngit branch new-branch-name\ngit push -u origin new-branch-name"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Push local Git repo to new remote including all branches and tags\nI have a local Git repo that I would like to push to a new remote repo (brand new repo set up on Beanstalk, if that matters).\nMy local repo has a few branches and tags, and I would like to keep all of my history. \nIt looks like I basically just need to do a git push, but that only uploads the master branch. \nHow do I push everything so I get a full replica of my local repo on the remote?"
},
{
"role": "assistant",
"content": "To push all your branches, use either (replace REMOTE with the name of the remote, for example \"origin\"):\ngit push REMOTE '*:*'\ngit push REMOTE --all\n\nTo push all your tags:\ngit push REMOTE --tags\n\nFinally, I think you can do this all in one command with:\ngit push REMOTE --mirror\n\nHowever, in addition --mirror, will also push your remotes, so this might not be exactly what you want."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-checkout - Switch branches or restore working tree files git checkout --detach [<branch>] git checkout [--detach] <commit>"
},
{
"role": "assistant",
"content": "Prepare to work on top of <commit> , by detaching HEAD at it\n(see \"DETACHED HEAD\" section), and updating the index and the\nfiles in the working tree. Local modifications to the files\nin the working tree are kept, so that the resulting working\ntree will be the state recorded in the commit plus the local\nmodifications. When the <commit> argument is a branch name, the --detach option can\nbe used to detach HEAD at the tip of the branch ( git checkout\n<branch> would check out that branch without detaching HEAD ). Omitting <branch> detaches HEAD at the tip of the current branch."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-fsck - Verifies the connectivity and validity of the objects in the database GIT_OBJECT_DIRECTORY"
},
{
"role": "assistant",
"content": "used to specify the object database root (usually $GIT_DIR/objects)"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-submodule - Initialize, update or inspect submodules update [--init] [--remote] [-N|--no-fetch] [--[no-]recommend-shallow] [-f|--force] [--checkout|--rebase|--merge] [--reference <repository>] [--depth <depth>] [--recursive] [--jobs <n>] [--[no-]single-branch] [--filter <filter-spec>] [--] [<path>…]"
},
{
"role": "assistant",
"content": "Update the registered submodules to match what the superproject\nexpects by cloning missing submodules, fetching missing commits\nin submodules and updating the working tree of\nthe submodules. The \"updating\" can be done in several ways depending\non command line options and the value of submodule.<name>.update configuration variable. The command line option takes precedence over\nthe configuration variable. If neither is given, a checkout is performed.\n(note: what is in .gitmodules file is irrelevant at this point;\nsee git submodule init above for how .gitmodules is used).\nThe update procedures supported both from the command line as well as\nthrough the submodule.<name>.update configuration are: checkout the commit recorded in the superproject will be\nchecked out in the submodule on a detached HEAD. If --force is specified, the submodule will be checked out (using git checkout --force ), even if the commit specified\nin the index of the containing repository already matches the commit\nchecked out in the submodule. rebase the current branch of the submodule will be rebased\nonto the commit recorded in the superproject. merge the commit recorded in the superproject will be merged\ninto the current branch in the submodule. The following update procedures have additional limitations: custom command mechanism for running arbitrary commands with the\ncommit ID as an argument. Specifically, if the submodule.<name>.update configuration variable is set to !custom command , the object name of the commit recorded in the\nsuperproject for the submodule is appended to the custom command string and executed. Note that this mechanism is not supported in\nthe .gitmodules file or on the command line. none the submodule is not updated. This update procedure is not\nallowed on the command line. If the submodule is not yet initialized, and you just want to use the\nsetting as stored in .gitmodules , you can automatically initialize the\nsubmodule with the --init option. If --recursive is specified, this command will recurse into the\nregistered submodules, and update any nested submodules within. If --filter <filter-spec> is specified, the given partial clone filter will be\napplied to the submodule. See git-rev-list for details on filter\nspecifications."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-am - Apply a series of patches from a mailbox"
},
{
"role": "assistant",
"content": "NAME git-am - Apply a series of patches from a mailbox"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "IntelliJ and Git Branch Name\nI've recently moved from Eclipse to IntelliJ. A challenge as I'm a keyboard shortcut junkie, but that isn't what I'm here about. \nI miss having the git branch name shown in the package/project view. \nDoes anyone know of a way to configure IntelliJ to display what git branch the project is in, so I don't have to keep switching back to the terminal and checking.\nThanks."
},
{
"role": "assistant",
"content": "As of IntelliJ 11 the current Git branch is displayed in the bottom right corner of the status bar. Moreover, clicking on the branch name displays a nice popup with all available branches, and you can invoke some actions on them.\n\nTo enable status bar follow the below steps : \n View --> Appearance --> Status Bar [and click to enable/disable]"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git - the stupid content tracker git-restore"
},
{
"role": "assistant",
"content": "Restore working tree files"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-config - Get and set repository or global options stash.showStat"
},
{
"role": "assistant",
"content": "If this is set to true, the git stash show command without an\noption will show a diffstat of the stash entry. Defaults to true.\nSee the description of the show command in git-stash ."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How do I merge changes to a single file, rather than merging commits?\nI have two branches (A and B) and I want to merge a single file from branch A with a corresponding single file from Branch B."
},
{
"role": "assistant",
"content": "I came across the same problem. To be precise, I have two branches A and B with the same files but a different programming interface in some files. Now the methods of file f, which is independent of the interface differences in the two branches, were changed in branch B, but the change is important for both branches. Thus, I need to merge just file f of branch B into file f of branch A.\nA simple command already solved the problem for me if I assume that all changes are committed in both branches A and B:\ngit checkout A\n\ngit checkout --patch B f\n\nThe first command switches into branch A, into where I want to merge B's version of the file f. The second command patches the file f with f of HEAD of B. You may even accept/discard single parts of the patch. Instead of B you can specify any commit here, it does not have to be HEAD.\nCommunity edit: If the file f on B does not exist on A yet, then omit the --patch option. Otherwise, you'll get a \"No Change.\" message."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to compare two files not in repo using git\nI'd like to compare two css files which are not in any git repository. Is there such a functionality in git?"
},
{
"role": "assistant",
"content": "git's diff is more functional than the standard unix diff. I often want to do this and since this question ranks highly on google, I want this answer to show up.\nThis question: How to use git diff --color-words outside a Git repository?\nShows how to use git to diff files where at least one of them is not in the repository by using --no-index:\ngit diff --no-index file1.txt file2.txt\n\nIt doesn't matter which one is tracked by git and which is not - one or both can be untracked, eg:\n$ date > x\n$ sleep 2\n$ date > y\n$ git diff --color-words --no-index x y\ndiff --git a/x b/y\nindex 6b10c7c..70f036c 100644\n--- a/x\n+++ a/y\n@@ -1 + 1 @@\nWed Jun 10 10:57:45|10:57:47 EDT 2013\n\nThe color can't be shown here so I separated the changes with a pipe in the example."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Egit rejected non-fast-forward\n\nI am getting this message while pushing to github repository. Can you tell me step by step procedure to fix it? I pushed only once and it was successful. But, when I updated a project and tried to push my second commit, it shows \"master rejected non-fast-forward\" and does not allow me to push. Please explain the procedure."
},
{
"role": "assistant",
"content": "I had this same problem and I was able to fix it. afk5min was right, the problem is the branch that you pulled code from has since changed on the remote repository. Per the standard git practices(http://git-scm.com/book/en/Git-Basics-Working-with-Remotes), you need to (now) merge those changes at the remote repository into your local changes before you can commit. This makes sense, this forces you to take other's changes and merge them into your code, ensuring that your code continues to function with the other changes in place.\nAnyway, on to the steps.\n\nConfigure the 'fetch' to fetch the branch you originally pulled from.\nFetch the remote branch.\nMerge that remote branch onto your local branch.\nCommit the (merge) change in your local repo.\nPush the change to the remote repo.\n\nIn detail...\n\nIn eclipse, open the view 'Git Repositories'.\nEnsure you see your local repository and can see the remote repository as a subfolder. In my version, it's called Remotes, and then I can see the remote project within that.\nLook for the green arrow pointing to the left, this is the 'fetch' arrow. Right click and select 'Configure Fetch'.\nYou should see the URI, ensure that it points to the remote repository.\nLook in the ref mappings section of the pop-up. Mine was empty. This will indicate which remote references you want to fetch. Click 'Add'.\nType in the branch name you need to fetch from the remote repository. Mine was 'master' (btw, a dropdown here would be great!!, for now, you have to type it). Continue through the pop-up, eventually clicking 'Finish'.\nClick 'Save and Fetch'. This will fetch that remote reference.\nLook in the 'Branches' folder of your local repository. You should now see that remote branch in the remote folder. Again, I see 'master'.\nRight-Click on the local branch in the 'Local' folder of 'Branches', which is named 'master'. Select 'Merge', and then select the remote branch, which is named 'origin/master'.\nProcess through the merge.\nCommit any changes to your local repository.\nPush your changes to the remote repository.\nGo have a tasty beverage, congratulating yourself. Take the rest of the day off."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Have Git Select Local Version On Merge Conflict on a Specific File?\nSay I'm collaborating with someone via a git repository, and there is a particular file that I never want to accept any external changes to.\nIs there any way to set up my local repo to not complain about a conflicted merge every time I git pull? I'd like to always select my local version when merging this file."
},
{
"role": "assistant",
"content": "On the specific instance of a config file, I would agree with Ron's answer:\nthe config should be \"private\" to your workspace (hence \"ignored\", as in \"declared in a .gitignore file\").\nYou may have a config file template with tokenized values in it, and a script transforming that config.template file into a private (and ignored) config file.\n\nHowever, that specific remark does not answer what is a broader more general question, i.e. your question(!):\n\nHow do I tell git to always select my local version for conflicted merges on a specific file ? (for any file or group of files)\n\nThis kind of merge is a \"copy merge\", in which you will always copy 'ours' or 'theirs' version of a file whenever there is a conflict.\n\n(as Brian Vandenberg notes in the comments, 'ours' and 'theirs' are here used for a merge.\nThey are reversed for a rebase: see \"Why is the meaning of “ours” and “theirs” reversed with git-svn\", which uses a rebase, \"git rebase, keeping track of 'local' and 'remote'\")\n\nFor \"a file\" (a file in general, not speaking of a \"config\" file, since it is a bad example), you would achieve that with a custom script called through merges.\nGit will call that script because you will have to define a gitattributes value, which defines a custom merge driver.\nThe \"custom merge driver\" is, in this case, a very simple script that basically will keep unchanged the current version, hence allowing you to always select your local version.\nIE., As noted by Ciro Santilli:\necho 'path/to/file merge=ours' >> .gitattributes\ngit config --global merge.ours.driver true\n\n\nLet's test that in a simple scenario, with a msysgit 1.6.3 on Windows, in a mere DOS session:\ncd f:\\prog\\git\\test\nmkdir copyMerge\\dirWithConflicts\nmkdir copyMerge\\dirWithCopyMerge\ncd copyMerge\ngit init\nInitialized empty Git repository in F:/prog/git/test/copyMerge/.git/\n\nNow, let's make two files, which will both have conflicts, but which will be merged differently.\necho a > dirWithConflicts\\a.txt\necho b > dirWithCopyMerge\\b.txt\ngit add -A\ngit commit -m \"first commit with 2 directories and 2 files\"\n[master (root-commit) 0adaf8e] first commit with 2 directories and 2 files\n\nWe will introduce a \"conflict\" in the content of both those files in two different git branches:\ngit checkout -b myBranch\nSwitched to a new branch 'myBranch'\necho myLineForA >> dirWithConflicts\\a.txt\necho myLineForB >> dirWithCopyMerge\\b.txt\ngit add -A\ngit commit -m \"add modification in myBranch\"\n[myBranch 97eac61] add modification in myBranch\n\ngit checkout master\nSwitched to branch 'master'\ngit checkout -b hisBranch\nSwitched to a new branch 'hisBranch'\necho hisLineForA >> dirWithConflicts\\a.txt\necho hisLineForB >> dirWithCopyMerge\\b.txt\ngit add -A\ngit commit -m \"add modification in hisBranch\"\n[hisBranch 658c31c] add modification in hisBranch\n\nNow, let's try to merge \"hisBranch\" upon \"myBranch\", with:\n\nmanual resolution for conflicting merges\nexcept for dirWithCopyMerge\\b.txt where I always want to keep my version of b.txt.\n\nSince the merge occurs in 'MyBranch', we will switch back to it, and add the 'gitattributes' directives which will customize the merge behavior.\ngit checkout myBranch\nSwitched to branch 'myBranch'\necho b.txt merge=keepMine > dirWithCopyMerge\\.gitattributes\ngit config merge.keepMine.name \"always keep mine during merge\"\ngit config merge.keepMine.driver \"keepMine.sh %O %A %B\"\ngit add -A\ngit commit -m \"prepare myBranch with .gitattributes merge strategy\"\n[myBranch ec202aa] prepare myBranch with .gitattributes merge strategy\n\nWe have a .gitattributes file defined in the dirWithCopyMerge directory (defined only in the branch where the merge will occurs: myBranch), and we have a .git\\config file which now contains a merge driver.\n[merge \"keepMine\"]\n name = always keep mine during merge\n driver = keepMine.sh %O %A %B\n\nIf you do not yet define keepMine.sh, and launch the merge anyway, here is what you get.\ngit merge hisBranch\nsh: keepMine.sh: command not found\nfatal: Failed to execute internal merge\ngit st\n# On branch myBranch\n# Changed but not updated:\n# (use \"git add <file>...\" to update what will be committed)\n# (use \"git checkout -- <file>...\" to discard changes in working directory)\n#\n# modified: dirWithConflicts/a.txt\n#\nno changes added to commit (use \"git add\" and/or \"git commit -a\")\n\ntype dirWithConflicts\\a.txt\na\n<<<<<<< HEAD:dirWithConflicts/a.txt\nmyLineForA\n=======\nhisLineForA\n>>>>>>> hisBranch:dirWithConflicts/a.txt\n\nThat is fine:\n\na.txt is ready to be merged and has conflict in it\nb.txt is still untouched, since the merge driver is supposed to take care of it (due to the directive in the .gitattributes file in its directory).\n\nDefine a keepMine.sh anywhere in your %PATH% (or $PATH for our Unix friend. I do both of course: I have an Ubuntu session in a VirtualBox session)\nAs commented by lrkwz, and described in the \"Merge Strategies\" section of Customizing Git - Git Attributes, you can replace the shell script with the shell command true.\ngit config merge.keepMine.driver true\n\nBut in the general case, you can define a script file:\nkeepMine.sh\n# I want to keep MY version when there is a conflict\n# Nothing to do: %A (the second parameter) already contains my version\n# Just indicate the merge has been successfully \"resolved\" with the exit status\nexit 0\n\n(that was one simple merge driver ;) (Even simpler in that case, use true)\n(If you wanted to keep the other version, just add before the exit 0 line:\ncp -f $3 $2.\nThat's it. Your merge driver would always keep the version coming from the other branch, overriding any local change)\nNow, let's retry the merge from the beginning:\ngit reset --hard\nHEAD is now at ec202aa prepare myBranch with .gitattributes merge strategy\n\ngit merge hisBranch\nAuto-merging dirWithConflicts/a.txt\nCONFLICT (content): Merge conflict in dirWithConflicts/a.txt\nAuto-merging dirWithCopyMerge/b.txt\nAutomatic merge failed; fix conflicts and then commit the result.\n\nThe merge fails... only for a.txt.\nEdit a.txt and leave the line from 'hisBranch', then:\ngit add -A\ngit commit -m \"resolve a.txt by accepting hisBranch version\"\n[myBranch 77bc81f] resolve a.txt by accepting hisBranch version\n\nLet's check that b.txt has been preserved during this merge\ntype dirWithCopyMerge\\b.txt\nb\nmyLineForB\n\nThe last commit does represent the full merge:\ngit show -v 77bc81f5e\ncommit 77bc81f5ed585f90fc1ca5e2e1ddef24a6913a1d\nMerge: ec202aa 658c31c\ngit merge hisBranch\nAlready up-to-date.\n\n(The line beginning with Merge does prove that)\n\nConsider you can define, combine and/or overwrite merge driver, as Git will:\n\nexamine <dir>/.gitattributes (which is in the same directory as the path in question): will prevail upon the other .gitattributes in directories\nThen it examines .gitattributes (which is in the parent directory), and will only set directives if not already set\nFinally it examines $GIT_DIR/info/attributes. This file is used to override the in-tree settings. It will overwrite <dir>/.gitattributes directives.\n\nBy \"combining\", I mean \"aggregate\" multiple merge drivers.\nNick Green tries, in the comments, to actually combine merge drivers: see \"Merge pom's via python git driver\".\nHowever, as mentioned in his other question, it only works in case of conflicts (concurrent modification in both branches)."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-diff - Show changes between commits, commit and working tree, etc --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 .\nIt can be changed by the color.ui and color.diff configuration settings."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-update-index - Register file contents in the working tree to the index"
},
{
"role": "assistant",
"content": "FILE SYSTEM MONITOR This feature is intended to speed up git operations for repos that have\nlarge working directories. It enables git to work together with a file system monitor (see git-fsmonitor--daemon and the\n\"fsmonitor-watchman\" section of githooks ) that can\ninform it as to what files have been modified. This enables git to avoid\nhaving to lstat() every file to find modified files. When used in conjunction with the untracked cache, it can further improve\nperformance by avoiding the cost of scanning the entire working directory\nlooking for new files. If you want to enable (or disable) this feature, it is easier to use\nthe core.fsmonitor configuration variable (see git-config ) than using the --fsmonitor option to git\nupdate-index in each repository, especially if you want to do so\nacross all repositories you use, because you can set the configuration\nvariable in your $HOME/.gitconfig just once and have it affect all\nrepositories you touch. When the core.fsmonitor configuration variable is changed, the\nfile system monitor is added to or removed from the index the next time\na command reads the index. When --[no-]fsmonitor are used, the file\nsystem monitor is immediately added to or removed from the index."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Use git to manage home directory\nI'd like to create one single git repo in my Linux $HOME directory. In this repo - obviously - I could add everything under version control, but this wouldn't make any sense. I'd like to only add the files and folders that are relevant to me, like .vimrc, .vim, .bashrc, etc. (probably only hidden files and folders, but maybe not)\nI know I could leverage .gitignore to try and achieve such behavior but that would be painful and virtually un-maintainable. Instead, what I'd want to know is if there'd be any way to manually declare files and folders that I would want to manage, and only that."
},
{
"role": "assistant",
"content": ".gitignore\n# Ignore everything\n*\n\n# But not these files...\n!*.vimrc\n!*.vim\n!*.bashrc\n!.gitignore\n\n# etc...\n\nMy home directory is also on GitHub."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "sh: husky: command not found\nI've setup a node project with husky but when my collegue tries to run npm install on his Mac he gets the following error :\n[email protected] prepare\nhusky install\n\nsh: husky: command not found\nnpm ERR! code 127\nnpm ERR! path /Users/X/Desktop/Workspace/project\nnpm ERR! command failed\nnpm ERR! command sh -c husky install\n\nnpm ERR! A complete log of this run can be found in:\nnpm ERR! /Users/X/.npm/_logs/2021-04-12T13_07_25_842Z-debug.log\n\nThese are the relevant package.json parts:\n{\n \"scripts\": {\n \"prepare\": \"husky install\"\n },\n \"devDependencies\": {\n \"husky\": \"^5.2.0\",\n }\n}\n\nI thought this would be enough for husky to be installed when running npm install, but it's not. What am I missing?"
},
{
"role": "assistant",
"content": "If you are using nvm, you might want to create a file called .huskyrc in your home directory and add the following lines of code to it:\n~/.huskyrc\nexport NVM_DIR=\"$HOME/.nvm\"\n[ -s \"$NVM_DIR/nvm.sh\" ] && \\. \"$NVM_DIR/nvm.sh\""
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-rev-parse - Pick out and massage parameters --short[=<length>]"
},
{
"role": "assistant",
"content": "Same as --verify but shortens the object name to a unique\nprefix with at least length characters. The minimum length\nis 4, the default is the effective value of the core.abbrev configuration variable (see git-config )."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "What are some good ways to manage a changelog using Git? [closed]\n\nClosed. This question needs to be more focused. It is not currently accepting answers.\n \n \n\n\n\n\n\n\n\n\n\n\n\nWant to improve this question? Update the question so it focuses on one problem only by editing this post.\n\n\nClosed 3 years ago.\n\n\nThe community reviewed whether to reopen this question 4 months ago and left it closed:\n\nOriginal close reason(s) were not resolved\n\n\n\n\n\n\n Improve this question\n \n\n\n\nI've been using Git for a while now, and I recently started using it to tag my releases so that I could more easily keep track of changes and be able to see which version each of our clients is running (unfortunately the code currently mandates that each client have their own copy of the PHP site; I'm changing this, but it's slow-going).\nIn any case, we're starting to build some momentum, and I thought it would be really good to be able to show people what has changed since the last release. The problem is, I haven't been maintaining a changelog, because I don't have a good idea of how to go about it. For this particular time, I can run through the log and manually create one, but that will get tiring very quickly.\nI tried googling \"git changelog\" and \"git manage changelog\", but I didn't find anything that really talked about the workflow of code changes and how that coincides with the changelog. We're currently following Rein Henrichs' development workflow and I would love something that went along with that.\nIs there a standard approach that I am missing, or is this an area where everybody does their own thing?"
},
{
"role": "assistant",
"content": "This was in 2015, but for the sake of future searchers, it's now possible to generate gorgeous logs with:\ngit log --oneline --decorate\n\nOr, if you want it even prettier (with color for the terminal):\ngit log --oneline --decorate --color\n\nPiping that output to ChangeLog is what I currently use in all my projects, and it's simply amazing."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-diff - Show changes between commits, commit and working tree, etc -l<num>"
},
{
"role": "assistant",
"content": "The -M and -C options involve some preliminary steps that\ncan detect subsets of renames/copies cheaply, followed by an\nexhaustive fallback portion that compares all remaining\nunpaired destinations to all relevant sources. (For renames,\nonly remaining unpaired sources are relevant; for copies, all\noriginal sources are relevant.) For N sources and\ndestinations, this exhaustive check is O(N^2). This option\nprevents the exhaustive portion of rename/copy detection from\nrunning if the number of source/destination files involved\nexceeds the specified number. Defaults to diff.renameLimit.\nNote that a value of 0 is treated as unlimited."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Github: how to fork after cloning?\nI cloned a git repo to my local machine, played around with it a bit and found it cool.\nNow I would like to keep the result as I modified it in my own github space. How can I proceed?\nI suppose the regular way would have been to fork the repo on the first place to my space, clone it, modify and then push it to GitHub, but now I cloned the original's author repo, how can I commit that as a new thing in my personnal?"
},
{
"role": "assistant",
"content": "First rename the old remote as upstream, in case you want to be able to keep in sync with the original repository.\ngit remote rename origin upstream\n\nThen add your forked repository as origin:\ngit remote add origin https://github.com/<your-username>/<your-project>\n\nOr if you're using ssh:\ngit remote add origin [email protected]:<your-username>/<your-project>.git\n\nTo push to your repository:\ngit push -u origin master\n\nTo pull from the base repository:\ngit pull upstream\n\nI recommend you do all of your work in a separate branch, not the master branch. It will be easier to rebase to the upstream/master branch in case you want to make a pull request.\nYou don't really have to rename the origin to upstream - the remote names can be arbitrary, however I recommended you to do so to keep up with the naming convention used by GitHub."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "gitlab ci cache/keep golang packages between stages\n\nI use gitlab-ci to test, compile and deploy a small golang application but the problem is that the stages take longer than necessary because they have to fetch all of the dependencies every time.\nHow can I keep the golang dependencies between two stages (test and build)?\nThis is part of my current gitlab-ci config:\ntest:\n stage: test\n script:\n # get dependencies\n - go get github.com/foobar/...\n - go get github.com/foobar2/...\n # ...\n - go tool vet -composites=false -shadow=true *.go\n - go test -race $(go list ./... | grep -v /vendor/)\n\ncompile:\n stage: build\n script:\n # getting the same dependencies again\n - go get github.com/foobar/...\n - go get github.com/foobar2/...\n # ...\n - go build -race -ldflags \"-extldflags '-static'\" -o foobar\n artifacts:\n paths:\n - foobar"
},
{
"role": "assistant",
"content": "As mentioned by Yan Foto, you can only use paths that are within the project workspace. But you can move the $GOPATH to be inside your project, as suggested by extrawurst blog.\ntest:\n image: golang:1.11\n cache:\n paths:\n - .cache\n script:\n - mkdir -p .cache\n - export GOPATH=\"$CI_PROJECT_DIR/.cache\"\n - make test"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-config - Get and set repository or global options submodule.<name>.update"
},
{
"role": "assistant",
"content": "The method by which a submodule is updated by git submodule update ,\nwhich is the only affected command, others such as git checkout --recurse-submodules are unaffected. It exists for\nhistorical reasons, when git submodule was the only command to\ninteract with submodules; settings like submodule.active and pull.rebase are more specific. It is populated by git submodule init from the gitmodules file.\nSee description of update command in git-submodule ."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to get a fresh copy of a branch from the remote repository?\nMy friend's local master branch is apparently a disaster (through accidental merges and commits, I guess). However, his dev branches are fine but contain changes he's not ready to push to remote.\nWhat's the best way of overriding his local master branch with the remote master branch and get a fresh copy (without overriding his other branches)?"
},
{
"role": "assistant",
"content": "As Jefromi commented, \ngit checkout master\ngit reset --hard origin/master\n\ndoes the right thing: setting the master to its origin state. (If you are already on the master branch, you can omit the first command.) It also leaves the branch's reflog intact.\n\nOld inferior answer:\ngit checkout dev\ngit branch -D master\ngit checkout master\n\nThis switches to another branch (\"dev\" in this case – choose any other branch you might have), deletes the local master branch, and then recreates it from remotes/origin/master (which might not work depending on your settings and Git version). The last command is often equivalent to\ngit checkout -b master remotes/origin/master\n\nCompared to the new answer above this has the disadvantage that the reflog is destroyed and recreated (i.e. you can't as easy undo this if needed), and it is less clear what happens here. Also, you need to have another branch existing to which you can switch during deletion and recreation (but that was the case in the original question)."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Checkout branch on different remote\nI have a repo that has another remote upstream besides origin. I can do git checkout origin/master, but when I run git checkout upstream/master, I get:\nerror: pathspec 'upstream/master' did not match any file(s) known to git.\n\nThis does not work either:\n$ git fetch upstream\nFrom https://github.com/getsentry/sentry\n * branch HEAD -> FETCH_HEAD\n$ git co -b asdf --track upstream/master\nfatal: Cannot update paths and switch to branch 'asdf' at the same time.\nDid you intend to checkout 'upstream/master' which can not be resolved as commit?\n\nHow to check out branches on upstream remote as I do on origin remote? My git version is 2.1.2."
},
{
"role": "assistant",
"content": "Just fetch the refs from the remote (this will fetch all branch, commit, refs etc for the upstream repo)\ngit fetch upstream\n\nAfter this, checkout the needed branch (this creates a local copy of the branch)\ngit checkout -b <branchname> --track upstream/<branchname>\n\nNow if you want to pull the changes in this branch in future, all you need to do is \ngit pull upstream <branchname>\n\n\nAs mentioned here, try doing an explicit fetch on the branch name:\ngit fetch upstream master:branch_name"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-log - Show commit logs %b"
},
{
"role": "assistant",
"content": "body"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Git, How to reset origin/master to a commit?\nI reset my local master to a commit by this command:\ngit reset --hard e3f1e37\n\nwhen I enter $ git status command, terminal says:\n# On branch master\n# Your branch is behind 'origin/master' by 7 commits, and can be fast-forwarded.\n\n# (use \"git pull\" to update your local branch)\n#\nnothing to commit, working directory clean\n\nSince I want to reset origin/header as well, I checkout to origin/master:\n$ git checkout origin/master\nNote: checking out 'origin/master'.\n\nYou are in 'detached HEAD' state. You can look around, make experimental\nchanges and commit them, and you can discard any commits you make in this\nstate without impacting any branches by performing another checkout.\n\nIf you want to create a new branch to retain commits you create, you may\ndo so (now or later) by using -b with the checkout command again. Example:\n\n git checkout -b new_branch_name\n\nHEAD is now at 2aef1de... master problem fixed for master. its okay now.\n\nand reset the header by this command:\n$ git reset --hard e3f1e37\nHEAD is now at e3f1e37 development version code incremented for new build.\n\nThen I tried to add commit to origin/header that I was not successful.\n$ git commit -m \"Reverting to the state of the project at e3f1e37\"\n# HEAD detached from origin/master\nnothing to commit, working directory clean\n\nFinally, I checkout to my local master.\n$ git checkout master\nSwitched to branch 'master'\nYour branch is behind 'origin/master' by 7 commits, and can be fast-forwarded.\n (use \"git pull\" to update your local branch)\n\nSince, I reset the head of origin/master I expect local and origin should be in same direction but as you see, git is saying that my local/master is behind origin/master by 7 commits.\nHow can I fix this issue? The things that I'm looking for is Head of local/master and origin/master point to same commit. Following image shows what I did. Thanks."
},
{
"role": "assistant",
"content": "origin/xxx branches are always pointer to a remote. You cannot check them out as they're not pointer to your local repository (you only checkout the commit. That's why you won't see the name written in the command line interface branch marker, only the commit hash).\nWhat you need to do to update the remote is to force push your local changes to master:\ngit checkout master\ngit reset --hard e3f1e37\ngit push --force origin master\n# Then to prove it (it won't print any diff)\ngit diff master..origin/master"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Sourcetree remote: Invalid username or password\nIm trying to push to github with sourcetree but get the following error:\n\ngit -c diff.mnemonicprefix=false -c core.quotepath=false push -v\n --tags origin live_version:live_version remote: Invalid username or password. fatal: Authentication failed for\n 'https://github.com/myname/myrepo/' Pushing to\n https://github.com/myname/myrepo\nCompleted with errors, see above.\n\n\nHowever when I go to \n\ntools > authentication > my github account\n\nAnd click edit > refresh oauth token\n\nA page opens and I get:\nAuthentication Successful\nSourceTree has been successfully authenticated. You may now close this page.\n\nIt always worked but it suddenly stopped, i do not have two factor authentication. \nI tried deleting the account and adding it again to no avail.\nHow can I get the connection working again so that I can push my project to github.\nSourcetree version 2.1.8.0"
},
{
"role": "assistant",
"content": "I found the answer here, it is a known bug for version 2.1.8+\nThe following steps fixed it for me:\nTools > Options > Git > Update Embedded Git\n\nAlso pushing with the command line works.\nEDIT\nAlso adding @Latisha's answer:\n1. Do the above.\n2. Close Sourcetree\n3. Delete AppData\\Local\\Atlassian\\SourceTree\\passwd \n4. Restart SourceTree"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-commit - Record changes to the repository whitespace"
},
{
"role": "assistant",
"content": "Same as strip except #commentary is not removed."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Remove file from latest commit\nHow do I remove a file from the latest commit?"
},
{
"role": "assistant",
"content": "I think other answers here are wrong, because this is a question of moving the mistakenly committed files back to the staging area from the previous commit, without cancelling the changes done to them. This can be done like Paritosh Singh suggested:\ngit reset --soft HEAD^ \n\nor\ngit reset --soft HEAD~1\n\nThen reset the unwanted files in order to leave them out from the commit (the old way):\ngit reset HEAD path/to/unwanted_file\n\nNote, that since Git 2.23.0 one can (the new way):\ngit restore --staged path/to/unwanted_file\n\nNow commit again, you can even re-use the same commit message:\ngit commit -c ORIG_HEAD \n\nEDIT: The easiest way to do this is to use e.g. git gui. Just select Commit => Amend Last Commit and simply uncheck the desired file from the commit and click Commit."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Confusing error message from git\n\nI got this message from Git:\n\nYou asked to pull from the remote 'origin', but did not specify\n a branch. Because this is not the default configured remote\n for your current branch, you must specify a branch on the command line.\n\nCan anyone explain it? and more important how to fix it?"
},
{
"role": "assistant",
"content": "You have to tell git which branch you want to pull from the \"origin\" remote repos.\nI guess you want the default branch (master) so git pull origin master should fix your problem.\nSee git help branch, git help pull and git help fetch for more informations."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-diff - Show changes between commits, commit and working tree, etc git diff [<options>] [--merge-base] <commit> [--] [<path>…]"
},
{
"role": "assistant",
"content": "This form is to view the changes you have in your\nworking tree relative to the named <commit>. You can\nuse HEAD to compare it with the latest commit, or a\nbranch name to compare with the tip of a different\nbranch. If --merge-base is given, instead of using <commit>, use the merge base\nof <commit> and HEAD. git diff --merge-base A is equivalent to git diff $(git merge-base A HEAD) ."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-gc - Cleanup unnecessary files and optimize the local repository"
},
{
"role": "assistant",
"content": "SYNOPSIS git gc [--aggressive] [--auto] [--quiet] [--prune=<date> | --no-prune] [--force] [--keep-largest-pack]"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-diff - Show changes between commits, commit and working tree, etc --minimal"
},
{
"role": "assistant",
"content": "Spend extra time to make sure the smallest possible\ndiff is produced."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "how to clone an old git-commit (and some more questions about git)\nI have a git-repository of my project with about 20 commits. I know how to clone the actual commit with git clone, \n\nbut how can I \"clone\" an old commit? \nis there a really good git-GUI (imho qgit is not a good GUI)? \nwhat exactly are \"branches\"?\nwhen I want to release 0.1, 0.2 and so on, what is the best way to mark these commits in git?\nwhat are the big differences to svn?"
},
{
"role": "assistant",
"content": "A git repository contains the all history at all time.\nSo when you are cloning a repository, you are cloning it with its full history, and then, you can make a branch from whatever commit you want:\n $ git checkout -b aNewBranch SHA1\n\nwith SHA1 representing the commit id from which you want to proceed.\n\nBranches in Git are just a way to keep track of one path of a DAG (Directed Acyclic Graph) which is the set of commits representing the history of a Git repository.\nIt is a mere pointer you assign to one of those commits, and it will keep moving along with each new commits.\n\nSee Pro Git book for more.\n\nYou can mark a specific commit with a tag, which, like a branch, is a mere pointer, but an immutable one (it wont move when you make new commit).\nYou will use preferably annotated tags, which are stored as full objects in the Git database. They’re checksummed; contain the tagger name, e-mail, and date; have a tagging message; and can be signed and verified with GNU Privacy Guard (GPG).\n\nThe \"Graphical Interfaces\" section of InterfacesFrontendsAndTools page on Git Wiki lists the various GUI for Git at the moment. \n\nYou will see many questions about the difference between Git and SVN: see my answer (or this one) for example.\nMy most complete answer about the fundamental differences between Git and SVN is here:\n\"which of the two is better:git or SVN\"."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to discard local commits in Git?\nI'd been working on something, and decided it was completely screwed...after having committed some of it. So I tried the following sequence:\ngit reset --hard\ngit rebase origin\ngit fetch\ngit pull\ngit checkout\n\nAt which point I got the message\nYour branch is ahead of 'origin/master' by 2 commits.\n\nI want to discard my local commits, without having to wipe out my local directory and redownload everything. How can I accomplish that?"
},
{
"role": "assistant",
"content": "git reset --hard origin/master\n\nwill remove all commits not in origin/master where origin is the repo name and master is the name of the branch."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to replace crlf with lf in a single file\nHow do I convert a single file that has crlf line returns to have lf line returns?\ngit is already correctly handling crlf to lf conversion automatically for files when I push them to a remote repository, but in this particular case I am not doing a push to a repository. Rather, I am uploading a file, using a file field on an HTML form, to a website that requires that the file have lf line returns. So I need to be able to convert this file individually.\nMy available potentially useful tools available on this computer would be git and Dreamweaver CC 2014.1. (I'm guessing Word, Wordpad and Notepad are not viable options but I'm open to being corrected.)\nI am on Windows 7 and using git line commands."
},
{
"role": "assistant",
"content": "The git installation on windows usually includes the dos2unix tool.\ndos2unix <file>\n\nBut in your case you should use .gitattributes to prevent the file from being converted on windows.\nA .gitattributes file can look like this\n*.vcproj eol=crlf\n*.sh eol=lf\n\nFrom the .gitattributes documentation\n\nSet to string value \"lf\"\nThis setting forces Git to normalize line endings to LF on checkin and prevents conversion to CRLF \n when the file is checked out.\n\nJust commit the .gitattributes file and your file will be checkout out on every system with LF line ending."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to find the number of files changed from one commit to another in git\nI am working on a git repository which contains huge number of files changed b/w one commit to another, how to extract the number of files changes b/w commits."
},
{
"role": "assistant",
"content": "EDIT: \"this will always count the files plus one, cause the --format=oneline includes the commit-hash/header\" as mentioned by c00kiemon5ter\n\nThe git whatchanged tool shows you a summary of files that were modified. By itself it lists all commits, but you can also limit it to just the recent n commits:\ngit whatchanged -1\n\nTo count files:\ngit whatchanged -1 --format=oneline | wc -l\n\nSee git help whatchanged for details."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "SVN:externals equivalent in Git?\nI have two SVN projects in use from another SVN repository using svn:externals. \nHow can I have the same repository layout structure in Git?"
},
{
"role": "assistant",
"content": "Git has two approaches similar to, but not exactly equivalent to svn:externals:\n\nSubtree merges insert the external project's code into a separate sub-directory within your repo. This has a detailed process to set up and then is very easy for other users, because it is automatically included when the repository is checked out or cloned. This can be a convenient way to include a dependency in your project.\nIt is easy to pull changes from the other project, but complicated to submit changes back. And if the other project have to merge from your code, the project histories get merged and the two projects effectively become one.\n\nGit submodules (manual) link to a particular commit in another project's repository, much like svn:externals with an -r argument. Submodules are easy to set up, but all users have to manage the submodules, which are not automatically included in checkouts (or clones).\nAlthough it is easy to submit changes back to the other project, doing so may cause problems if the repo has changed. Therefore it is generally not appropriate to submit changes back to a project that is under active development."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-rm - Remove files from the working tree and from the index --pathspec-file-nul"
},
{
"role": "assistant",
"content": "Only meaningful with --pathspec-from-file . Pathspec elements are\nseparated with NUL character and all other characters are taken\nliterally (including newlines and quotes)."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "\"git add\" using wildcard is not functioning as I hoped - must I cd into specific directories?\nWhen I try to do a basic git add *.erb (or any simple wildcard expressions) git is not recognizing it (them). As a side-note, I have never done this before so I'm sure it's a rookie mistake, but I've found no help in other SO posts or my school's alumni listserv so I thought this post may be appropriate.\nFor (a different) example, git status is giving me:\n# modified: config/routes.rb\n# modified: spec/models/question_spec.rb\n\nI wanted to only stage the routes file, so I tried git add *s.rb and no dice. I am in the root of the app...do I need to be in the directory that contains the file(s) I'm trying to apply the wildcard expression to? That would be painful, but...actually...it just worked.\nHope this doesn't have to be a separate post, but is there an easier way to use wildcards where you don't have to cd into the specific directory?"
},
{
"role": "assistant",
"content": "Put it around single quotes. This should work.\ngit add '*s.rb'\nUPDATE\nAfter more testing, I find out that I can even do git add *s.rb without quotes. This might just work for me with my git version 1.7.10.4 (Mac OSX Lion, homebrew). My explanation is that if shell wildcards expansion doesn't match any file, it'd supply the original unexpanded argument '*s.rb' to git add.\nsh-3.2$ git status\n#\n# modified: config/routes.rb\n# modified: spec/models/products_spec.rb\n#\n\nNow I do git add without quotes.\nsh-3.2$ git add *s.rb\n\nSurprisingly it works!\nsh-3.2$ git status\n# On branch master\n# Changes to be committed:\n# (use \"git reset HEAD <file>...\" to unstage)\n#\n# modified: config/routes.rb\n#\n# Changes not staged for commit:\n# (use \"git add <file>...\" to update what will be committed)\n# (use \"git checkout -- <file>...\" to discard changes in working directory)\n#\n# modified: spec/models/products_spec.rb\n#\n\nIf wildcard pattern doesn't match any file, git will give out this error.\nsh-3.2$ git add *x.rb\nfatal: pathspec '*x.rb' did not match any files"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-diff - Show changes between commits, commit and working tree, etc --name-only"
},
{
"role": "assistant",
"content": "Show only names of changed files. The file names are often encoded in UTF-8.\nFor more information see the discussion about encoding in the git-log manual page."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-diff-index - Compare a tree to the working tree or index --inter-hunk-context=<lines>"
},
{
"role": "assistant",
"content": "Show the context between diff hunks, up to the specified number\nof lines, thereby fusing hunks that are close to each other.\nDefaults to diff.interHunkContext or 0 if the config option\nis unset."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-diff-index - Compare a tree to the working tree or index --summary"
},
{
"role": "assistant",
"content": "Output a condensed summary of extended header information\nsuch as creations, renames and mode changes."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-config - Get and set repository or global options color.branch"
},
{
"role": "assistant",
"content": "A boolean to enable/disable color in the output of git-branch . May be set to always , false (or never ) or auto (or true ), in which case colors are used\nonly when the output is to a terminal. If unset, then the\nvalue of color.ui is used ( auto by default)."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git - the stupid content tracker giteveryday"
},
{
"role": "assistant",
"content": "A useful minimum set of commands for Everyday Git"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-am - Apply a series of patches from a mailbox stop"
},
{
"role": "assistant",
"content": "The command will fail, stopping in the middle of the current am session. This is the default behavior."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How can I see the differences between two branches?\nHow can I see the differences between branches branch_1 and branch_2?"
},
{
"role": "assistant",
"content": "Use git diff.\ngit diff [<options>] <commit>..<commit> [--] [<path>…]\n\n<commit> is a branch name, a commit hash, or a shorthand symbolic reference.\nExamples:\ngit diff abc123..def567\ngit diff HEAD..origin/master\nThat will produce the diff between the tips of the two branches. If you'd prefer to find the changes that occurred in the common ancestor since the branch was started off, you can use three dots instead of two:\ngit diff <commit>...<commit>\n\nTo check which files differ, not how the content differs, use --name-only:\ngit diff --name-only <commit>..<commit>\n\nNote that in the <commit>..<commit> (two dot) syntax, the dots are optional; the following is synonymous:\ngit diff commit1 commit2"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-config - Get and set repository or global options difftool.prompt"
},
{
"role": "assistant",
"content": "Prompt before each invocation of the diff tool."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Link to a specific (current) revision on GitHub\n\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-format-patch - Prepare patches for e-mail submission --inline[=<boundary>]"
},
{
"role": "assistant",
"content": "Create multipart/mixed attachment, the first part of\nwhich is the commit message and the patch itself in the\nsecond part, with Content-Disposition: inline ."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-show - Show various types of objects --no-color-moved"
},
{
"role": "assistant",
"content": "Turn off move detection. This can be used to override configuration\nsettings. It is the same as --color-moved=no ."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Unable to change source branch in GitHub Pages\n\nI have created a simple web site for GitHub Pages. The source of the site is in the \"master\" branch and the generated web site (what I want to see published) is under the \"gh-pages\" branch.\n\nI was expecting to be able to change the source of the site in the settings. However, the setting is grayed out? I cannot change it (see screenshot below). What am I doing wrong? How do I switch to the \"gh-pages\" branch?"
},
{
"role": "assistant",
"content": "Personal or organization sites are built from master. gh-pages branch is used to build sites for projects.\nAs far as I can see, you're using https://user-name.github.io/ url, this is a personal one, so that's why master branch is the default one.\nSee the documentation page\n\nIf your site is a User or Organization Page that has a repository named <username>.github.io or <orgname>.github.io, you cannot publish your site's source files from different locations. User and Organization Pages that have this type of repository name are only published from the master branch.\n\nSo the answer is No, you can not change it. You'll have to adjust your workflow and keep development in another branch (let's call it development) and merge to master when you're ready to publish.\nUPD: It's 2020 out there, so as of July 31st GitHub Pages allow you to configure any branch to act as an old master"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-remote - Manage set of tracked repositories"
},
{
"role": "assistant",
"content": "DISCUSSION The remote configuration is achieved using the remote.origin.url and remote.origin.fetch configuration variables. (See git-config )."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How can I configure Android studio to add new line at end of file?\nI use Android Studio and when I commit to a repo on GitHub and view git diff I see a red marker at end of line for few files with a warning 'No newline at end of file'. How can I configure Android Studio to ensure that it does add a newline at file of file for every file. Thank you."
},
{
"role": "assistant",
"content": "Yes, you can configure Android Studio to automatically add a new line at the end of a file.\nFile | Settings... menu, then Editor under IDE Settings, then check the Ensure line feed at file end on Save option box.\nThis will only take effect on freshly edited files after the setting has been enabled.\n\nUPDATE\nOn newer versions of Android Studio, the preference location has changed to\nFile > Preferences > Editor > General > Ensure line feed at file end on Save"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git refname 'origin/master' is ambiguous\nI have a git repository that is tracking several remote branches:\n$ git branch -a\n* master\n remotes/git-svn\n remotes/origin/master\n remotes/trunk\n\nWhen I try to setup a default one I get the following error:\n$ git branch --set-upstream-to=origin/master master\nwarning: refname 'origin/master' is ambiguous.\nfatal: Ambiguous object name: 'origin/master'.\n\nI would like to kremove some of the remote master branches but the master references are still there. How can I remove them to be able to set the default upstream branch to origin/master?\n$ git show-ref master\ncba97a58c99743c355b569bbf35636c8823c2d96 refs/heads/master\n6726b4985107e2ddc7539f95e1a6aba536d35bc6 refs/origin/master\nd83f025cd3800ed7acd76b2e52ae296e33f1cd07 refs/original/refs/heads/master\ncba97a58c99743c355b569bbf35636c8823c2d96 refs/remotes/origin/master"
},
{
"role": "assistant",
"content": "The output of git branch -a shows that you have a remote-tracking branch called origin/master. Perfectly normal.\nHowever, the output of git show-ref master contains\n6726b4985107e2ddc7539f95e1a6aba536d35bc6 refs/origin/master\n\nwhich indicates that you most likely ran something like the following low-level command:\ngit update-ref refs/origin/master master\n\nThis command creates a branch (pointing at the same commit as master) called origin/master, but living directly under refs/, i.e. outside the refs/heads/ namespace, where local branches normally live. Quite suspicious... Did you mean to do that?\nSuch a branch won't get listed by git branch -a. Git is getting confused, though, because it sees two branches whose refnames end with origin/master:\n\nrefs/remotes/origin/master, your remote-tracking branch, and\nrefs/origin/master, the local branch that you created (by accident) outside refs/heads/.\n\nSolution\nIf you did not mean to create refs/origin/master\nSimply delete it:\ngit update-ref -d refs/origin/master\n\nThen, there won't be any ambiguity, and Git will comply when you try to set master's upstream.\nIf you did mean to create refs/origin/master\nTo avoid ambiguity, simply specify the full refname of the branch you wish to set as master's upstream:\ngit branch --set-upstream-to=refs/remotes/origin/master master\n\n\nTo fix ideas, here is some code that reproduces the situation in one of my GitHub repos:\n$ cd ~/Desktop\n$ git clone https://github.com/Jubobs/gitdags && cd gitdags\n\n$ git update-ref refs/origin/master\n\n$ git branch -a\n* master\n remotes/origin/HEAD -> origin/master\n remotes/origin/master\n\n$ git show-ref master\n15b28ec22dfb072ff4369b35ef18df51bb55e900 refs/heads/master\n15b28ec22dfb072ff4369b35ef18df51bb55e900 refs/origin/master\n15b28ec22dfb072ff4369b35ef18df51bb55e900 refs/remotes/origin/HEAD\n15b28ec22dfb072ff4369b35ef18df51bb55e900 refs/remotes/origin/master\n\n$ git branch --set-upstream-to=origin/master master\nwarning: refname 'origin/master' is ambiguous.\nfatal: Ambiguous object name: 'origin/master'.\n\n$ git update-ref -d refs/origin/master\n$ git branch --set-upstream-to=origin/master master\nBranch master set up to track remote branch master from origin."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-log - Show commit logs 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": "git-rev-list - Lists commit objects in reverse chronological order --no-object-names"
},
{
"role": "assistant",
"content": "Only useful with --objects ; does not print the names of the object\nIDs that are found. This inverts --object-names . This flag allows\nthe output to be more easily parsed by commands such as git-cat-file ."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to get Git 1.8 in Cygwin? [closed]\nClosed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.\n \n \n\n\n\n\n\n\n\n\n\n\n\n \n\n\nClosed 9 years ago.\n\n\n\nThis question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.\nThis question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.\n\n\n\n\n\n\n Improve this question\n \n\n\n\nAccording to http://cygwin.com/packages/git/ the latest available Cygwin package is 1.7.9-1.\nI would like to update git to at least 1.8.0.\nCan I do this?"
},
{
"role": "assistant",
"content": "cygwinports has many new versions of various tools\nAt the time i write this it has 1.8.3.4\n\nNew, simplified installation instructions:\n\nUse the latest Cygwin installers (at least version 2.829): setup-x86.exe for 32-bit, or setup-x86_64.exe for 64-bit. (Note that\n many packages have not yet been ported to x86_64.)\nLaunch setup-*.exe with the -K flag, e.g.:\ncygstart -- /path/to/setup-x86.exe -K http://cygwinports.org/ports.gpg\nOn Choose Installation Type page, select \"Install from Internet\".\nOn Choose Download Site(s) page, select a distro mirror, then enter ftp://ftp.cygwinports.org/pub/cygwinports in the User URL field\n and press Add (making sure that both are highlighted).\n \n \nAlternatively, you can use a sourceware mirror, but if you do, you must use one hosted on a different server than your selected\n distro mirror.\n\nProceed with package selection and installation, making sure to install any indicated dependencies."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Automatic TOC in github-flavoured-markdown\n\nIs it possible to generate an automatic Table of Contents using Github Flavoured Markdown?"
},
{
"role": "assistant",
"content": "I created two options to generate a toc for github-flavored-markdown:\nDocToc Command Line Tool (source) requires node.js\nInstallation:\nnpm install -g doctoc\nUsage:\ndoctoc . to add table of contents to all markdown files in the current and all sub directories.\nDocToc WebApp\nIf you want to try it online first, go to the doctoc site,\npaste the link of the markdown page and it will generate a table of\ncontent that you can insert at the top of your markdown file.\nGithub Wikis and Anchors\nAs Matthew Flaschen pointed out in the comments below, for its wiki pages GitHub previously didn't generate the anchors that doctoc depends on.\nUPDATE: However, they fixed this issue."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-clone - Clone a repository into a new directory -o <name> --origin <name>"
},
{
"role": "assistant",
"content": "Instead of using the remote name origin to keep track of the upstream\nrepository, use <name> . Overrides clone.defaultRemoteName from the\nconfig."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Why is my Git pre-commit hook not executable by default?\nIf you see the accepted answer in:\nAggregating and uglifying JavaScript in a Git pre-commit hook, you'll see that I had to do a chmod +x on my pre-commit hook to get it to work.\nWhy is this not executable by Git by default?"
},
{
"role": "assistant",
"content": "My context - web development Node.js. I needed to add husky functionality, but got an error, probably to the disk access. This helped in my situation:\nchmod ug+x .husky/*\nchmod ug+x .git/hooks/*"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "GitHub: Permission denied (publickey). fatal: Could not read from remote repository\n\nI´m having trouble with GitHub. I´ve playing around with a remote repository of Git.\nWhen I now try to make any changes to the remote directory, i.e.\ngit remote show origin\n\nor\ngit push -u origin master\n\nI get this error\n\nPermission denied (publickey).\nfatal: Could not read from remote repository.\n\n\nPlease make sure you have the correct access rights\nand the repository exists.\nUlrichs-MacBook-Pro:coredatatest ulrichheinelt$ git push -u origin master\nPermission denied (publickey).\nfatal: Could not read from remote repository.\n\nI would be happy, when I could start again with a new (empty) remote directory. Or is there a way, to fix this error?\nThis are my first steps with GitHub, started yesterday...\nEdit 1\nmy settings at https://github.com/UlliH/CoreDataTest/settings\n...\nEdit 2\ntoo early happy :-(\nAfter setting the SSH and GPG keys, the errors are still the same. :-/\nEdit 3\nI think that's right so, but still the same..."
},
{
"role": "assistant",
"content": "Generate SSH key using ssh-keygen -t rsa -b 4096 -C \"your email\".\nCopy the output of cat ~/.ssh/id_rsa.pub to your clipboard\nPaste the above-copied output to the form at https://github.com/settings/ssh/new\nThen go ahead to retry the operation that generated the initial fatal error.\n\nUpdate: If you are still facing \"ssh: connect to host github.com port 22: Connection timed out\", then follow the below steps.\nCheck the connection, mostly it will time out\n$ ssh -T [email protected]\nssh: connect to host github.com port 22: Connection timed out\n\nCheck the same by providing optional param port\n$ ssh -T -p 443 [email protected]\nHi <user_name>! You've successfully authenticated, but GitHub does not provide shell access.\n\nUpdate the SSH settings\n$ vim ~/.ssh/config\n# Add github in the know hosts\nHost github.com\n Hostname ssh.github.com\n Port 443\n\nCheck the connection, mostly it will connect this time\n$ ssh -T [email protected]\nHi <user_name>! You've successfully authenticated, but GitHub does not\nprovide shell access."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "gitattributes - Defining attributes per path Unset"
},
{
"role": "assistant",
"content": "Take the version from the current branch as the\ntentative merge result, and declare that the merge has\nconflicts. This is suitable for binary files that do\nnot have a well-defined merge semantics."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Deploying to Heroku using git on bitbucket\nI want to host my source on bitbucket using git because I obviously get a free private repo and I want to host my app on heroku using the source code from bitbucket. \nCan i do it using the github client and heroku toolbelt. Will it work? Github is great but i dont want everyone seeing my code and I dont want to pay for a private repo because its a small project."
},
{
"role": "assistant",
"content": "Deploying to Heroku should work regardless of where you host your code as the Heroku CLI adds it's own git remote for the sake of deployments. In fact, you can even git pull from Heroku, so you could technically use Heroku as a private git repository instead (though not recommended). As for using the GitHub client to connect to bitbucket, simply change the repository remote to the URL provided by bitbucket in the settings tab of the client."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-config - Get and set repository or global options 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": "Configure IntelliJ IDEA such that source detected in git but Unregistered Vcs root detected\nUnregistered Vcs root detected\n The directory C:\\Users\\Andrew is under Git, but is not registered in the Settings.\n Configure Ignore VCS root errors\n\nWhy is this showing ?"
},
{
"role": "assistant",
"content": "This occurs because Android Studio has detected that you have git projects imported but they have not been \"registered\" to track their status in Android Studio. Your project will not be negatively affected if you choose not to configure this, IntelliJ only prompts you because it has some integrated version control features that will not be able to function. \nSo if you want to take advantage of ItelliJ's built in version control options or just get rid of an annoying warning, its an easy fix. \nJust register all of the projects you want to have the version control IDE integrations for in the Preferences > Version Control section. You should see this screen: \n\nThe UI is a little confusing, but all you need to do is select one of the directories under the Unregistered roots: section and then click the + button in the lower left corner of the window. If you have added all the directories you should see the Unregistered roots: disappear and you should no longer receive this warning. \nYou can select each directory and use the + and - buttons to determine which projects should use VCS in Android Studio"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "how do i create a merge request from a fork in gitlab\n\nI joined a project on which I've done some work. The work has now been validated and I need to create a merge request (back to master) from the changes I have pushed to my fork. But I don't understand how I can do this in gitlab...Can anybody help?"
},
{
"role": "assistant",
"content": "To create a merge request to merge branch from forked repo into the branch of the upstream repo, you can use below steps:\nIn the forked repo -> Merge Requests -> select the branch from forked repo as the source branch, and select branch from the upstream repo as target branch -> Compare branches -> Specify the user Assign to -> Submit merge request.\nMore details, you can refer the document Merging upstream."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-show - Show various types of objects --oneline"
},
{
"role": "assistant",
"content": "This is a shorthand for \"--pretty=oneline --abbrev-commit\"\nused together."
}
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.