messages
listlengths
3
3
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Compiler error - msgfmt command not found\nI'm trying to update Git from my shared hosting. For that I'm following these steps:\n\nDownload latest Git version\nUnpack and place it on the server\nConfigure and create the Makefile -> ./configure --prefix=$HOME/dev/git/src --without-tcltk\nBuild the package -> make then make install\nUpdate PATH .bash_profile\n\nI'm stuck at point 4. When I run the make command, I get the following:\nuser@ssh1:~/dev/git/src$ make\nSUBDIR gitweb\nSUBDIR ../\nmake[2]: ? GIT-VERSION-FILE ? est ? jour.\nGEN git-instaweb\nSUBDIR perl\nSUBDIR git_remote_helpers\nSUBDIR templates\nMSGFMT po/build/locale/is/LC_MESSAGES/git.mo\n/bin/sh: msgfmt: command not found\nmake: *** [po/build/locale/is/LC_MESSAGES/git.mo] Erreur 127\n\nCompiler throws a msgfmt command not found error.\nI Googled it and it seems to be related to the gettext package.\nAny idea how to fix that error on a shared hosting?" }, { "role": "assistant", "content": "I had the same issue. Thanks to your work on finding it was related to gettext, a simple apt-get install gettext fixed it for me." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-branch - List, create, or delete branches --recurse-submodules" }, { "role": "assistant", "content": "THIS OPTION IS EXPERIMENTAL! Causes the current command to\nrecurse into submodules if submodule.propagateBranches is\nenabled. See submodule.propagateBranches in git-config . Currently, only branch creation is\nsupported. When used in branch creation, a new branch <branchname> will be created\nin the superproject and all of the submodules in the superproject’s\n<start-point>. In submodules, the branch will point to the submodule\ncommit in the superproject’s <start-point> but the branch’s tracking\ninformation will be set up based on the submodule’s branches and remotes\ne.g. git branch --recurse-submodules topic origin/main will create the\nsubmodule branch \"topic\" that points to the submodule commit in the\nsuperproject’s \"origin/main\", but tracks the submodule’s \"origin/main\"." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-config - Get and set repository or global options feature.*" }, { "role": "assistant", "content": "The config settings that start with feature. modify the defaults of\na group of other config settings. These groups are created by the Git\ndeveloper community as recommended defaults and are subject to change.\nIn particular, new config options may be added with different defaults." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-rev-list - Lists commit objects in reverse chronological order --bisect-all" }, { "role": "assistant", "content": "This outputs all the commit objects between the included and excluded\ncommits, ordered by their distance to the included and excluded\ncommits. Refs in refs/bisect/ are not used. The farthest\nfrom them is displayed first. (This is the only one displayed by --bisect .) This is useful because it makes it easy to choose a good commit to\ntest when you want to avoid to test some of them for some reason (they\nmay not compile for example). This option can be used along with --bisect-vars , in this case,\nafter all the sorted commit objects, there will be the same text as if --bisect-vars had been used alone." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to .gitignore all files/folder in a folder, but not the folder itself? [duplicate]\nThis question already has answers here:\n \n \n\n\n\n\nHow do I add an empty directory to a Git repository?\n\n (37 answers)\n \n\nClosed 3 years ago.\n\n\n\nI want to check in a blank folder to my Git repository. Effectively, I need to ignore all of the files and folders within the folder, but not the folder itself. How can I do this? What should I put in my .gitignore file?\nFor those wondering why I would want to do this, I have an \"upload\" directory in my repository. I want to commit the blank directory, but without all the contents." }, { "role": "assistant", "content": "Put this .gitignore into the folder, then git add .gitignore.\n*\n!.gitignore\n\nThe * line tells git to ignore all files in the folder, but !.gitignore tells git to still include the .gitignore file. This way, your local repository and any other clones of the repository all get both the empty folder and the .gitignore it needs." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to import an existing bare git repository into Gitlab?\n\nI import my bare git repository into Gitlab as described as here , because it was not recognized as an git repository, but creates a 94K big 'empty' repo (the original is 2,8GB big):\n$ bundle exec rake gitlab:import:repos RAILS_ENV=production\nfatal: Not a git repository (or any of the parent directories): .git\nProcessing test.git\nINFO: Sidekiq client using redis://localhost:6379 with options:namespace=>\"resque:gitlab\"}\n * Created test (test.git)\nDone!\n\nAs a workaround I replace the empty project folder (which was created by import trial) with my bare repo. Afterwards I tree to clone the repo from remote and get the following error:\n$ git clone [email protected]:...test.git\nCloning into 'test'\nfatal: '...test.git' does not appear to be a git repository\nfatal: Could not read from remote repository.\n\nPlease make sure you have the correct access rights\nand the repository exists.\n\nBut the git user should have all rights which are needed. -Maybe I have something overlooked?\nMy System: RHEL6.3, Git 1.8.3.4, Gitlab5.3.\nDoes Gitlab need a normal repository (non-bare)? Or what could be my problem?" }, { "role": "assistant", "content": "Does Gitlab need a normal repository (non-bare)?\n\nNo, all repos managed by gitlab are bare repos.\nYou should see:\n/home/git/repositories/user1/repo1.git\n/home/git/repositories/user1/repo2.git\n/home/git/repositories/greoup1/repo3.git\n...\n\nMake sure the rights of your test.git folder (and bare repo files within it) are the same than the existing bare repos under /home/git/repositories/.\nIf the import doesn't work, then \"replace the empty project folder (which was created by import trial) with my bare repo\" should.\nBut: you need to make sure any hook which was in the empty bare repo created by GitLab (in ~git/repositories/arepo.git/hooks) is copied over your full bare repo replacing the empty one (same path).\nCheck also what was in ~git/repositories/arepo.git/info and ~git/repositories/arepo.git/config \nTo debug, try first to clone the empty bare repo created by GitLab during the failed import.\nThen replace it with your own, double-check the hooks and try again.\n\nAs mentioned by the OP and documented in GitLab \"Trouble Shooting Guide\", the correct ssh url is:\n[email protected]:repositories/mygroup/proj1.git\n\nwith :repositories mentioned.\n\nTo import bare repos (as mentioned by Sytse Sijbrandij below and in raketasks/import.md)\n\ncopy your bare repos under git repos_path (see config/gitlab.yml gitlab_shell -> repos_path)\nrun the command below\nbundle exec rake gitlab:import:repos RAILS_ENV=production" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to view the git history of a specific file using GitKraken similar to PhpStorm/WebStorm\nI DON'T care about looking at the git history of a file that has been marked as \"modified\". \nWhat I want is something akin to what WebStorm/PhpStorm have where you can select any file in your project (modified or NOT) and inspect it's git history and all the changes to that file.\nI also DON'T want to have to look down the list of the git tree, and click on each one to see which files were commited." }, { "role": "assistant", "content": "You can use the fuzzy finder in GitKraken to accomplish this.\nWhile in the repository\n\nPress control/cmd + p\nType history\nEnter in the filename you wish to view the history of" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git - the stupid content tracker git-merge-one-file" }, { "role": "assistant", "content": "The standard helper program to use with git-merge-index" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Git submodule fails with Could not access submodule\n\nOperating system: Linux\ngit version: 2.26.2\nGit repo provider of my repo: gitlab\nRepo provider of the failing submodules: Github\n.gitmodules\n[submodule \"libraries/stb\"]\n path = libraries/stb\n url = https://github.com/nothings/stb.git\n branch = master\n[submodule \"libraries/harfbuzz\"]\n path = libraries/harfbuzz\n url = https://github.com/harfbuzz/harfbuzz.git\n branch = master\n[submodule \"libraries/shaderc\"]\n path = libraries/shaderc\n url = https://github.com/google/shaderc.git\n branch = master\n[submodule \"libraries/freetype2\"]\n path = libraries/freetype2\n url = https://github.com/aseprite/freetype2.git\n branch = master\n[submodule \"libraries/VulkanMemoryAllocator\"]\n path = libraries/VulkanMemoryAllocator\n url = https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator.git\n branch = master\n[submodule \"libraries/googletest\"]\n path = libraries/googletest\n url = https://github.com/google/googletest.git\n branch = master\n[submodule \"libraries/Eigen\"]\n path = libraries/Eigen\n url = https://gitlab.com/libeigen/eigen.git\n branch = master\n[submodule \"libraries/benchmark\"]\n path = libraries/benchmark\n url = https://github.com/google/benchmark.git\n[submodule \"libraries/rapidcheck\"]\n path = libraries/rapidcheck\n url = https://github.com/emil-e/rapidcheck.git\n branch = master\n[submodule \"libraries/magic_get\"]\n path = libraries/magic_get\n url = https://github.com/apolukhin/magic_get.git\n branch = master\n\ncommand and output:\ngit pull --recurse-submodules=true\n\nFetching submodule libraries/Eigen\nFetching submodule libraries/VulkanMemoryAllocator\nFetching submodule libraries/benchmark\nFetching submodule libraries/freetype2\nFetching submodule libraries/googletest\nFetching submodule libraries/harfbuzz\nCould not access submodule 'libraries/magic_get'\nCould not access submodule 'libraries/rapidcheck'\nCould not access submodule 'libraries/shaderc'\nCould not access submodule 'libraries/stb'\n\ngit submodule status:\ngit submodule status \n a145e4adf5e71391d64c0ab150a8c26851cf332d libraries/Eigen (before-git-migration-159-ga145e4adf)\n 755fd47121ce0c77ef11818e4987790ae99c2eba libraries/VulkanMemoryAllocator (v2.1.0-334-g755fd47)\n d3ad0b9d11c190cb58de5fb17c3555def61fdc96 libraries/benchmark (v1.5.0-56-gd3ad0b9)\n fbbcf50367403a6316a013b51690071198962920 libraries/freetype2 (VER-2-10-0)\n dcc92d0ab6c4ce022162a23566d44f673251eee4 libraries/googletest (release-1.8.0-2331-gdcc92d0a)\n 89ad3c6cc520517af15174391a9725e634929107 libraries/harfbuzz (2.6.5-71-g89ad3c6c)\n\ngit tree\ngit ls-tree -r HEAD\n160000 commit a145e4adf5e71391d64c0ab150a8c26851cf332d Eigen\n160000 commit 755fd47121ce0c77ef11818e4987790ae99c2eba VulkanMemoryAllocator\n160000 commit d3ad0b9d11c190cb58de5fb17c3555def61fdc96 benchmark\n160000 commit fbbcf50367403a6316a013b51690071198962920 freetype2\n160000 commit dcc92d0ab6c4ce022162a23566d44f673251eee4 googletest\n160000 commit 89ad3c6cc520517af15174391a9725e634929107 harfbuzz\n160000 commit 762a4ec1f4458a84bc19cd6efc1e993add90ec95 libigl\n160000 commit 03afd0b83ce67062a105cfcbe80bbca152743f0a magic_get\n160000 commit 7bc7d302191a4f3d0bf005692677126136e02f60 rapidcheck\n160000 commit 011139094ec790ff7f32ea2d80286255fc9ed18b shaderc\n160000 commit b42009b3b9d4ca35bc703f5310eedc74f584be58 stb\n\n\nThis used to work about 6 months ago" }, { "role": "assistant", "content": "Just in case, make sure all submodules are initialized:\ngit submodule update --init --recursive\n\nThen, try the pull --recurse-submodules=true again.\nSomehow, activating the traces improve the situation:\ngit -c trace2.eventTarget=1 pull --recurse-submodules=true" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-read-tree - Reads tree information into the index -u" }, { "role": "assistant", "content": "After a successful merge, update the files in the work\ntree with the result of the merge." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to clone git repository with specific revision/changeset?\nHow can I clone git repository with specific revision, something like I usually do in Mercurial:\nhg clone -r 3 /path/to/repository" }, { "role": "assistant", "content": "$ git clone $URL\n$ cd $PROJECT_NAME\n$ git reset --hard $SHA1\n\nTo again go back to the most recent commit\n$ git pull\n\n\nTo save online (remote) the reverted commit, you must to push enforcing origin:\ngit push origin -f" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to add empty spaces into MD markdown readme on GitHub?\n\nI'm struggling to add empty spaces before the string starts to make my GitHub README.md looks something like this:\n\nRight now it looks like this:\n\nI tried adding <br /> tag to fix the new string start, now it works, but I don't understand how to add spaces before the string starts without changing everything to &nbsp;. Maybe there's a more elegant way to format it?" }, { "role": "assistant", "content": "You can use <pre> to display all spaces & blanks you have typed. E.g.:\n<pre>\nhello, this is\n just an example\n....\n</pre>" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git pull error :error: remote ref is at but expected\nFull message:\nerror: Ref refs/remotes/origin/user is at 3636498c2ea7735fdcedc9af5ab3c8689e6abe77 but expected a21359c6cc2097c85775cde6a40105f4bd7100ec\nFrom github.com:{github project url}\n ! a21359c..6273ffc user -> origin/user (unable to update local ref)" }, { "role": "assistant", "content": "Permanent Fix\ngit update-ref -d resolved my instance of this error, e.g.\ngit update-ref -d refs/remotes/origin/user\n\nNote that this doesn't impact remote.\nIn my case, a subsequent git fetch fetched that branch again, and following git fetches/pulls no longer gave the error \"remote ref is at but expected\".\nIf that doesn't work, a temporary fix:\nNote also that if you don't care about the branch in question (e.g. you just want to update master, not origin/user), a git pull workaround is to fetch then just merge the particular branch you care about, e.g.\ngit fetch # may give an error for a particular branch, but other branches will still be successfully fetched\ngit merge origin/master" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Can I get a list of files marked --assume-unchanged?\nWhat have I marked as --assume-unchanged? Is there any way to find out what I've tucked away using that option?\nI've dug through the .git/ directory and don't see anything that looks like what I'd expect, but it must be somewhere. I've forgotten what I marked this way a few weeks ago and now I need to document those details for future developers." }, { "role": "assistant", "content": "You can use git ls-files -v. If the character printed is lower-case, the file is marked assume-unchanged.\nTo print just the files that are unchanged use:\ngit ls-files -v | grep '^[[:lower:]]'\n\nTo embrace your lazy programmer, turn this into a git alias. Edit your .gitconfig file to add this snippet:\n[alias]\n ignored = !git ls-files -v | grep \"^[[:lower:]]\"\n\nNow typing git ignored will give you output like this:\nh path/to/ignored.file\nh another/ignored.file" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "This repository is over its data quota. Account responsible for LFS bandwidth should purchase more data packs to restore access\n\nH!\nI installed LFS in my github repository to track my *.csv files but when someone else tried to upload other csv and I wanted to make the pull of my repository this was the result\nThis repository is over its data quota. Account responsible for\nLFS bandwidth should purchase more data packs to restore access.\n\nMy question is How can I recover the access to my repository, it doesn´t matter if I can not use anymore LFS I will move my csv files to other place, I just want to recover the access to my github repository and being able to push and pull." }, { "role": "assistant", "content": "Go to your repo settings.\nScroll down to the archives section.\nCheck on the checkbox of Include Git LFS objects in archives.\nThen try to push from locally again." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-config - Get and set repository or global options notes.rewrite.<command>" }, { "role": "assistant", "content": "When rewriting commits with <command> (currently amend or rebase ), if this variable is false , git will not copy\nnotes from the original to the rewritten commit. Defaults to true . See also \" notes.rewriteRef \" below. This setting can be overridden with the GIT_NOTES_REWRITE_REF environment variable, which must be a colon separated list of refs or\nglobs." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "What are the relative strengths and weaknesses of Git, Mercurial, and Bazaar? [closed]\nAs it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.\n \n \n\n\n\nClosed 11 years ago.\n\n\n\nWhat do folks here see as the relative strengths and weaknesses of Git, Mercurial, and Bazaar?\nIn considering each of them with one another and against version control systems like SVN and Perforce, what issues should be considered?\nIn planning a migration from SVN to one of these distributed version control systems, what factors would you consider?" }, { "role": "assistant", "content": "Git is very fast, scales very well, and is very transparent about its concepts. The down side of this is that it has a relatively steep learning curve. A Win32 port is available, but not quite a first-class citizen. Git exposes hashes as version numbers to users; this provides guarantees (in that a single hash always refers to the exact same content; an attacker cannot modify history without being detected), but can be cumbersome to the user. Git has a unique concept of tracking file contents, even as those contents move between files, and views files as first-level objects, but does not track directories. Another issue with git is that has many operations (such as rebase) which make it easy to modify history (in a sense -- the content referred to by a hash will never change, but references to that hash may be lost); some purists (myself included) don't like that very much.\nBazaar is reasonably fast (very fast for trees with shallow history, but presently scales poorly with history length), and is easy-to-learn to those familiar with the command-line interfaces of traditional SCMs (CVS, SVN, etc). Win32 is considered a first-class target by its development team. It has a pluggable architecture for different components, and replaces its storage format frequently; this allows them to introduce new features (such as better support for integration with revision control systems based on different concepts) and improve performance. The Bazaar team considers directory tracking and rename support first-class functionality. While globally unique revision-id identifiers are available for all revisions, tree-local revnos (standard revision numbers, more akin to those used by svn or other more conventional SCMs) are used in place of content hashes for identifying revisions. Bazaar has support for \"lightweight checkouts\", in which history is kept on a remote server instead of copied down to the local system and is automatically referred to over the network when needed; at present, this is unique among DSCMs.\nBoth have some form of SVN integration available; however, bzr-svn is considerably more capable than git-svn, largely due to backend format revisions introduced for that purpose. [Update, as of 2014: The third-party commercial product SubGit provides a bidirectional interface between SVN and Git which is comparable in fidelity to bzr-svn, and considerably more polished; I strongly recommend its use over that of git-svn when budget and licensing constraints permit].\nI have not used Mercurial extensively, and so cannot comment on it in detail -- except to note that it, like Git, has content-hash addressing for revisions; also like Git, it does not treat directories as first-class objects (and cannot store an empty directory). It is, however, faster than any other DSCM except for Git, and has far better IDE integration (especially for Eclipse) than any of its competitors. Given its performance characteristics (which lag only slightly behind those of Git) and its superior cross-platform and IDE support, Mercurial may be compelling for teams with significant number of win32-centric or IDE-bound members.\nOne concern in migrating from SVN is that SVN's GUI frontends and IDE integration are more mature than those of any of the distributed SCMs. Also, if you currently make heavy use of precommit script automation with SVN (ie. requiring unit tests to pass before a commit can proceed), you'll probably want to use a tool similar to PQM for automating merge requests to your shared branches.\nSVK is a DSCM which uses Subversion as its backing store, and has quite good integration with SVN-centric tools. However, it has dramatically worse performance and scalability characteristics than any other major DSCM (even Darcs), and should be avoided for projects which are liable to grow large in terms of either length of history or number of files.\n[About the author: I use Git and Perforce for work, and Bazaar for my personal projects and as an embedded library; other parts of my employer's organization use Mercurial heavily. In a previous life I built a great deal of automation around SVN; before that I have experience with GNU Arch, BitKeeper, CVS and others. Git was quite off-putting at first -- it felt like GNU Arch inasmuch as being a concept-heavy environment, as opposed to toolkits built to conform to the user's choice of workflows -- but I've since come to be quite comfortable with it]." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-grep - Print lines matching a pattern -l --files-with-matches --name-only -L --files-without-match" }, { "role": "assistant", "content": "Instead of showing every matched line, show only the\nnames of files that contain (or do not contain) matches.\nFor better compatibility with git diff , --name-only is a\nsynonym for --files-with-matches ." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-diff-index - Compare a tree to the working tree or index --ignore-space-at-eol" }, { "role": "assistant", "content": "Ignore changes in whitespace at EOL." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-grep - Print lines matching a pattern --no-textconv" }, { "role": "assistant", "content": "Do not honor textconv filter settings.\nThis is the default." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-send-email - Send a collection of patches as emails --reply-to=<address>" }, { "role": "assistant", "content": "Specify the address where replies from recipients should go to.\nUse this if replies to messages should go to another address than what\nis specified with the --from parameter." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to abort an interactive rebase if --abort doesn't work?\nI've got myself into a muddle via an interactive rebase, and I now wish to abort it. (i.e. go back to the point before I was dropped into interactive rebase mode, in my case via git pull --rebase.) The way to do this seems to be via git rebase --abort, but this doesn't work:\n$ git rebase --abort\nerror: Ref refs/heads/master is at 55b388c141b1485b1acd9e050dbeb0eb90ef2ee7 but\nexpected b918ac16a33881ce00799bea63d9c23bf7022d67\nfatal: Cannot lock the ref 'refs/heads/master'.\nCould not move back to refs/heads/master\n\nHow can I get out of interactive rebase mode, and clean up all references to it? (git reset --hard succeeds, but doesn't drop me out of rebase mode.)" }, { "role": "assistant", "content": "Try to follow the advice you see on the screen, and first reset your master's HEAD to the commit it expects.\ngit update-ref refs/heads/master b918ac16a33881ce00799bea63d9c23bf7022d67\n\nThen, abort the rebase again." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How do you open SourceTree from the command line?\nIs there a quick and easy way to open a git repository in SourceTree from the command line? \nI do a lot of git work from Terminal, but sometimes there's no replacement for a good history view/diff. Would love to be able to open without using bookmarks." }, { "role": "assistant", "content": "Installing the SourceTree Command Line Tools will provide you with the stree command. This will allow you to open the current directory in SourceTree.\n\nYou can also specify a particular path to a repo\nstree ~/my-repo-in-another-folder\n\n\nIf installing command-line tools isn't an option for whatever reason, you can also do the following:\nopen -a SourceTree path-to-file\n\nand maybe set up an alias in .bashrc or .zshrc\nalias sourcetree='open -a SourceTree'\n\nFor those who are using SourceTree 3\nalias sourcetree='open -a SourceTree\\ 3'" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-bugreport - Collect information for user to file a bug report -s <format> --suffix <format> --no-suffix" }, { "role": "assistant", "content": "Specify an alternate suffix for the bugreport name, to create a file\nnamed git-bugreport-<formatted-suffix> . This should take the form of a\nstrftime(3) format string; the current local time will be used. --no-suffix disables the suffix and the file is just named git-bugreport without any disambiguation measure." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-diff - Show changes between commits, commit and working tree, etc -X[<param1,param2,…​>] --dirstat[=<param1,param2,…​>]" }, { "role": "assistant", "content": "Output the distribution of relative amount of changes for each\nsub-directory. The behavior of --dirstat can be customized by\npassing it a comma separated list of parameters.\nThe defaults are controlled by the diff.dirstat configuration\nvariable (see git-config ).\nThe following parameters are available: changes Compute the dirstat numbers by counting the lines that have been\nremoved from the source, or added to the destination. This ignores\nthe amount of pure code movements within a file. In other words,\nrearranging lines in a file is not counted as much as other changes.\nThis is the default behavior when no parameter is given. lines Compute the dirstat numbers by doing the regular line-based diff\nanalysis, and summing the removed/added line counts. (For binary\nfiles, count 64-byte chunks instead, since binary files have no\nnatural concept of lines). This is a more expensive --dirstat behavior than the changes behavior, but it does count rearranged\nlines within a file as much as other changes. The resulting output\nis consistent with what you get from the other --*stat options. files Compute the dirstat numbers by counting the number of files changed.\nEach changed file counts equally in the dirstat analysis. This is\nthe computationally cheapest --dirstat behavior, since it does\nnot have to look at the file contents at all. cumulative 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. <limit> An integer parameter specifies a cut-off percent (3% by default).\nDirectories contributing less than this percentage of the changes\nare not shown in the output. Example: The following will count changed files, while ignoring\ndirectories with less than 10% of the total amount of changed files,\nand accumulating child directory counts in the parent directories: --dirstat=files,10,cumulative ." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-rebase - Reapply commits on top of another base tip --ignore-whitespace" }, { "role": "assistant", "content": "Ignore whitespace differences when trying to reconcile\ndifferences. Currently, each backend implements an approximation of\nthis behavior: apply backend When applying a patch, ignore changes in whitespace in context\nlines. Unfortunately, this means that if the \"old\" lines being\nreplaced by the patch differ only in whitespace from the existing\nfile, you will get a merge conflict instead of a successful patch\napplication. merge backend Treat lines with only whitespace changes as unchanged when merging.\nUnfortunately, this means that any patch hunks that were intended\nto modify whitespace and nothing else will be dropped, even if the\nother side had no changes that conflicted." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Git master branch has no upstream branch\n\nI'm trying to push one of my projects to github, and I keep getting this error:\nfatal: The current branch master has no upstream branch.\n\nI've never seen this before. I re-initialized my git, re-added my origin, deleted and re-made the repo, and recreated my SSH key." }, { "role": "assistant", "content": "Instead of creating a new repository on Github, cloning that, or reinitializing your local repository, the following command would have been sufficient:\ngit push -u origin master\n\norigin stands for the remote name (default is origin),\nmaster is the branch you want to push, in your case it's master, otherwise you would have to change that in the command.\n-u means, that your local branch will be setup to track the new created master branch on the origin repository (the master on the origin will be the upstream branch of your local branch). If the branch master doesn't exist on the remote repository, it will be created, otherwise it will be updated (the -u works no matter if it exists or not)." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Get changes from another branch without affecting current branch at all\nIs there a simple way to get changes from another branch without merge or rebase. And keep those changes as untracked (for new files) or not staged for commit (for existing files)?" }, { "role": "assistant", "content": "do a merge to get the change then cancel the merge but keep modification:\ngit merge --no-ff feature\ngit reset HEAD~1" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "`docker pull` returns `denied: access forbidden` from private gitlab registry\n\nI have a Dockerfile which is going to be implemented FROM a private registry's image. I build this file without any problem with Docker version 1.12.6, build 78d1802 and docker-compose version 1.8.0, build unknown, but in another machine which has Docker version 17.06.1-ce, build 874a737 and docker-compose version 1.16.1, build 6d1ac21, the docker-compose build returns:\nFROM my.private.gitlab.registry:port/image:tag\nhttp://my.private.gitlab.registry:port/v2/docker/image/manifests/tag: denied: access forbidden\n\ndocker pull my.private.gitlab.registry:port/image:tag returns the same. \nNotice that I tried to get my.private.registry:port/image:tag and http://my.private.registry:port/v2/docker/image/manifests/tag has been catched." }, { "role": "assistant", "content": "If this is an authenticated registry, then you need to run docker login <registryurl> on the machine where you are building this.\nThis only needs to be done once per host. The command then caches the auth in a file\n$ cat ~/.docker/config.json\n{\n \"auths\": {\n \"https://index.docker.io/v1/\": {\n \"auth\": \"......=\"\n }\n }\n}" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-config - Get and set repository or global options --name-only" }, { "role": "assistant", "content": "Output only the names of config variables for --list or --get-regexp ." } ]
[ { "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 -x <pattern> --exclude=<pattern>" }, { "role": "assistant", "content": "Skip untracked files matching pattern.\nNote that pattern is a shell wildcard pattern. See EXCLUDE PATTERNS\nbelow for more information." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-log - Show commit logs --color-words[=<regex>]" }, { "role": "assistant", "content": "Equivalent to --word-diff=color plus (if a regex was\nspecified) --word-diff-regex=<regex> ." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-config - Get and set repository or global options gpg.<format>.program" }, { "role": "assistant", "content": "Use this to customize the program used for the signing format you\nchose. (see gpg.program and gpg.format ) gpg.program can still\nbe used as a legacy synonym for gpg.openpgp.program . The default\nvalue for gpg.x509.program is \"gpgsm\" and gpg.ssh.program is \"ssh-keygen\"." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "GitHub: How can I close the two issues with commit message?\n\nI try \ngit commit -m \"example of coding - close #1 close #2\" \ngit push origin develop\n\nbut it only close #1 issue. How can I close two or more issues with commit message?" }, { "role": "assistant", "content": "You can use any of these keywords to close an issue via commit message:\nclose, closes, closed, fix, fixes, fixed, resolve, resolves, resolved\n\nThe message MUST contain a string matching the following pattern: KEYWORD #ISSUE. For example: close #1.\n\nHow can I close two or more issues with commit message?\n\nYou can use comma separated list in the commit message for it.\nSee this link for more information.\n\nIt is also possible to close several issues in the same commit: just repeat several time the pattern to close issues. For example, the following commit message: add new quick sort algorithm, fixes #4, resolve #6, closed #12 would close, the issues 4, 6 & 12 of the project on which the commit would occur.\n\nYou can try:\ngit commit -m \"closes #1, closes #2, closes #3; YOUR COMMIT MESSAGE\"\n\nEDIT:\nAdding a link from docs.github.com.\n\nYou can link a pull request to an issue by using a supported keyword\nin the pull request's description or in a commit message (please note\nthat the pull request must be on the default branch).\n\n\nclose, closes, closed, fix, fixes, fixed, resolve, resolves resolved" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git - the stupid content tracker git-whatchanged" }, { "role": "assistant", "content": "Show logs with differences each commit introduces" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Why after merge does GIT say \"Already up-to-date\", but differences between branches still exist?\nI was originally working in 'newfeature' branch and I was called to fix a bug on the live branch urgently. I created a branch for that called 'generalmaintenance', did the job and then switched to develop and merged it in. I now want to return to 'newfeature' branch and to merge in the changes that I merged into it earlier.\nWhen I switched to 'newfeature' and merged in 'develop', there were conflicts in 3 files.\nI got in a tangle resolving the conflicts and eventually decided to use the \"Revert\" command in the 'Team' menu of Aptana Studio 3 (which is my IDE). I expected this to roll me back to before the merge, which it appears to have done.\nAnyway, when I merge in 'develop' again, it says, Already-up-to-date, but when comparing files between the two branches, they are very different and the changes I added in the other branch are not being merged in.\nHow will I merge the two branches now please?" }, { "role": "assistant", "content": "Reverting Merges vs. Resetting Merges\nMy guess is that you actually are Already-up-to-date. \nThe problem is that git revert doesn't undo the merge, it only undoes the changes that the merge brought with it. When you create a merge commit, you're combining the commit histories of those two branches.\nMerging\n develop\n |\nA---B---C\n \\ \\\n E---F---M\n |\n newfeature\n\nIn the case above, develop is merged into newfeature, creating the M commit. If you were to run git log newfeature you would see all the commits from both branches, however from the perspective of the newfeature branch, all those changes were performed by the M commit.\nReverting\nThe git revert command does not remove any commits, instead it creates a new commit that undoes the changes that the commit contained. For example if you had a commit containing this diff...\n-This is the old sentence.\n+This is the new sentence.\n\nThen reverted this, the revert command would create a new commit that just preformed the opposite diff, it simply flips the signs.\n-This is the new sentence.\n+This is the old sentence.\n\nThis is really useful for undoing damage caused by commits that other developers already have. It moves history forward rather than changing history. \nReverting Merges\nHowever, in the context of a non-fastforward merge it may have an undesired effect.\n develop\n |\nA---B---C\n \\ \\\n E---F---M---W\n |\n newfeature\n\nAssuming W is a reversion commit, you can see how running git log newfeature will still include all the commits from the develop branch. As a result, additional merges from develop will no work, because it doesn't see anything missing from your branch.\nUsing git reset instead of revert.\nIn the future, you might want to consider using git reset --hard <ref> (where <ref> is the commit hash of the merge) to undo a merge if that merge has not been shared with other developers. In the example above, after having created merge commit M, running the command git reset --hard F would result in the following.\n develop\n |\nA---B---C\n \\ \\\n E---F---M\n |\n newfeature\n\nAs you can see this technique doesn't obliterate the commit as some people tend to think, it simply moves your branch back to the commit you selected. Now if you ran git log newfeature you would only get commit F, E, and A. Now the merge is actually gone from your branches history, so a later attempts to re-merge in develop will cause no problems.\nThis method is not without its complications. Realize that you are now modifying history, so if the newfeature branch was pushed to a remote branch after the M merge was made, then git is going to think you are simply out of date and tell you that you need to run git pull. If its just you working on that remote branch, then feel free to force-push - git push -f <remote> <branch>. This will have the same effect of the reset but on the remote branch.\nIf this branch is being used by multiple developers, who would have by now already pulled from it - then this is a bad idea. This is the very reason git revert is useful, because it undoes changes without changing the actual history.\nUsing reset on history is really only on option for commits that have not been shared. \nThe solution - reverting the reversion.\nIf the merge commit has already been shared, then the best approach is probably to use git revert on that merge. However as we said before, you can not then simply merge the branch back in and expect all the changes from that branch to re-appear. The answer is to revert the revert commit. \nLets say you did some work on the develop branch after having revered the merge in newfeature. Your history would look something like this.\n develop\n |\nA---B---C---D\n \\ \\\n E---F---M---W\n |\n newfeature\n\nIf you merge develop into newfeature now, you would only get D because its the only commit that is not already part of the history of the newfeature branch. What you also need to do is revert that W commit - git revert W should do the trick followed by git merge develop. \n develop\n |\nA---B---C-----------D\n \\ \\ \\\n E---F---M---W---M---G\n |\n newfeature\n\nThis restores all the changes made by the original merge commit - which were actually made by C and B but were reverted in W, it then brings in D via a new merge commit G I would recommend reverting the revert before merging in the recent changes to develop, I suspect doing it in that order will have a lower chance of triggering conflicts.\nTL;DR\nReverting creates a 'revert commit'. When undoing a revert, you need to run the revert command on the revert commit that was created when you reverted the first time. It should be easy enough to find, git tends to auto-comment on reverts so that they start with the word \"Reverted\".\ngit revert <commit>" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Using Gitlab Variables in Gitlab README.md for SonarQube Badges\n\nI'm using Gitlab and Sonarqube and the Sonarqube Plugin SVG Badges.\nTo represent the Sonarqube state on gitlab I have something like this in my README.md file:\n[![coverage](https://sonar.domain.com/api/badges/measure?key=com.domain:projectname&metric=coverage)](https://sonar.domain.com/component_measures/metric/coverage/list?id=de.domain:projectname)\n\nThis works perfect. My badge is shown, the link is working, everything is fine.\nIs there some way to build something like:\n[![coverage](https://sonar.domain.com/api/badges/measure?key={MYDOMAIN}:{THIS}&metric=coverage)](https://sonar.domain.com/component_measures/metric/coverage/list?id={MYDOMAIN}:{THIS})\n\nI want to provide a skeleton that every Developer just can copy and paste into their README.md file and the variables are filled into the README automatically, with something like .gitlab-ci.yml\nI also tried the permanent Gitlab Variables mentioned here but that wasn't working too!\n [![coverage](https://sonar.domain.com/api/badges/measure?key=com.mydomain:$CI_PROJECT_NAME&metric=coverage)](https://sonar.domain.com/component_measures/metric/coverage/list?id={MYDOMAIN}:$CI_PROJECT_NAME)\n\nAnyone has some idea?" }, { "role": "assistant", "content": "The variables in https://gitlab.com/help/ci/variables/README.md are present only in a CI environment (i.e. a job), so you can't use them in the Markdown viewer when displaying the file. - That's a great idea for a feature proposal, though. I opened one - https://gitlab.com/gitlab-org/gitlab-ce/issues/32255. Feel free to chime in.\nWhat you could do is add a placeholder where you want those variables to go and then create a job which sed's them.\nupdate_readme:\n script:\n - echo $CI_PROJECT_NAME # Sanity check\n - sed -ie \"s/{THIS}/$CI_PROJECT_NAME/g\" README.md\n\nNote the use of double-quotes (\") and not single quotes ('). Using double-quotes will interpolate $CI_PROJECT_NAME while single-quotes would just retain it's literal value." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Hosting a Maven repository on github\n\nI have a fork of a small open sourced library that I'm working on github. I'd like to make it available to other developers via maven, but I don't want to run my own Nexus server, and because it's a fork I can't easily deploy it to oss.sonatype.org.\nWhat I'd like to do is to deploy it to github so that others can access it using maven. What's the best way to do this?" }, { "role": "assistant", "content": "The best solution I've been able to find consists of these steps:\n\nCreate a branch called mvn-repo to host your maven artifacts.\nUse the github site-maven-plugin to push your artifacts to github.\nConfigure maven to use your remote mvn-repo as a maven repository.\n\nThere are several benefits to using this approach:\n\nMaven artifacts are kept separate from your source in a separate branch called mvn-repo, much like github pages are kept in a separate branch called gh-pages (if you use github pages)\nUnlike some other proposed solutions, it doesn't conflict with your gh-pages if you're using them.\nTies in naturally with the deploy target so there are no new maven commands to learn. Just use mvn deploy as you normally would\n\nThe typical way you deploy artifacts to a remote maven repo is to use mvn deploy, so let's patch into that mechanism for this solution.\nFirst, tell maven to deploy artifacts to a temporary staging location inside your target directory. Add this to your pom.xml:\n<distributionManagement>\n <repository>\n <id>internal.repo</id>\n <name>Temporary Staging Repository</name>\n <url>file://${project.build.directory}/mvn-repo</url>\n </repository>\n</distributionManagement>\n\n<plugins>\n <plugin>\n <artifactId>maven-deploy-plugin</artifactId>\n <version>2.8.1</version>\n <configuration>\n <altDeploymentRepository>internal.repo::default::file://${project.build.directory}/mvn-repo</altDeploymentRepository>\n </configuration>\n </plugin>\n</plugins>\n\nNow try running mvn clean deploy. You'll see that it deployed your maven repository to target/mvn-repo. The next step is to get it to upload that directory to GitHub.\nAdd your authentication information to ~/.m2/settings.xml so that the github site-maven-plugin can push to GitHub:\n<!-- NOTE: MAKE SURE THAT settings.xml IS NOT WORLD READABLE! -->\n<settings>\n <servers>\n <server>\n <id>github</id>\n <username>YOUR-USERNAME</username>\n <password>YOUR-PASSWORD</password>\n </server>\n </servers>\n</settings>\n\n(As noted, please make sure to chmod 700 settings.xml to ensure no one can read your password in the file. If someone knows how to make site-maven-plugin prompt for a password instead of requiring it in a config file, let me know.)\nThen tell the GitHub site-maven-plugin about the new server you just configured by adding the following to your pom:\n<properties>\n <!-- github server corresponds to entry in ~/.m2/settings.xml -->\n <github.global.server>github</github.global.server>\n</properties>\n\nFinally, configure the site-maven-plugin to upload from your temporary staging repo to your mvn-repo branch on Github:\n<build>\n <plugins>\n <plugin>\n <groupId>com.github.github</groupId>\n <artifactId>site-maven-plugin</artifactId>\n <version>0.11</version>\n <configuration>\n <message>Maven artifacts for ${project.version}</message> <!-- git commit message -->\n <noJekyll>true</noJekyll> <!-- disable webpage processing -->\n <outputDirectory>${project.build.directory}/mvn-repo</outputDirectory> <!-- matches distribution management repository url above -->\n <branch>refs/heads/mvn-repo</branch> <!-- remote branch name -->\n <includes><include>**/*</include></includes>\n <repositoryName>YOUR-REPOSITORY-NAME</repositoryName> <!-- github repo name -->\n <repositoryOwner>YOUR-GITHUB-USERNAME</repositoryOwner> <!-- github username -->\n </configuration>\n <executions>\n <!-- run site-maven-plugin's 'site' target as part of the build's normal 'deploy' phase -->\n <execution>\n <goals>\n <goal>site</goal>\n </goals>\n <phase>deploy</phase>\n </execution>\n </executions>\n </plugin>\n </plugins>\n</build>\n\nThe mvn-repo branch does not need to exist, it will be created for you.\nNow run mvn clean deploy again. You should see maven-deploy-plugin \"upload\" the files to your local staging repository in the target directory, then site-maven-plugin committing those files and pushing them to the server.\n[INFO] Scanning for projects...\n[INFO] \n[INFO] ------------------------------------------------------------------------\n[INFO] Building DaoCore 1.3-SNAPSHOT\n[INFO] ------------------------------------------------------------------------\n...\n[INFO] --- maven-deploy-plugin:2.5:deploy (default-deploy) @ greendao ---\nUploaded: file:///Users/mike/Projects/greendao-emmby/DaoCore/target/mvn-repo/com/greendao-orm/greendao/1.3-SNAPSHOT/greendao-1.3-20121223.182256-3.jar (77 KB at 2936.9 KB/sec)\nUploaded: file:///Users/mike/Projects/greendao-emmby/DaoCore/target/mvn-repo/com/greendao-orm/greendao/1.3-SNAPSHOT/greendao-1.3-20121223.182256-3.pom (3 KB at 1402.3 KB/sec)\nUploaded: file:///Users/mike/Projects/greendao-emmby/DaoCore/target/mvn-repo/com/greendao-orm/greendao/1.3-SNAPSHOT/maven-metadata.xml (768 B at 150.0 KB/sec)\nUploaded: file:///Users/mike/Projects/greendao-emmby/DaoCore/target/mvn-repo/com/greendao-orm/greendao/maven-metadata.xml (282 B at 91.8 KB/sec)\n[INFO] \n[INFO] --- site-maven-plugin:0.7:site (default) @ greendao ---\n[INFO] Creating 24 blobs\n[INFO] Creating tree with 25 blob entries\n[INFO] Creating commit with SHA-1: 0b8444e487a8acf9caabe7ec18a4e9cff4964809\n[INFO] Updating reference refs/heads/mvn-repo from ab7afb9a228bf33d9e04db39d178f96a7a225593 to 0b8444e487a8acf9caabe7ec18a4e9cff4964809\n[INFO] ------------------------------------------------------------------------\n[INFO] BUILD SUCCESS\n[INFO] ------------------------------------------------------------------------\n[INFO] Total time: 8.595s\n[INFO] Finished at: Sun Dec 23 11:23:03 MST 2012\n[INFO] Final Memory: 9M/81M\n[INFO] ------------------------------------------------------------------------\n\nVisit github.com in your browser, select the mvn-repo branch, and verify that all your binaries are now there.\n\nCongratulations!\nYou can now deploy your maven artifacts to a poor man's public repo simply by running mvn clean deploy.\nThere's one more step you'll want to take, which is to configure any poms that depend on your pom to know where your repository is. Add the following snippet to any project's pom that depends on your project:\n<repositories>\n <repository>\n <id>YOUR-PROJECT-NAME-mvn-repo</id>\n <url>https://github.com/YOUR-USERNAME/YOUR-PROJECT-NAME/raw/mvn-repo/</url>\n <snapshots>\n <enabled>true</enabled>\n <updatePolicy>always</updatePolicy>\n </snapshots>\n </repository>\n</repositories>\n\nNow any project that requires your jar files will automatically download them from your github maven repository.\nEdit: to avoid the problem mentioned in the comments ('Error creating commit: Invalid request. For 'properties/name', nil is not a string.'), make sure you state a name in your profile on github." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-difftool - Show changes using common diff tools git-mergetool" }, { "role": "assistant", "content": "Run merge conflict resolution tools to resolve merge conflicts" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-diff - Show changes between commits, commit and working tree, etc lines" }, { "role": "assistant", "content": "Compute the dirstat numbers by doing the regular line-based diff\nanalysis, and summing the removed/added line counts. (For binary\nfiles, count 64-byte chunks instead, since binary files have no\nnatural concept of lines). This is a more expensive --dirstat behavior than the changes behavior, but it does count rearranged\nlines within a file as much as other changes. The resulting output\nis consistent with what you get from the other --*stat options." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Get changes from master into branch in Git\nIn my repository I have a branch called aq which I'm working on.\nI then committed new work and bugs in master. \nWhat is the best way to get those commits into the aq branch? Create another new branch out of master and merge it with aq?" }, { "role": "assistant", "content": "Check out the aq branch, and rebase from master.\ngit checkout aq\ngit rebase master" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-shortlog - Summarize git log output --show-pulls" }, { "role": "assistant", "content": "Include all commits from the default mode, but also any merge\ncommits that are not TREESAME to the first parent but are\nTREESAME to a later parent. This mode is helpful for showing\nthe merge commits that \"first introduced\" a change to a branch." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-show - Show various types of objects %%" }, { "role": "assistant", "content": "a raw %" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "gitglossary - A Git Glossary resolve" }, { "role": "assistant", "content": "The action of fixing up manually what a failed automatic merge left behind." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-diff - Show changes between commits, commit and working tree, etc -O<orderfile>" }, { "role": "assistant", "content": "Control the order in which files appear in the output.\nThis overrides the diff.orderFile configuration variable\n(see git-config ). To cancel diff.orderFile ,\nuse -O/dev/null . The output order is determined by the order of glob patterns in\n<orderfile>.\nAll files with pathnames that match the first pattern are output\nfirst, all files with pathnames that match the second pattern (but not\nthe first) are output next, and so on.\nAll files with pathnames that do not match any pattern are output\nlast, as if there was an implicit match-all pattern at the end of the\nfile.\nIf multiple pathnames have the same rank (they match the same pattern\nbut no earlier patterns), their output order relative to each other is\nthe normal order. <orderfile> is parsed as follows: Blank lines are ignored, so they can be used as separators for\nreadability. Lines starting with a hash (\" # \") are ignored, so they can be used\nfor comments. Add a backslash (\" \\ \") to the beginning of the\npattern if it starts with a hash. Each other line contains a single pattern. Patterns have the same syntax and semantics as patterns used for\nfnmatch(3) without the FNM_PATHNAME flag, except a pathname also\nmatches a pattern if removing any number of the final pathname\ncomponents matches the pattern. For example, the pattern \" foo*bar \"\nmatches \" fooasdfbar \" and \" foo/bar/baz/asdf \" but not \" foobarx \"." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-config - Get and set repository or global options remote.<name>.fetch" }, { "role": "assistant", "content": "The default set of \"refspec\" for git-fetch . See git-fetch ." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How do I view previous diff commits using Git?\nHow do I view previous diff commits using Git?\nI have a file that I've made several commits on, but I want to view previous versions of the file AND its diff's at different stages. Seeing where I made mistakes and how I fixed them is really helping my code. By the way, I'm using Tower as a GUI on top of Git." }, { "role": "assistant", "content": "git log --full-diff -p your_file_path\n\nCheck out: \nhttp://git-scm.com/docs/git-log" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Should I check in folder \"node_modules\" to Git when creating a Node.js app on Heroku?\nI followed the basic getting started instructions for Node.js on Heroku here:\nhttps://devcenter.heroku.com/categories/nodejs\nThese instructions don't tell you to create a .gitignore node_modules, and therefore imply that folder node_modules should be checked into Git. When I included node_modules in the Git repository, my getting started application ran correctly.\nWhen I followed the more advanced example at:\n\nBuilding a Real-time, Polyglot Application with Node.js, Ruby, MongoDB and Socket.IO\nhttps://github.com/mongolab/tractorpush-server (source)\n\nIt instructed me to add folder node_modules to file .gitignore. So I removed folder node_modules from Git, added it to file .gitignore, and then redeployed. This time the deployment failed like so:\n-----> Heroku receiving push\n-----> Node.js app detected\n-----> Resolving engine versions\n Using Node.js version: 0.8.2\n Using npm version: 1.0.106\n-----> Fetching Node.js binaries\n-----> Vendoring node into slug\n-----> Installing dependencies with npm\n Error: npm doesn't work with node v0.8.2\n Required: [email protected] || 0.5 || 0.6\n at /tmp/node-npm-5iGk/bin/npm-cli.js:57:23\n at Object.<anonymous> (/tmp/node-npm-5iGk/bin/npm-cli.js:77:3)\n at Module._compile (module.js:449:26)\n at Object.Module._extensions..js (module.js:467:10)\n at Module.load (module.js:356:32)\n at Function.Module._load (module.js:312:12)\n at Module.require (module.js:362:17)\n at require (module.js:378:17)\n at Object.<anonymous> (/tmp/node-npm-5iGk/cli.js:2:1)\n at Module._compile (module.js:449:26)\n Error: npm doesn't work with node v0.8.2\n Required: [email protected] || 0.5 || 0.6\n at /tmp/node-npm-5iGk/bin/npm-cli.js:57:23\n at Object.<anonymous> (/tmp/node-npm-5iGk/bin/npm-cli.js:77:3)\n at Module._compile (module.js:449:26)\n at Object.Module._extensions..js (module.js:467:10)\n at Module.load (module.js:356:32)\n at Function.Module._load (module.js:312:12)\n at Module.require (module.js:362:17)\n at require (module.js:378:17)\n at Object.<anonymous> (/tmp/node-npm-5iGk/cli.js:2:1)\n at Module._compile (module.js:449:26)\n Dependencies installed\n-----> Discovering process types\n Procfile declares types -> mongod, redis, web\n-----> Compiled slug size is 5.0MB\n-----> Launching... done, v9\n\nRunning \"heroku ps\" confirms the crash. OK, no problem, so I rolled back the change, added folder node_module back to the Git repository and removed it from file .gitignore. However, even after reverting, I still get the same error message on deployment, but now the application is running correctly again. Running \"heroku ps\" tells me the application is running.\nWhat's the right way to do this? Include folder node_modules or not? And why would I still be getting the error message when I roll back? My guess is the Git repository is in a bad state on the Heroku side." }, { "role": "assistant", "content": "Second Update\nThe FAQ is not available anymore.\nFrom the documentation of shrinkwrap:\n\nIf you wish to lock down the specific bytes included in a package, for example to have 100% confidence in being able to reproduce a deployment or build, then you ought to check your dependencies into source control, or pursue some other mechanism that can verify contents rather than versions.\n\nShannon and Steven mentioned this before but I think it should be part of the accepted answer.\n\nUpdate\nThe source listed for the below recommendation has been updated. They are no longer recommending the node_modules folder be committed.\n\nUsually, no. Allow npm to resolve dependencies for your packages.\nFor packages you deploy, such as websites and apps, you should use npm\nshrinkwrap to lock down your full dependency tree:\nhttps://docs.npmjs.com/cli/shrinkwrap\n\n\nOriginal Post\nFor reference, npm FAQ answers your question clearly:\n\nCheck node_modules into git for things you deploy, such as websites\nand apps. Do not check node_modules into git for libraries and modules\nintended to be reused. Use npm to manage dependencies in your dev\nenvironment, but not in your deployment scripts.\n\nand for some good rationale for this, read Mikeal Rogers' post on this.\n\nSource: https://docs.npmjs.com/misc/faq#should-i-check-my-node-modules-folder-into-git" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git: list new files only\nWhen I do a git status I get a list of files prefixed with new file: . How can I get only this list? I want to process this files in a simple loop in a little shell script." }, { "role": "assistant", "content": "The commands below no longer give the expected results, I may originally also have made some mistakes. Please double-check your output and the options you are using. Nevertheless: The basic tenet of using diff-filter should still hold true.\nDon't use grep to parse git output. Git almost certainly has the things you are looking for built-in (except if you are going for really advanced stuff).\nYou can use git diff to show the changes. --name-only shows only the filenames. --diff-filter=A lists only the added files.\nIf you want to see new files you have already added to the index use --cached, otherwise omit it. To see both diff to HEAD.\nThe commands look like this:\ngit diff --name-only --diff-filter=A --cached # All new files in the index \ngit diff --name-only --diff-filter=A # All files that are not staged \ngit diff --name-only --diff-filter=A HEAD # All new files not yet committed" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Is it possible to use pip to install a package from a private GitHub repository?\nI am trying to install a Python package from a private GitHub repository. For a public repository, I can issue the following command which works fine:\npip install git+git://github.com/django/django.git\n\nHowever, if I try this for a private repository:\npip install git+git://github.com/echweb/echweb-utils.git\n\nI get the following output:\nDownloading/unpacking git+git://github.com/echweb/echweb-utils.git\nCloning Git repository git://github.com/echweb/echweb-utils.git to /var/folders/cB/cB85g9P7HM4jcPn7nrvWRU+++TI/-Tmp-/pip-VRsIoo-build\nComplete output from command /usr/local/bin/git clone git://github.com/echweb/echweb-utils.git /var/folders/cB/cB85g9P7HM4jcPn7nrvWRU+++TI/-Tmp-/pip-VRsIoo-build:\nfatal: The remote end hung up unexpectedly\n\nCloning into /var/folders/cB/cB85g9P7HM4jcPn7nrvWRU+++TI/-Tmp-/pip-VRsIoo-build...\n\n----------------------------------------\nCommand /usr/local/bin/git clone git://github.com/echweb/echweb-utils.git /var/folders/cB/cB85g9P7HM4jcPn7nrvWRU+++TI/-Tmp-/pip-VRsIoo-build failed with error code 128\n\nI guess this is because I am trying to access a private repository without providing any authentication. I therefore tried to use Git + ssh hoping that pip would use my SSH public key to authenticate:\npip install git+ssh://github.com/echweb/echweb-utils.git\n\nThis gives the following output:\nDownloading/unpacking git+ssh://github.com/echweb/echweb-utils.git\nCloning Git repository ssh://github.com/echweb/echweb-utils.git to /var/folders/cB/cB85g9P7HM4jcPn7nrvWRU+++TI/-Tmp-/pip-DQB8s4-build\nComplete output from command /usr/local/bin/git clone ssh://github.com/echweb/echweb-utils.git /var/folders/cB/cB85g9P7HM4jcPn7nrvWRU+++TI/-Tmp-/pip-DQB8s4-build:\nCloning into /var/folders/cB/cB85g9P7HM4jcPn7nrvWRU+++TI/-Tmp-/pip-DQB8s4-build...\n\nPermission denied (publickey).\n\nfatal: The remote end hung up unexpectedly\n\n----------------------------------------\nCommand /usr/local/bin/git clone ssh://github.com/echweb/echweb-utils.git /var/folders/cB/cB85g9P7HM4jcPn7nrvWRU+++TI/-Tmp-/pip-DQB8s4-build failed with error code 128\n\nIs what I am trying to achieve even possible? If so, how can I do it?" }, { "role": "assistant", "content": "You can use the git+ssh URI scheme, but you must set a username. Notice the git@ part in the URI:\npip install git+ssh://[email protected]/echweb/echweb-utils.git\n\nAlso read about deploy keys.\nPS: In my installation, the \"git+ssh\" URI scheme works only with \"editable\" requirements:\npip install -e URI#egg=EggName\n\nRemember: Change the : character that git remote -v prints to a / character before using the remote's address in the pip command:\n$ git remote -v\norigin [email protected]:echweb/echweb-utils.git (fetch)\n# ^ change this to a '/' character\n\nIf you forget, you will get this error:\nssh: Could not resolve hostname github.com:echweb:\n nodename nor servname provided, or not known" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git - the stupid content tracker git-http-backend" }, { "role": "assistant", "content": "Server side implementation of Git over HTTP" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Creating an official github mirror\n\nHow do I create a github mirror for an external git repository, such that it appears as \"real mirror\", e.g., as in https://github.com/mirrors?\nSo far, I set up a mirror using:\ncd /path/to/bare/repository\ngit remote add --mirror github [email protected]:user/repo.git\n\nand configure the post receive hook to do a git push --quiet github. This way, however, github does not recognize the mirror.\nAny ideas how to do it the github way, such that \"Mirrorred from\" appears underneath the repostiory name?" }, { "role": "assistant", "content": "Based on communicating with GitHub's support team, I found that GitHub currently offers no direct mechanism for a user to mirror repositories in this fashion.\nHowever, one can ask GitHub to install this service for repositories which are part of an organization. GitHub then configures an existing repository as such a mirror and pulls from it in an interval that is a function of the number of overall mirrors they have. \nEDIT: as Stuart points out, GitHub no longer accepts requests for mirroring arbitrary repositories. The only remaining option is the solution I posted in my question, i.e., creating a post-receive hook to automatically push to your GitHub repository." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Where did I branch from?\nI got back on an old project and I ran the nice git status to figure out what was going on and I noticed way too many branches! I want to do some housekeeping before starting to work on this again but I'm not sure which branch comes from which..\nE.G. Does \"branchA\" derive from \"develop\"? Does \"branchB\" derive from \"master\" or \"branchA\"??\nHow can I answer the sample questions above?" }, { "role": "assistant", "content": "git merge-base shows the commit that is the common ancestor of two branches.\nSimple usage: git merge-base <branch> <branch> shows the common commit of the two branches." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to git-svn clone the last n revisions from a Subversion repository?\nProblem\nHow do you create a shallow copy with git-svn from a Subversion repository, e.g. how do you pull only the last three revisions?\nThe git clone command can get the last n revisions from a Git repository if you use the option --depth, i.e. you get a shallow copy of the repository. Example:\ngit clone --depth 3 git://some/repo myshallowcopyrepo\n\nIs there a similar option for git-svn?\nMy discoveries so far\nSo far I've only found the -rN option where N is the revision to pull. Example:\ngit svn clone -rN svn://some/repo\n\nAccording to the documentation there is the possibility to use -r$REVNUMBER:HEAD. I tried the following to get the last 3 revisions which returned an error message.\n$ git svn clone --prefix=svn/ -s -rHEAD~3:HEAD http://some/svn/repo .\nrevision argument: HEAD~3:HEAD not understood by git-svn\n\nSo I replaced HEAD~3 with the actual number of the third but last revision 534. That worked, but that requires me to first figure out the revision number of the third but last commit.\n$ git svn clone --prefix=svn/ -s -r534:HEAD http://some/svn/repo .\n\nDocumentation\ngit-clone\ngit-svn" }, { "role": "assistant", "content": "You've already discovered the simplest way to specify a shallow clone in Git-SVN, by specifying the SVN revision number that you want to start your clone at ( -r$REV:HEAD). \nFor example: git svn clone -s -r1450:HEAD some/svn/repo\nGit's data structure is based on pointers in a directed acyclic graph (DAG), which makes it trivial to walk back n commits. But in SVN ( and therefore in Git-SVN) you will have to find the revision number yourself." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Update my github repo which is forked out from another project [duplicate]\nThis question already has answers here:\n \n \n\n\n\n\nPull new updates from original GitHub repository into forked GitHub repository\n\n (8 answers)\n \n\nClosed 8 years ago.\n\n\n\nI have forked out a Parent: project to Child: this. Now, I want to update my child with parents current updates. Can I do that, if yes how?\nWhen I update my github repo, then I can do a \"git pull\" to update my local repo." }, { "role": "assistant", "content": "In your local clone of Child, pull from Parent, adding it as a remote if you like:\ncd child\ngit remote add parent <parent-url>\ngit pull parent\n\nThe url of the parent could be the public github repo, or your local clone of it - the local clone will of course be faster. If you want to pull a branch other than the current HEAD of the parent repo, just add an argument (e.g. git pull parent topic-branch). If this is a one-time thing, you can just skip adding the remote: git pull <parent-url> [branch].\nPulling is a combination of fetching and merging, so once you've done that, you've got a new merge commit you'll presumably want to push back to your public repo at some point.\nThe key point here, in case it's not clear, is that pulling from the parent (upstream) repository is not different from pulling from your public clone of child, your current repository. Either way, you're fetching from a repository with some common history, and merging that into your current branch. And of course, since you're merging, a work tree is required - so this is something that must be done in your local repo. The repo hosted on github is essentially a way of publishing what you've done locally. All you can really do with it is push/pull, and browse what's there." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to select/comment on a range of lines in github pull request?\n\nThere is an option to comment on a range of lines in file on github, see How to refer to a specific line or range of lines in github?\nBut is there similar option to comment on range of lines inside pull request?\n\nWhen I click on line, only single line is highlighted yellow and R### (e.g. R446) is appended to url, clicking another line with shift pressed doesn't do anything. I tried to change url to R446-450 but it didn't do anything. Changing it to #L450-458 also didn't do anything. Also even that single highlighted line doesn't seem to affect anything.\nClicking blue plus that appears on hover creates comment window, but it only commenting on a single line.\nCommenting on single line results in this\n\nComment on pull-request page shows only 4 lines above selected/commented line, but I'm interested in showing 7 lines, not 4" }, { "role": "assistant", "content": "Since Oct. 2019, Nat Friedman (CEO of GitHub) declares that feature available\n(And, see below, since Feb. 2020, multi-lines comment reference is possible)\n\n🔥\n Multi-line comments are here!\n Click and drag to comment on multiple lines in a pull request diff. ✨\nThese little quality-of-life improvements are at the heart of what we love doing at GitHub. \n 🥰\n\n\nThanks to:\n\nJohn Caine\nMike Skalnik\nPat Nakajima\nMike Chlipala\nJoel Califa\nMatt Colyer\nMelanie Gilman\n\n\nNick Craver immediately asks:\n\nFollow-up question: are there plans to support suggestions?\n It seems to apply to the last line at the moment:\n\n\nThat would be, according to Nat, \"Coming early next year\". \nUpdate Feb. 2020: \"A new interaction for multi-line pull request comments \"\n\nTo leave a comment referencing multiple lines, you can either:\n\nclick on a line number in the diff view, hold Shift, click on a second line number and click the \"+\" button next to the second line number; or\nclick and hold to the right of a line number, drag and then release the mouse when you’ve reached the desired line.\n\n\nThis was announced by Nat Friedman\n\nShipping today on GitHub: multi-line suggestions! \n\n\nWith, again, special thanks to Melanie Gilman, Pat Nakajima, Mike Chlipala, Joel Califa, John Caine, Matt Colyer and \n, and Kelly Arwine.\nGitHub Changelog also references this.\n\nHenry adds an observation \n\nA smaller side effect, but I assume being able to share a multi-line diff in the PR is new too!\n\nExample: babel/babel PR 10511 diff-L261-L263\n\nBut that was available since July 2019" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Check if pull needed in Git\nHow do I check whether the remote repository has changed and I need to pull?\nNow I use this simple script:\ngit pull --dry-run | grep -q -v 'Already up-to-date.' && changed=1\n\nBut it is rather heavy.\nIs there a better way? The ideal solution would check all the remote branches, and return names of the changed branches and the number of new commits in each one." }, { "role": "assistant", "content": "First use git remote update, to bring your remote refs up to date. Then you can do one of several things, such as:\n\ngit status -uno will tell you whether the branch you are tracking is ahead, behind or has diverged. If it says nothing, the local and remote are the same.\n\ngit show-branch *master will show you the commits in all of the branches whose names end in 'master' (eg master and origin/master).\n\n\nIf you use -v with git remote update (git remote -v update) you can see which branches got updated, so you don't really need any further commands.\nHowever, it looks like you want to do this in a script or program and end up with a true/false value. If so, there are ways to check the relationship between your current HEAD commit and the head of the branch you're tracking, although since there are four possible outcomes you can't reduce it to a yes/no answer. However, if you're prepared to do a pull --rebase then you can treat \"local is behind\" and \"local has diverged\" as \"need to pull\", and the other two (\"local is ahead\" and \"same\") as \"don't need to pull\".\nYou can get the commit id of any ref using git rev-parse <ref>, so you can do this for master and origin/master and compare them. If they're equal, the branches are the same. If they're unequal, you want to know which is ahead of the other. Using git merge-base master origin/master will tell you the common ancestor of both branches, and if they haven't diverged this will be the same as one or the other. If you get three different ids, the branches have diverged.\nTo do this properly, eg in a script, you need to be able to refer to the current branch, and the remote branch it's tracking. The bash prompt-setting function in /etc/bash_completion.d has some useful code for getting branch names. However, you probably don't actually need to get the names. Git has some neat shorthands for referring to branches and commits (as documented in git rev-parse --help). In particular, you can use @ for the current branch (assuming you're not in a detached-head state) and @{u} for its upstream branch (eg origin/master). So git merge-base @ @{u} will return the (hash of the) commit at which the current branch and its upstream diverge and git rev-parse @ and git rev-parse @{u} will give you the hashes of the two tips. This can be summarized in the following script:\n#!/bin/sh\n\nUPSTREAM=${1:-'@{u}'}\nLOCAL=$(git rev-parse @)\nREMOTE=$(git rev-parse \"$UPSTREAM\")\nBASE=$(git merge-base @ \"$UPSTREAM\")\n\nif [ $LOCAL = $REMOTE ]; then\n echo \"Up-to-date\"\nelif [ $LOCAL = $BASE ]; then\n echo \"Need to pull\"\nelif [ $REMOTE = $BASE ]; then\n echo \"Need to push\"\nelse\n echo \"Diverged\"\nfi\n\nNote: older versions of git didn't allow @ on its own, so you may have to use @{0} instead.\nThe line UPSTREAM=${1:-'@{u}'} allows you optionally to pass an upstream branch explicitly, in case you want to check against a different remote branch than the one configured for the current branch. This would typically be of the form remotename/branchname. If no parameter is given, the value defaults to @{u}.\nThe script assumes that you've done a git fetch or git remote update first, to bring the tracking branches up to date. I didn't build this into the script because it's more flexible to be able to do the fetching and the comparing as separate operations, for example if you want to compare without fetching because you already fetched recently." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git - the stupid content tracker gitformat-commit-graph" }, { "role": "assistant", "content": "Git commit-graph format" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How can I keep my branch up to date with master with git?\n\nI have a bug fix in my master, and I also want my branch to get that bug fix. What git command do I use?" }, { "role": "assistant", "content": "Assuming you're fine with taking all of the changes in master, what you want is:\ngit checkout <my branch>\n\nto switch the working tree to your branch; then:\ngit merge master\n\nto merge all the changes in master with yours." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-log - Show commit logs %>( <N> ) , %>|( <M> )" }, { "role": "assistant", "content": "similar to %<( <N> ) , %<|( <M> ) respectively,\nbut padding spaces on the left" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-stash - Stash the changes in a dirty working directory away" }, { "role": "assistant", "content": "SYNOPSIS git stash list [<log-options>] git stash show [-u | --include-untracked | --only-untracked] [<diff-options>] [<stash>] git stash drop [-q | --quiet] [<stash>] git stash pop [--index] [-q | --quiet] [<stash>] git stash apply [--index] [-q | --quiet] [<stash>] git stash branch <branchname> [<stash>] git stash [push [-p | --patch] [-S | --staged] [-k | --[no-]keep-index] [-q | --quiet]\n\t [-u | --include-untracked] [-a | --all] [(-m | --message) <message>]\n\t [--pathspec-from-file=<file> [--pathspec-file-nul]]\n\t [--] [<pathspec>…​]] git stash save [-p | --patch] [-S | --staged] [-k | --[no-]keep-index] [-q | --quiet]\n\t [-u | --include-untracked] [-a | --all] [<message>] git stash clear git stash create [<message>] git stash store [(-m | --message) <message>] [-q | --quiet] <commit>" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to compare two different commits on the same branch in github?\n\nComparing histories on the same branch is very confusing for me on GitHub. I struggle with this regularly:\nIf I use compare/master in the URL after the GitHub repo name, I can compare against other branches in the repo based on the options in the drop-down menus.\nhttps://help.github.com/en/articles/comparing-commits-across-time\nHowever, I usually want to compare several commits on master. \nHow is this easily done? Could I get a more clear example?" }, { "role": "assistant", "content": "You can use the following URL structure to compare commits in the same branch:\ngithub.com/<username>/<repo_name>/compare/<commit1>...<commit2>\n\nReplace values for username, repo_name, commit1(old commit) & commit2(new commit) acc. to your project.\nThe separator between the two commits is ... i.e. 3 dots." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Distributed Version Control Systems and the Enterprise - a Good mix? [closed]\nClosed. This question is opinion-based. 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 can be answered with facts and citations by editing this post.\n\n\nClosed 6 years ago.\n\n\n\n\n\n\n\n Improve this question\n \n\n\n\nI can see why distributed source control systems (DVCS - like Mercurial) make sense for open source projects.\nBut do they make sense for an enterprise? (over a centralized Source Control System such as TFS)\nWhat features of a DVCS make it better or worse suited for an enterprise with many developers? (over a centralized system)" }, { "role": "assistant", "content": "I have just introduced a DVCS (Git in this case) in a large banking company, where Perforce, SVN or ClearCase was the centralized VCS of choices:\nI already knew of the challenges (see my previous answer \"Can we finally move to DVCS in Corporate Software? Is SVN still a 'must have' for development?\")\nI have been challenged on three fronts:\n\ncentralization: while the decentralized model has its merits (and allows for private commits or working without the network while having access to the full history), there still needs to be a clear set of centralized repos, acting as the main reference for all developers.\n\nauthentication: a DVCS allows you to \"sign-off\" (commit) your code as... pretty much anyone (author \"foo\", email \"[email protected]\").\nYou can do a git config user.name foo, or git config user.name whateverNameIFeelToHave, and have all your commits with bogus names in it.\nThat doesn't mix well with the unique centralized \"Active Directory\" user referential used by big enterprises.\n\nauthorization: by default, you can clone, push from or pull to any repository, and modify any branch, or any directory.\nFor sensitive projects, that can be a blocking issue (the banking world is usually very protective of some pricing or quants algorithms, which require strict read/write access for a very limited number of people)\n\n\nThe answer (for a Git setup) was:\n\ncentralization: a unique server has been set up for any repository having to be accessible by all users.\nBackup has been taking care of (incremental every day, full every week).\nDRP (Disaster Recovery Plan) has been implemented, with a second server on another site, and with real-time data replication through SRDF.\nThis setup in itself is independent of the type of referential or tool you need (DVCS, or Nexus repo, or main Hudson scheduler, or...): any tool which can be critical for a release into production needs to be installed on servers with backup and DR.\n\n.\n\nauthentication: only two protocols allow users to access the main repos:\n\nssh based, with public/private key:\n\nuseful for users external to the organization (like off-shore development),\nand useful for generic accounts that Active Directory manager don't want to create (because it would be an \"anonymous\" account): a real person has to be responsible for that generic account, and that would be the one owning the private key\n\n\nhttps-based, with an Apache authenticating the users through a LDAP setting: that way, an actual login must be provided for any git operation on those repos.\nGit offers it with its smart http protocol, allowing not just pull (read) through http, but also push (write) through http.\n\n\n\nThe authentication part is also reinforced at the Git level by a post-receive hook which makes sure that at least one of the commits you are pushing to a repo has a \"committer name\" equals to the user name detected through shh or http protocol.\nIn other words, you need to set up your git config user.name correctly, or any push you want to make to a central repo will be rejected.\n.\n\nauthorization: both previous settings (ssh or https) are wired to call the same set of perl script, named gitolite, with as parameters:\n\nthe actual username detected by those two protocols\nthe git command (clone, push or pull) that user wants to do\n\n\n\nThe gitolite perl script will parse a simple text file where the authorizations (read/write access for a all repository, or for branches within a given repository, or even for directories within a repository) have been set.\nIf the access level required by the git command doesn't match the ACL defined in that file, the command is rejected.\n\nThe above describes what I needed to implement for a Git setting, but more importantly, it lists the main issues that need to be addressed for a DVCS setting to make sense in a big corporation with a unique user base.\nThen, and only then, a DVCS (Git, Mercurial, ...) can add values because of:\n\ndata exchange between multiple sites: while those users are all authenticated through the same Active Directory, they can be located across the world (the companies I have worked for have developments usually between teams across two or three countries). A DVCS is naturally made for exchanging efficiently data between those distributed teams.\n\nreplication across environments: a setting taking care of authentication/authorization allows for cloning those repositories on other dedicated servers (for integration testing, UAT testing, pre-production, and pre-deployment purposes)\n\nprocess automation: the ease with which you can clone a repo can also be used locally on one user's workstation, for unit-testing purposes with the \"guarded commits\" techniques and other clever uses: see \"What is the cleverest use of source repository that you have ever seen?\".\nIn short, you can push to a second local repo in charge of:\n\nvarious tasks (unit test or static analysis of the code)\npushing back to the main repo if those tasks are successful\nwhile you are still working in the first repo without having to wait for the result of those tasks.\n\n\n\n.\n\nkiller features: Any DVCS comes with those, the main one being merging (ever tried to do a complex merge workflow with SVN? Or sloooowly merge 6000 files with ClearCase?).\nThat alone (merging) means you can really take advantage of branching, while being able at all time to merge back your code to another \"main\" line of development because you would do so:\n\nfirst locally within your own repo, without disturbing anybody\nthen on the remote server, pushing the result of that merge on the central repo." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Git push remote rejected {change ### closed}\ni am having problems pushing my changes from my local master to remote master because of this error:\nremote: Processing changes: refs: 1, done\nTo ssh://[email protected]:29418/xxxxxx\n ! [remote rejected] HEAD -> refs/for/master (change 14823 closed)\nerror: failed to push some refs to 'ssh://[email protected]:29418/xxxxxx'\n\nany idea how i can fix this issue?\ngit status says my branch is ahead of origin/master by 5 commits." }, { "role": "assistant", "content": "I got the same message. And it was because I have managed to get the same Change-Id for two commits. Maybe due to some cherry-picking or similar between my local branches. Solved by removing the Change-Id from the commit message, a new Id then was added by the commit hook." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-rev-parse - Pick out and massage parameters --is-bare-repository" }, { "role": "assistant", "content": "When the repository is bare print \"true\", otherwise \"false\"." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-svn - Bidirectional operation between a Subversion repository and Git -i<GIT_SVN_ID> --id <GIT_SVN_ID>" }, { "role": "assistant", "content": "This sets GIT_SVN_ID (instead of using the environment). This\nallows the user to override the default refname to fetch from\nwhen tracking a single URL. The log and dcommit commands\nno longer require this switch as an argument." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-apply - Apply a patch to files and/or to the index" }, { "role": "assistant", "content": "SYNOPSIS git apply [--stat] [--numstat] [--summary] [--check] [--index | --intent-to-add] [--3way]\n\t [--apply] [--no-add] [--build-fake-ancestor=<file>] [-R | --reverse]\n\t [--allow-binary-replacement | --binary] [--reject] [-z]\n\t [-p<n>] [-C<n>] [--inaccurate-eof] [--recount] [--cached]\n\t [--ignore-space-change | --ignore-whitespace]\n\t [--whitespace=(nowarn|warn|fix|error|error-all)]\n\t [--exclude=<path>] [--include=<path>] [--directory=<root>]\n\t [--verbose | --quiet] [--unsafe-paths] [--allow-empty] [<patch>…​]" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to use git as source control provider for SQL Server Management Studio\nCan we use GIT as the source control for sql management studio?" }, { "role": "assistant", "content": "for Database source control within SSMS\nAgent SVN - SCC Subversion Plug-in.\nhttp://www.zeusedit.com/agent/ssms/ms_ssms.html\nor\nhttp://www.red-gate.com/products/sql-development/sql-source-control/" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Git add all files modified, deleted, and untracked?\nIs there a way to add all files no matter what you do to them whether it be deleted, untracked, etc? like for a commit. I just don't want to have to git add or git rm all my files every time I commit, especially when I'm working on a large product." }, { "role": "assistant", "content": "Try:\ngit add -A\n\n\nWarning: Starting with git 2.0 (mid 2013), this will always stage files on the whole working tree.\nIf you want to stage files under the current path of your working tree, you need to use:\ngit add -A .\n\nAlso see: Difference of git add -A and git add ." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to uninstall a git repo using pip?\nI'm using pip in a virtualenv and have installed a package from a git repo by doing this:\npip install -e git://github.com/dwaiter/django-bcrypt.git@475a3bef1e3ff31935a2dc905e244a63a804fce9#egg=django_bcrypt-dev\n\nBut I now want to uninstall that and can't see how, as it doesn't have a conventional package name. I've tried what seem like obvious variations (like replacing 'install' with 'uninstall') but can't see how to do this from the docs.\n(In this case I ultimately want to upgrade from the git repo version of django-bcrypt to version 0.9.2, and am assuming I need to uninstall the git version first.)" }, { "role": "assistant", "content": "You uninstall it like you would any other library:\npip uninstall django-bcrypt\nIf you want to ultimately upgrade, you could also do \npip install --upgrade -e git://github.com/dwaiter/django-bcrypt.git#egg=django_bcrypt" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-config - Get and set repository or global options core.askPass" }, { "role": "assistant", "content": "Some commands (e.g. svn and http interfaces) that interactively\nask for a password can be told to use an external program given\nvia the value of this variable. Can be overridden by the GIT_ASKPASS environment variable. If not set, fall back to the value of the SSH_ASKPASS environment variable or, failing that, a simple password\nprompt. The external program shall be given a suitable prompt as\ncommand-line argument and write the password on its STDOUT." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to modify GitHub pull request? [duplicate]\nThis question already has answers here:\n \n \n\n\n\n\nPreferred Github workflow for updating a pull request after code review\n\n (2 answers)\n \n\nClosed 2 years ago.\n\n\n\nI've opened a pull request to a project. The maintainer has decided to accept it, but told me to modify some contents. \nHow can I do it? Whether I should keep the commit hash unchanged, how can I do it?" }, { "role": "assistant", "content": "Just push more commits on to the branch the request is for. The pull request will pick this up then.\nExample:\nIf you want to have b merged into master\n\nYou push c1,c2,c3 to b\nthen you make a new request for b\nit gets reviewed and you need more commits\nYou push c11,c21,c31 to b\nThe pull request now shows all 6 six commits" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-ls-tree - List the contents of a tree object" }, { "role": "assistant", "content": "NAME git-ls-tree - List the contents of a tree object" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to diff a commit with its parent\nAside from writing an alias or script, is there a shorter command for getting the diff for a particular commit?\ngit diff 15dc8^..15dc8\n\nIf you only give the single commit id git diff 15dc8, it diffs that commit against HEAD." }, { "role": "assistant", "content": "Use git show $COMMIT. It'll show you the log message for the commit, and the diff of that particular commit." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Visual Studio Code: Review Merge Changes Side by Side, rather than top down\nIs there any way to compare file changes in Visual Studio Code Side By Side, rather than top down? Regular Visual Studio Enterprise has this option.\nThis is during git merge conflict resolution." }, { "role": "assistant", "content": "2022: update for VSCode 1.69 (June 2022), as noted in Audwin Oyong's answer, there is now a 3-way merge view, which allows a side-by-side resolution.\n\nIn this release, we continued working on the 3-way merge editor.\nThis feature can be enabled by setting git.mergeEditor to true and will be enabled by default in future releases.\nThe merge editor allows you to quickly resolve Git merge conflicts. >\nWhen enabled, the merge editor can be opened by clicking on a conflicting file in the Source Control view.\nCheckboxes are available to accept and combine changes in Theirs or Yours:\n\n\nAnd VSCode 1.70 (July 2022) will offer a way to open the regular file (not in 3 way merge mode).\nSame as diff editor, it could use an action in the editor title area\n\nSee PR 155159 and its new action merge.openResult.\nAudwin Oyong adds, based on the release notes:\n\nTo turn off the 3-way merge view, you can set git.mergeEditor to false.\n\nOpen the VSCode settings with Ctrl,:\n\n(From Harshil Patanvadiya's answer)\n\n2021: By default, you see all conflicts \"top down\", but for each one, clicking on \"compare changes\" would open a tab with a side-by-side diff.\n\n(from issue 27562)\nNot ideal, but a good workaround.\n\nIn VSCode 1.71 (Aug. 2022):\n\nMerge Editor: Toggling word wrap should apply to all editors\nIt was weird when I toggled word wrap in the merge editor yet only the editor I was focused on had it toggled.\nI kind of expected all editors to have it toggled.\nMy rationale is that toggling word wrap is usually a symptom of having long lines and the chances that all three editors have long lines is high if a single editor has long lines.\n\nAnd:\n\nImprove Merge Editor Story For Files Having/Getting Conflict Markers\nOriginally we had this icon along to toggle between the raw file and merge editor views. Could use it with this new label too.\ngit-merge felt out of place as an icon choice to my eyes." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to git reset --hard everything but 4 files\nAssuming nothing is staged, what's the recommended way to reset all the work you've done, except for files:\napp/models/a.rb\napp/views/a/index.html.rb\nconfig/foo.rb\nconfig/bar.rb\n\nOther dirty files exist in app/models/ and app/views/ that I don't want to keep." }, { "role": "assistant", "content": "As you described the problem, it doesn't look like you want do reset. The simplest thing for this is:\ngit add app/models/a.rb app/views/a/index.html.rb config/foo.rb config/bar.rb\ngit checkout .\n\nso, it adds your 4 files into the index, and checks out clean versions (i.e. discards changes) for other files.\nI assume you have not staged (git add) modified files before (you should then unstage it using reset)." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How can I make docker-compose build an image from a remote git repository?\nDocker-compose allows you to utilize either preëxisting docker images or build from source. For the build option, the official reference requires\n\nEither a path to a directory containing a Dockerfile, or a url to a git repository.\n\nI'd like to take advantage of the latter case, so that I don't have to create a git submodule in my project, or register a new repository on Docker Hub. Unfortunately, there are no examples for how to format the url, and every form I've tried is mistaken for a relative file path.\ne.g.\n---\nletsencrypt:\n build: https://github.com/letsencrypt/letsencrypt.git\n...\n\nFails with the error:\n\nERROR: build path /{MY_CURRENT_PATH}/https:/github.com/letsencrypt/letsencrypt.git either does not exist or is not accessible.\n\nI didn't have any more luck with the other forms I've tried:\n\n[email protected]:letsencrypt/letsencrypt.git\ngit://github.com/letsencrypt/letsencrypt.git\nhttps://github.com/letsencrypt/letsencrypt" }, { "role": "assistant", "content": "Are you running version 1.5.2? It looks like this was actually recently added in https://github.com/docker/compose/pull/2430. Try upgrading.\nExample:\n---\n\nversion: '2'\n\nservices:\n redis:\n image: \"redis:3.2.3\"\n hostname: redis\n\n redis-commander:\n build: https://github.com/joeferner/redis-commander.git\n command: --redis-host redis\n links:\n - \"redis:redis\"\n ports:\n - 8081\n\nTested with:\n$ docker-compose -v\ndocker-compose version 1.11.2, build dfed245" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-log - Show commit logs --boundary" }, { "role": "assistant", "content": "Output excluded boundary commits. Boundary commits are\nprefixed with - ." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-checkout - Switch branches or restore working tree files --guess --no-guess" }, { "role": "assistant", "content": "If <branch> is not found but there does exist a tracking\nbranch in exactly one remote (call it <remote> ) with a\nmatching name, treat as equivalent to $ git checkout -b <branch> --track <remote>/<branch> If the branch exists in multiple remotes and one of them is named by\nthe checkout.defaultRemote configuration variable, we’ll use that\none for the purposes of disambiguation, even if the <branch> isn’t\nunique across all remotes. Set it to\ne.g. checkout.defaultRemote=origin to always checkout remote\nbranches from there if <branch> is ambiguous but exists on the origin remote. See also checkout.defaultRemote in git-config . --guess is the default behavior. Use --no-guess to disable it. The default behavior can be set via the checkout.guess configuration\nvariable." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How do I change the default home page of my gitlab installation\n\nBy default my gitlab homepage starts www.mydomain.com/users/sign_in. I would like to change this to show 'www.mydomain.com/public' instead. How do I configure this?" }, { "role": "assistant", "content": "Setting custom startpage for non-logged in users:\n\nFrom \"Admin Area\" goto the gear on the left and choose \"Settings\"\nFind parameter \"Home page URL\" and set it to www.mygitlab.com/explore.\nOptional set \"After sign out path\" to same url\nClick save\n\nTested with version is 8.14.4 CE" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-diff - Show changes between commits, commit and working tree, etc diff.submodule" }, { "role": "assistant", "content": "Specify the format in which differences in submodules are\nshown. The \"short\" format just shows the names of the commits\nat the beginning and end of the range. The \"log\" format lists\nthe commits in the range like git-submodule summary does. The \"diff\" format shows an inline diff of the changed\ncontents of the submodule. Defaults to \"short\"." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-revert - Revert some existing commits" }, { "role": "assistant", "content": "DESCRIPTION Given one or more existing commits, revert the changes that the\nrelated patches introduce, and record some new commits that record\nthem. This requires your working tree to be clean (no modifications\nfrom the HEAD commit). Note: git revert is used to record some new commits to reverse the\neffect of some earlier commits (often only a faulty one). If you want to\nthrow away all uncommitted changes in your working directory, you\nshould see git-reset , particularly the --hard option. If\nyou want to extract specific files as they were in another commit, you\nshould see git-restore , specifically the --source option. Take care with these alternatives as\nboth will discard uncommitted changes in your working directory. See \"Reset, restore and revert\" in git for the differences\nbetween the three commands." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "What is the best practice for dealing with passwords in git repositories?\n\nI've got a little Bash script that I use to access twitter and pop up a Growl notification in certain situations. What's the best way to handle storing my password with the script? \nI would like to commit this script to the git repo and make it available on GitHub, but I'm wondering what the best way to keep my login/password private while doing this is. Currently, the password is stored in the script itself. I can't remove it right before I push because all the old commits will contain the password. Developing without a password isn't an option. I imagine that I should be storing the password in an external config file, but I thought I'd check to see if there was an established way to handle this before I tried and put something together." }, { "role": "assistant", "content": "The typical way to do this is to read the password info from a configuration file. If your configuration file is called foobar.config, then you would commit a file called foobar.config.example to the repository, containing sample data. To run your program, you would create a local (not tracked) file called foobar.config with your real password data.\nTo filter out your existing password from previous commits, see the GitHub help page on Removing sensitive data." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Which is the smarter git protocol, ssh or git(over ssh) or https protocol?\n\nWhich is efficient? SSH:// or Git:// (File compression)\nI understand in Git, git protocol is smart because there is a protocol agent on both ends of communication to compress the file transfer resulting in faster clone by efficiently using the network bandwidth.\nFrom an O'Reilly book I found the following statements.\nFor secure, authenticated connections, the Git native \nprotocol can be tunneled over an SSH connection using\nthe following URL templates:\n\nssh: //[user@]example.com[:port]/path/to/repo.git\nssh: //[user@]example.com/path/to/repo.git\nssh: //[user@]example.com/~user2/path/to/repo.git\nssh: //[user@]example.com/~/path/to/repo.git*\n\nI'm not sure if the author means what he says. He talks of git protocol getting tunneled over SSH. \nFrom my perspective, unless you connect to the git port (agent port), the protocol is not in effect. And SSH is merely an uncompressed file transfer. But as per the author, if we use SSH he says the git protocol is tunneled over it. So is SSH smarter in GIT?\nVon C,\nThanks for your answer. \"Network protocols (HTTP and Git) are generally read-only\" Git can be made rw when you run the daemon with --enable=receive-pack. \nFollowing are my concerns.\nWhen they say git protocol is smart, they mean when you execute git clone, Git server agent compresses the data that is sent back to the client, so the clone should be faster. In my use case I'll be setting the Git server in Hongkong and using it on San Jose and other countries as well, So I want to be efficient over network due to latency concerns.\nSo my question is when I use git clone ssh://user@server/reposloc do I get the benefits of git protocol also? As per O'Reilly author book he means git is tunneled over ssh, then how does git protocol work when I don't have git daemon running on the server.\nSo using SSh://xyz... does it give both the benefit of ssh and git protocols?\nAppreciate your answers in advance." }, { "role": "assistant", "content": "Update 2010-2014:\nBoth ssh and https are equivalent, since Git 1.6.6+ (2010) and the implementation of smart http protocol:\n\nYou now can use ssh or https for read/write access to your repos.\nYou can also detect if your remote server supports smart http.\nAdd the right environment variable if you have to use a proxy.\nQ3 2015, as Yousha Aleayoub mentions in the comments:\nGitHub \"Which remote URL should I use?\"\n\nThe https:// clone URLs are available on all repositories, public and private.\n They are smart, so they will provide you with either read-only or read/write access, depending on your permissions to the repository.\n\nThe git-http-backend is the:\n\nsimple CGI program to serve the contents of a Git repository to Git clients accessing the repository over http:// and https:// protocols.\n The program supports clients fetching using both the smart HTTP protocol and the backwards-compatible dumb HTTP protocol, as well as clients pushing using the smart HTTP protocol.\n\n\nOriginal answer (July 2010):\nFrom the Pro Git Book:\n\nProbably the most common transport protocol for Git is SSH.\n This is because SSH access to servers is already set up in most places — and if it isn’t, it’s easy to do. \nSSH is also the only network-based protocol that you can easily read from and write to. The other two network protocols (HTTP and Git) are generally read-only, so even if you have them available for the unwashed masses, you still need SSH for your own write commands. \nSSH is also an authenticated network protocol; and because it’s ubiquitous, it’s generally easy to set up and use.\n\nSo it is not \"smarter\" than Git protocol, just a complementary protocol for certain features not addressed by the Git protocol.\n\nThe downside of the Git protocol is the lack of authentication. It’s generally undesirable for the Git protocol to be the only access to your project.\n Generally, you’ll pair it with SSH access for the few developers who have push (write) access and have everyone else use git:// for read-only access\nIt also requires firewall access to port 9418, which isn’t a standard port that corporate firewalls always allow. Behind big corporate firewalls, this obscure port is commonly blocked.\n\n(that is why in my shop, I need to use ssh+git and not just git, even for read access: 9418 is blocked...)" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Meaning of lib directory in github repositories\n\nMost of the time, when I look at projects in github , I see lib/ directory. \nI just googled if there is a conventional meaning of lib/ directory. But I couldn't find much.\nI would like to know what lib/ directory is for just to choose where to start looking at in github projects. \nProject which have lib/ directories. \norchestrator \ngulp" }, { "role": "assistant", "content": "The lib directory, for most of my projects, is where I place shared components that might be used in multiple facets of my application. Things in this folder should not be tightly coupled to your application, and should theoretically be able to be plucked from one project to another, and work as expected (assuming all dependencies are available). Some examples of things I put in my lib folders:\n\nIf I'm defining a policy/process for loading bootstrapped data off the page into my frontend code, I would define the class/method in a file in the lib folder. It is just functional, and not bound to any of my application code or DOM structure.\nIf I need to build my own UI components (let's say I need to merge some Tagging functionality into a text area, and am unhappy with existing OSS alternatives), I would do it here. The code in lib just outlines how my component works, but doesn't implement any application-specific functionality. I can then include this in my core application and use it as if it were a third party library.\n\nEssentially, anything that could be a third party dependency that you don't want to place in it's own repository and set up management for, you can use lib and have that functionality cleanly decoupled within your primary app." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "gitignore - Specifies intentionally untracked files to ignore" }, { "role": "assistant", "content": "SYNOPSIS $XDG_CONFIG_HOME/git/ignore, $GIT_DIR/info/exclude, .gitignore" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-diff - Show changes between commits, commit and working tree, etc -b --ignore-space-change" }, { "role": "assistant", "content": "Ignore changes in amount of whitespace. This ignores whitespace\nat line end, and considers all other sequences of one or\nmore whitespace characters to be equivalent." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Automatically delete git branch after merge to master\nWe will be attempting a work flow in github where every ticket is a branch off of master.\nAfter the ticket is complete, the work is merged into staging where regression and integration tests are performed before it is merged into master.\nA team lead brought up the issue of the old ticket branches after a merge will start to build up. \nI found this script and want to know if this would work in our environment. We only want to delete branches that have been merged into master." }, { "role": "assistant", "content": "Github has released a feature where anyone with admin permission to the repository can configure branches to get deleted automatically after pull requests are merged. Here are the steps -\n\nNavigate to main page of the repository and click on Settings.\nUnder \"Merge button\", you can select or unselect \"Automatically delete head branches\" option.\n\nThis feature has been released by Github on July 31, 2019." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-show - Show various types of objects -R" }, { "role": "assistant", "content": "Swap two inputs; that is, show differences from index or\non-disk file to tree contents." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-branch - List, create, or delete branches" }, { "role": "assistant", "content": "NAME git-branch - List, create, or delete branches" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Reduce Git repository size\nI tried looking for a good tutorial on reducing git repository sizes, but I found none.\nHow do I reduce my repository size?\nIt's about 10 MB, but Heroku only allows 50 MB\nand I'm nowhere near finished developing my application.\nI added the usual suspects (log, vendor, doc, etc.) to the .gitignore file already.\nAlthough I only added .gitignore recently.\nWhat can I do?" }, { "role": "assistant", "content": "Update Feb. 2021, eleven years later: the new git maintenance command (man page) should supersede git gc, and can be scheduled.\n\nOriginal: git gc --aggressive is one way to force the prune process to take place (to be sure: git gc --aggressive --prune=now). You have other commands to clean the repo too. Don't forget though, sometimes git gc alone can increase the size of the repo!\nIt can be also used after a filter-branch, to mark some directories to be removed from the history (with a further gain of space); see here. But that means nobody is pulling from your public repo. filter-branch can keep backup refs in .git/refs/original, so that directory can be cleaned too.\nFinally, as mentioned in this comment and this question; cleaning the reflog can help:\ngit reflog expire --all --expire=now\ngit gc --prune=now --aggressive\n\nAn even more complete, and possibly dangerous, solution is to remove unused objects from a git repository\n\nNote that git filter-repo now (Git 2.24+, Q4 2019) replaces the obsolete git filter-branch or BFG: it is a python-based tool, to be installed first.\nJoe suggests:\n# Find the largest files in .git:\ngit rev-list --objects --all | grep -f <(git verify-pack -v .git/objects/pack/*.idx| sort -k 3 -n | cut -f 1 -d \" \" | tail -10)\n\n# Strat filtering these large files:\ngit filter-repo --path-glob '../../src/../..' --invert-paths --force\n#or\ngit filter-repo --path-glob '*.zip' --invert-paths --force\n#or\ngit filter-repo --path-glob '*.a' --invert-paths --force\n\ngit remote add origin [email protected]:.../...git\ngit push --all --force\ngit push --tags --force" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Link latest file on Bitbucket Git repository\nI have a public Git repository on Bitbucket. I want to link the latest version of a Read-Me file. Here's the link to a revision/commit:\nhttps://bitbucket.org/wordless/thofu-interpreter/raw/5bfc37864c5d/ThoFu%20Interpreter/ReadMe.txt\nI tried to replace the revision number with tip and default, but it didn't work. Is there any way to get a permanent link to my latest files?" }, { "role": "assistant", "content": "Two ideas:\nUse master in the url (this seems to work):\nhttps://bitbucket.org/wordless/thofu-interpreter/raw/master/ThoFu%20Interpreter/ReadMe.txt\n\nAnother idea is to create a wiki page for your project, then use the wiki's functionality to link to the latest version of a file with this syntax:\n<<file path/to/file [revision] [linenumber]>>\n\nJust omit the revision and line number parameters, they are optional.\nThen, refer to the wiki page everywhere else you'd like link to the read me file." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to install an npm package from GitHub directly\n\nTrying to install modules from GitHub results in this error:\n\nENOENT error on package.json.\n\nEasily reproduced using express:\nnpm install https://github.com/visionmedia/express throws error.\nnpm install express works.\nWhy can't I install from GitHub?\nHere is the console output:\nnpm http GET https://github.com/visionmedia/express.git\nnpm http 200 https://github.com/visionmedia/express.git\nnpm ERR! not a package /home/guym/tmp/npm-32312/1373176518024-0.6586997057311237/tmp.tgz\nnpm ERR! Error: ENOENT, open '/home/guym/tmp/npm-32312/1373176518024-0.6586997057311237/package/package.json'\nnpm ERR! If you need help, you may report this log at:\nnpm ERR! <http://github.com/isaacs/npm/issues>\nnpm ERR! or email it to:\nnpm ERR! <[email protected]>\n\nnpm ERR! System Linux 3.8.0-23-generic\nnpm ERR! command \"/usr/bin/node\" \"/usr/bin/npm\" \"install\" \"https://github.com/visionmedia/express.git\"\nnpm ERR! cwd /home/guym/dev_env/projects_GIT/proj/somename\nnpm ERR! node -v v0.10.10\nnpm ERR! npm -v 1.2.25\nnpm ERR! path /home/guym/tmp/npm-32312/1373176518024-0.6586997057311237/package/package.json\nnpm ERR! code ENOENT\nnpm ERR! errno 34\nnpm ERR!\nnpm ERR! Additional logging details can be found in:\nnpm ERR! /home/guym/dev_env/projects_GIT/proj/somename/npm-debug.log\nnpm ERR! not ok code 0" }, { "role": "assistant", "content": "Because https://github.com/visionmedia/express is the URL of a web page and not an npm module. Use this flavor: git+{url}.git\ngit+https://github.com/visionmedia/express.git\n\nor this flavor if you need SSH:\ngit+ssh://[email protected]/visionmedia/express.git\n\nor if you need to install a GitHub Enterprise repository:\ngit+https://<github enterprise url>/<org>/<repo>.git#<branch>" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Ansible SSH private key in source control?\nI have been developing an Ansible playbook for a couple of weeks, therefore, my experience with such technology is relatively short. Part of my strategy includes using a custom ansible_ssh_user for provisioning hosts throughout the inventory, however, such user will need its own SSH key pair, which would involve some sort of a plan for holding/storing its correspondent private key. On a production environment, this playbook would be cloned/pulled and run inside a certain playbook node whose role is to provision the rest of the infrastructure.\nAt first, I was thinking to just put that private key inside the playbook git repository, but I am having second thoughts about it nonetheless, mostly because of somewhat obvious security reasons and common sense around it, hence the reason I need to consult you about this matter. \nWith this set on the table, here are the follow-up questions:\n\nIn an Ansible-based development environment, is it sane/reasonable to hold a private SSH key in source control?\nWould this practice be advised only for development environments whereas another local git branch inside the playbook node would be then used to hold the actual production SSH private key?\nWould it be better to address this case scenario via Ansible Vault instead?, I have not ever used this before, but regardless of that I cannot yet tell whether this would be a proper case for using it.\nIn your experience, what would be your approach around this in a production environment?, what would it be considered as the best practice in this particular scenario?" }, { "role": "assistant", "content": "It's a bad idea to store any kind of plaintext secret in revision control, SSH private keys included. Instead, use ansible-vault to store the private key.\nansible-vault can operate on any file type. Just encrypt the file with\nansible-vault encrypt /path/to/local/private_key\n\nthen install the key:\n- name: Install a private SSH key\n vars:\n source_key: /path/to/local/private_key\n dest_key: /path/to/remote/private_key\n tasks:\n - name: Ensure .ssh directory exists.\n file: \n dest: \"{{ dest_key | dirname }}\"\n mode: 0700 \n owner: user \n state: directory\n - name: Install ssh key\n copy: \n src: \"{{ source_key }}\" \n dest: \"{{ dest_key }}\"\n mode: 0600\n owner: user" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Git push error: Unable to unlink old (Permission denied)\nIn the remote server I have a post-receive hook set up in order to make a git checkout of my repository:\n#!/bin/sh\nGIT_WORK_TREE=/var/www/<website> git checkout -f\n\nBut when I make a push from my local machine to the git repository in the server, I get the following error messages:\nremote: error: unable to unlink old '<file>' (Permission denied)\n\nThis appears many times over, one error message for almost every file.\nHowever I have a README.txt file that I'm able to change using git, here are its permissions:\n-rw-r--r-- 1 <serverusername> <serverusername> 2939 Aug 2 10:58 README.txt\n\nBut other files with exactly the same owner and same permissions, give me that error.\nIn another local repository for another website, I have the files with my local machine username as owner, and when I push to the remote server it respects the remote server owner of the files and works like a charm.\nObviously it seems a permissions related error, but I can't find a way to fix it, any suggestions?" }, { "role": "assistant", "content": "When you have to unlink file, you have to have permission 'w' for directory, in which file is, not for the file..." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How can I debug e-mail sending on Gitlab?\n\nMy Gitlab (version 5) is not sending any e-mails and I am lost trying to figure out what is happening. The logs give no useful information. I configured it to used sendmail.\nI wrote a small script that sends e-mail through ActionMailer (I guess it is what gitlab uses to send e-mail, right?). And it sends the e-mail correctly.\nBut, on my Gitlab, I can guarantee that sendmail is not even being called.\nDo I need to enable something to get e-mail notifications? How can I debug my issue?\nUpdate\nThe problem is that I can not find any information anywhere. The thing just fails silently. Where can I find some kind of log? The logs in the log dir provide no useful information.\nMy question is, how can I make Gitlab be more verbose? How can I make it tell me what is going on?\nUpdate 2\nI just found a lot of mails scheduled on the Background jobs section. A lot of unprocessed Sidekiq::Extensions::DelayedMailer. What does it mean? Why were these jobs not processed?" }, { "role": "assistant", "content": "Stumbled upon this issue today, here's my research:\nDebugging SMTP connections in the GitLab GUI is not supported yet. However there is a pending feature request and a command line solution.\nSet the desired SMTP settings /etc/gitlab/gitlab.rb and run gitlab-ctl reconfigure (see https://docs.gitlab.com/omnibus/settings/smtp.html).\nStart the console running gitlab-rails console -e production.\nShow the configured delivery method (should be :smtp) running the command ActionMailer::Base.delivery_method. Show all configured SMTP settings running ActionMailer::Base.smtp_settings.\nTo send a test mail run\nNotify.test_email('[email protected]', 'Hello World', 'This is a test message').deliver_now\n\nOn the admin page in GitLab, the section »Background jobs« shows information about all jobs. Failing SMTP connections are listed there as well.\nPlease note, you may need to restart the GitLab instance in order to use the newly configured SMTP settings (on my instance the console was able to send mails, the GUI required a restart). Run gitlab-ctl restart to restart your instance." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to resume review process after updating pull request at GitHub?\n\nI forked GitHub repository and created pull request. Reviewer requested changes from me:\n\n\nChanges requested\n1 review requesting changes by reviewers with write access. Learn more.\n\nI've committed and pushed necessary changes in pull request branch, so they are displaying at pull request page. Now I want ask contributor to continue review my changes.\nIs there any button or action for this? Can't find this." }, { "role": "assistant", "content": "2 years and a half years later, (February 2019), do check if the new button \"Re-request review\" would help. \nAs illustrated on twitter, if your PR was already reviewed, but now it’s time for round 2: With fresh eyes and fresh code, re-request a review 🔃\n\n\nNote/caveat: (from \"Requesting a pull request review\")\n\nPull request authors can't request reviews unless they are either a repository owner or collaborator with write access to the repository.\n\nAs noted in the comments by gertvdijk:\n\nI am a contributor on the project and the owner of the PR.\n It does not make sense to me that I need to be a collaborator on the project to request a re-review? \nOh, wow, it's by design that PR authors can't use this feature?\n Damn, that's very much killing the whole feature." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-bundle - Move objects and refs by archive -q --quiet" }, { "role": "assistant", "content": "This flag makes the command not to report its progress\non the standard error stream." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to change the main branch in BitBucket?\nI have a repo on bitbucket with two branches. First branch is master with a fake content, then I have another one called trunk with the correct content.\nI would like to change the main branch to trunk (actually is master). I found that in the repo adminsitration are on bitbucket web I could change this but I couldn't.\nFinally I would like to understand if is possible to do this through terminal from my local repo.\nMaybe an easy thing is to delete contents from master and merge trunk into master and the delete trunk but I neither know how to do this." }, { "role": "assistant", "content": "Repositories.\nClick on a repository.\nRepository settings.\nAdvanced\nMain branch.\nChange it from master to main or something else.\nSave changes.\n\nBack in the day\n\nRepositories\n\n\n\nSelect repository\nSettings\n\n\n\nMain branch: master\n\n\n\nSave repository details" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Is there a way to cache https credentials for pushing commits?\nI recently switched to synchronizing my repositories to https:// on GitHub (due to firewall issues), and it asks for a password every time.\nIs there a way to cache the credentials, instead of authenticating every time that git push?" }, { "role": "assistant", "content": "Since Git 1.7.9 (released 2012), there is a neat mechanism in Git to avoid having to type your password all the time for HTTP / HTTPS, called credential helpers.\nYou can just use one of the following credential helpers:\ngit config --global credential.helper cache\n\nThe credential.helper cache value tells Git to keep your password cached in memory for a particular amount of minutes. The default is 15 minutes, you can set a longer timeout with:\n# Cache for 1 hour\ngit config --global credential.helper \"cache --timeout=3600\"\n\n# Cache for 1 day\ngit config --global credential.helper \"cache --timeout=86400\"\n\n# Cache for 1 week\ngit config --global credential.helper \"cache --timeout=604800\"\n\nYou can also store your credentials permanently if so desired, see the other answers below.\nGitHub's help also suggests that if you're on Mac OS X and used Homebrew to install Git, you can use the native Mac OS X keystore with:\ngit config --global credential.helper osxkeychain\n\nFor Windows, there is a helper called Git Credential Manager for Windows or wincred in msysgit.\ngit config --global credential.helper wincred # obsolete\n\nWith Git for Windows 2.7.3+ (March 2016):\ngit config --global credential.helper manager\n\nFor Linux, you would use (in 2011) gnome-keyring(or other keyring implementation such as KWallet).\nNowadays (2020), that would be (on Linux)\nFedora\nsudo dnf install git-credential-libsecret\ngit config --global credential.helper /usr/libexec/git-core/git-credential-libsecret\n\nUbuntu\nsudo apt-get install libsecret-1-0 libsecret-1-dev\ncd /usr/share/doc/git/contrib/credential/libsecret\nsudo make\ngit config --global credential.helper /usr/share/doc/git/contrib/credential/libsecret/git-credential-libsecret" } ]