messages
listlengths 3
3
|
---|
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How do I pull my project from github?\n\nI have a project on github that I have been working on before. However, I wiped out my computer and I am wondering which git command should I invoke under my username to checkout my project again so that I can push my latest changes to github under my account."
},
{
"role": "assistant",
"content": "Git clone is the command you're looking for:\ngit clone [email protected]:username/repo.git\n\nUpdate:\nAnd this is the official guide:\nhttps://help.github.com/articles/fork-a-repo\nTake a look at:\nhttps://help.github.com/\nIt has really useful content"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-log - Show commit logs --oneline"
},
{
"role": "assistant",
"content": "This is a shorthand for \"--pretty=oneline --abbrev-commit\"\nused together."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-cherry-pick - Apply the changes introduced by some existing commits -r"
},
{
"role": "assistant",
"content": "It used to be that the command defaulted to do -x described above, and -r was to disable it. Now the\ndefault is not to do -x so this option is a no-op."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-worktree - Manage multiple working trees"
},
{
"role": "assistant",
"content": "CONFIGURATION FILE By default, the repository config file is shared across all worktrees.\nIf the config variables core.bare or core.worktree are present in the\ncommon config file and extensions.worktreeConfig is disabled, then they\nwill be applied to the main worktree only. In order to have worktree-specific configuration, you can turn on the worktreeConfig extension, e.g.: $ git config extensions.worktreeConfig true In this mode, specific configuration stays in the path pointed by git\nrev-parse --git-path config.worktree . You can add or update\nconfiguration in this file with git config --worktree . Older Git\nversions will refuse to access repositories with this extension. Note that in this file, the exception for core.bare and core.worktree is gone. If they exist in $GIT_DIR/config , you must move\nthem to the config.worktree of the main worktree. You may also take this\nopportunity to review and move other configuration that you do not want to\nshare to all worktrees: core.worktree should never be shared. core.bare should not be shared if the value is core.bare=true . core.sparseCheckout should not be shared, unless you are sure you\nalways use sparse checkout for all worktrees. See the documentation of extensions.worktreeConfig in git-config for more details."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-diff - Show changes between commits, commit and working tree, etc --relative[=<path>] --no-relative"
},
{
"role": "assistant",
"content": "When run from a subdirectory of the project, it can be\ntold to exclude changes outside the directory and show\npathnames relative to it with this option. When you are\nnot in a subdirectory (e.g. in a bare repository), you\ncan name which subdirectory to make the output relative\nto by giving a <path> as an argument. --no-relative can be used to countermand both diff.relative config\noption and previous --relative ."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-shortlog - Summarize git log output Default mode"
},
{
"role": "assistant",
"content": "Simplifies the history to the simplest history explaining the\nfinal state of the tree. Simplest because it prunes some side\nbranches if the end result is the same (i.e. merging branches\nwith the same content)"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "What is the convention for the content of an initial/first git commit?\nI know that Git commits should be made for each logical change, but what is the convention (if any exist) for the first commit? \n\n[note: I'm not inviting opinion/discussion on this - if there isn't a common convention then fine]. \n\nFor instance I've started a website from scratch with index.html - my first 'logical change' commit could be anything from adding the <head> elements, adding the HTML structure, or adding the basic content and CSS. Or should the first commit be the first 'working' version?\nEdit: I don't mean the commit message; I mean the content of the files."
},
{
"role": "assistant",
"content": "Usually the first commit is named \"Initial commit\".\nAs best practice its include a README file describing the project.\nThe README is usually is a md file.\nJust for fun read this: Funny initial git commit messages:"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git - the stupid content tracker git-fmt-merge-msg"
},
{
"role": "assistant",
"content": "Produce a merge commit message"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-config - Get and set repository or global options gitweb.avatar gitweb.blame gitweb.grep gitweb.highlight gitweb.patches gitweb.pickaxe gitweb.remote_heads gitweb.showSizes gitweb.snapshot"
},
{
"role": "assistant",
"content": "See gitweb.conf for description."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to easily create Github friendly markdown for documented JavaScript functions?\n\nI want to be able to take JSDoc comments like this anywhere in JavaScript source (even nested down several layers of functions, in a module or even anonymous functions):\n/**\n * Used to do some important thing that needs doing that works like xyz.\n * @param {String} whatever - some string that has some purpose\n * @param {Function} callback - a function that needs to be run\n * @returns {Boolean} whether or not something happened\n */\n function something(whatever, callback) {\n ...\n\nand have some easy way to produce nice markdown:\n##`root.something(whatever,callback)`\nUsed to do some important thing that needs doing that works like xyz.\n\n*Parameters*\n `whatever {String}` some string that has some purpose\n `callback {Function}` a function that needs to be run\n\n*Returns*\n `{Boolean}` whether or not something happened\n\nWhere \"root\" is the namespace at which that function is reachable. Or if it's an anonymous function or a private function (that for some reason should be in public doco, does that even make sense??), use some other convention to denote that. Maybe\n##_private_function_ `something(whatever,callback)`\n\n and\n\n##_anonymous_function_`(whatever,callback)`\n\nIt doesn't have to be exactly that format, just something that looks good on Github and makes sense. The ideal tool would be smart enough to be able to take code like Mustache.js and produce good output. And extra good would be if it can handle lots of source files and produce one document as output, or a linked set of documents depending on configuration.\nAnd it would be best if this was done in a way that can be fully and easily included in a git repo so that people don't need to set up a highly specific toolchain to update the doco. Or require a minimal toolchain at least.\nOh, and a pony.\n\nExisting options\nJSDoc, plus some kind of HTML -> markdown conversion\nJSDoc is pretty good. But I can't seem to make it work well with modules. Or rather, it's a bigger hassle than it ought to be IMHO. I shouldn't need to add an extra tag to name the function. I've tried the @export and @name and still have trouble getting it to show up in the final doc the way I'd want. If someone can point to a JSDoc commented source that has modules in it and is done well, that might help. Update: JSDoc v3 actually seems much better with modules than v2 so this might be a better fit.\nEven if I could get JSDoc output like I want, I'd need to convert from HTML to markdown. I can't seem to find a good tool for that, does one exist?\nDocdown\nI played a bit with Docdown but the fact it's PHP is kind of a nonstarter for me...\nYUIDoc, plus conversion\nI actually haven't played with YUIDoc but it looks ok. Still, I would need a converter. Does it deal with modules easily and avoid having to supply the function name and export name explicitly?\nDox, plus markdown templates\nDox produces JSON as it's output, so then you'd need to marry that to some good markdown templates, and plus include a template engine to generate the documents. Has anyone put together a set of such templates in a useful fashion?\njGrouse, plus conversion\nRuns with ANT. Next...\nScriptDoc...\nDoes this even exist anymore? Seems to be part of Aptana studio so that would be a nonstarter... Aptana doesn't seem to any info on it. But ScriptDoc.org has some interesting information on crack, if that's helpful...\nPdoc\nPdoc is Ruby based but that toolchain is not uncommon so that's not a huge problem. You can provide your own templates so maybe there are already some good markdown ones. I haven't played with it... is it worthwhile? Are there good markdown templates out there?\nSomething else?\nWhat else is out there?\nMake your own!\nAfter messing around with JSDoc for a few hours trying to make it work how I wanted, I gave up and wrote my own quick and dirty solution in Java for CharFunk, a unicode JavaScript library I've been working on. It works well enough for what I need though it's not close to general purpose yet.\n\nSo.....\nIs this an unmet need or is it just me?"
},
{
"role": "assistant",
"content": "I use jsdoc-to-markdown.. \nwrite documented code:\n/**\na quite wonderful function\n@param {object} - privacy gown\n@param {object} - security\n@returns {survival}\n*/\nfunction protection(cloak, dagger){}\n\nget markdown docs: \n$ jsdoc2md example/function.js\n\n#protection(cloak, dagger)\na quite wonderful function\n\n**Params**\n\n- cloak `object` - privacy gown\n- dagger `object` - security\n\n**Returns**: `survival`\n\nThese projects have readme files rendered by jsdoc2md:\n\nhandbrake-js\narray-tools\ncommand-line-args"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-config - Get and set repository or global options dense"
},
{
"role": "assistant",
"content": "make unequal size columns to utilize more space"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git - the stupid content tracker git-diff-index"
},
{
"role": "assistant",
"content": "Compare a tree to the working tree or index"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Unable to push files to git due to: failed to push some refs\n\nI have a directory that i want to turn into a git project.\nI created a new project in gitlab and then i did the following:\ngit init\ngit remote add origin [email protected]:a/b/c.git\ngit add .\ngit commit -m \"Initial commit\"\ngit push -u origin master\n\nIn addition, I created the following .gitignore file:\n*\n!*/scripts\n!*/jobs\n\nAfter running git push -u origin master i got the following error:\nCounting objects: 33165, done.\nDelta compression using up to 2 threads.\nCompressing objects: 100% (32577/32577), done.\nWriting objects: 100% (33165/33165), 359.84 MiB | 1.70 MiB/s, done.\nTotal 33165 (delta 21011), reused 0 (delta 0)\nremote: Resolving deltas: 100% (21011/21011), done.\nremote: GitLab: \nremote: A default branch (e.g. master) does not yet exist for a/b/c\nremote: Ask a project Owner or Maintainer to create a default branch:\nremote: \nremote: https://gitlab.com/a/b/c/project_members\nremote: \nTo gitlab.com:a/b/c.git\n ! [remote rejected] master -> master (pre-receive hook declined)\nerror: failed to push some refs to '[email protected]:a/b/c.git'\n\nWhat could be the issue?\nPlease advise"
},
{
"role": "assistant",
"content": "This is linked to issue 27456 and merge request 6608:\n\ndocument the need to be owner or have the master permission level for the initial push \n\nSo it might be a permission level, not a branch issue.\nSee commit 81ee443:\n\nYou will need to be owner or have the master permission level for the initial push, as the master branch is automatically protected."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "gitglossary - A Git Glossary changeset"
},
{
"role": "assistant",
"content": "BitKeeper/cvsps speak for \" commit \". Since Git does not\nstore changes, but states, it really does not make sense to use the term\n\"changesets\" with Git."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Is there any GitHub GUI Client for Linux OS? [closed]\n\nClosed. This question is off-topic. 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's on-topic for Stack Overflow.\n\n\nClosed 11 years ago.\n\n\n\n\n\n\n\n Improve this question\n \n\n\n\nIs there anything similar to GitHub for Windows or GitHub for Mac for Linux systems?"
},
{
"role": "assistant",
"content": "Try the SmartGitHg. It's a Git GUI that both support Windows and Linux. And it supports GitHub very well."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "ExecJS::ProgramError: Unexpected token punc «(», expected punc «:» when running rake assets:precompile on production\nWhen deploying my Rails app I get the following error:\nrake aborted!\n ExecJS::ProgramError: Unexpected token punc «(», expected punc «:» (line: 15, col: 14, pos: 265)\n\n Error\n at new JS_Parse_Error (/tmp/execjs20150524-4411-1p45n63js:2359:10623)\n at js_error (/tmp/execjs20150524-4411-1p45n63js:2359:10842)\n at croak (/tmp/execjs20150524-4411-1p45n63js:2359:19086)\n at token_error (/tmp/execjs20150524-4411-1p45n63js:2359:19223)\n at expect_token (/tmp/execjs20150524-4411-1p45n63js:2359:19446)\n at expect (/tmp/execjs20150524-4411-1p45n63js:2359:19584)\n at /tmp/execjs20150524-4411-1p45n63js:2359:28513\n at /tmp/execjs20150524-4411-1p45n63js:2359:19957\n at expr_atom (/tmp/execjs20150524-4411-1p45n63js:2359:27269)\n at maybe_unary (/tmp/execjs20150524-4411-1p45n63js:2359:30019)new JS_Parse_Error ((execjs):2359:10623)\n js_error ((execjs):2359:10842)\n croak ((execjs):2359:19086)\n token_error ((execjs):2359:19223)\n expect_token ((execjs):2359:19446)\n expect ((execjs):2359:19584)\n (execjs):2359:28513\n (execjs):2359:19957\n expr_atom ((execjs):2359:27269)\n maybe_unary ((execjs):2359:30019)\n\nThe file in question is valid, it works on localhost. I also tried running rake assests:precompile on localhost, it all passes. Finally, I tried to remove the content from the file, git push and redeploy - still got the same error. Only completely removing the file and re-deploying helps.\nWould appreciate any ideas."
},
{
"role": "assistant",
"content": "Here I found help for the same problem you had.\nRun rails console and:\nJS_PATH = \"app/assets/javascripts/**/*.js\"; \nDir[JS_PATH].each do |file_name|\n puts \"\\n#{file_name}\"\n puts Uglifier.compile(File.read(file_name), harmony: true)\nend\n\nIt will show you the file and the line where the Uglifier is making the problem."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Git LFS refused to track my large files properly, until I did the following\n\nProblem\nI had troubles trying to use git LFS, despite the many suggestions here on SO, on Git and GitHub's documentation, and on some Gists I'd run across.\nMy problem was as follows:\nAfter performing the necessary steps:\ngit lfs install\ngit lfs track \"<file of interest>\"\ngit commit\n\nI would still not have any files being tracked. If I performed\ngit lfs ls-files\n\nit would be blank. If I went ahead & performed the push, the transaction would fail, saying that the files are too large. (As expected, but I was desperate.)"
},
{
"role": "assistant",
"content": "New Solution\nThe original solution is from 2016. Tech progresses...\nSeems the best solution now is\ngit lfs migrate\n\nThanks to @iff_or for alerting me to this (see comments).\nOutdated Solution, don't use\nI then discovered a few fixes, some of which seem to be bugs, some of which simply were not obvious to me.\n\nIt seems that in order to use lfs with an existing repository, a hack or third party tool such as BFG's converter is needed.\n\nI did not want to go that route, so I simply initialized a new repository locally, then did the challenge of hooking it back up to the real repo.\nI created a new directory, then git init, etc.\n\nIn my case, the remote repository was GitHub. So I did all those proper hookups like git remote add origin [email protected]:<my_id>/<my_repo>.git\n\n\n\n\nAlso, while Git's Training Video claims that you can simply specify a folder, such as \"my_folder/\", I could not get this to work. Therefore, I just cleverly used filename extensions to manage things.\n\nFor example, git lfs track \"my_folder/\" would not work for me, but git lfs track \"*.zip\" did work.\n\n\nI had no luck getting LFS files to be identified correctly unless I had first updated the .gitattributes file, and committed and pushed that new file to the remote server.\n\ngit lfs track \"*.zip\"\ngit add .gitattributes\ngit commit -m \"Updated the attributes\"\ngit push\ngit add my_large_file.zip\ngit lfs ls-files\n\nAnd here I would ensure that I saw my_large_file.zip being tracked.\n\n\ngit commit -m \"Now I am adding the large file\"\ngit push\n\n\n\n\nIt's possible that some of the things work, and I was simply doing them wrong. However, following the witchcraft described above finally got LFS to work, so I thought I'd pass on these details for others, in case someone else had the same problem."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to grep the git diff?\nIs there a way to show the git-diff filtered by a given pattern.\nSomething like \ngit grepdiff pattern\n\nchanged file\n+++ some sentence with pattern\nchanged file 2\n--- some other pattern\n\nUnfortunately the simplest solution is not good enough\ngit diff | grep pattern \n\n+++ some sentence with pattern\n--- some other pattern\n# not an option as doesn't put the filename close to the match\n\nI came with a workaround using awk\ngit diff | awk \"/\\+\\+\\+/{f = \\$2}; /PATTERN/ {print f \\$0} \"\n\nBut would love to find out that there is a command for this."
},
{
"role": "assistant",
"content": "Not sure but isn't git diff -G <regex> flag OK?\n\n-G < regex>\nLook for differences whose added or removed line matches the given <regex>."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Git push takes forever\n\nWhen I am trying to push to my remote git repository, but it is taking forever and nothing happens. I waited for so long, but push is never getting finished. My OS is Ubuntu 12.10. Thank you."
},
{
"role": "assistant",
"content": "Try using the --verbose option to see what actually happens. Even if you did small changes, some internal things might cause git to push a lot more data. \nHave a look at git gc. It cleans up your local repository and might speed up things, depending on you issue. Backup strongly advised."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-config - Get and set repository or global options bundle.<id>.*"
},
{
"role": "assistant",
"content": "The bundle.<id>.* keys are used to describe a single item in the\nbundle list, grouped under <id> for identification purposes."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-rm - Remove files from the working tree and from the index"
},
{
"role": "assistant",
"content": "SUBMODULES Only submodules using a gitfile (which means they were cloned\nwith a Git version 1.7.8 or newer) will be removed from the work\ntree, as their repository lives inside the .git directory of the\nsuperproject. If a submodule (or one of those nested inside it)\nstill uses a .git directory, git rm will move the submodules\ngit directory into the superprojects git directory to protect\nthe submodule’s history. If it exists the submodule.<name> section\nin the gitmodules file will also be removed and that file\nwill be staged (unless --cached or -n are used). A submodule is considered up to date when the HEAD is the same as\nrecorded in the index, no tracked files are modified and no untracked\nfiles that aren’t ignored are present in the submodule’s work tree.\nIgnored files are deemed expendable and won’t stop a submodule’s work\ntree from being removed. If you only want to remove the local checkout of a submodule from your\nwork tree without committing the removal, use git-submodule deinit instead. Also see gitsubmodules for details on submodule removal."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How do I contribute to other's code in GitHub? [closed]\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 4 years ago.\n\n\n\n\n\n\n\n Improve this question\n \n\n\n\nI would like to contribute to a certain project in GitHub. Should I fork it? Branch it? What is recommended and how to do it?"
},
{
"role": "assistant",
"content": "Ideally you:\n\nFork the project\nMake one or more well commented and clean commits to the repository. You can make a new branch here if you are modifying more than one part or feature.\nPerform a pull request in github's web interface.\n\nif it is a new Feature request, don't start the coding first. Remember to post an issue to discuss the new feature.\nIf the feature is well discuss and there are some +1 or the project owner approved it, assign the issue to yourself, then do the steps above.\nSome projects won't use the pull request system. Check with the author or mailing list on the best way to get your code back into the project."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How do I modify a specific commit?\nI have the following commit history:\n\nHEAD\nHEAD~\nHEAD~2\nHEAD~3\n\ngit commit --amend modifies the current HEAD commit. But how do I modify HEAD~3?"
},
{
"role": "assistant",
"content": "Use git rebase. For example, to modify commit bbc643cd, run:\ngit rebase --interactive bbc643cd~\n\nPlease note the tilde ~ at the end of the command, because you need to reapply commits on top of the previous commit of bbc643cd (i.e. bbc643cd~).\nIn the default editor, modify pick to edit in the line mentioning bbc643cd.\nSave the file and exit. git will interpret and automatically execute the commands in the file. You will find yourself in the previous situation in which you just had created commit bbc643cd.\nAt this point, bbc643cd is your last commit and you can easily amend it. Make your changes and then commit them with the command:\ngit commit --all --amend --no-edit\n\nAfter that, return back to the previous HEAD commit using:\ngit rebase --continue\n\nWARNING: Note that this will change the SHA-1 of that commit as well as all children -- in other words, this rewrites the history from that point forward. You can break repos doing this if you push using the command git push --force."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-diff - Show changes between commits, commit and working tree, etc --no-color"
},
{
"role": "assistant",
"content": "Turn off colored diff.\nThis can be used to override configuration settings.\nIt is the same as --color=never ."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-rebase - Reapply commits on top of another base tip -C<n>"
},
{
"role": "assistant",
"content": "Ensure at least <n> lines of surrounding context match before\nand after each change. When fewer lines of surrounding\ncontext exist they all must match. By default no context is\never ignored. Implies --apply . See also INCOMPATIBLE OPTIONS below."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Get the current git hash in a Python script\nI would like to include the current git hash in the output of a Python script (as a the version number of the code that generated that output).\nHow can I access the current git hash in my Python script?"
},
{
"role": "assistant",
"content": "No need to hack around getting data from the git command yourself. GitPython is a very nice way to do this and a lot of other git stuff. It even has \"best effort\" support for Windows.\nAfter pip install gitpython you can do\nimport git\nrepo = git.Repo(search_parent_directories=True)\nsha = repo.head.object.hexsha\n\n\nSomething to consider when using this library. The following is taken from gitpython.readthedocs.io\n\nLeakage of System Resources\nGitPython is not suited for long-running processes (like daemons) as it tends to leak system resources. It was written in a time where destructors (as implemented in the __del__ method) still ran deterministically.\nIn case you still want to use it in such a context, you will want to search the codebase for __del__ implementations and call these yourself when you see fit.\nAnother way assure proper cleanup of resources is to factor out GitPython into a separate process which can be dropped periodically"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-shortlog - Summarize git log output --author=<pattern> --committer=<pattern>"
},
{
"role": "assistant",
"content": "Limit the commits output to ones with author/committer\nheader lines that match the specified pattern (regular\nexpression). With more than one --author=<pattern> ,\ncommits whose author matches any of the given patterns are\nchosen (similarly for multiple --committer=<pattern> )."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-ls-files - Show information about files in the index and the working tree K"
},
{
"role": "assistant",
"content": "untracked paths which are part of file/directory conflicts\nwhich prevent checking out tracked files"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "What's a good (free) visual merge tool for Git? (on windows) [closed]\nClosed. This question is seeking recommendations for software libraries, tutorials, tools, books, or other off-site resources. It does not meet Stack Overflow guidelines. It is not currently accepting answers.\n \n \n\n\n\n\n\n\n\n\n\n\n\n We don’t allow questions seeking recommendations for software libraries, tutorials, tools, books, or other off-site resources. You can edit the question so it can be answered with facts and citations.\n\n\nClosed 9 years ago.\n\n\n\n\n\n\n\n Improve this question\n \n\n\n\nA similar question was already asked, but for Ubuntu.\nIt would help to know if the tool is free as in beer or as in liber.\nAlso, up and downs of the tool would be nice to know."
},
{
"role": "assistant",
"content": "I've also used Meld. It's written in python. There is an official installer for Windows that works well.\nInstall it and then set it as your default mergetool.\n$ git config --global merge.tool \"meld\"\n$ git config --global mergetool.meld.path \"C:\\Program Files (x86)\\Meld\\Meld.exe\"\n\nIf using a GUI GIT client, try the following (instructions for SourceTree, adjust accordingly)\n\nIn SourceTree, go to Tools/Options/Diff\nIn External Diff Tool, choose Custom\nEnter C:\\Program Files (x86)\\Meld\\meld.exe in Diff Command and $LOCAL $REMOTE in Arguments\nIn Merge Tool, choose Custom\nEnter C:\\Program Files (x86)\\Meld\\meld.exe in Diff Command and $LOCAL $MERGED $REMOTE in Arguments"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-clone - Clone a repository into a new directory -- [ no- ] shallow-submodules"
},
{
"role": "assistant",
"content": "All submodules which are cloned will be shallow with a depth of 1."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git SSL certificate- Invalid certificate chain while accessing\n\nI'm fairly new to github and git, but I do have git setup on my Mac (using Mavericks) and have added a repo on github. I'm using MAMP and working on a Drupal site, and when I try my first push to the repo, using git push origin master I get an error:\nerror: SSL certificate problem: Invalid certificate chain while accessing\n https://githib.com/...git/info/refs?service=git-receive-pack\nfatal: HTTP request failed\n\nI've looked around to try and make sense of this error without any luck. I'd greatly appreciate any help."
},
{
"role": "assistant",
"content": "if you use self generated ssl key, you can try this.\ngit config --global http.sslVerify false\n\nRefer\nhttps://confluence.atlassian.com/display/FISHKB/Unable+to+clone+Git+repository+due+to+self+signed+certificate"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Bitbucket, Windows and \"fatal: could not read Password for\"\nI recently reinstalled Windows and I have a problem with downloading files from repository.\nI have installed GIT and Python, but when I am trying to download anything from Bitbucket I get the message: \n\"fatal: could not read Password for: 'https://[email protected]': No such file or directory\".\n\nWhat am I doing wrong?"
},
{
"role": "assistant",
"content": "I solved it setting a global parameter:\ngit config --global core.askpass /usr/libexec/git-core/git-gui--askpass"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Github actions actions/checkout@v2 lfs: true flag not converting pointers to actual files\n\nThis is my github actions yml file:\nname: CI\n\non: [pull_request]\n\njobs:\n build_ios:\n name: Set up\n runs-on: ${{ matrix.os }}\n\n strategy:\n matrix:\n os: [self-hosted]\n node-version: [10.x]\n\n steps:\n - name: Checkout github repo (+ download lfs dependencies)\n uses: actions/checkout@v2\n with:\n lfs: true\n\nAfter it runs I expect all the git lfs files to be downloaded, checked out and ready to use, but instead the content of the file is this:\nversion https://git-lfs.github.com/spec/v1\noid sha256:f23e4c2b1244bc93085dbccf17c447e54sca44650294648df128d58303e4eff\nsize 58951008\n\nBelow I attach the actual github actions log in case it's helpful:\nRun actions/checkout@v2\n with:\n lfs: true\n repository: SudoPlz/test-project-mobile\n token: ***\n ssh-strict: true\n persist-credentials: true\n clean: true\n fetch-depth: 1\n submodules: false\nSyncing repository: SudoPlz/test-project-mobile\nGetting Git version info\n Working directory is '/Users/sudoplz/Development/tmp/actions-runner/_work/test-project-mobile/test-project-mobile'\n /usr/bin/git version\n git version 2.24.1 (Apple Git-126)\n /usr/bin/git lfs version\n git-lfs/2.8.0 (GitHub; darwin amd64; go 1.12.7)\n/usr/bin/git config --local --get remote.origin.url\nhttps://github.com/SudoPlz/test-project-mobile\nRemoving previously created refs, to avoid conflicts\n /usr/bin/git rev-parse --symbolic-full-name --verify --quiet HEAD\n HEAD\n /usr/bin/git rev-parse --symbolic-full-name --branches\n /usr/bin/git rev-parse --symbolic-full-name --remotes=origin\nCleaning the repository\n /usr/bin/git clean -ffdx\n Removing .jest/\n Removing node_modules/\n Removing patchLog.txt\n /usr/bin/git reset --hard HEAD\n HEAD is now at 21bea25da Merge ab95479fd7dce51551520250ac521532d0079f94 into c70ec18b35029c581b0c0e06566228f69e091d3d\nDisabling automatic garbage collection\n /usr/bin/git config --local gc.auto 0\nSetting up auth\n /usr/bin/git config --local --name-only --get-regexp core\\.sshCommand\n /usr/bin/git submodule foreach --recursive git config --local --name-only --get-regexp 'core\\.sshCommand' && git config --local --unset-all 'core.sshCommand' || :\n /usr/bin/git config --local --name-only --get-regexp http\\.https\\:\\/\\/github\\.com\\/\\.extraheader\n /usr/bin/git submodule foreach --recursive git config --local --name-only --get-regexp 'http\\.https\\:\\/\\/github\\.com\\/\\.extraheader' && git config --local --unset-all 'http.https://github.com/.extraheader' || :\n /usr/bin/git config --local http.https://github.com/.extraheader AUTHORIZATION: basic ***\n/usr/bin/git lfs install --local\nUpdated git hooks.\nGit LFS initialized.\nFetching the repository\n /usr/bin/git -c protocol.version=2 fetch --no-tags --prune --progress --no-recurse-submodules --depth=1 origin +d4be6d58e6a72e54b0b03be61fc508dcee8d7bec:refs/remotes/pull/44/merge\n remote: Enumerating objects: 10, done. \n remote: Counting objects: 10% (1/10) \n remote: Counting objects: 20% (2/10) \n remote: Counting objects: 30% (3/10) \n remote: Counting objects: 40% (4/10) \n remote: Counting objects: 50% (5/10) \n remote: Counting objects: 60% (6/10) \n remote: Counting objects: 70% (7/10) \n remote: Counting objects: 80% (8/10) \n remote: Counting objects: 90% (9/10) \n remote: Counting objects: 100% (10/10) \n remote: Counting objects: 100% (10/10), done. \n remote: Compressing objects: 33% (1/3) \n remote: Compressing objects: 66% (2/3) \n remote: Compressing objects: 100% (3/3) \n remote: Compressing objects: 100% (3/3), done. \n remote: Total 5 (delta 2), reused 2 (delta 0), pack-reused 0 \n From https://github.com/SudoPlz/test-project-mobile\n + 21bea25da...d4be6d58e d4be6d58e6a72e54b0b03be61fc508dcee8d7bec -> pull/44/merge (forced update)\nDetermining the checkout info\nFetching LFS objects\n /usr/bin/git lfs fetch origin refs/remotes/pull/44/merge\n fetch: Fetching reference refs/remotes/pull/44/merge\nChecking out the ref\n /usr/bin/git checkout --progress --force refs/remotes/pull/44/merge\n Warning: you are leaving 1 commit behind, not connected to\n any of your branches:\n\n 21bea25da Merge ab95479fd7dce51551520250ac521532d0079f94 into c70ec18b35029c581b0c0e06566228f69e091d3d\n\n If you want to keep it by creating a new branch, this may be a good time\n to do so with:\n\n git branch <new-branch-name> 21bea25da\n\n HEAD is now at d4be6d58e Merge 8d05f53305eaef70a2d4635767b39dbfbe663b5a into c70ec18b35029c581b0c0e06566228f69e091d3d\n/usr/bin/git log -1\ncommit d4be6d58e6a72e54b0b03be61fc508dcee8d7bec\nAuthor: SudoPlz <*@*.*>\nDate: Fri Apr 24 18:38:50 2020 +0000\n\n Merge 8d05f53305eaef70a2d4635767b39dbfbe663b5a into c70ec18b35029c581b0c0e06566228f69e091d3d"
},
{
"role": "assistant",
"content": "The LFS objects seem to be only fetched based on the log. You need to checkout the LFS files inorder for the pointer files to be replaced with their LFS counterparts. Here's an attempt at a modified actions.yml based on a search on GitHub Actions (never used it before) :\nname: CI\n\non: [pull_request]\n\njobs:\n build_ios:\n name: Set up\n runs-on: ${{ matrix.os }}\n\n strategy:\n matrix:\n os: [self-hosted]\n node-version: [10.x]\n\n steps:\n - name: Checkout github repo (+ download lfs dependencies)\n uses: actions/checkout@v2\n with:\n lfs: true\n - name: Checkout LFS objects\n run: git lfs checkout\n\nIf the LFS objects have not been fetched, then you can replace git lfs checkout with git lfs pull. \nRelevant issues : Cache for LFS"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git - the stupid content tracker git-replace"
},
{
"role": "assistant",
"content": "Create, list, delete refs to replace objects"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Can I make git recognize a UTF-16 file as text?\nI'm tracking a Virtual PC virtual machine file (*.vmc) in git, and after making a change git identified the file as binary and wouldn't diff it for me. I discovered that the file was encoded in UTF-16.\nCan git be taught to recognize that this file is text and handle it appropriately?\nI'm using git under Cygwin, with core.autocrlf set to false. I could use mSysGit or git under UNIX, if necessary."
},
{
"role": "assistant",
"content": "I've been struggling with this problem for a while, and just discovered (for me) a perfect solution:\n$ git config --global diff.tool vimdiff # or merge.tool to get merging too!\n$ git difftool commit1 commit2\n\ngit difftool takes the same arguments as git diff would, but runs a diff program of your choice instead of the built-in GNU diff. So pick a multibyte-aware diff (in my case, vim in diff mode) and just use git difftool instead of git diff.\nFind \"difftool\" too long to type? No problem:\n$ git config --global alias.dt difftool\n$ git dt commit1 commit2\n\nGit rocks."
}
] |
[
{
"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>] [--] [<path>…]"
},
{
"role": "assistant",
"content": "This form is to view the changes you made relative to\nthe index (staging area for the next commit). In other\nwords, the differences are what you could tell Git to\nfurther add to the index but you still haven’t. You can\nstage these changes by using git-add ."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-config - Get and set repository or global options mergetool.keepTemporaries"
},
{
"role": "assistant",
"content": "When invoking a custom merge tool, Git uses a set of temporary\nfiles to pass to the tool. If the tool returns an error and this\nvariable is set to true , then these temporary files will be\npreserved; otherwise, they will be removed after the tool has\nexited. Defaults to false ."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "gitcli - Git command-line interface and conventions --help-all"
},
{
"role": "assistant",
"content": "Some Git commands take options that are only used for plumbing or that\nare deprecated, and such options are hidden from the default usage. This\noption gives the full list of options."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-config - Get and set repository or global options core.safecrlf"
},
{
"role": "assistant",
"content": "If true, makes Git check if converting CRLF is reversible when\nend-of-line conversion is active. Git will verify if a command\nmodifies a file in the work tree either directly or indirectly.\nFor example, committing a file followed by checking out the\nsame file should yield the original file in the work tree. If\nthis is not the case for the current setting of core.autocrlf , Git will reject the file. The variable can\nbe set to \"warn\", in which case Git will only warn about an\nirreversible conversion but continue the operation. CRLF conversion bears a slight chance of corrupting data.\nWhen it is enabled, Git will convert CRLF to LF during commit and LF to\nCRLF during checkout. A file that contains a mixture of LF and\nCRLF before the commit cannot be recreated by Git. For text\nfiles this is the right thing to do: it corrects line endings\nsuch that we have only LF line endings in the repository.\nBut for binary files that are accidentally classified as text the\nconversion can corrupt data. If you recognize such corruption early you can easily fix it by\nsetting the conversion type explicitly in .gitattributes. Right\nafter committing you still have the original file in your work\ntree and this file is not yet corrupted. You can explicitly tell\nGit that this file is binary and Git will handle the file\nappropriately. Unfortunately, the desired effect of cleaning up text files with\nmixed line endings and the undesired effect of corrupting binary\nfiles cannot be distinguished. In both cases CRLFs are removed\nin an irreversible way. For text files this is the right thing\nto do because CRLFs are line endings, while for binary files\nconverting CRLFs corrupts data. Note, this safety check does not mean that a checkout will generate a\nfile identical to the original file for a different setting of core.eol and core.autocrlf , but only for the current one. For\nexample, a text file with LF would be accepted with core.eol=lf and could later be checked out with core.eol=crlf , in which case the\nresulting file would contain CRLF , although the original file\ncontained LF . However, in both work trees the line endings would be\nconsistent, that is either all LF or all CRLF , but never mixed. A\nfile with mixed line endings would be reported by the core.safecrlf mechanism."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-show - Show various types of objects -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": "Cherry-pick and squash a range of commits into a subdirectory or subtree\nHow can I tell cherry-pick to pick range of commits and squash it?\nOr in other words, apply the diff between two commits to the current state of the repository?\nThe following does not work (cherry-pick has no --squash option):\ngit cherry-pick --squash e064480..eab48b59c\n\nNote: My use case is within a subtree scenario - before anyone starts arguing that I should not squash.\nThe following works, but then I have a range of separate commits. I can squash them manually with interactive rebase afterwards.\ngit cherry-pick -X subtree=vendor/package e064480..eab48b59c\n\nIs there any way to do the squashing as part of the cherry-pick?"
},
{
"role": "assistant",
"content": "Pass -n to git cherry-pick. This will apply all the commits, but not commit them. Then simply do git commit to commit all the changes in a single commit."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Find out the admin(s) for a git repo\nI am a contributor for a git repo in github for a company.\nI want to find out who among the contributors are the admins.\nHow do I find out who is the admin besides going around and asking everyone in the company?"
},
{
"role": "assistant",
"content": "If you have push access to this repository, you can use Github API to find collaborators\nYou will need an access token, the endpoint https://api.github.com/repos/ORG/REPO/collaborators gives you a list of all collaborators with the list of permission type for each of them :\n\"permissions\": {\n \"admin\": true,\n \"push\": true,\n \"pull\": true\n }\n\nYou can use curl and jq (to parse JSON response) like this : \ncurl https://api.github.com/repos/ORG/REPO/collaborators \\\n -H \"Authorization: Token ACCESS_TOKEN\" | \\\n jq '[ .[] | select(.permissions.admin == true) | .login ]'"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git - how can I clone local svn repository?\nI am completely unable to find any explanation how I should specify location of existing svn repository.\nIn other words - what should be used as URL in \ngit svn clone URL\n\nwhen svn repository is local?"
},
{
"role": "assistant",
"content": "You should be able to succeed like this:\ngit svn clone file:///e/svn_repo_on_E_drive\n\nSimilar to svn checkout command:\nsvn co file:///e/svn_repo_on_E_drive\n\nfile:// for folder on the current drive of the executing CMD prompt, file:///d/some_folder for D:\\some_folder.\nNote: The extra / and the removed colon : in the file link on Windows. file://e:/svn_repo_on_E_drive → file:///e/svn_repo_on_E_drive\ngit svn clone also works on remote svn repos\n# for example\ngit svn clone https://your.hostname/path/here/svn/\n\n\nnote: git svn clone gets all commits, as opposed to svn checkout only getting the most recent file set, and so the shell command can take a long time if the svn repo has lots of commits and/or files."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git - the stupid content tracker --git-dir=<path>"
},
{
"role": "assistant",
"content": "Set the path to the repository (\".git\" directory). This can also be\ncontrolled by setting the GIT_DIR environment variable. It can be\nan absolute path or relative path to current working directory. Specifying the location of the \".git\" directory using this\noption (or GIT_DIR environment variable) turns off the\nrepository discovery that tries to find a directory with\n\".git\" subdirectory (which is how the repository and the\ntop-level of the working tree are discovered), and tells Git\nthat you are at the top level of the working tree. If you\nare not at the top-level directory of the working tree, you\nshould tell Git where the top-level of the working tree is,\nwith the --work-tree=<path> option (or GIT_WORK_TREE environment variable) If you just want to run git as if it was started in <path> then use git -C <path> ."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Please enter a commit message to explain why this merge is necessary, especially if it merges an updated upstream into a topic branch\nI am using Git. I did a pull from a remote repo and got an error message:\n\nPlease enter a commit message to explain why this merge is necessary,\n especially if it merges an updated upstream into a topic branch. \n\nI try to type a message and press Enter but nothing happens.\nHow do I tell Git/Terminal I am done typing in my message?\nI am using Terminal on OS X."
},
{
"role": "assistant",
"content": "The commit message is from Git, but it is actually the editor that keeps you from quitting. This is because Git uses your default editor, which for a variety of reasons is usually set to vi (it might be something else on your OS, like pico).\nTo write a commit message and get out of VI, follow these steps:\n\npress i (i for insert)\nwrite your merge message\npress esc (escape)\nwrite :wq (write & quit)\nthen press enter\n\nYou can also configure Git to use another editor to avoid having to use VI (or its close cousin VIM)."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "gitglossary - A Git Glossary DAG"
},
{
"role": "assistant",
"content": "Directed acyclic graph. The commit objects form a\ndirected acyclic graph, because they have parents (directed), and the\ngraph of commit objects is acyclic (there is no chain which begins and ends with the same object )."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Is it possible to delete issues on GitLab?\n\nI recently installed GitLab to try it out and I am really enjoying it. It's very easy to install and use, still, I found an annoying \"problem\". I haven't yet found a way to delete Issues associated to projects. \nI know that it's not a good practice to remove Issues from the system, but there are some specific occasions where this is really useful, such as when you create an Issue that makes no sense and don't want to be in the system, even after being closed.\nSo, my question, really simple: Is it possible to delete Issues on GitLab? If so, how can I do it?\nI am using GitLab 7.2.1, on Debian wheezy.\nMany thanks"
},
{
"role": "assistant",
"content": "It is now possible to delete issues starting with GitLab 8.6:\nGitLab 8.6 released with Deploy to Kubernetes and Subscribe to Label\n\nDelete Issues\nSometimes, simply closing an issue or merge request is not sufficient. For those times, we are now making it possible to delete issues and merge requests.\nOnly owners can delete issues by editing the issue or merge request and clicking, you guessed it, Delete."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How can I run notebooks of a Github project in Google Colab?\n\nI want to run the notbooks in the following project on Github (located in notebook folder)\nhttps://github.com/n-waves/multifit\nThe notebooks depend on the other modules, files and data of the whole project, so I can't just open them in google Colab. I can use !git clone ... to make a clone on the space provided by Colab, but then I can't open the notbooks in the browser and run them (like other notebooks run by google Colab).\nSo, my question is how to run those notebooks in google colab, I would prefer to run them in visual mode (I mean the browser)?"
},
{
"role": "assistant",
"content": "Open the Github notebook that you want to work with in Google Colab.\nChange the domain from 'github.com' to 'githubtocolab.com'.\nThe notebook will open in Colab.\nOnly works with Public repos."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-diff - Show changes between commits, commit and working tree, etc --ignore-cr-at-eol"
},
{
"role": "assistant",
"content": "Ignore carriage-return at the end of line when doing a comparison."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-log - Show commit logs %ah"
},
{
"role": "assistant",
"content": "author date, human style (like the --date=human option of git-rev-list )"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-log - Show commit logs -a --text"
},
{
"role": "assistant",
"content": "Treat all files as text."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "What are the differences between `--squash` and `--no-ff --no-commit`?\nWhich one should one use to hide microcommits?\nIs the only difference between git merge --squash and git merge --no-ff --no-commit the denial of the other parents?"
},
{
"role": "assistant",
"content": "The differences\nThese options exists for separate purposes. Your repository ends up differently.\nLet's suppose that your repository is like this after you are done developing on the topic branch:\n\n\n--squash\nIf you checkout master and then git merge --squash topic; git commit -m topic, you get this:\n\n\n--no-ff --no-commit\nInstead, if you do git merge --no-ff --no-commit; git commit -m topic, you get this:\n\nHiding micro-commits\nIf you really want to hide (I mean delete from your repository) your micro-commits, use --squash. Because, as you can see in the above images, you are not really hiding your micro-commits if you do not squash. Moreover, you do not usually push your topic branches to the world. Topic branches are for topic to get mature.\nIf you want your history to have all your micro-commits, but leave them in another line of development (the green line in the above images), use --no-ff --no-commit. But please remember that a) this is not a branch, and b) does not really mean anything in Git because it is just another parent of your commit.\nPlease refer to Git Branching - What a Branch Is if you really want to understand."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Make .git directory web inaccessible\nI have a website that I use github (closed source) to track changes and update site. The only problem is, it appears the .git directory is accessible via the web. How can I stop this and still be able to use git?\nShould I use .htaccess?\nShould I change permissions of .git?"
},
{
"role": "assistant",
"content": "Put this in an .htaccess file at the root of your web server:\nRedirectMatch 404 /\\.git\n\nThis solution is robust and secure: it\n\nworks for all .git directories in your site, even if there are more than one,\nalso hides other Git files like .gitignore and .gitmodules \nworks even for newly-added .git directories, and\ndoesn't even give away the fact that the directories exist."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How do you reuse a before_script from a shared yml file in Gitlab CI?\n\nI know that you can reuse blocks of code in a before script using yaml anchors:\n.something_before: &something_before\n- echo 'something before' \n\n\nbefore_script:\n - *something_before\n - echo \"Another script step\"\n\nbut this doesn't seem to work when the .something_before is declared in a shared .yml file via the include:file. It also does not seem that extends works for before_script. Does anyone know a way of reusing some steps in a before_script from a shared .yml file?\nEDIT: My use case is that I have 2 gitlab projects with almost identical before_script steps. I don't want to have to change both projects whenever there's a change, so I have a third, separate Gitlab project that has a .yml template that I am including via include:file in both projects. I want to put all the common code in that shared template, and just have like two lines before_script for the git project that has the two extra steps."
},
{
"role": "assistant",
"content": "You can use the !reference tag.\n.something:\n before_script:\n - echo 'something before' \n\n\nbefore_script:\n - !reference [\".something\", \"before_script\"]\n - echo \"Another script step\""
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-show - Show various types of objects %T"
},
{
"role": "assistant",
"content": "tree hash"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Not able to \"git pull\" - Host key verification failed\n\nI've got root access to our production server and I want to deploy the latest version in git to the server but I'm running into the error below when I \"git pull\" on the folder I want to update. \nI've browsed around a bit, but can't find a clear answer on what to do..\nThe staging server runs on the same machine, but just in a different folder and when I pull on that folder it all goes fine.\nI'm not very experienced when it comes to Linux, so please help me out with a clear answer on how to fix :-)\nOtherwise I have access to anything I need\np.s.\nThis has worked in the past, so I'm assuming it's got something to do with the SSH key\nError:\n@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n@ WARNING: POSSIBLE DNS SPOOFING DETECTED! @\n@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\nThe ECDSA host key for www.site.org has changed,\nand the key for the corresponding IP address x.x.x.x\nis unknown. This could either mean that\nDNS SPOOFING is happening or the IP address for the host\nand its host key have changed at the same time.\n@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @\n@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\nIT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!\nSomeone could be eavesdropping on you right now (man-in-the-middle attack)!\nIt is also possible that a host key has just been changed.\nThe fingerprint for the ECDSA key sent by the remote host is\n*************\nPlease contact your system administrator.\nAdd correct host key in /root/.ssh/known_hosts to get rid of this message.\nOffending ECDSA key in /root/.ssh/known_hosts:1\n remove with: ssh-keygen -f \"/root/.ssh/known_hosts\" -R gitlab.site.org\nECDSA host key for gitlab.site.org has changed and you have requested strict checking.\nHost key verification failed."
},
{
"role": "assistant",
"content": "In the log you see the following text:\n\n(...)\n\nPlease contact your system administrator.\nAdd correct host key in /root/.ssh/known_hosts to get rid of this message.\nOffending ECDSA key in /root/.ssh/known_hosts:1\nremove with: ssh-keygen -f \"/root/.ssh/known_hosts\" -R gitlab.site.org\nECDSA host key for gitlab.site.org has changed and you have requested strict checking.\nHost key verification failed.\n\nSo it is a matter of performing the command that is suggested there:\nssh-keygen -f \"/root/.ssh/known_hosts\" -R gitlab.site.org"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-svn - Bidirectional operation between a Subversion repository and Git --include-paths=<regex>"
},
{
"role": "assistant",
"content": "This allows one to specify a Perl regular expression that will\ncause the inclusion of only matching paths from checkout from SVN.\nThe --include-paths option should match for every fetch (including automatic fetches due to clone , dcommit , rebase , etc) on a given repository. --ignore-paths takes\nprecedence over --include-paths . config key: svn-remote.<name>.include-paths"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Why is it not a commit and a branch cannot be created from it?\nI need to work with an intricate configuration of repositories. I have 5 of them:\n\nA remote central repository on machine 1.\nMy local repository on my notebook (machine 2).\nA bare repository on machine 3.\nA repository on machine 3.\nA repository on machine 4 where we do code review.\n\nSo, my understanding that it works this way:\n\nOn my laptop (machine 2) I clone / pull from the central repository located on machine 1.\nI push the local repo to the machine 3 (using the bare repository as a \"intermediate\").\n\nNow I did some changes on the machine 3 and I want to push these changes to machine 4. Here are the instructions that I need to follow:\n\nOn machine 3 do all work in your test-branch, commit.\nPush to your bare repo on machine 3: git push origin test-branch\nOn your laptop: fetch new commits from the machine-3 repo: git fetch machine3\nCheck out your branch from machine 3: git checkout -b test-branch machine-3/test-branch\nFetch commits from machine-4: git fetch origin\ngit rebase origin/master\ngit push origin HEAD:refs/for/master\n\nI have problems with step 4. I get the following error:\n\nfatal: 'machine3/test-branch' is not a commit and a branch 'test-branch' cannot be created from it\n\nADDED\nWhen I execute\ngit rev-parse machine3/test-branch\n\nOn my laptop (machine 2) I get:\n\nmachine3/test-branch\nfatal: ambiguous argument 'machine3/test-branch': unknown revision or path not in the working tree.\nUse '--' to separate paths from revisions, like this:\n'git <command> [<revision>...] -- [<file>...]'"
},
{
"role": "assistant",
"content": "For those who found this searching for an answer to fatal: 'origin/remote-branch-name' is not a commit and a branch 'local-branch-name' cannot be created from it, you may also want to try this first:\ngit fetch --all\n\nIf you run git checkout -b local-branch-name origin/remote-branch-name without fetching first, you can run into that error.\nThe reason it says \"is not a commit\" rather than something clearer like \"branch doesn't exist\" is because git takes the argument where you specified origin/remote-branch-name and tries to resolve it to a commit hash. You can use tag names and commit hashes as an argument here, too. If they fail, it generates the same error. If git can't resolve the branch you provide to a specific commit, it's usually because it doesn't have the freshest list of remote branches. git fetch --all fixes that scenario.\nThe --all flag is included in case you have multiple remotes (e.g. origin, buildserver, joespc, etc.), because git fetch by itself defaults to your first remote-- usually origin. You can also run fetch against a specific remote; e.g., git fetch buildserver will only fetch all the branches from the buildserver remote.\nTo list all your remotes, run the command git remote -v. You can omit the --all flag from git fetch if you only see one remote name (e.g. origin) in the results."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git rename many files and folders\nI am trying to rename many files in my application and need to be able to do a rename in all subdirectories from the app root through git (i.e. git mv %filenamematch% %replacement%) that only replaces the matching text. I'm no good with bash scripting though.\nupdate: would be good it if also renamed directories that match as well!"
},
{
"role": "assistant",
"content": "This should do the trick:\nfor file in $(git ls-files | grep %filenamematch% | sed -e 's/\\(%filenamematch%[^/]*\\).*/\\1/' | uniq); do git mv $file $(echo $file | sed -e 's/%filenamematch%/%replacement%/'); done\n\nTo follow what this is doing, you'll need to understand piping with \"|\" and command substitution with \"$(...)\". These powerful shell constructs allow us to combine several commands to get the result we need. See Pipelines and Command Substitution.\nHere's what's going on in this one-liner:\n\ngit ls-files: This produces a list of files in the Git repository. It's similar to what you could get from ls, except it only outputs Git project files. Starting from this list ensures that nothing in your .git/ directory gets touched.\n\n| grep %filenamematch%: We take the list from git ls-files and pipe it through grep to filter it down to only the file names containing the word or pattern we're looking for.\n\n| sed -e 's/\\(%filenamematch%[^/]*\\).*/\\1/': We pipe these matches through sed (the stream editor), executing (-e) sed's s (substitute) command to chop off any / and subsequent characters after our matching directory (if it happens to be one).\n\n| uniq: In cases where the match is a directory, now that we've chopped off contained directories and files, there could be many matching lines. We use uniq to make them all into one line.\n\nfor file in ...: The shell's \"for\" command will iterate through all the items (file names) in the list. Each filename in turn, it assigns to the variable \"$file\" and then executes the command after the semicolon (;).\n\nsed -e 's/%filenamematch%/%replacement%/': We use echo to pipe each filename through sed, using it's substitute command again--this time to perform our pattern replacement on the filename.\n\ngit mv: We use this git command to mv the existing file ($file) to the new filename (the one altered by sed).\n\n\nOne way to understand this better would be to observe each of these steps in isolation. To do that, run the commands below in your shell, and observe the output. All of these are non-destructive, only producing lists for your observation:\n\ngit ls-files\n\ngit ls-files | grep %filenamematch%\n\ngit ls-files | grep %filenamematch% | sed -e 's/\\(%filenamematch%[^/]*\\).*/\\1/'\n\ngit ls-files | grep %filenamematch% | sed -e 's/\\(%filenamematch%[^/]*\\).*/\\1/' | uniq\n\nfor file in $(git ls-files | grep %filenamematch% | sed -e 's/\\(%filenamematch%[^/]*\\).*/\\1/' | uniq); do echo $file; done\n\nfor file in $(git ls-files | grep %filenamematch% | sed -e 's/\\(%filenamematch%[^/]*\\).*/\\1/' | uniq); do echo $file | sed -e 's/%filenamematch%/%replacement%/'; done"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-diff-index - Compare a tree to the working tree or index <tree-ish>"
},
{
"role": "assistant",
"content": "The id of a tree object to diff against."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-for-each-ref - Output information on each ref --include-root-refs"
},
{
"role": "assistant",
"content": "List root refs (HEAD and pseudorefs) apart from regular refs."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Mirroring from GitLab to GitHub\n\nI have been using a private GitLab instance to hold all my code. But since most of the staff that work with me now have a GitHub account, i would really like to get moving and mirror my Gitlab repo to Github.\nMy situation:\n\na server running Gitlab (Omnibus)\na Github account for which I'll create an organization for where me and my staff can be organized together.\n\nI know that there is the --mirror switch in git, but I am not really sure how this is ment to work. Documentation I found online was very wonky... So it would be nice if someone could help me out. :)"
},
{
"role": "assistant",
"content": "GitLab has now an option to do this from the UI, go to the Settings->Repository of your repo:\nhttps://gitlab.com/yourUserNameInGitLab/yourRepoName/settings/repository\nThen find the option \"Mirror a repository\" and click on expand. What you want to do is choose the \"Push\" mirror direction and fill this URL:\nhttps://[email protected]/yourUserNameInGitHub/yourRepoName.git\nIn the password field, you have to use a Personal Access Token (as GitHub has deprecated password access now), which you can generate here: https://github.com/settings/tokens (don't forget to enable the \"repo\" and \"workflow\" permissions when generating it)"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to cherry pick from 1 branch to another\nI have 2 branches, master and dev.\nI am on dev branch and I want to cherry-pick 1 commit from master to dev. So I did \n$ git cherry-pick be530cec7748e037c665bd5a585e6d9ce11bc8ad\nFinished one cherry-pick.\n\nBut when I do git status and gitx, I don't see my commit be530cec7748e037c665bd5a585e6d9ce11bc8ad in git history.\nHow can I see my commit in the dev branch?"
},
{
"role": "assistant",
"content": "When you cherry-pick, it creates a new commit with a new SHA. If you do: \ngit cherry-pick -x <sha>\n\nthen at least you'll get the commit message from the original commit appended to your new commit, along with the original SHA, which is very useful for tracking cherry-picks."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "A Regex to match a SHA1\nI'm trying to match SHA1's in generic text with a regular expression.\nIdeally I want to avoid matching words. \nIt's safe to say that full SHA1's have a distinctive pattern (they're long and a consistent length) - so I can match these reliably - but what about abbreviated SHA1's?\nCan I rely on the presence of numbers?\nLooking at the SHA1's in my commit log - numbers always appear in the first 3 characters. But is this too short? How many characters of SHA1 do I need to consider before I can assume a number would have appeared? \nThis does not have to be 100% accurate - I just need to match an abbreviated SHA1 99% of the time."
},
{
"role": "assistant",
"content": "You can consider the SHA1 hashes to be completely random, so this reduces to a matter of probabilities. The probability that a given digit is not a number is 6/16, or 0.375. The probability that three SHA1 digits are all not numbers is 0.375 ** 3, or 0.0527 (5% ish). At six digits, this reduces again to 0.00278 (0.2%). At five digits, the probability of all letters drops below 1% (you said you wanted to match 99% of the time).\nIt's easy to craft a regular expression that always matches SHA1 values:\n\\b[0-9a-f]{5,40}\\b\n\nHowever, this may also match perfectly good five letter words, like \"added\" or \"faded\". In my /usr/share/dict/words file, there are several six letter words that would match: \"accede\", \"beaded\", \"bedded\", \"decade\", \"deface\", \"efface\", and \"facade\" are the most likely. At seven letters, there is only \"deedeed\" which is unlikely to appear in prose. It all depends on how many false positives you can tolerate, and what the likely words you will encounter actually are."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Adding self-signed SSL certificate without disabling authority-signed ones\nI have a corporate git server working through https using self-signed certificate. The local clone contains two remotes — the origin pointing to that server, and another pointing to github.\nBy default pulling from the origin fails:\n$ git pull\nfatal: unable to access 'https://[email protected]/git/fizzbuzz.git/': SSL certificate problem: self signed certificate\n\nThe github remote works fine.\nThere are two often-suggested solutions:\ngit config http.sslVerify false\n\nwhich is a bad idea, and the one suggested at configure Git to accept a particular self-signed server certificate for a particular https remote:\ngit config http.sslCAInfo <downloaded certificate>.pem\n\nwhich fixes pulling from origin, but break the github remote:\n$ git pull github\nfatal: unable to access 'https://github.com/user/fizzbuzz.git/': SSL certificate problem: unable to get local issuer certificate\n\nHow to make pulling from the corporate server work without breaking pulling from github?"
},
{
"role": "assistant",
"content": "If you are using Git 1.8.5+ (August 2013), you can specify http directives per URL(!).\nIn your case:\ngit config --global http.\"https://code.example.com/\".sslVerify false\n#\n# or, if not on default 443 port:\n#\ngit config --global http.\"https://code.example.com:<aPort>/\".sslVerify false\n\nThat would disable SSL verification only for code.example.com, not for other URLs. \nOr:\ngit config --global http.\"https://code.example.com/\".sslCAInfo <downloaded certificate>.pem\n\nSame idea: sslCAInfo would point to <downloaded certificate>.pem only for code.example.com URLs.\nIt is possible to add your certificate in the Git system certificate store, which, with git-for-windows, would be in C:\\path\\to\\PortableGit-2.6.1-64-bit\\usr\\ssl\\certs\\ca-bundle.crt.\nIt isn't the best practice, though, unless you have to distribute a Git distro with internal certificates in it."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Why has Git allowed me to create two branches with the same name?\n\nI'm still relatively new to Git and I have made a bit of a mess of my repository. I'm hoping there is a way to fix it without re-cloning. \nI have a repository which I have cloned from Github. The repository has several branches. I worked on the master branch for a while but then needed to switch to one of the other branches.\nSo, I had:\n$ git branch --all\n* master\n remotes/origin/abc\n remotes/origin/def\n remotes/origin/HEAD -> origin/master\n remotes/origin/ghi\n\nProblem: I wanted to switch to the 'abc' branch but instead of doing git checkout remotes/origin/abc I accidentally did git branch remotes/origin/abc which leaves me with the following:\n$ git branch --all\n* master\n remotes/origin/abc\n remotes/origin/abc\n remotes/origin/def\n remotes/origin/HEAD -> origin/master\n remotes/origin/ghi\n\nMy questions are:\n\nWhy on Earth does Git allow you to create two branches with the same\nname? \nHow do I identify which is the real remotes/origin/abc branch?\nHow do I remove the unwanted remotes/origin/abc that I created by\naccident?\n\nAny help much appreciated."
},
{
"role": "assistant",
"content": "You can't create two local branches or two distant branches with the same name.\n\nHere you have a local branch named remotes/origin/abc and a distant branch named abc on the remote origin. They have not the same name, but it seems to when you use the git branch --all command.\nTo identify which branch is which, you can show local branches with git branch, or show remote branches with git branch --remote. You could also easily differentiate them even while using git branch --all with the branch syntax coloration (git config --global color.branch auto).\nTo remove the accidentally created local branch abc, you have to do git branch -d abc (or git branch -D abc to force deletion, see man git-branch)."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to force GitLab to run a complete pipeline before starting a new one?\n\nI have one runner associated with my project to avoid concurrent build. GitLab to process the complete pipeline before start a new one?\nconcurrent is set to = 1 (config file of the runner)\nbefore_script:\n - echo %CI_COMMIT_SHA%\n - echo %CI_PROJECT_DIR%\n\nstages:\n - createPBLs\n - build\n - package\n\n\ncreate PBLs:\n stage: createPBLs\n script: \n - md \"C:\\HierBauen\\%CI_COMMIT_SHA%\\\"\n - xcopy /y /s \"C:/Bauen\" \"C:/HierBauen/%CI_COMMIT_SHA%\"\n - xcopy /y /s \"%CI_PROJECT_DIR%\" \"C:\\HierBauen\\%CI_COMMIT_SHA%\"\n - cd \"C:\\HierBauen\\%CI_COMMIT_SHA%\"\n - ./run_orcascript.cmd\n only:\n - tags\n - master\n\nbuild:\n stage: build\n script:\n - cd \"C:\\HierBauen\\%CI_COMMIT_SHA%\"\n - ./run_pbc.cmd\n only:\n - tags\n except:\n - master\n\nbuild_master:\n stage: build\n script:\n - cd \"C:\\HierBauen\\%CI_COMMIT_SHA%\"\n - ./run_pbcm.cmd\n only:\n - master\n\npackage:\n stage: package\n script:\n - cd \"C:\\HierBauen\\%CI_COMMIT_SHA%\"\n - ./cpfiles.cmd\n artifacts:\n expire_in: 1 week\n paths:\n - GitLab-Build\n name: \"%CI_COMMIT_REF_NAME%\"\n only:\n - tags\n - master\n\nUnfortunately, the earlier started pipeline is disturbed by a new started pipeline. As a result, the build is flawed at the end ...\nEDIT new config file:\nbefore_script:\n - echo %CI_BUILD_REF%\n - echo %CI_PROJECT_DIR%\n - xcopy /y /s \"C:/Bauen\" \"%CI_PROJECT_DIR%\"\n\nstages:\n - createPBLs\n - build\n - package\n\n\ncreate PBLs:\n stage: createPBLs\n script: \n - ./run_orcascript.cmd\n only:\n - tags\n - master\n\n\nbuild:\n stage: build\n script:\n - ./run_pbc.cmd\n only:\n - tags\n except:\n - master\n\n\nbuild_master:\n stage: build\n script:\n - ./run_pbcm.cmd\n\n\n\n only:\n - master\n\npackage:\n stage: package\n script:\n - ./cpfiles.cmd\n artifacts:\n expire_in: 1 week\n name: \"%CI_COMMIT_REF_NAME%\"\n paths:\n - GitLab-Build\n only:\n - tags\n - master"
},
{
"role": "assistant",
"content": "Currently there is no way for this, and there is an open issue at the moment on GitLab.\nWhat you can do instead is to add limit = 1 in your gitlab-runner config.toml file, which would enforce the gitlab-runner to only accept one job at a time.\nI see that you are not passing artifacts between your stages, but if your build stage, depended on anything in the createPBLs stage, you can use\na combination ofartifacts and dependencies to pass data between stages.\n\nFor example:\nbefore_script:\n - echo %CI_COMMIT_SHA%\n - echo %CI_PROJECT_DIR%\n\nstages:\n - createPBLs\n - build\n - package\n\n\ncreate PBLs:\n stage: createPBLs\n script: \n - md \"C:\\HierBauen\\%CI_COMMIT_SHA%\\\"\n - xcopy /y /s \"C:/Bauen\" \"C:/HierBauen/%CI_COMMIT_SHA%\"\n - xcopy /y /s \"%CI_PROJECT_DIR%\" \"C:\\HierBauen\\%CI_COMMIT_SHA%\"\n - cd \"C:\\HierBauen\\%CI_COMMIT_SHA%\"\n - ./run_orcascript.cmd\n artifacts:\n name: createPBLS_%CI_COMMIT_SHA%\n untracked: true\n expire_in: 1 day\n only:\n - tags\n - master\n\nbuild:\n stage: build\n script:\n - cd \"C:\\HierBauen\\%CI_COMMIT_SHA%\"\n - ./run_pbc.cmd\n dependencies:\n - createPBLs\n artifacts:\n name: build_%CI_COMMIT_SHA%\n untracked: true\n expire_in: 1 day\n only:\n - tags\n except:\n - master\n\nbuild_master:\n stage: build\n script:\n - cd \"C:\\HierBauen\\%CI_COMMIT_SHA%\"\n - ./run_pbcm.cmd\n dependencies:\n - createPBLs\n artifacts:\n name: build_%CI_COMMIT_SHA%\n untracked: true\n expire_in: 1 day\n only:\n - master\n\npackage:\n stage: package\n script:\n - cd \"C:\\HierBauen\\%CI_COMMIT_SHA%\"\n - ./cpfiles.cmd\n dependencies:\n - build_master\n artifacts:\n expire_in: 1 week\n paths:\n - GitLab-Build\n name: \"%CI_COMMIT_REF_NAME%\"\n only:\n - tags\n - master"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Invalid active developer path error after upgrading to El Capitan\nI ran into this error trying to push to git, when I typed git init.\n\nxcrun: error: invalid active developer path\n (/Library/Developer/CommandLineTools), missing xcrun at:\n /Library/Developer/CommandLineTools/usr/bin/xcrun\n\nI tried the following solutions.\nxcode-select —install\nsudo xcode-select -switch\nsudo xcode-select —install\nbrew doctor\nbrew update\nbrew upgrade\nbrew cleanup"
},
{
"role": "assistant",
"content": "This is all you need to do:\n$ xcode-select --install"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-diff - Show changes between commits, commit and working tree, etc Comparing with arbitrary commits"
},
{
"role": "assistant",
"content": "$ git diff test (1) $ git diff HEAD -- ./test (2) $ git diff HEAD^ HEAD (3) Instead of using the tip of the current branch, compare with the\ntip of \"test\" branch. Instead of comparing with the tip of \"test\" branch, compare with\nthe tip of the current branch, but limit the comparison to the\nfile \"test\". Compare the version before the last commit and the last commit."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "IntelliJ IDEA with Git remember author\nI'm using IntelliJ with a Git project, and have setup my user.name and user.email properly. The problem is when committing using the IDE interface the author is not selected by default. I can click and I get a dropdown to select it, but sometimes I forget to do that, and it's a pain to ammend the commit each time I forget.\nIs there a way to set the author automatically on commit, since it's only one, and it would save me some headaches?"
},
{
"role": "assistant",
"content": "IntelliJ IDEA doesn't pre-select author in the combobox which is a known cosmetic issue, however it should use the author defined in the git configuration by default.\nPlease double check that user.name and user.email is specified properly in the global git configuration.\nSome users mentioned a problem when using cygwin git, when IDEA probably cannot find the global git config. In this case it may help if you specify the user for the local project configuration:\ngit config --local user.name \"John Doe\"\ngit config --local user.email [email protected]"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Trigger Github Action only on new tags?\n\nIs there a possibility to trigger a GitHub action only if a new version (which comes with a new tag) is pushed? I don't want run them on every push into master, but I also want to avoid creating a release branch."
},
{
"role": "assistant",
"content": "Use the following syntax:\non:\n push:\n # Pattern matched against refs/tags\n tags: \n - '*' # Push events to every tag not containing /\n\nFor hierarchical tags:\non:\n push:\n # Pattern matched against refs/tags\n tags: \n - '**' # Push events to every tag including hierarchical tags like v1.0/beta\n\nhttps://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#patterns-to-match-branches-and-tags"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?\nI have a .diff file created by a coworker, and would like to apply the changes listed in that diff file to my local branch of the exact same repository. I do not have access to that worker's pc or branch that was used to generate this diff file.\nObviously I could go line by line and retype everything, but i'd rather not subject the system to human error. What's the easiest way to do this?"
},
{
"role": "assistant",
"content": "Copy the diff file to the root of your repository, and then do:\ngit apply yourcoworkers.diff\n\nMore information about the apply command is available on its man page.\nBy the way: A better way to exchange whole commits by file is the combination of the commands git format-patch on the sender and then git am on the receiver, because it also transfers the authorship info and the commit message.\nIf the patch application fails and if the commits the diff was generated from are actually in your repo, you can use the -3 option of apply that tries to merge in the changes.\nIt also works with Unix pipe as follows:\ngit diff d892531 815a3b5 | git apply"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "fatal: The current branch master has no upstream branch\n\nI'm trying to push one of my projects to github, and I keep getting this error:\npeeplesoft@jane3:~/846156 (master) $ git push\n\nfatal: The current branch master has no upstream branch.\nTo push the current branch and set the remote as upstream, use\n\n git push --set-upstream origin master\n\nSo I tried it and got this:\npeeplesoft@jane3:~/846156 (master) $ git push --set-upstream origin master\n\nfatal: Authentication failed\n\nAnother stackoverflow thread suggested I try the following, with disappointing results.\npeeplesoft@jane3:~/846156 (master) $ git push -u origin master\n\nfatal: Authentication failed\n\nThen I tried this:\npeeplesoft@jane3:~/846156 (master) $ git config remote.origin.push HEAD\n\npeeplesoft@jane3:~/846156 (master) $ git push\n\nfatal: Authentication failed\n\nAny hints?"
},
{
"role": "assistant",
"content": "You fixed the push, but, independently of that push issue (which I explained in \"Why do I need to explicitly push a new branch?\": git push -u origin master or git push -u origin --all), you need now to resolve the authentication issue.\nThat depends on your url (ssh as in '[email protected]/yourRepo, or https as in https://github.com/You/YourRepo)\nFor https url:\nIf your account is protected by the two-factor authentication, your regular password won't work (for https url), as explained here or here.\nSame problem if your password contains special character (as in this answer)\nIf https doesn't work (because you don't want to generate a secondary key, a PAT: personal Access Token), then you can switch to ssh, as I have shown here.\n\nAs noted by qwerty in the comments, you can automatically create the branch of same name on the remote with:\ngit push -u origin head \n\nWhy?\n\nHEAD (see your .git\\HEAD file) has the refspec of the currently checked out branch (for example: ref: refs/heads/master)\nthe default push policy is simple\n\nSince the refpec used for this push is head: (no destination), a missing :<dst> means to update the same ref as the <src> (head, which is a branch).\nThat won't work if HEAD is detached though.\n\nOr you can use Git 2.37 (Q3 2022) and the new global option push.autoSetupRemote:\ngit config --global push.autoSetupRemote true\ngit push"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Git refusing to merge unrelated histories on rebase\nDuring git rebase origin/development the following error message is shown from Git:\nfatal: refusing to merge unrelated histories\nError redoing merge 1234deadbeef1234deadbeef\n\nMy Git version is 2.9.0. It used to work fine in the previous version. \nHow can I continue this rebase allowing unrelated histories with the forced flag introduced in the new release?"
},
{
"role": "assistant",
"content": "You can use --allow-unrelated-histories to force the merge to happen.\nThe reason behind this is that default behavior has changed since Git 2.9:\n\n\"git merge\" used to allow merging two branches that have no common\nbase by default, which led to a brand new history of an existing\nproject created and then get pulled by an unsuspecting maintainer,\nwhich allowed an unnecessary parallel history merged into the\nexisting project. The command has been taught not to allow this by\ndefault, with an escape hatch --allow-unrelated-histories option\nto be used in a rare event that merges histories of two projects\nthat started their lives independently.\n\nSee the Git release changelog for more information.\nMore information can be found in this answer."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Get the difference between two branches in Git\nI did following (I simplified this comparing to a reality):\n\ncreated a branch Branch1, switched to it\nadded file File1 and modified existing file File2 and commited this\nfigured out that I don't need File1, removed it and commited this\n\nSo, the actual difference between original branch and Branch1 is only modification of File2.\nI want to get this actual difference between branches and put in Branch2. Generally speaking, I want to get rid of not necessary history of adding/removing File1."
},
{
"role": "assistant",
"content": "Let's assume that you started on the branch master. Then you can do:\ngit diff master Branch1 > ../patchfile\ngit checkout Branch2 \ngit apply ../patchfile\n\nAlternatively, if your goal is to rewrite history, then you could use an interactive rebase to squash commits."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Show just the current branch in Git\nIs there a Git command equivalent to:\ngit branch | awk '/\\*/ { print $2; }'"
},
{
"role": "assistant",
"content": "$ git rev-parse --abbrev-ref HEAD\nmaster\n\nThis should work with Git 1.6.3 or newer."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-config - Get and set repository or global options cumulative"
},
{
"role": "assistant",
"content": "Count changes in a child directory for the parent directory as well.\nNote that when using cumulative , the sum of the percentages\nreported may exceed 100%. The default (non-cumulative) behavior can\nbe specified with the noncumulative parameter."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Git author Unknown\nmy author name in all my commits is coming up as unknown https://github.com/freeenergy/Teacher-Login-Validation-Module\ndid this\n$ git config --global user.name \"Firstname Lastname\"Sets the name of the user for all git instances on the system\n$ git config --global user.email \"[email protected]\"\n\nbut still the author/committer name shows [unknown]\nnot knowing what I was doing I experimented with setting $ GIT_AUTHOR_NAME=\"my name\" and it changed my name to my username [freeenergy] (I.E. my issue was fixed.) But when I switched back to my other computer the issue was the same.\nmy config file now looks like this but is still committing as [unknown]\n[core]\n repositoryformatversion = 0\n filemode = false\n bare = false\n logallrefupdates = true\n symlinks = false\n ignorecase = true\n hideDotFiles = dotGitOnly\n[remote \"origin\"]\n url = [email protected]:freeenergy/my-project.git\n fetch = +refs/heads/*:refs/remotes/origin/*\n[user]\n name = my name\n email = myEmail.com"
},
{
"role": "assistant",
"content": "Even better than running git config, you can edit your ~/.gitconfig file directly. Look and see if there's a section for [user] with the relevant information. For example, my ~/.gitconfig has this...\n[user]\n name = Bob Gilmore\n email = [email protected]\n\n(There's no space in front of the [user], and single tabs in front of the name and email labels)\nIf it doesn't have those set properly, just go ahead and edit the .gitconfig file by hand."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Can I amend a commit made with VSCode to GitHub repo?\n\nI learn Git and Using VSCode and just learn the commit \"amend\" command and now trying it on origin (GitHub).\nI can't find any way to do this. Do I need some external tool to do that I don't see any \"push amend\" from the Git menu in VSCode"
},
{
"role": "assistant",
"content": "You can go to Commit -> choose Commit All(Amend) or Commit Staged(Amend). Take a look at the picture."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to delete or change directory of a cloned git repository on a local computer\nUsed git clone [url] to clone an open source project but it cloned to the \nC:\\Documents and Setings\\$USER\\project\nWhat I wanted to do is clone the project to C:\\project. I don't want to have duplicate project clones on my local machine.\nHow do I go about moving it to that location or deleting the existing repository(hopefully that's a correct term) and cloning it again?\nI assume after deleting I should use something like the following to clone it to the desired location?\n$ git clone [url] C:\\project"
},
{
"role": "assistant",
"content": "Just move it :)\ncommand line :\nmove \"C:\\Documents and Setings\\$USER\\project\" C:\\project\n\nor just drag the folder in explorer. \nGit won't care where it is - all the metadata for the repository is inside a folder called .git inside your project folder."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Relative Link to Repo's Root from Markdown file\n\nI need to have a relative link to root of my repo from markdown file\n(I need it working for any forks)\nSo it looks like the only way it's to provide a link to some file in the root:\nthe [Root](/README.md)\nor\nthe [Root](../README.md)\n(if it's located at /doc/README.md for instance)\nAt the same time I can refer to any folder without referring to a file\nthe [Doc](/doc)\nBut if I try to put a link to the root folder:\nthe [real root](/)\nthe [real root](../)\nI'll have a link such\nhttps://github.com/UserName/RepoName/blob/master\nwhich unlike the \nhttps://github.com/UserName/RepoName/blob/master/doc\nrefers to 404\nSo if I don't want to refer to README.md in the root (I could havn't it at all)\nIs there any way to have such a link?"
},
{
"role": "assistant",
"content": "After some research I've found this solution:\n[the real relative root of any fork](/../../)\nIt always points to the default branch. For me it's Ok, so it's up to you\nPS\nWith such a trick you can also access the following abilities:\n[test](/../../tree/test) - link to another branch\n[doc/readme.md](/../../edit/master/doc/readme.md) - open in editor\n[doc/readme.md](/../../delete/master/doc/readme.md) - ask to delete file\n[doc/readme.md](/../../commits/master/doc/readme.md) - history\n[doc/readme.md](/../../blame/master/doc/readme.md) - blame mode\n[doc/readme.md](/../../raw/master/doc/readme.md) - raw mode (will redirect)\n[doc/](/../../new/master/doc/) - ask to create new file\n[doc/](/../../upload/master/doc/) - ask to upload file\n[find](/../../find/test) - find file"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-config - Get and set repository or global options receive.maxInputSize"
},
{
"role": "assistant",
"content": "If the size of the incoming pack stream is larger than this\nlimit, then git-receive-pack will error out, instead of\naccepting the pack file. If not set or set to 0, then the size\nis unlimited."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Preferred Github workflow for updating a pull request after code review\nI've submitted a change to an Open Source project on Github, and received code review comments from one of the core team members.\nI would like to update the code taking into account the review comments, and re-submit it. What is the best workflow for doing this? From my limited knowledge of git/github, I could do any of the following:\n\nUpdate the code as a new commit, and add both the initial and updated commit to my pull request.\nSomehow (??) rollback the old commit from my repository, and create a single new commit containing everything, then raise a pull request for that?\ngit commit has an amend feature, but I've heard that you shouldn't use it after you've pushed the commit outside of your local repository? In this case I have made the change on my local PC and pushed to my github branch of the project. Would this be OK to use 'amend'?\nSomething else?\n\nIt seems like option 2/3 would be nice, as the open source project would only have one commit in their history which would implement everything, but I'm not sure how to do this.\nNote: I don't know if this affects the answer or not, but I didn't make the changes in a separate branch, I just did a commit on top of master"
},
{
"role": "assistant",
"content": "To update a pull request\nTo update a pull request (point #1), the only thing you need to do is checkout the same branch the pull request is from and push to it again:\ncd /my/fork\ngit checkout master\n...\ngit commit -va -m \"Correcting for PR comments\"\ngit push\n\nOptional - Cleaning commit history\nYou may be asked to squash your commits together so that the repository history is clean, or yourself want to remove intermediary commits which distract from \"the message\" in your pull request (point #2). For example if your commit history looks like this:\n$ git remote add parent [email protected]:other-user/project.git\n$ git fetch parent\n$ git log --oneline parent/master..master\ne4e32b8 add test case as per PR comments\neccaa56 code standard fixes as per PR comments\nfb30112 correct typos and fatal error\n58ae094 fixing problem\n\nIt's a good idea to squash things together so they appear as a single commit:\n$ git rebase -i parent/master \n\nThis will prompt you to choose how to rewrite the history of your pull request, the following will be in your editor:\npick 58ae094 fixing actual problem\npick fb30112 correct typos\npick eccaa56 code standard fixes\npick e4e32b8 add test case as per PR comments\n\nFor any commit you want to be part of the previous commit - change pick to squash:\npick 58ae094 fixing actual problem\nsquash fb30112 correct typos\nsquash eccaa56 code standard fixes\nsquash e4e32b8 add test case as per PR comments\n\nAnd close your editor. Git will then rewrite the history and prompt you to provide a commit message for the one combined commit. Amend accordingly and your commit history will now be concise:\n$ git log --oneline parent/master..master\n9de3202 fixing actual problem\n\nPush that to your fork:\n$ git push -f\nCounting objects: 19, done.\nDelta compression using up to 4 threads.\nCompressing objects: 100% (5/5), done.\nWriting objects: 100% (11/11), 978 bytes, done.\nTotal 11 (delta 9), reused 7 (delta 6)\nTo [email protected]:me/my-fork.git\n f1238d0..9de3202 HEAD -> master\n\nand your pull request will contain a single commit, incorporating all changes previously split into several commits.\nChanging history on public repos is a bad thing\nRewriting history and using git push -f on a branch that, potentially, someone else has already cloned is a bad thing - it causes the repository's history and that of the checkout to diverge.\nHowever, amending the history of your fork to correct the change you are proposing to be integrated into a repository - is a good thing. As such have no reservations squashing \"noise\" out of your pull requests.\nA note on branches\nIn the above I show the pull request as having come from the master branch of your fork, there's nothing wrong with that necessarily but it does create certain limitations such as, if this is your standard technique, only being able to have one PR open per repository. It's a better idea though to create a branch for each individual change you wish to propose:\n$ git branch feature/new-widgets\n$ git checkout feature/new-widgets\n...\nHack hack hack\n...\n$ git push\n# Now create PR from feature/new-widgets"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-for-each-ref - Output information on each ref"
},
{
"role": "assistant",
"content": "SYNOPSIS git for-each-ref [--count=<count>] [--shell|--perl|--python|--tcl]\n\t\t [(--sort=<key>)…] [--format=<format>]\n\t\t [--include-root-refs] [ --stdin | <pattern>… ]\n\t\t [--points-at=<object>]\n\t\t [--merged[=<object>]] [--no-merged[=<object>]]\n\t\t [--contains[=<object>]] [--no-contains[=<object>]]\n\t\t [--exclude=<pattern> …]"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-ls-files - Show information about files in the index and the working tree -o --others"
},
{
"role": "assistant",
"content": "Show other (i.e. untracked) files in the output"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Why is git pull showing new branches all the time?\nI'm using git bash for Windows:\n$ git version\ngit version 1.8.0.msysgit.0\n\nEverything has been working fine for months, I've been gradually getting used to how git works, then all of a sudden, git pull is retrieving a number of \"new\" branches each time I try to pull:\nme@MYPC /d/Projects/MyProject (master)\n$ git pull\nFrom github.com:ClientUsername/RepoName\n * [new branch] branch1 -> origin/branch1\n * [new branch] branch2 -> origin/branch2\nAlready up-to-date.\n\nme@MYPC /d/Projects/MyProject (master)\n$ git pull\nFrom github.com:ClientUsername/RepoName\n * [new branch] branch1 -> origin/branch1\n * [new branch] branch2 -> origin/branch2\nAlready up-to-date.\n\nHave I configured something incorrectly? Is this normal behavior?\n\nEDIT\nAfter some helpful comments, I deleted the branch files from .git\\refs\\remotes\\origin. I tried to pull again and got the following:\nme@MyPC /d/Projects/MyProject (master)\n$ git pull\nFrom github.com:ClientUsername/RepoName\n * [new branch] Branch1 -> origin/Branch1\n * [new branch] Branch2 -> origin/Branch2\n * [new branch] branch1 -> origin/branch1\n * [new branch] branch2 -> origin/branch2\nAlready up-to-date.\nme@MyPC /d/Projects/MyProject (master)\n$ git pull\nFrom github.com:ClientUsername/RepoName\n * [new branch] Branch1 -> origin/Branch1\n * [new branch] Branch2 -> origin/Branch2\nAlready up-to-date.\n\nThe only difference being the case of the branch names?"
},
{
"role": "assistant",
"content": "In my case, the issue was related to two branches having the same name (one uppercase, one lower case). Once I removed the \"duplicate\" branch from remote origin, I ran the following:\ngit fetch --prune origin\n\nand the [new branch] message stop showing after every pull. For documentation on prune see reference."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Bower install using only https?\nI am trying to set up Bower on a build server at our organization's data center, but git's port does not appear to be open on the data center's firewall. I can use the git command line client to clone via https://[repo], but not git://[repo].\nIs there a switch or preference which will instruct bower to perform git clone using https rather than the git protocol?\nI've looked at the source, and considered changing the resolution code to replace git:// with https://, but I figured I'd ask before I go to those lengths."
},
{
"role": "assistant",
"content": "You can make git replace the protocol for you. Just run:\ngit config --global url.\"https://\".insteadOf git://\n\nto use HTTPS protocol instead of Git."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Is there a single Git command to get the current tag, branch and commit?\nI'm currently using a collection of three commands to get the current tag, branch and the date and SHA1 of the most recent commit.\ngit describe --always --tag\ngit log -1 --format=\"%H%n%aD\"\ngit rev-parse --abbrev-ref HEAD\n\nWhich will output something like:\n1.2.3-5-gdeadbeef\ndeadbeef3b8d90071c24f51ac8f26ce97a72727b\nWed, 19 May 2010 09:12:34 +0200\nmaster\n\nTo be honest, I'm totally fine with this. But I'm using these commands from Maven and anyone who'd used Maven before, knows how much things like external commands bloat the POM. I just want to slim down my pom.xml and maybe reduce execution time a bit."
},
{
"role": "assistant",
"content": "git log is extremely flexible, with lots and lots of options. You might not be able to reproduce the exact output of the three commands above, but you might come close enough to achieve the effect you need.\nFor example:\ngit log --pretty=format:'%ad %h %d' --abbrev-commit --date=short -1\n\nproduces the date, SHA-1 and symbolic references (including tags) of the latest (HEAD) commit:\n\n2010-05-20 45bd5e7 (HEAD, origin/master) \n\nAfter which, presumably, sed and/or awk or maybe Maven-native methods can do the fine-tuning/polishing. Note that a particular tag is associated with a particular commit, so if it was three commits prior to HEAD that was tagged with, for example, \"v1.0.0\", you are not going to see \"v1.0.0\" showing up with the above.\nA simpler single command to provide a succint description of a commit is:\ngit describe\n\nwhich writes out the latest applicable tag, the number of commits since the tagged commit, and the SHA1:\n\nv3.3.0-46-g71a77dc\n\nI am not at all familiar with Maven, and have no idea how easy/difficult it is to run external processes, so am unsure whether any of the following help in any way, but I thought I might mention it just in case.\nFor the exact purpose that you describe, i.e. tagging builds, in an autoconf/automake framework, I actually use something like:\nBUILDTAG=\"`git symbolic-ref HEAD 2> /dev/null | cut -b 12-`-`git log --pretty=format:\\\"%h\\\" -1`\"\n\nwhich produces something suitable for tacking onto the end of a program path:\n\nmaster-c5282ff\n\nA more extended description, suitable for including as a comment or a printed identifier:\nBUILDDESC=\"$(git symbolic-ref HEAD 2> /dev/null | cut -b 12-)-$(git log --pretty=format:'%h, %ad' -1)\"\n\nproduces something like:\n\nmaster-c5282ff, Fri Mar 12 22:19:51 2010 -0600\n\n\nI think playing around with git log, possibly in conjunction with text processing tools/methods will get you what you want."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to get a count of all the files in a git repository?\nHow would you get a count of all the files currently in a git repository?"
},
{
"role": "assistant",
"content": "You can get a count of all tracked files in a git respository by using the following command:\ngit ls-files | wc -l\n\nCommand Breakdown:\n\nThe git ls-files command by itself prints out a list of all the tracked files in the repository, one per line.\nThe | operator funnels the output from the preceding command into the command following the pipe.\nThe wc -l command calls the word count (wc) program. Passing the -l flag asks it to return the total number of lines.\n\nNote: This returns a count of only the tracked files in the repository meaning that any ignored files or new & uncommitted files will not be counted."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-config - Get and set repository or global options remote.pushDefault"
},
{
"role": "assistant",
"content": "The remote to push to by default. Overrides branch.<name>.remote for all branches, and is overridden by branch.<name>.pushRemote for specific branches."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "What should I do when git revert aborts with an error message?\nOK, so I'm getting an error sometimes when I try to revert a commit (with Git). All that I do is\ngit revert <commit hash>\nand it gives me this message:\nerror: could not revert <commit hash> <commit message>\nhint: after resolving the conflicts, mark the corrected paths\nhint: with 'git add <paths>' or 'git rm <paths>'\n\nDoes this mean that I should use git mergetool and resolve any conflicts? Once I do this can I add/rm and then commit, and the revert is complete?"
},
{
"role": "assistant",
"content": "Yes you will have to resolve the conflicts, mark them as so with git add or git rm and git commit\nThe commit is not done yet, after the git revert - if you see .git/MERGE_MSG, you will see something like:\n\nRevert \"adding revert\"\nThis reverts commit\n c1366607f15a8384434948cb0bcbf8ece48bb460.\nConflicts:\nrevert\n\nSo once you resolved the merge and do a git commit you will be presented with the message from the MERGE_MSG file and you can commit and that completes the revert."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Have the same README both in Markdown and reStructuredText\n\nI have a project hosted on GitHub. For this I have written my README using the Markdown syntax in order to have it nicely formatted on GitHub.\nAs my project is in Python I also plan to upload it to PyPi. The syntax used for READMEs on PyPi is reStructuredText. \nI would like to avoid having to handle two READMEs containing roughly the same content; so I searched for a markdown to RST (or the other way around) translator, but couldn't find any. \nThe other solution I see is to perform a markdown/HTML and then a HTML/RST translation. I found some ressources for this here and here so I guess it should be possible.\nWould you have any idea that could fit better with what I want to do?"
},
{
"role": "assistant",
"content": "I would recommend Pandoc, the \"swiss-army knife for converting files from one markup format into another\" (check out the diagram of supported conversions at the bottom of the page, it is quite impressive). Pandoc allows markdown to reStructuredText translation directly. There is also an online editor here which lets you try it out, so you could simply use the online editor to convert your README files."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Can I restore deleted files (undo a `git clean -fdx`)?\nI was following the instructions on making github pages, and forgot to move down into my git sub directory. As a result, I just nuked an entire directory of documents with git clean -fdx.\nIs there any way I can undo this terrible mistake?"
},
{
"role": "assistant",
"content": "No. Those files are gone.\n(Just checked on Linux: git clean calls unlink(), and does not backup up anything beforehand.)"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Git pushing to a private repo\n\nI have been working on my local on a web app and I was ask to push it to an empty(only read me file on it) private repo created just for this project. I'm new to git and I'm having trouble doing so. \nCan someone tell me what am I doing wrong? \nI first navigate to the main folder of the app in my local using command line and initialize git. After, I try cloning the remote repo with:\ngit clone git://github.com/somename/Web-App.git\n\nbut I get the error:\n\nCloning into 'Web-App'... fatal: remote error: Repository not\n found.\n\nI know the repo is there.. Do I actually need to clone or pull from that remote first or is there a way to just push to that repo. \nAgain, all I'm trying to do is to get the files that I have in my local pushed to a specific repo that I was given access to. \nI will really appreciate any help."
},
{
"role": "assistant",
"content": "Let us say 'yourWebApp' is the folder you have your local web app. Change it to the directory\ncd 'yourWebApp'\n\nInit git in the folder\ngit init\n\nNow add your github url as a remote\ngit remote add origin git://github.com/somename/Web-App.git\n\nHere origin is the short name for your url\nNow pull the read me file from the github repo\n git pull origin master\n\nNow push your web app to the github repository\ngit push origin master\n\nHere it is assumed that you are in your master, the default branch\nHere pulling your readme files is necessary to merge the readme file with your local work. If your github repository is empty, you can skip the pull and directly push to your github repository.\nOn the other hand, if you want to use clone, there is no need to init as clone automatically sets up git in the directory. clone also sets your remote git url. In that case, your workflow should be\n git clone https://github.com/path/to/your/repo\n make some changes\n git add your changes\n git commit your changes\n git push"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-fetch - Download objects and refs from another repository --recurse-submodules-default=[yes|on-demand]"
},
{
"role": "assistant",
"content": "This option is used internally to temporarily provide a\nnon-negative default value for the --recurse-submodules\noption. All other methods of configuring fetch’s submodule\nrecursion (such as settings in gitmodules and git-config ) override this option, as does\nspecifying --[no-]recurse-submodules directly."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-config - Get and set repository or global options worktree"
},
{
"role": "assistant",
"content": "$GIT_DIR/config.worktree"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git: fatal: I don't handle protocol 'http'\nI copy and pasted an git clone command from a web page: https://fedorahosted.org/ibus-typing-booster/\nI got this:\nuser@host> git clone http://git.fedorahosted.org/git/ibus-typing-booster.git\n\nCloning into 'ibus-typing-booster'...\nfatal: I don't handle protocol 'http'"
},
{
"role": "assistant",
"content": "I copied and pasted the whole line git clone http://....\nThe character between git clone and http://... looks like a space, but it is a special Unicode character!\nShort answer: After removing this character, and entering a real space, it worked!\nFor people who love details: I see two ways to reveal ascii vs special-unicode-characters\nWay1: Python\nHere is the real line:\nvi t.txt # copy+paste the line\npython\nopen('t.txt').read()\ngit clone \\xe2\\x80\\x8b\\xe2\\x80\\x8bhttp://...\n\nWay2: less\nvi t.txt # copy+paste the line\nLESSCHARSET=ascii less vi.txt\n\nIf it looks like git clone <E2><80><8B><E2><80><8B>http://, then you copy+pasted special-unicode-characters."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Linking a single file from another git repository\nHow do you link a single file from another git repository to your own repository? I don't want the full repository, just a single file. Using git submodule seems like the right route to go, but it wants to grab the whole thing."
},
{
"role": "assistant",
"content": "Considering that the unit of work for git is a repository (or more precisely a repository content), I don't think you can easily integrate one file.\nIf you don't need its history, you could consider simply copy it in your repo.\nBut if you do need the history, then some git filter-branch (as in \"git: How to split off library from project? filter-branch, subtree?\") are in order. That seems a lot of effort for just one file though.\nIn theory, \"git: symlink/reference to a file in an external repository\" suggests a solution combining submodule and symlink.\n(from Pavel Šimerda)\n$ git submodule add /url/submodule/<reponame>\n$ ln -s <reponame>/path/to/<linked_file>\n$ git add .gitmodules <linked_file>\n$ git commit -m \"add a symbolic link to <linked_file> with the respective submodule\"\n\nSince 2011 (original answer above), Gavriel reports in the comments that:\n\n\nWhen I checkout the main repo, the linked file is not a symlink, but instead the file content is \"<reponame>/path/to/<linked_file>\". \n In other words git commits the symlink's target as file content\nBut the basic idea works.\n I use \"submodule/path/to/file\" instead of \"file\" and it works"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "ssh: Could not resolve hostname github.com: Name or service not known; fatal: The remote end hung up unexpectedly\nThe process of setting up a GitHub account works just fine but it doesn't work when I try pushing my repository to GitHub. The error message it shows is as follows:\nssh: Could not resolve hostname github.com: Name or service not known\nfatal: The remote end hung up unexpectedly\n\nI have tried changing RSA keys and all but still getting error.\nWhat causes this error?"
},
{
"role": "assistant",
"content": "Recently, I have seen this problem too. Below, you have my solution:\n\nping github.com, if ping failed. it is DNS error.\nsudo vim /etc/resolv.conf, the add:\nnameserver 8.8.8.8\nnameserver 8.8.4.4\n\nOr it can be a genuine network issue. Restart your network-manager using sudo service network-manager restart or fix it up"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "fatal: NullReferenceException encountered when interacting with remote\nThis is new machine with fresh install of Git.\n> git --version\ngit version 2.19.1.windows.1\n\nI cloned repo using https. Every time when I try to talk to remote I get this.\n> git pull\nfatal: NullReferenceException encountered.\nObject reference not set to an instance of an object.\nfatal: NullReferenceException encountered.\nObject reference not set to an instance of an object.\n\nI tried uninstalling and installing git again. I also cloned same repo to different directory on disk but none of this helped.\nWhen I go to web UI of my BitBucket, there is 2FA enabled. I don't know if this has anything to do with my problem."
},
{
"role": "assistant",
"content": "The reason for this is that the Git Credential Manager (GCM) that is distributed with Git 2.19.1 needs to be updated.\nThe release of Git 2.19.1 says:\n\nComes with Git Credential Manager v1.18.0.\n\nAnd when we look at GCM 1.18.1 (the next version) release notes:\n\nFixes Null Reference exceptions when parameters or contentType are not populated\n\n(Edit 23. Nov 2018): As @pgsandstrom says in the comment, Git has released a new version that also contains a newer GCM. You can download it here: Git Releases.\n\n(Rest is old version before 23. Nov 2018))\nThe interim fix, until Git releases a new version with the updated GCM is to simply install the new version of Git Credential Manager yourself.\nSo go download the latest version from here and install it and it should fix your issues.\n\nNote that it is not clear to me whether this is a fault introduced by Git (ie. it fails to populate the parameter or contentType), or that it is a fault introduced by GCM. All I know is that Git has not released a new version that fixes the issue but GCM has."
}
] |