messages
listlengths 3
3
|
---|
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git fetch origin --prune doesn't delete local branches?\nAt one point I thought that git fetch origin --prune deleted local branches that were no longer present on the server. Somehow this is not my experience at the moment.\nI ran this command, and the local branch was not deleted. It is not currently checked out. I ran git branch -vv to check this info, and I see\nfeature/MyGreatFeature f30efc7 [origin/feature/MyGreatFeature: gone]\n\nSo it seems to know that it is gone. Why would it not delete my local branch?\nRunning git version 2.7.4 (Apple Git-66)"
},
{
"role": "assistant",
"content": "The following command chain can be used to delete local branches:\ngit branch --v | grep \"\\[gone\\]\" | awk '{print $1}' | xargs git branch -D\n\n\ngit branch --v lists the local branches verbosely\ngrep \"\\[gone\\]\" finds all the branches whose remote branch is gone\nawk '{print $1}' outputs only the name of the matching local branches\nxargs git branch -D deletes all the matching local branches\n\nThis should work on MacOS as well as *nix environments."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Getting Git to work with a proxy server - fails with \"Request timed out\"\nHow do I get Git to use a proxy server?\nI need to check out code from a Git server, but it shows \"Request timed out\" every time. How do I get around this? \nAlternatively, how can I set a proxy server?"
},
{
"role": "assistant",
"content": "The command to use:\ngit config --global http.proxy http://proxyuser:[email protected]:8080\n\n\nchange proxyuser to your proxy user\nchange proxypwd to your proxy password\nchange proxy.server.com to the URL of your proxy server\nchange 8080 to the proxy port configured on your proxy server\n\nNote that this works for both HTTP and HTTPS repositories.\nIf you decide at any time to reset this proxy and work without proxy:\nThe command to use:\ngit config --global --unset http.proxy\n\nFinally, to check the currently-set proxy:\ngit config --global --get http.proxy"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Dockerfile strategies for Git\nWhat is the best strategy to clone a private Git repository into a Docker container using a Dockerfile? Pros/Cons? \nI know that I can add commands on Dockerfile in order to clone my private repository into a docker container. But I would like to know which different approaches people have used on this case. \nIt’s not covered in the Dockerfile best practices guide."
},
{
"role": "assistant",
"content": "From Ryan Baumann's blog post “Git strategies for Docker”\n\nThere are different strategies for getting your Git source code into a\n Docker build. Many of these have different ways of interacting with\n Docker’s caching mechanisms, and may be more or less appropriately\n suited to your project and how you intend to use Docker.\nRUN git clone\nIf you’re like me, this is the approach that first springs to mind\n when you see the commands available to you in a Dockerfile. The\n trouble with this is that it can interact in several unintuitive ways\n with Docker’s build caching mechanisms. For example, if you make an\n update to your git repository, and then re-run the docker build which\n has a RUN git clone command, you may or may not get the new commit(s)\n depending on if the preceding Dockerfile commands have invalidated the\n cache.\nOne way to get around this is to use docker build --no-cache, but\n then if there are any time-intensive commands preceding the clone\n they’ll have to run again too.\nAnother issue is that you (or someone you’ve distributed your\n Dockerfile to) may unexpectedly come back to a broken build later on\n when the upstream git repository updates.\nA two-birds-one-stone approach to this while still using RUN git clone\n is to put it on one line1 with a specific revision checkout, e.g.:\nRUN git clone https://github.com/example/example.git && cd example && git checkout 0123abcdef\n\nThen updating the revision to check out in the Dockerfile will\n invalidate the cache at that line and cause the clone/checkout to run.\nOne possible drawback to this approach in general is that you have to\n have git installed in your container.\nRUN curl or ADD a tag/commit tarball URL\nThis avoids having to have git installed in your container\n environment, and can benefit from being explicit about when the cache\n will break (i.e. if the tag/revision is part of the URL, that URL\n change will bust the cache). Note that if you use the Dockerfile ADD\n command to copy from a remote URL, the file will be downloaded every\n time you run the build, and the HTTP Last-Modified header will also be\n used to invalidate the cache.\nYou can see this approach used in the golang\n Dockerfile.\nGit submodules inside Dockerfile repository\nIf you keep your Dockerfile and Docker build in a separate repository\n from your source code, or your Docker build requires multiple source\n repositories, using git submodules (or git subtrees) in this\n repository may be a valid way to get your source repos into your build\n context. This avoids some concerns with Docker caching and upstream\n updating, as you lock the upstream revision in your submodule/subtree\n specification. Updating them will break your Docker cache as it\n changes the build context.\nNote that this only gets the files into your Docker build context, you\n still need to use ADD commands in your Dockerfile to copy those paths\n to where you expect them in the container.\nYou can see this approach used in the\n here\nDockerfile inside git repository\nHere, you just have your Dockerfile in the same git repository\n alongside the code you want to build/test/deploy, so it automatically\n gets sent as part of the build context, so you can e.g. ADD . /project\n to copy the context into the container. The advantage to this is that\n you can test changes without having to potentially commit/push them to\n get them into a test docker build; the disadvantage is that every time\n you modify any files in your working directory it will invalidate the\n cache at the ADD command. Sending the build context for a large\n source/data directory can also be time-consuming. So if you use this\n approach, you may also want to make judicious use of the\n .dockerignore\n file,\n including doing things like ignoring everything in your .gitignore and\n possibly the .git directory itself.\nVolume mapping\nIf you’re using Docker to set up a dev/test environment that you want\n to share among a wide variety of source repos on your host machine,\n mounting a host directory as a data\n volume\n may be a viable strategy. This gives you the ability to specify which\n directories you want to include at docker run-time, and avoids\n concerns about docker build caching, but none of this will be shared\n among other users of your Dockerfile or container image."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-svn - Bidirectional operation between a Subversion repository and Git -A<filename> --authors-file=<filename>"
},
{
"role": "assistant",
"content": "Syntax is compatible with the file used by git cvsimport but\nan empty email address can be supplied with <> : loginname = Joe User <[email protected]> If this option is specified and git svn encounters an SVN\ncommitter name that does not exist in the authors-file, git svn will abort operation. The user will then have to add the\nappropriate entry. Re-running the previous git svn command\nafter the authors-file is modified should continue operation. config key: svn.authorsfile"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Per-project flake8 max line length?\nI'm using a Flake8 git hook in my project and I want to relax the line length limit, but only for one project. Given that it looks like there's no clear API for that, how do I modify this hook to do that? Alternatively, is there a git-config setting or an environment variable that would let me set that? Here's the hook source code:\n#!/usr/bin/env python\nimport os\nimport sys\nimport logging\nimport os.path as P\n\nfrom flake8.main import git\n\n\nif __name__ == '__main__':\n ret = git.hook(\n strict=git.config_for('strict'),\n lazy=git.config_for('lazy'),\n )\n if ret:\n sys.exit(ret)"
},
{
"role": "assistant",
"content": "Use the setup.cfg file in each project. This file is read by various Python-related tools, including pep8 (see pep8's documentation) and flake8.\nThe documentation for setup.cfg with flake8 is in the Configuring Flake8 chapter. In short, you want a setup.cfg file with this content (obviously, adjust the 99 to your needs):\n[flake8]\nmax-line-length = 99\n\nIf you don't want to create a setup.cfg file, you can also specify this as an argument to the command:\nflake8 --max-line-length 99"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-svn - Bidirectional operation between a Subversion repository and Git --parent"
},
{
"role": "assistant",
"content": "Fetch only from the SVN parent of the current HEAD."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git: switch branch without detaching head\nI have a repository on github with a main branch (master) and a branch for some experimental work. I made some commits and pushed to the experimental branch and everything was fine.\nNow, on a different machine, I try to clone my repository (git clone repository) and then switch to the experimental branch (git checkout branchname) but every time I do this my head gets detached and I can't push my changes. What am I doing wrong? I get the feeling I'm missing a fundamental git concept someplace but reading random git man pages isn't giving me any clues.\nI'm new to git so I'm sorry if I'm being an idiot but I can't find anything in the docs that will help me reattach my head.\nEDIT\nThe concept of a tracking branch is what I was missing. Now that I grok that concept everything is clear. Personally, I find the git branch --track syntax to be much more intuitive than git checkout -b branch-name origin/branch-name.\nThanks for the help!"
},
{
"role": "assistant",
"content": "# first time: make origin/branchname locally available as localname\ngit checkout -b localname origin/branchname \n\n# othertimes \ngit checkout localname \n\ngit push origin\n\nFor convenience, you may use the same string for localname & branchname\nWhen you checked out origin/branchname you weren't really checking out a branch. \norigin/branchname is a \"remote\" name, and you can get a list of them with \nbranch -a \n\nIf you have colours enabled, local branches will be one colour, and remote another. \nYou have to first make a remote branch tracked locally in order to be able to switch-to and work on it."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Git add all subdirectories\nI'm having trouble adding a folder and all of it's subdirectories to my git repository. I realized this is a very popular question after doing some googling and I've tried each suggestion with no luck, specifically the suggestion from the man page on git-add. I even tried git add -A with no success. For simplicity sake, say I initialized my git repository as Dir1. Then I have the following directory structure of files.\nDir1/file1-1.txt\nDir1/file1-2.txt\nDir1/Dir2/file2-1.txt\nDir1/Dir2/Dir3/file3-1.txt\n\nMy real files have subdirectories that span 5-6 levels deep, so is there a git command to add all the files in each subdirectory to my repository? Right now, when I do the suggestion from the man page git add Dir1/\\* I can see Dir2 in my repo, but it shows up as a green folder and I can't open it, which leads me to believe that all the files/folders in Dir2 did not get added. Any help would be greatly appreciated. I'm a new git user (less than a week of using it), so try and keep your instructions at a beginner's level."
},
{
"role": "assistant",
"content": "Do,\ngit add .\n\nwhile in the root of the repository. It will add everything. If you do git add *, it will only add the files * points to. The single dot refers to the directory.\nIf your directory or file wasn't added to git index/repo after the above command, remember to check if it's marked as ignored by git in .gitignore file."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to reverse apply a stash?\nI have a small patch saved away in my git stash. I've applied it to my working copy using git stash apply. Now, I'd like to back out those changes by reverse applying the patch (kind of like what git revert would do but against the stash).\nDoes anyone know how to do this?\nClarification: There are other changes in my working copy. My particular case is hard to describe but you can imagine some debugging or experimental code that's in the stash. Now it's mixed in my working copy with some other changes and I'd like to see the effect with and without the changes from the stash.\nIt doesn't look like stash supports this currently, but a git stash apply --reverse would be a nice feature."
},
{
"role": "assistant",
"content": "According to the git-stash manpage, \"A stash is represented as a commit whose tree records the state of the working directory, and its first parent is the commit at HEAD when the stash was created,\" and git stash show -p gives us \"the changes recorded in the stash as a diff between the stashed state and its original parent.\nTo keep your other changes intact, use git stash show -p | patch --reverse as in the following:\n$ git init\nInitialized empty Git repository in /tmp/repo/.git/\n\n$ echo Hello, world >messages\n\n$ git add messages\n\n$ git commit -am 'Initial commit'\n[master (root-commit)]: created 1ff2478: \"Initial commit\"\n 1 files changed, 1 insertions(+), 0 deletions(-)\n create mode 100644 messages\n\n$ echo Hello again >>messages\n\n$ git stash\n\n$ git status\n# On branch master\nnothing to commit (working directory clean)\n\n$ git stash apply\n# On branch master\n# Changed but not updated:\n# (use \"git add <file>...\" to update what will be committed)\n# (use \"git checkout -- <file>...\" to discard changes in working directory)\n#\n# modified: messages\n#\nno changes added to commit (use \"git add\" and/or \"git commit -a\")\n\n$ echo Howdy all >>messages\n\n$ git diff\ndiff --git a/messages b/messages\nindex a5c1966..eade523 100644\n--- a/messages\n+++ b/messages\n@@ -1 +1,3 @@\n Hello, world\n+Hello again\n+Howdy all\n\n$ git stash show -p | patch --reverse\npatching file messages\nHunk #1 succeeded at 1 with fuzz 1.\n\n$ git diff\ndiff --git a/messages b/messages\nindex a5c1966..364fc91 100644\n--- a/messages\n+++ b/messages\n@@ -1 +1,2 @@\n Hello, world\n+Howdy all\n\nEdit:\nA light improvement to this is to use git apply in place of patch:\ngit stash show -p | git apply --reverse\n\nAlternatively, you can also use git apply -R as a shorthand to git apply --reverse.\nI've been finding this really handy lately..."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Untrack files from git temporarily\n\nI have setup a local git on my machine. When I initialized git, I added pre-compiled libs and binaries. However, now during my development I don't want to check in those files intermittently. I dont want to remove these files from repo. Is there any way to not keep a track of these files till I complete my development. (I think I can not use .gitignore as it works only for those files which are not in git. I want to temporarily disable tracking of files.)"
},
{
"role": "assistant",
"content": "git update-index should do what you want\nThis will tell git you want to start ignoring the changes to the file\ngit update-index --assume-unchanged path/to/file\nWhen you want to start keeping track again\ngit update-index --no-assume-unchanged path/to/file\nGithub Documentation: update-index"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to change a release on Github point to the latest commit?\n\nI recently released a new version of my project on Github by clicking the release button, on the right-hand side of the page. However, I found something error in my code, so, I just fixed and committed it.\nNow, I would like to change my latest release in order to include my latest commit. I tried to remove the release and recreate it once again using the same tag name, however, it still points to the previous commit. I have been googling but still no luck. Any help would be appreciated."
},
{
"role": "assistant",
"content": "You would need to update/move the tag locally first, and force push it (as in here):\n# assuming you are in the branch referencing currently the right new commit:\ngit tag -f <tagname>\n\n# push your new commit:\ngit push \n\n# force push your moved tag:\ngit push origin -f <tagname>\n\nThen you can go on GitHub and associate new binaries with the release for that tag (which should point to the right commit)."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to commit a change with both \"message\" and \"description\" from the command line? [duplicate]\nThis question already has answers here:\n \n \n\n\n\n\nGit/GitHub commit with extended message/description\n\n (3 answers)\n \n\nClosed 6 years ago.\n\n\n\nI can push commits to GitHub via git (on the command line, not the Mac app).\nWhen I push commits directly from the GitHub web interface (e.g. quickly fixing a typo), I have the chance to \"comment\" the commit, and GitHub gives me a commit title and a commit description. I find this very useful.\nStill, when I git push from the local machine, git opens my default editor: so I write the commit comment, and then GitHub automatically divides it into title and \"body\". Is there a way to pretty comment commits from terminal too?"
},
{
"role": "assistant",
"content": "There is also another straight and more clear way\ngit commit -m \"Title\" -m \"Description ..........\";"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Clearing the pipeline cache with Gitlab CI\n\nIs it possible to invalidate or clear a pipeline cache with the Gitlab CI after a pipeline completes?\nMy .gitlab-ci.yml file has the following global cache definition\ncache:\n key: \"%CI_PIPELINE_ID%\"\n paths:\n - './msvc/Project1`/bin/Debug'\n - './msvc/Project2`/bin/Debug'\n - './msvc/Project3`/bin/Debug'\n\nThe cache-key value specifies that each pipeline should maintain it's own cache, which is working fine, but the cache file continues to exist after the pipeline completes. With hundreds of pipelines being run, the size starts to add up and manually deleting the cache folder on our machine isn't a great solution.\nI tried adding a cleanup job at the end of the pipeline\ncleanup:\n stage: cleanup\n script:\n - rm -rf './msvc/Project1/bin'\n - rm -rf './msvc/Project2/bin'\n - rm -rf './msvc/Project3/bin'\n when: always\n\nWhich deletes the local files, but won't delete them from the cache.\nAm I missing something here?\nCurrently running Gitlab-EE 10.3.3"
},
{
"role": "assistant",
"content": "Artifacts are the solution as mentioned in the comments. However there is an option to clear caches in the Pipelines page as shown in the image below."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Make Git automatically remove trailing white space before committing\nI'm using Git with my team and would like to remove white space changes from my diffs, logs, merges, etc. I'm assuming that the easiest way to do this would be for Git to automatically remove trailing white space (and other white space errors) from all commits as they are applied.\nI have tried to add the following to the ~/.gitconfig file, but it doesn't do anything when I commit. Maybe it's designed for something different. What's the solution?\n[core]\n whitespace = trailing-space,space-before-tab\n[apply]\n whitespace = fix\n\nI'm using Ruby in case anyone has any Ruby specific ideas. Automatic code formatting before committing would be the next step, but that's a hard problem and is not really causing a big problem."
},
{
"role": "assistant",
"content": "Those settings (core.whitespace and apply.whitespace) are not there to remove trailing whitespace but to:\n\ncore.whitespace: detect them, and raise errors\napply.whitespace: and strip them, but only during patch, not \"always automatically\"\n\nI believe the git hook pre-commit would do a better job for that (includes removing trailing whitespace)\n\nNote that at any given time you can choose to not run the pre-commit hook:\n\ntemporarily: git commit --no-verify .\npermanently: cd .git/hooks/ ; chmod -x pre-commit\n\nWarning: by default, a pre-commit script (like this one), has not a \"remove trailing\" feature\", but a \"warning\" feature like:\nif (/\\s$/) {\n bad_line(\"trailing whitespace\", $_);\n}\n\nYou could however build a better pre-commit hook, especially when you consider that:\n\nCommitting in Git with only some changes added to the staging area still results in an “atomic” revision that may never have existed as a working copy and may not work.\n\n\nFor instance, oldman proposes in another answer a pre-commit hook which detects and remove whitespace.\nSince that hook get the file name of each file, I would recommend to be careful for certain type of files: you don't want to remove trailing whitespace in .md (markdown) files!\n\nAnother approach, suggested by hakre in the comments:\n\nYou can have two spaces at end of line in markdown and not have it as trailing whitespace by adding \"\\\" before \\n.\n\nThen a content filter driver:\ngit config --global filter.space-removal-at-eol.clean 'sed -e \"s/ \\+$//\"'\n# register in .gitattributes \n*.md filter=space-removal-at-eol"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Is it possible on gitlab ci build only on tag push event?\n\nwhen I have a project with continuous integration gitlab at the time of making the push automatically tasks that are within the gitlab-ci.yml file are released , what I want is that only in time to make the push of a tag ( git push --follow -tags ) , the tasks of file gitlab-ci.yml - run , is this possible (only git push --follow -tags)?\n\nI refer to this event , but with the build in gitlab ci."
},
{
"role": "assistant",
"content": "Solved:\nAdd to .gitlab-ci.yml tags:\nmyjob:\n script: test\n only:\n - tags"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "gitlab-reconfigure blocked on redis after reinstalling gitlab on ubuntu 18.04.4LTS\n\nThis is the third time I install gitlab on server and never had issues before. \nI decide to reinstall gitlab-ce ( 12.10.0 ) after dealing with issues on 12.9.0. \nBefore installing the new version, I had ensured that all gitlab files where removed and reboot the server.\nStep1: Uninstall gitlab 12.9.0\n# gitlab-ctl stop\n# gitlab-ctl uninstall\n# apt-get remove --purge gitlab-ce\n# find / -iname \"gitlab\" then try to remove all outputed files\n# init 6\n\nStep 2: Fresh install gitlab 12.10.0\n# apt-get update\n# apt-get install gitlab-ce=12.10.0-ce.0\n\nThen I updated my /etc/gitlab/gitlab.rb file according to my server config.\nFinally, I executed:\ngitlab-ctl reconfigure\n\nThe processes was blocked on : \nruby_block[wait for redis service socket] action run\nAny solutions ?"
},
{
"role": "assistant",
"content": "The link provided by Manuel Richarz indicated there might be different lines upon which the installation may hang, one of them being the ruby_block[wait for redis service socket] action run line your question is about.\nTheir proposed solution is to open a new terminal and run:\nsystemctl restart gitlab-runsvdir.service\n\nThis worked for me for the ruby_block[wait for logrotate service socket] action run line."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Change Github account in Android Studio\nI have used one Github account to push an android project to Github from Android Studio. Now I have created another account on Github and want to push my another android project to this new account. But I am not able to find any option to change the Github account in Android Studio. It keeps pushing from the previous account and hence results in this error:\n\nremote: Permission to new_username/repository_name.git denied to old_username.\nfatal: unable to access 'https://github.com/new_username/repository_name.git/': The requested URL returned error: 403\n\nI am using Android Studio 1.2.2 on Windows OS."
},
{
"role": "assistant",
"content": "Go to: \nSetting --> Version Control --> GitHub --> Change you username."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Conda: Installing / upgrading directly from github\n\nCan I install/upgrade packages from GitHub using conda?\nFor example, with pip I can do:\npip install git+git://github.com/scrappy/scrappy@master\n\nto install scrappy directly from the master branch in GitHub. Can I do something equivalent with conda?\nIf this is not possible, would it make any sense to install pip with conda and manage such local installations with pip?"
},
{
"role": "assistant",
"content": "The answers are outdated. You simply have to conda install pip and git. Then you can use pip normally:\n\nActivate your conda environment source activate myenv\nconda install git pip \npip install git+git://github.com/scrappy/scrappy@master"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How do I configure Git to automatically pull from current branch when using \"git pull\"?\nWith our current setup you always have to enter the branch name (ie: git pull origin feature-branch\" when doing a pull. I've already made the mistake of pulling from one branch into another, accidentally merging two branches with two very different releases. I'd like to avoid this by configuring Git so that simply typing git pull will pull the current branch you're in.\nHow do I do this?"
},
{
"role": "assistant",
"content": "I am, too, a fan of typing just git pull and getting all the magic. \nYou have 2 options:\n1) git config --global branch.autoSetupMerge always\nThis will ensure that whether you checkout a remote branch, or create a new one; the tracking information will be handled automatically by git. Then you will be able to\ngit clone <some_repo>\ngit checkout -b <new_branch>\ngit push\ngit pull\n\nNote that in order to push without more keywords, you need to set the push option as well. I have set it to matching, but everyone has their preference on that. (git config --global push.default matching)\nMore info: autosetupmerge defaults to true. When set to true, this lets git to perform tracking when you checkout an already existing branch at the remote. For example, if you do git checkout <branch>, git will handle the tracking info so that you can do git pull while on that branch. However, it will not perform this on branches that you create with -b option. Setting autosetupmerge to always ensures that git handles tracking info all the time.\n2) When checking out a new branch, you need to specifically set the branch to pull from origin (aka tracking)\ngit checkout -b <branch> --track <remote>/<branch>\n\nI find this less useful when the branches are transient. If you rarely create a new branch, you should go with this. However, if you are like me, where only the master branch is persistent and every feature has its own brand new branch, then I find option 1 more useful.\nNote that, you do not need to make git configuration --global. You may simply write --local there, and have that setting specific to that repository only."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-diff - Show changes between commits, commit and working tree, etc changes"
},
{
"role": "assistant",
"content": "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."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git - remote add origin vs remote set-url origin\nI create a new repository:\ngit init\necho \"# MESSAGE\" >> README.md\ngit add README.md\ngit commit -m \"first commit\"\n\nThen I want to push my commit to the empty remote repository created on github so I have to set remote.\nWhat is difference between using following commands ? :\ngit remote add origin [email protected]:User/UserRepo.git\ngit remote set-url origin [email protected]:User/UserRepo.git\n\nAt the end I perform push:\ngit push -u origin master\n\nWhat happens when I call git remote set-url origin just after git init? Does git remote set-url origin create origin? If origin already exists after git init there is no difference between using those commands in my scenario, right?"
},
{
"role": "assistant",
"content": "below is used to add a new remote:\ngit remote add \"origin\" [email protected]:User/UserRepo.git\n\nbelow is used to change the url of an existing remote repository:\ngit remote set-url \"origin\" [email protected]:User/UserRepo.git\n\nbelow will push your code to the master branch of the remote repository defined with \"origin\" and -u let you point your current local branch to the remote master branch:\ngit push -u origin main\n\nDocumentation"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-range-diff - Compare two commit ranges (e.g. two versions of a branch)"
},
{
"role": "assistant",
"content": "NAME git-range-diff - Compare two commit ranges (e.g. two versions of a branch)"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-rev-list - Lists commit objects in reverse chronological order --unpacked"
},
{
"role": "assistant",
"content": "Only useful with --objects ; print the object IDs that are not\nin packs."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-update-index - Register file contents in the working tree to the index --really-refresh"
},
{
"role": "assistant",
"content": "Like --refresh , but checks stat information unconditionally,\nwithout regard to the \"assume unchanged\" setting."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "GitLab CI builds remains pending\n\nWe recently started to use GitLab-CI on the gitlab.com free service.\nAt first everything went fine, but now, seems like we can't build our project anymore. The builds are shown as pending and doesn't do anything.\nHere's what we have in our builds list:\n\nAnd if we check the details of a build:\n\nAs you might notice, in the list, each build is assigned to a runner id, but in the details page, the runner section is blank.\nAt first, we thought it was just latency caused by gitlab.com ingrastructure, but it's really just stuck there...\nEDIT\nIt's more than 1 year ago but I keep having notifications about this question. If I recall properly, the problem was due to GitLab itself. Follow the GitLab docs and make sure your setup is valid, and hope for the best !"
},
{
"role": "assistant",
"content": "If you are working with local gitlab-runner, like macOS or custom runner that you have been made, you should start running jobs manually.\nBased on this topic on gitlab documentation you should start manually in user-mode or system-mode based on where you executing this command\nRun in terminal\nIf you did not started gitlab-runner yet\ngitlab-runner start \n\nsystem-mode execution\nsudo gitlab-runner run \n\nuser-mode execution\ngitlab-runner run"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Gitlab CI multiple branches\n\nI have two branches: master and test. When I push to the master branch, my code is deployed to the first server by gitlab-ci. I want to deploy to a different server whenever I push to the test branch. Is this possible using Gitlab CI?\n\nmaster - 10.10.10.1\ntest - 10.10.10.2\n\nMy gitlab-ci.yml:\nmaven_build:\nscript: \n - mvn install\n - /opt/payara41/bin/./asadmin --passwordfile /home/asadminpass --user admin undeploy myApplication-ear-1.0-SNAPSHOT\n - sudo /etc/init.d/glassfish restart\n - /opt/payara41/bin/./asadmin --passwordfile /home/asadminpass --host localhost --user admin deploy --force /home/gitlab-runner/builds/10b25461/0/myapp/myAppPrototype/myApp-ear/target/myApplication-SNAPSHOT.ear\n\nonly:\n - master"
},
{
"role": "assistant",
"content": "You're on the right track with only:.\nSimply create two different steps, one with only: master and one with only: test.\nChange the script: to deploy to a different server.\ndeploy_master:\n script: \n - <script to deploy to master server>\n only:\n - master\n\ndeploy_test:\n script: \n - <script to deploy to test server>\n only:\n - test"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "cannot lock ref 'refs/remotes/origin/master'\nI always got cannot lock ref 'refs/remotes/origin/master' when I execute git pull first time if there are some updates.\nThe full console log is belows.\nD:\\code\\react-native\\expo-multi-screen-starter>git pull\nerror: cannot lock ref 'refs/remotes/origin/master': is at b2459b4d5af42622cba55f9fe47ccd14fbd879bc but expected 76f11048c866cfe3e6570eaacf90db3cb7732723\nFrom github.com:liudonghua123/expo-multi-screen-starter\n ! 76f1104..b2459b4 master -> origin/master (unable to update local ref)\n\nD:\\code\\react-native\\expo-multi-screen-starter>git pull\n App.js | 19 ++++-----\n src/navigation/AuthStack.js | 14 +++++++\n src/navigation/RootNavigator.js | 22 ++++++++++\n src/navigation/TabNavigator.js | 4 +-\n src/screens/AuthLoadingScreen.js | 35 ++++++++++++++++\n src/screens/HomeScreen.js | 19 +++++++++\n src/screens/{LoginScreen.js => SignInScreen.js} | 54 ++++++++++++++++++++++---\n 7 files changed, 147 insertions(+), 20 deletions(-)\n create mode 100644 src/navigation/AuthStack.js\n create mode 100644 src/navigation/RootNavigator.js\n create mode 100644 src/screens/AuthLoadingScreen.js\n rename src/screens/{LoginScreen.js => SignInScreen.js} (61%)\n\nD:\\code\\react-native\\expo-multi-screen-starter>"
},
{
"role": "assistant",
"content": "You need to update the reference using following Git command on Git bash:\n$ git update-ref -d refs/remotes/origin/[locked branch name]\n\nthen pull using $git pull\n[locked branch name] is the name of the branch that the error is happening because of mismatch of commit Ids."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Get back the changes after accidental checkout?\nThe following was the status of my repo.\n[~/rails_apps/jekyll_apps/nepalonrails (design)⚡] ➔ gst\n# On branch design\n# Changed but not updated:\n# (use \"git add/rm <file>...\" to update what will be committed)\n# (use \"git checkout -- <file>...\" to discard changes in working directory)\n#\n# modified: _layouts/default.html\n# deleted: _site/blog/2010/04/07/welcome-to-niraj-blog/index.html\n# deleted: _site/blog/2010/04/08/the-code-syntax-highlight/index.html\n# deleted: _site/blog/2010/05/01/showing-demo-to-kalyan/index.html\n# deleted: _site/config.ru\n# deleted: _site/index.html\n# deleted: _site/static/css/style.css\n# deleted: _site/static/css/syntax.css\n# modified: static/css/style.css\n#\nno changes added to commit (use \"git add\" and/or \"git commit -a\")\n\nAccedently, I did git checkout -f and now the changes are gone which I wasnt supposed to do.\n[~/rails_apps/jekyll_apps/nepalonrails (design)⚡] ➔ git co -f\n[~/rails_apps/jekyll_apps/nepalonrails (design)] ➔ gst\n# On branch design\nnothing to commit (working directory clean)\n[~/rails_apps/jekyll_apps/nepalonrails (design)] ➔ \n\nCan I get back the changes back?"
},
{
"role": "assistant",
"content": "Another thing you can look at is through your IDE. I accidentally checkout 2 files and was able to bring back the changes through the 'local history' of my IDE (Netbeans). What a blessing!\nIf you're using Eclipse, do this by right clicking on the file and going to Team->Show Local History."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-rev-parse - Pick out and massage parameters <describeOutput> , e.g. v1.7.4.2-679-g3bee7fb"
},
{
"role": "assistant",
"content": "Output from git describe ; i.e. a closest tag, optionally\nfollowed by a dash and a number of commits, followed by a dash, a g , and an abbreviated object name."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-diff - Show changes between commits, commit and working tree, etc -1 --base -2 --ours -3 --theirs"
},
{
"role": "assistant",
"content": "Compare the working tree with the \"base\" version (stage #1),\n\"our branch\" (stage #2) or \"their branch\" (stage #3). The\nindex contains these stages only for unmerged entries i.e.\nwhile resolving conflicts. See git-read-tree section \"3-Way Merge\" for detailed information."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Unstage a deleted file in git\nUsually, to discard changes to a file you would do:\ngit checkout -- <file>\n\nWhat if the change I want to discard is deleting the file? The above line would give an error:\nerror: pathspec '<file>' did not match any file(s) known to git.\n\nWhat command will restore that single file without undoing other changes?\nbonus point: Also, what if the change I want to discard is adding a file? I would like to know how to unstage that change as well."
},
{
"role": "assistant",
"content": "Assuming you're wanting to undo the effects of git rm <file> or rm <file> followed by git add -A or something similar:\n# this restores the file status in the index\ngit reset -- <file>\n# then check out a copy from the index\ngit checkout -- <file>\n\nTo undo git add <file>, the first line above suffices, assuming you haven't committed yet."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Gitlab, Permission denied (publickey), version 6-4 stable\n\nPermission denied (publickey). fatal: Could not read from remote\nrepository.\nPlease make sure you have the correct access rights and the repository\nexists.\nGitlab version 6-4 stable \nroot@gitlab:/home/git/gitlab# sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production\n\nSystem information\nSystem: Ubuntu 12.04\nCurrent User: git\nUsing RVM: no\nRuby Version: 2.0.0p353\nGem Version: 2.0.14\nBundler Version:1.5.2\nRake Version: 10.1.0\n\nGitLab information\nVersion: 6.4.3\nRevision: 38397db\nDirectory: /home/git/gitlab\nDB Adapter: mysql2\nURL: http://gitlab.xxx.xxx\nHTTP Clone URL: http://gitlab.xxx.xxx/some-project.git\nSSH Clone URL: [email protected]/some-project.git\nUsing LDAP: no\nUsing Omniauth: no\n\nGitLab Shell\nVersion: 1.8.0\nRepositories: /home/git/repositories/\nHooks: /home/git/gitlab-shell/hooks/\nGit: /usr/bin/git\n\n\n\nroot@gitlab:/home/git/gitlab# sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production\n\nChecking Environment ...\n\nGit configured for git user? ... yes\nHas python2? ... yes\npython2 is supported version? ... yes\n\nChecking Environment ... Finished\n\nChecking GitLab Shell ...\n\nGitLab Shell version >= 1.7.9 ? ... OK (1.8.0)\nRepo base directory exists? ... yes\nRepo base directory is a symlink? ... no\nRepo base owned by git:git? ... yes\nRepo base access is drwxrws---? ... yes\nupdate hook up-to-date? ... yes\nupdate hooks in repos are links: ... \nAlexander / Test ... repository is empty\nRunning /home/git/gitlab-shell/bin/check\nCheck GitLab API access: OK\nCheck directories and files: \n /home/git/repositories: OK\n /home/git/.ssh/authorized_keys: OK\nTest redis-cli executable: redis-cli 2.2.12\nSend ping to redis server: PONG\ngitlab-shell self-check successful\n\nChecking GitLab Shell ... Finished\n\nChecking Sidekiq ...\n\nRunning? ... yes\nNumber of Sidekiq processes ... 1\n\nChecking Sidekiq ... Finished\n\nChecking LDAP ...\n\nLDAP is disabled in config/gitlab.yml\n\nChecking LDAP ... Finished\n\nChecking GitLab ...\n\nDatabase config exists? ... yes\nDatabase is SQLite ... no\nAll migrations up? ... yes\nGitLab config exists? ... yes\nGitLab config outdated? ... no\nLog directory writable? ... yes\nTmp directory writable? ... yes\nInit script exists? ... yes\nInit script up-to-date? ... yes\nprojects have namespace: ... \nAlexander / Test ... yes\nProjects have satellites? ... \nAlexander / Test ... can't create, repository is empty\nRedis version >= 2.0.0? ... yes\nYour git bin path is \"/usr/bin/git\"\nGit version >= 1.7.10 ? ... yes (1.8.5)\n\nChecking GitLab ... Finished\n\nAnd trying to push \nroot@gitlab:/home/git/repositories/test# git push origin master\n\nPermission denied (publickey). fatal: Could not read from remote repository. Please make sure you have the correct access rights and\n the repository exists.\n\nshh -vv [email protected]\n alex@xxxxxxx:~$ ssh -vv [email protected]\nOpenSSH_6.2p2 Ubuntu-6ubuntu0.1, OpenSSL 1.0.1e 11 Feb 2013\ndebug1: Reading configuration data /etc/ssh/ssh_config\ndebug1: /etc/ssh/ssh_config line 19: Applying options for *\ndebug2: ssh_connect: needpriv 0\ndebug1: Connecting to gitlab.xxx.xxx [192.168.0.40] port 22.\ndebug1: Connection established.\ndebug1: identity file /home/alex/.ssh/id_rsa type 1\ndebug1: Checking blacklist file /usr/share/ssh/blacklist.RSA-2047\ndebug1: Checking blacklist file /etc/ssh/blacklist.RSA-2047\ndebug1: identity file /home/alex/.ssh/id_rsa-cert type -1\ndebug1: identity file /home/alex/.ssh/id_dsa type -1\ndebug1: identity file /home/alex/.ssh/id_dsa-cert type -1\ndebug1: identity file /home/alex/.ssh/id_ecdsa type -1\ndebug1: identity file /home/alex/.ssh/id_ecdsa-cert type -1\ndebug1: Enabling compatibility mode for protocol 2.0\ndebug1: Local version string SSH-2.0-OpenSSH_6.2p2 Ubuntu-6ubuntu0.1\ndebug1: Remote protocol version 2.0, remote software version OpenSSH_5.9p1 Debian-5ubuntu1.1\ndebug1: match: OpenSSH_5.9p1 Debian-5ubuntu1.1 pat OpenSSH_5*\ndebug2: fd 3 setting O_NONBLOCK\ndebug1: SSH2_MSG_KEXINIT sent\ndebug1: SSH2_MSG_KEXINIT received\ndebug2: kex_parse_kexinit: ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1\ndebug2: kex_parse_kexinit: [email protected],[email protected],[email protected],ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,[email protected],[email protected],[email protected],[email protected],ssh-rsa,ssh-dss\ndebug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,[email protected],[email protected],aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,[email protected]\ndebug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,[email protected],[email protected],aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,[email protected]\ndebug2: kex_parse_kexinit: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-md5,hmac-sha1,[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-ripemd160,[email protected],hmac-sha1-96,hmac-md5-96\ndebug2: kex_parse_kexinit: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-md5,hmac-sha1,[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-ripemd160,[email protected],hmac-sha1-96,hmac-md5-96\ndebug2: kex_parse_kexinit: none,[email protected],zlib\ndebug2: kex_parse_kexinit: none,[email protected],zlib\ndebug2: kex_parse_kexinit: \ndebug2: kex_parse_kexinit: \ndebug2: kex_parse_kexinit: first_kex_follows 0 \ndebug2: kex_parse_kexinit: reserved 0 \ndebug2: kex_parse_kexinit: ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1\ndebug2: kex_parse_kexinit: ssh-rsa,ssh-dss,ecdsa-sha2-nistp256\ndebug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,[email protected]\ndebug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,[email protected]\ndebug2: kex_parse_kexinit: hmac-md5,hmac-sha1,[email protected],hmac-sha2-256,hmac-sha2-256-96,hmac-sha2-512,hmac-sha2-512-96,hmac-ripemd160,[email protected],hmac-sha1-96,hmac-md5-96\ndebug2: kex_parse_kexinit: hmac-md5,hmac-sha1,[email protected],hmac-sha2-256,hmac-sha2-256-96,hmac-sha2-512,hmac-sha2-512-96,hmac-ripemd160,[email protected],hmac-sha1-96,hmac-md5-96\ndebug2: kex_parse_kexinit: none,[email protected]\ndebug2: kex_parse_kexinit: none,[email protected]\ndebug2: kex_parse_kexinit: \ndebug2: kex_parse_kexinit: \ndebug2: kex_parse_kexinit: first_kex_follows 0 \ndebug2: kex_parse_kexinit: reserved 0 \ndebug2: mac_setup: found hmac-md5\ndebug1: kex: server->client aes128-ctr hmac-md5 none\ndebug2: mac_setup: found hmac-md5\ndebug1: kex: client->server aes128-ctr hmac-md5 none\ndebug1: sending SSH2_MSG_KEX_ECDH_INIT\ndebug1: expecting SSH2_MSG_KEX_ECDH_REPLY\ndebug1: Server host key: ECDSA xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\ndebug1: Host 'gitlab.xxx.xxx' is known and matches the ECDSA host key.\ndebug1: Found key in /home/alex/.ssh/known_hosts:30\ndebug1: ssh_ecdsa_verify: signature correct\ndebug2: kex_derive_keys\ndebug2: set_newkeys: mode 1\ndebug1: SSH2_MSG_NEWKEYS sent\ndebug1: expecting SSH2_MSG_NEWKEYS\ndebug2: set_newkeys: mode 0\ndebug1: SSH2_MSG_NEWKEYS received\ndebug1: Roaming not allowed by server\ndebug1: SSH2_MSG_SERVICE_REQUEST sent\ndebug2: service_accept: ssh-userauth\ndebug1: SSH2_MSG_SERVICE_ACCEPT received\ndebug2: key: /home/alex/.ssh/id_rsa (0x7f8d86afa4f0),\ndebug2: key: /home/alex/.ssh/id_dsa ((nil)),\ndebug2: key: /home/alex/.ssh/id_ecdsa ((nil)),\ndebug1: Authentications that can continue: publickey\ndebug1: Next authentication method: publickey\ndebug1: Offering RSA public key: /home/alex/.ssh/id_rsa\ndebug2: we sent a publickey packet, wait for reply\ndebug1: Server accepts key: pkalg ssh-rsa blen 276\ndebug2: input_userauth_pk_ok: fp xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\ndebug1: Authentication succeeded (publickey).\nAuthenticated to gitlab.xxx.xxx ([192.168.0.40]:22).\ndebug1: channel 0: new [client-session]\ndebug2: channel 0: send open\ndebug1: Requesting [email protected]\ndebug1: Entering interactive session.\ndebug1: Remote: Forced command.\ndebug1: Remote: Port forwarding disabled.\ndebug1: Remote: X11 forwarding disabled.\ndebug1: Remote: Agent forwarding disabled.\ndebug1: Remote: Pty allocation disabled.\ndebug1: Remote: Forced command.\ndebug1: Remote: Port forwarding disabled.\ndebug1: Remote: X11 forwarding disabled.\ndebug1: Remote: Agent forwarding disabled.\ndebug1: Remote: Pty allocation disabled.\ndebug2: callback start\ndebug2: fd 3 setting TCP_NODELAY\ndebug2: client_session2_setup: id 0\ndebug2: channel 0: request pty-req confirm 1\ndebug1: Sending environment.\ndebug1: Sending env LC_PAPER = de_DE.UTF-8\ndebug2: channel 0: request env confirm 0\ndebug1: Sending env LC_ADDRESS = de_DE.UTF-8\ndebug2: channel 0: request env confirm 0\ndebug1: Sending env LC_MONETARY = de_DE.UTF-8\ndebug2: channel 0: request env confirm 0\ndebug1: Sending env LC_NUMERIC = de_DE.UTF-8\ndebug2: channel 0: request env confirm 0\ndebug1: Sending env LC_TELEPHONE = de_DE.UTF-8\ndebug2: channel 0: request env confirm 0\ndebug1: Sending env LC_IDENTIFICATION = de_DE.UTF-8\ndebug2: channel 0: request env confirm 0\ndebug1: Sending env LANG = en_US.UTF-8\ndebug2: channel 0: request env confirm 0\ndebug1: Sending env LC_MEASUREMENT = de_DE.UTF-8\ndebug2: channel 0: request env confirm 0\ndebug1: Sending env LC_TIME = de_DE.UTF-8\ndebug2: channel 0: request env confirm 0\ndebug1: Sending env LC_NAME = de_DE.UTF-8\ndebug2: channel 0: request env confirm 0\ndebug2: channel 0: request shell confirm 1\ndebug2: callback done\ndebug2: channel 0: open confirm rwindow 0 rmax 32768\ndebug2: channel_input_status_confirm: type 100 id 0\nPTY allocation request failed on channel 0\ndebug2: channel 0: rcvd adjust 2097152\ndebug2: channel_input_status_confirm: type 99 id 0\ndebug2: shell request accepted on channel 0\nWelcome to GitLab, Anonymous!\ndebug1: client_input_channel_req: channel 0 rtype exit-status reply 0\ndebug1: client_input_channel_req: channel 0 rtype [email protected] reply 0\ndebug2: channel 0: rcvd eow\ndebug2: channel 0: close_read\ndebug2: channel 0: input open -> closed\ndebug2: channel 0: rcvd eof\ndebug2: channel 0: output open -> drain\ndebug2: channel 0: obuf empty\ndebug2: channel 0: close_write\ndebug2: channel 0: output drain -> closed\ndebug2: channel 0: rcvd close\ndebug2: channel 0: almost dead\ndebug2: channel 0: gc: notify user\ndebug2: channel 0: gc: user detached\ndebug2: channel 0: send close\ndebug2: channel 0: is dead\ndebug2: channel 0: garbage collecting\ndebug1: channel 0: free: client-session, nchannels 1\nConnection to gitlab.xxx.xxx closed.\nTransferred: sent 4088, received 2432 bytes, in 0.3 seconds\nBytes per second: sent 14872.5, received 8847.8\ndebug1: Exit status 0\n\nalex@xxxxx:~$ ssh [email protected]\nPTY allocation request failed on channel 0\nWelcome to GitLab, Anonymous!\nConnection to gitlab.xxx.xx closed.\nI tried with 5.4 stable and the same problem on production server. \nBut when for the sake of interest I installed 5.4 on local test server with virtual box and It works fine. Now I am even had compared everything, but It does not push on production server. Looks like this problem is related to SSH. \nI searched already a lot, but all solutions I tried did not work in my case. I have already no idea, feels like it is kind of software bug...\nI will appreciate any help. Thanks in advance! \nKind regards,\nAlex"
},
{
"role": "assistant",
"content": "Try also pushing to the https url instead of the ssh this can save you lot of trouble - for example use this:\ngit remote add origin https://gitlab.com/someuser/algorithm-excercises.git\n\ninstead of:\ngit remote add origin [email protected]:someuser/algorithm-excercises.git"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-show - Show various types of objects %t"
},
{
"role": "assistant",
"content": "abbreviated tree hash"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-send-email - Send a collection of patches as emails --header-cmd=<command>"
},
{
"role": "assistant",
"content": "Specify a command that is executed once per outgoing message\nand output RFC 2822 style header lines to be inserted into\nthem. When the sendemail.headerCmd configuration variable is\nset, its value is always used. When --header-cmd is provided\nat the command line, its value takes precedence over the sendemail.headerCmd configuration variable."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-log - Show commit logs --min-parents=<number> --max-parents=<number> --no-min-parents --no-max-parents"
},
{
"role": "assistant",
"content": "Show only commits which have at least (or at most) that many parent\ncommits. In particular, --max-parents=1 is the same as --no-merges , --min-parents=2 is the same as --merges . --max-parents=0 gives all root commits and --min-parents=3 all octopus merges. --no-min-parents and --no-max-parents reset these limits (to no limit)\nagain. Equivalent forms are --min-parents=0 (any commit has 0 or more\nparents) and --max-parents=-1 (negative numbers denote no upper limit)."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-read-tree - Reads tree information into the index -i"
},
{
"role": "assistant",
"content": "Usually a merge requires the index file as well as the\nfiles in the working tree to be up to date with the\ncurrent head commit, in order not to lose local\nchanges. This flag disables the check with the working\ntree and is meant to be used when creating a merge of\ntrees that are not directly related to the current\nworking tree status into a temporary index file."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "svn to git conversion: Correct remote ref must start with 'refs/' error\n\n(I'm posting this question with the intention of answering it myself as I could not find the answer elsewhere. Hopefully it will help others who run into the same issue and it will help me next time I'm trying to do it.)\nThe Challenge\nI want to convert an SVN repository to a locally hosted gitlab GIT repository and maintain history.\nThe Setup\nGitlab 8.5, Ubuntu 14.04 LTS, subversion 1.8.8\nThe Problem\nInitial attempts to convert from svn to git using git-svn or svn2git resulted in the following error.\nError\nsvn-remote.svn: remote ref '//example.com:81/svn/myrepository/trunk:refs/remotes/trunk' must start with 'refs/'\nWhat I've tried\nI've followed both guides in the external references below.\nExternal References used\n\nhttp://doc.gitlab.com/ce/workflow/importing/migrating_from_svn.html\nhttp://john.albin.net/git/convert-subversion-to-git"
},
{
"role": "assistant",
"content": "Generate an authors.txt file. This will contain a mapping between your SVN users and your Gitlab users:\n\nFrom an existing svn repository: svn log -q | awk -F '|' '/^r/ {sub(\"^ \", \"\", $2); sub(\" $\", \"\", $2); print $2\" = \"$2\" <\"$2\">\"}' | sort -u > authors.txt\nOtherwise, manually create it following this format:\noldSVNusername = newGitlabUsername <[email protected]>\n\nCreate a temporary directory init SVN repo\n\nmkdir temp\ncd temp\ngit svn init --no-metadata http://username:[email protected]:81/svn/myrepository\n\nConfigure git\n\ngit config svn.authorsfile ~/authors.txt\ngit config --global user.name myusername\ngit config --global user.email [email protected]\n\nGrab the files and clone them into a new git repo\n\ngit svn fetch\ngit clone . ../myrepository\ncd ../myrepository\n\nSetup new repository in gitlab, make sure your user has access to it.\nAdd a remote gitlab repository\n\ngit remote add gitlab gitlab.example.com:gitlab-group/myrepository.git\n\nDouble check your configuration in myrepository/.git/config (especially the URL line)\n[core]\n repositoryformatversion = 0\n filemode = true\n bare = false\n logallrefupdates = true\n[remote \"origin\"]\n url = /root/temp/.\n fetch = +refs/heads/*:refs/remotes/origin/*\n[branch \"master\"]\n remote = gitlab\n merge = refs/heads/master\n[remote \"gitlab\"]\n url = http://gitlab.example.com/gitlab-group/myrepository.git\n fetch = +refs/heads/*:refs/remotes/gitlab/*\n[user]\n name = myusername\nPush it all upstream\n\ngit push --set-upstream gitlab master\n\n\nNow you should have all the files and history converted to git and displaying in gitlab."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-send-email - Send a collection of patches as emails --[no-]chain-reply-to"
},
{
"role": "assistant",
"content": "If this is set, each email will be sent as a reply to the previous\nemail sent. If disabled with \"--no-chain-reply-to\", all emails after\nthe first will be sent as replies to the first email sent. When using\nthis, it is recommended that the first file given be an overview of the\nentire patch series. Disabled by default, but the sendemail.chainReplyTo configuration variable can be used to enable it."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-push - Update remote refs along with associated objects -o <option> --push-option=<option>"
},
{
"role": "assistant",
"content": "Transmit the given string to the server, which passes them to\nthe pre-receive as well as the post-receive hook. The given string\nmust not contain a NUL or LF character.\nWhen multiple --push-option=<option> are given, they are\nall sent to the other side in the order listed on the\ncommand line.\nWhen no --push-option=<option> is given from the command\nline, the values of configuration variable push.pushOption are used instead."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "After Git clone from GitHub, I do not see my branch\n\nI have a repository on GitHub. It contains master and one branch.\nWhen I clone it, I obtain only master and do not see my branch.\nWhy is it so? How can I see all branches in the repository?"
},
{
"role": "assistant",
"content": "By default, git clone creates only one branch: the currently checked out one, generally master. However, it does create remote tracking branches for all other branches in the remote. Think of these as local copies of the remote's branches, which can be updated by fetching. They're not real local branches, as they're intended only as pointers to where the remote's branches are, not for you to work on. \nIf you run git branch -a you'll see all branches, local and remote. If you want to see just the remote ones, use git branch -r. If you prefer a visual history display, try gitk --all (or gitk --remotes). \nTo create a local branch to work on, use\ngit branch <branch-name> origin/<branch-name>\n\nThat'll create a new local branch using the remote's branch as the starting point."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to make \"git push\" include tags within a branch?\nWhen fetching a single branch, git fetch includes any tags that point into the branch:\n\nWhen refspec stores the fetched result in remote-tracking branches,\n the tags that point at these branches are automatically followed. This\n is done by first fetching from the remote using the given s,\n and if the repository has objects that are pointed by remote tags that\n it does not yet have, then fetch those missing tags. If the other end\n has tags that point at branches you are not interested in, you will not\n get them.\n\nIs there any way to make git push behave the same way? The man page says how to push no tags (the default), all tags (--tags), or ones you name on the command line. It doesn't give a way to push all the ones pointing into the branch."
},
{
"role": "assistant",
"content": "You can try, with git1.8.3+ (May 2013):\ngit push --follow-tags\n\n\nThe new \"--follow-tags\" option tells \"git push\" to push relevant annotated tags when pushing branches out.\n\nThis won't push all the tags, but only the ones accessible from the branch(es) HEAD(s) you are pushing.\nAs mentioned in \"Push a tag to a remote repository using Git?\", this concerns only annotated tags, not lightweight tags.\ngit tag 1.0 (lightweight) would not be pushed with --follow-tags, it would with git push --tags.\n\nWith Git 2.4.1+ (Q2 2015), that option can be set as default.\nSee commit a8bc269 by Dave Olszewski (cxreg):\n\nmake it easier to add new configuration bits and then add push.followTags configuration that turns --follow-tags option on by default.\n\nThe documentation will include:\npush.followTags::\n\n\nIf set to true enable '--follow-tags' option by default. You may override this configuration at time of push by specifying '--no-follow-tags'\n\nDo enable this setting globally, you can run git config --global push.followTags true. It can also be specified on a per repository-basis.\n\n\nI need a solution that can also push lightweight tags.\nThese limitations between lightweight and annotated tags are so annoying in Git.\n\nPushing lightweight tags alongside annotated tags is a more complex scenario: Lightweight tags are simpler pointers to specific commits, without the additional metadata or checksum verification provided by annotated tags. Git's built-in options for pushing tags (--tags and --follow-tags) differentiate between these types, with --follow-tags designed specifically to push only annotated tags that are reachable from the branches being pushed.\nIf you need to push both lightweight and annotated tags that are relevant to the branches being pushed, a custom approach is necessary.\nFirst, identify the commits that are part of the branch you are about to push. That can be done using git log or git rev-list.\nWith the list of commits in hand, you can identify both annotated and lightweight tags that point to these commits. That requires filtering the tags based on whether their referenced commit SHA is in the list of branch commits. Once you have identified all relevant tags, you can push the branch and these tags in a single or consecutive Git commands.\nFor instance, assuming that you are pushing the current branch and identifies tags pointing to any commit in this branch:\n# Get the current branch name\ncurrent_branch=$(git rev-parse --abbrev-ref HEAD)\n\n# Get all commits on this branch\ncommits=$(git rev-list $current_branch)\n\n# Initialize an empty string to hold tags to push\ntags_to_push=\"\"\n\n# Loop through all tags\nfor tag in $(git tag); do\n # Check if the tag points to a commit on this branch\n if echo \"$commits\" | grep -q $(git rev-parse $tag); then\n # If so, add the tag to the list of tags to push\n tags_to_push=\"$tags_to_push $tag\"\n fi\ndone\n\n# Push the current branch\ngit push origin $current_branch\n\n# Push all identified tags\nif [ -n \"$tags_to_push\" ]; then\n git push origin $tags_to_push\nfi\n\nOr you could use that script to push only lightweight tags, since annotated tags are easy to push with normal git commands:\n# Loop through all tags, filtering for those pointing directly to commits (lightweight tags)\nfor tag in $(git for-each-ref --format '%(refname:short) %(objecttype)' refs/tags | grep ' commit$' | cut -d \" \" -f1); do\n # Check if the tag points to a commit on this branch\n if echo \"$commits\" | grep -q $(git rev-parse $tag); then\n # If so, add the tag to the list of tags to push\n tags_to_push=\"$tags_to_push $tag\"\n fi\ndone"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Embed Git bash in PyCharm as external tool and work with it in PyCharm window (windows xp)\nI added cmd as external tool in PyCharm, and it works nicely in PyCharm console (View -> Run). Here\nis described how to launch Git bash from cmd. It opens in separate window, but I want it to be in the same PyCharm window, so I can type commands without pressing the CTRL+TAB. \nI suppose there should be other way, more straight-forward, but I dont see it."
},
{
"role": "assistant",
"content": "Configure the Terminal to use bash.exe or sh.exe from Git installation like this:\n\n\"c:\\Program Files\\Git\\bin\\sh.exe\" --login\nUse Tools | Open Terminal... (or click on the Terminal tool window) then run your git command in the Terminal tool window."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Git tab completion not working in zsh on mac\nNo matter what I try and do I can't seem to make git tab/auto completion work in my zsh shell. I've downloaded the bash-completion script and the zsh-completion one and followed the instructions, but I can't make it work. \nI've reinstalled oh-my-zsh but that didn't seem to help or make any difference. \nCan anyone who's got it working describe to me their setup so I can try an emulate it to get it working for me?\nTo be specific, what I've done so far is:\n\nSwitched to using zsh as my default shell\nInstalled oh-my-zsh\nDownloaded https://github.com/git/git/blob/master/contrib/completion/git-completion.bash and saved it in ~/.completion/git/git-completion.sh\nDownloaded https://github.com/git/git/blob/master/contrib/completion/git-completion.zsh and saved that in ~/.zsh/_git\nAdded zstyle ':completion:*:*:git:*' script ~/.completion/git/git-completion.sh\n\nNo luck."
},
{
"role": "assistant",
"content": "TL;DR one-liner\necho 'autoload -Uz compinit && compinit' >> ~/.zshrc && . ~/.zshrc\n\nthis will enable completion in .zshrc and apply the setting to your current terminal session.\nExplanation:\nActually, ZSH does know how to do git completion out of the box, but you need to turn on the completion feature itself (which from the steps you described I guess you haven't done)\nAdding this to your .zshrc should be enough:\nautoload -Uz compinit && compinit\n\nAfter you put the line .zshrc file, don't forget to restart the shell for ZSH to pick up the new config (alternatively, you can execute the line in your current session, that'll enable autocompletion for that one session)\nthe zsh compinit: insecure directories warning\nThanks to @FranMorzoa for suggesting to use compinit -u to skip the security checks for completion scripts\nWhile this will get rid of the warning/confirmation, the warning is there for a reason and it shouldn't happen normally.\nIt is a sign that something is wrong with ownership of the completion scripts, and it can (and should) be fixed with one of these:\n\nbrew.sh version:\nchmod -R go-w \"$(brew --prefix)/share\"\n\nanother one, will probably work for non-brew zsh, credits to pvinis on GitHub:\ncompaudit | xargs chmod g-w\n\n\nMore info\n\nhttps://git-scm.com/book/en/v2/Appendix-A:-Git-in-Other-Environments-Git-in-Zsh\nhttps://docs.brew.sh/Shell-Completion#configuring-completions-in-zsh\n\nPS Another answer here suggests installing the hub tool instead: although the tool is handy, it's merely a 3rd party (github community) wrapper around git. Hence, it has nothing to do with the topic of \"Git completion in ZSH\""
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-add - Add file contents to the index new content"
},
{
"role": "assistant",
"content": "You may also add new content that does not exist in the patch; simply\nadd new lines, each starting with \"+\". The addition will appear\nreverted in the working tree."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git - the stupid content tracker GIT_ALTERNATE_OBJECT_DIRECTORIES"
},
{
"role": "assistant",
"content": "Due to the immutable nature of Git objects, old objects can be\narchived into shared, read-only directories. This variable\nspecifies a \":\" separated (on Windows \";\" separated) list\nof Git object directories which can be used to search for Git\nobjects. New objects will not be written to these directories. Entries that begin with \" (double-quote) will be interpreted\nas C-style quoted paths, removing leading and trailing\ndouble-quotes and respecting backslash escapes. E.g., the value \"path-with-\\\"-and-:-in-it\":vanilla-path has two paths: path-with-\"-and-:-in-it and vanilla-path ."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Creating webhooks via GitLab API\n\nIs there any way of creating webhooks in GitLab via API similiar to what we have in GitHub using GitHub API by Koshuke?"
},
{
"role": "assistant",
"content": "You can add, list, edit and delete webhooks.\nPOST /projects/:id/hooks\nYou can add a webhook with your project ID or with namespace/project_name\nTake a look at this http://doc.gitlab.com/ce/api/projects.html#add-project-hook"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Can I make a user-specific gitignore file?\nI want to change the gitignore, but not everyone on the team wants these changes. How can a user have their own specific git ignore file?"
},
{
"role": "assistant",
"content": "You can create your own .gitignore using\ngit config --global core.excludesfile $HOME/.gitignore\n\nThen put your desired entries in that file."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "List all files changed in a pull request in Git/GitHub\nIs there a way (from the command line) to list the names of all files changed in a PR in Git/GitHub? This would be used to find what tests need to be run in a Travis CI build for that PR.\nThe CI build runs these commands before it calls our script:\ngit clone --depth=50 git://github.com/jekyll/jekyll.git jekyll/jekyll\ncd jekyll/jekyll\ngit fetch origin +refs/pull/2615/merge\ngit checkout -qf FETCH_HEAD"
},
{
"role": "assistant",
"content": "In general, you can list the files changed between any two commits with\ngit diff --name-only <ref1> <ref2>\n\nHow to list only the names of files that changed between two commits\nThe problem here seems to be determining the 'merge base'. If all branches originate with master, then you could do:\ngit --no-pager diff --name-only FETCH_HEAD $(git merge-base FETCH_HEAD master)\n\nThis will show you the changes between the point at which the FETCH_HEAD was branched from master to the current FETCH_HEAD. I tested this locally, and the PR branches are cut from master I believe it should work."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-rev-parse - Pick out and massage parameters --until=<datestring> --before=<datestring>"
},
{
"role": "assistant",
"content": "Parse the date string, and output the corresponding\n--min-age= parameter for git rev-list ."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to delete remotes/origin/{branch}?\nHow do you delete a remotes/origin/{branch}?"
},
{
"role": "assistant",
"content": "use: git remote prune origin\nor use git remote prune origin --dry-run to preview what branches will be removed.\nAs in git help remote\nprune\nDeletes all stale remote-tracking branches under . These stale branches have already been removed from the remote repository referenced by , but are still locally available in \"remotes/\".\nWith --dry-run option, report what branches will be pruned, but do not actually prune them."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to bridge git to ClearCase?\nI've recently used git svn and enjoyed it very much. Now I'm starting a new project at a different customer. At that site the SCM of choice is ClearCase. I haven't found a baked equivalent of git svn for ClearCase. Is there anybody who has tried to use git locally as a front-end to ClearCase using some tricks, configuration or scripting with any measure of success? If so can you please explain the method used?"
},
{
"role": "assistant",
"content": "Here's a method that avoids hijacks, which our team used this method quite successfully for over a year, until we retired ClearCase for Subversion (per company policy, although it is a backwards step for our team - we were basically just using ClearCase as a dumb file system, and virtually working natively in git, but now we're using the git-svn bridge which isn't as nice as native git.)\nWe used two directories, one for the ClearCase snapshot and master git repo, which we shared among the whole team and never edited files in, and one for our \"working\" directory.\nThe preparation in the ClearCase snapshot view is:\n\n% git init\n% git add **/*.cxx **/*.h **/Makefile (and so on)\n% git commit -m \"initial\"\n\nThen clone in your working directory:\n\n% mkdir ~/work\n% git clone /path/to/repo\n\nWork in the working directory, on a branch:\n\n% git checkout -b feature\n% ...edit/compile...\n% git add -u\n% git commit\n\nMake sure the ClearCase snapshot is up-to-date with pristine (which it always was for us, because we shared it among the team, and we all used git).\nThen merge the branch onto the master by rebasing it, to avoid an automatic merge commit:\n\n% git checkout master\n% git pull\n% git checkout feature\n% git rebase master\n% git checkout master\n% git merge feature\n% git branch -d feature\n\n% git diff --name-status origin/master\n\nPrepare the ClearCase view by checking out/mkelem/rmname any changed/new/removed files,\nbased off the output of git diff --name-status. We used a hand-rolled script to do this. Don't forget to check out any directories that have added/removed files:\nThen push the git stuff back, and check in with ClearCase:\n\n% git push\n% cd /path/to/repo\n% git reset --hard\n% cleartool ci `cleartool lsco -r -short -me`\n\nIt seems like a lot of commands, but this includes setup, and your daily workflow doesn't use many commands. You can trivially build a script around the push-back-to-ClearCase step, and discover/show your team all the cool extra git stuff gradually as everyone gets used to the basic workflow.\nThe real beauty of this system is, after a while when everyone's competent with git, you can trivially ditch ClearCase and all the associated individual monkey work and fees. Maybe give the company's ClearCase guy a much needed holiday and some retraining with the savings. (Sadly at my company the git stuff was all skunkworks, and we've moved to Subversion - forwards from ClearCase but backwards from git!)\nI strongly recommend you use the pristine script from ClearCase Globally, Git Locally, which runs in the ClearCase snapshot view and ensures it and git are in sync. We set this up as a cron job that ran twice daily, and also ran it manually whenever we were about to push back to git.\nUnfortunately the link to the blog post is no longer valid. However the script is still available on Github."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-diff-index - Compare a tree to the working tree or index"
},
{
"role": "assistant",
"content": "Combined diff format Any diff-generating command can take the -c or --cc option to\nproduce a combined diff when showing a merge. This is the default\nformat when showing merges with git-diff or git-show . Note also that you can give suitable --diff-merges option to any of these commands to force generation of\ndiffs in a specific format. A \"combined diff\" format looks like this: diff --combined describe.c\nindex fabadb8,cc95eb0..4866510\n--- a/describe.c\n+++ b/describe.c\n@@@ -98,20 -98,12 +98,20 @@@\n\treturn (a_date > b_date) ? -1 : (a_date == b_date) ? 0 : 1;\n }\n\n- static void describe(char *arg)\n -static void describe(struct commit *cmit, int last_one)\n++static void describe(char *arg, int last_one)\n {\n +\tunsigned char sha1[20];\n +\tstruct commit *cmit;\n\tstruct commit_list *list;\n\tstatic int initialized = 0;\n\tstruct commit_name *n;\n\n +\tif (get_sha1(arg, sha1) < 0)\n +\t\tusage(describe_usage);\n +\tcmit = lookup_commit_reference(sha1);\n +\tif (!cmit)\n +\t\tusage(describe_usage);\n +\n\tif (!initialized) {\n\t\tinitialized = 1;\n\t\tfor_each_ref(get_name); It is preceded by a \"git diff\" header, that looks like\nthis (when the -c option is used): diff --combined file or like this (when the --cc option is used): diff --cc file It is followed by one or more extended header lines\n(this example shows a merge with two parents): index <hash>,<hash>..<hash>\nmode <mode>,<mode>..<mode>\nnew file mode <mode>\ndeleted file mode <mode>,<mode> The mode <mode>,<mode>..<mode> line appears only if at least one of\nthe <mode> is different from the rest. Extended headers with\ninformation about detected content movement (renames and\ncopying detection) are designed to work with the diff of two\n<tree-ish> and are not used by combined diff format. It is followed by a two-line from-file/to-file header: --- a/file\n+++ b/file Similar to the two-line header for the traditional unified diff\nformat, /dev/null is used to signal created or deleted\nfiles. However, if the --combined-all-paths option is provided, instead of a\ntwo-line from-file/to-file, you get an N+1 line from-file/to-file header,\nwhere N is the number of parents in the merge commit: --- a/file\n--- a/file\n--- a/file\n+++ b/file This extended format can be useful if rename or copy detection is\nactive, to allow you to see the original name of the file in different\nparents. Chunk header format is modified to prevent people from\naccidentally feeding it to patch -p1 . Combined diff format\nwas created for review of merge commit changes, and was not\nmeant to be applied. The change is similar to the change in the\nextended index header: @@@ <from-file-range> <from-file-range> <to-file-range> @@@ There are (number of parents + 1) @ characters in the chunk\nheader for combined diff format. Unlike the traditional unified diff format, which shows two\nfiles A and B with a single column that has - (minus — appears in A but removed in B), + (plus — missing in A but\nadded to B), or \" \" (space — unchanged) prefix, this format\ncompares two or more files file1, file2,… with one file X, and\nshows how X differs from each of fileN. One column for each of\nfileN is prepended to the output line to note how X’s line is\ndifferent from it. A - character in the column N means that the line appears in\nfileN but it does not appear in the result. A + character\nin the column N means that the line appears in the result,\nand fileN does not have that line (in other words, the line was\nadded, from the point of view of that parent). In the above example output, the function signature was changed\nfrom both files (hence two - removals from both file1 and\nfile2, plus ++ to mean one line that was added does not appear\nin either file1 or file2). Also, eight other lines are the same\nfrom file1 but do not appear in file2 (hence prefixed with + ). When shown by git diff-tree -c , it compares the parents of a\nmerge commit with the merge result (i.e. file1..fileN are the\nparents). When shown by git diff-files -c , it compares the\ntwo unresolved merge parents with the working tree file\n(i.e. file1 is stage 2 aka \"our version\", file2 is stage 3 aka\n\"their version\")."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git - the stupid content tracker git-commit-graph"
},
{
"role": "assistant",
"content": "Write and verify Git commit-graph files"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git - the stupid content tracker <old|new>-file"
},
{
"role": "assistant",
"content": "are files GIT_EXTERNAL_DIFF can use to read the\ncontents of <old|new>,"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-log - Show commit logs --ita-invisible-in-index"
},
{
"role": "assistant",
"content": "By default entries added by \"git add -N\" appear as an existing\nempty file in \"git diff\" and a new file in \"git diff --cached\".\nThis option makes the entry appear as a new file in \"git diff\"\nand non-existent in \"git diff --cached\". This option could be\nreverted with --ita-visible-in-index . Both options are\nexperimental and could be removed in future."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "gitglossary - A Git Glossary orphan"
},
{
"role": "assistant",
"content": "The act of getting on a branch that does not\nexist yet (i.e., an unborn branch). After\nsuch an operation, the commit first created becomes a commit\nwithout a parent, starting a new history."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Tortoisegit asking password\nI just started to work on Git. I use windows 7 and has installed msysgit(1.7.8) and Tortoisegit(1.7.6).\nThe repository is created on Linux server which is accessible thru LAN. The issue I'm facing is I'm not able to clone the repository using Tortoisegit, it asks for password and I'm not sure what password it is asking.\nAt the same time I could clone the repository using Git Gui and do all operations.\nCan anybody please help me on understanding why Tortoisegit is asking password when Git Gui doesn't.\nI tried uninstalling Git and Tortoisegit and then install again but no success."
},
{
"role": "assistant",
"content": "My colleague solved the problem. Steps:\n\nRight click -> TortoiseGit -> Settings -> Network\nSSH client was pointing to C:\\Program Files\\TortoiseGit\\bin\\TortoisePlink.exe\nChanged path to C:\\Program Files (x86)\\Git\\bin\\ssh.exe\n\nAlternatively:\n\nC:\\Users\\...\\AppData\\Local\\Programs\\Git\\usr\\bin\\ssh.exe\nC:\\Program Files\\Git\\usr\\bin\\ssh.exe - with Git 2.37.3"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-diff - Show changes between commits, commit and working tree, etc --compact-summary"
},
{
"role": "assistant",
"content": "Output a condensed summary of extended header information such\nas file creations or deletions (\"new\" or \"gone\", optionally \"+l\"\nif it’s a symlink) and mode changes (\"+x\" or \"-x\" for adding\nor removing executable bit respectively) in diffstat. The\ninformation is put between the filename part and the graph\npart. Implies --stat ."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to skip GitHub Actions job on push event?\nWith Travis CI, we can skip the build for a particular commit with adding a suffix to a commit. This is described at Travis CI. I find this feature practical when I only edit README.md which is not code-related and the pre-flight build doesn't need to be triggered.\n[skip ci]\n\nHow do I skip the jobs trigged on: push events using GitHub Actions?\nname: Maven Build\non: [push]\n\njobs:\n build:\n\n runs-on: ubuntu-latest\n\n steps:\n - name: Check-out project\n uses: actions/checkout@v1\n - name: Set up JDK 11.0.3\n uses: actions/setup-java@v1\n with:\n java-version: 11.0.3\n - name: Build with Maven\n run: mvn -B package --file pom.xml\n\n\nAnswers summary:\nBig thanks to all the answerers providing various ways to achieve it. I bet everybody would need something a little bit different regarding to the origin of their problem and the CI approach. Here are the answers listed for a quick navigation:\n\nSkip CI on readme.md file: https://stackoverflow.com/a/61876395/3764965\nSkip CI on [skip ci] as a new GitHub feature:\n\nhttps://stackoverflow.com/a/66156840/3764965 (answer here)\nhttps://stackoverflow.com/a/66114678/3764965 (answer in another question)\n\n\nSkip CI on [skip ci] message by parsing (customizable solution):\n\nhttps://stackoverflow.com/a/59775665/3764965\n\n\nAllow CI per specific branch: https://stackoverflow.com/a/61876395/3764965\n\nAll the answers deserve upvote! If you like my question, you should double-like the answers."
},
{
"role": "assistant",
"content": "UPDATE: Please see Helmisek anwser, which points out that Github has the functionality built-in now.\nMy answer only makes sense, if you want to skip just some jobs/steps.\n\nYou can give the following a try:\nname: Maven Build\non: [push]\n\njobs:\n build:\n if: \"!contains(github.event.commits[0].message, '[skip ci]')\"\n runs-on: ubuntu-latest\n\n steps:\n - name: Check-out project\n uses: actions/checkout@v1\n - name: Set up JDK 11.0.3\n uses: actions/setup-java@v1\n with:\n java-version: 11.0.3\n - name: Build with Maven\n run: mvn -B package --file pom.xml"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How can I set up autocompletion for Git commands?\nI have Git (version 1.7.2.5) bash compeletion working on my Debian squeeze (6.0). Git was installed with aptitude and I am using standard debian's bash, which supports command line autocompletion.\nNow, I just installed Git (1.5.6.5) on an other machine (Lenny/Debian 5.0) and the there is no autocompletion. \n\nWhy is Git autocomplete not working on the second machine? How do I diagnose this?\nWhat is making completion work on my machine? I have looked for the file git-completion.bash but it doesn't seem to be on my machine. How does Git complete ever work?\nHow can I bring git complete to the other machine?"
},
{
"role": "assistant",
"content": "You need to source /etc/bash_completion.d/git to enable git auto-completion.\nIn my .bashrc it's done with:\nfor file in /etc/bash_completion.d/* ; do\n source \"$file\"\ndone"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-log - Show commit logs --diff-merges=<format>"
},
{
"role": "assistant",
"content": "Specify diff format to be used for merge commits. Default is\n`off` unless --first-parent is in use, in\nwhich case first-parent is the default. The following formats are supported: off, none Disable output of diffs for merge commits. Useful to override\nimplied value. on, m Make diff output for merge commits to be shown in the default\nformat. The default format can be changed using log.diffMerges configuration variable, whose default value\nis separate . first-parent, 1 Show full diff with respect to first parent. This is the same\nformat as --patch produces for non-merge commits. separate Show full diff with respect to each of parents.\nSeparate log entry and diff is generated for each parent. combined, c Show differences from each of the parents to the merge\nresult simultaneously instead of showing pairwise diff between\na parent and the result one at a time. Furthermore, it lists\nonly files which were modified from all parents. dense-combined, cc Further compress output produced by --diff-merges=combined by omitting uninteresting hunks whose contents in the parents\nhave only two variants and the merge result picks one of them\nwithout modification. remerge, r Remerge two-parent merge commits to create a temporary tree\nobject—potentially containing files with conflict markers\nand such. A diff is then shown between that temporary tree\nand the actual merge commit. The output emitted when this option is used is subject to change, and\nso is its interaction with other options (unless explicitly\ndocumented)."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-rev-parse - Pick out and massage parameters <refname>@{<n>} , e.g. master@{1}"
},
{
"role": "assistant",
"content": "A ref followed by the suffix @ with an ordinal specification\nenclosed in a brace pair (e.g. {1} , {15} ) specifies\nthe n-th prior value of that ref. For example master@{1} is the immediate prior value of master while master@{5} is the 5th prior value of master . This suffix may only be used\nimmediately following a ref name and the ref must have an existing\nlog ( $GIT_DIR/logs/<refname> )."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Contributing to project on github, how to \"rebase my pull request on top of master\"\nOk so I an contributing to a project on github. The project on github is upstream, my forked repo on github is origin, and my local repo on my computer.\ngit checkout -b feature\n# Working on feature\ngit commit -a -m 'only commit on feature'\n\nthen I submit a pull request \ngit push origin master\n\nThe pull request is reviewed and a unrelated change needs to be made. Someone else makes a commit and merge into upstream/master\nNow I am asked by the upstream maintainer to \"rebase my pull request on top of master\"\nThis is my story (insert Law and Order sound effect).....\nI did not make any changes to the pull request and its still the same commit on branch feature. \ngit checkout master\ngit fetch upstream\ngit checkout feature\ngit rebase master\n=> \"Current branch feature is up to date.\"\ngit push origin feature\n=> \"Everything up-to-date\"\n\nI don't understand. How is this possible when I know that someone committed and merged to upstream/master after I pushed my pull request to origin/feature?\nCan anyone tell me what the correct procedure should be in this situation?"
},
{
"role": "assistant",
"content": "You only show a fetch on the upstream repo. That doesn't actually update any of your local branches. It only updates your knowledge of upstream. You'd need to ensure upstream/master is fully merged into your master, like with a git pull, prior to rebasing onto master, or more simply just rebase onto upstream/master.\nI.e:\ngit checkout master\ngit pull upstream master\ngit checkout feature\ngit rebase master\n\nor\ngit checkout feature\ngit fetch upstream master\ngit rebase upstream/master\n\nUpdate:\nAfter fixing your local feature branch, you'll need to push it back to origin to finish updating the pull request. Since you've pushed feature once already, you can't simply push again because a rebase changes history, and it's no long a fast-forward. Normally, whan a push fails with a \"non-fast-forward\", you'd resolve it by doing a pull, but a pull will just combine the two divergent histories, which is definitely not what you want. That would mean your old (pre rebase) feature branch would be combined with the new (post rebase) one. You want to overwrite origin/feature with the state of the new feature branch, dumping any record of the old one. That means you'll want to force the push to happen, even though it's not a fast-forward, using git push -f origin feature. Note: force pushing is dangerous, and you can lose commits with it. Only use it if you're absolutely sure you know what you're doing, like right here, where you intentionally want to drop the old, useless commits in the pre-rebase feature branch."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Do I need authentication as well as signing keys on Github?\n\nGithub allows users to add SSH keys in order to access the repositories but it doesn't do a great job of explaining what the difference is between an \"Authentication Key\" and a \"Signing Key\" Specific questions I would like to know are:\n\nDo I need both Types of keys in order to access the repository?\n\nIf I only add one key and that key is a \"Singing Key\" will that also allow me to simply check out the code? in other words does a Signing Key also do authentication?\n\nIf I would like to do both Authentication and Signing, do those keys have to be different from one another or can I use the exact same key for both.\n\nIf those keys have to be different from one another, how do I configure Git on my server to send both keys, as I presume that would be necessary right?"
},
{
"role": "assistant",
"content": "The difference between signing keys and authentication keys is that signing keys can be used to sign Git commits and authentication keys can be used to access repositories. If you add a key as only one type, then it can be used only for that purpose, but the same key may be added for both.\nIf you just want to access repositories, then all you need is an authentication key. If you want to use an SSH key to verify that your commits have not been modified or tampered with and that they did indeed come from you (and not someone who forged your name and email in commits), then you'd want a signing key (plus a recent version of Git).\nThe reason they're different sets is that they have different security models and so it makes sense to allow people to set different keys for different purposes if they so choose. This is also in line with best practices for cryptographic key management."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Placing links inside markdown code blocks\n\nI want to have links inside my code blocks using GitHub flavored markdown.\n```cpp\nvoid Click ([Keycode](#keycode) key) const\n```\n\nUnfortunately, it renders that as code, anyway to make it a link instead?"
},
{
"role": "assistant",
"content": "If its a short piece of code this should do the trick:\n[`this is code`](https://this_is_url/)"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Merge conflict resolution\nWhen there's a merge conflict in Git, junk like the following is inserted into the conflicting files. Three questions:\n\nHow do you read these annotations?\nWhat are some strategies to use when fixing these merge conflicts?\nIs there a GUI tool for Mac that knows how to read these files and display the two versions side-by-side to make it easier to fix the problem?\n\n\nNote: In case it's relevant, I am using GitHub's Mac GUI client."
},
{
"role": "assistant",
"content": "Everything between <<<<<< and ====== comes from the HEAD revision, which is the committed state before starting the merge operation (git merge will complain if the tree is dirty, so it should be equivalent to your working directory).\nThe parts between ====== and >>>>>> come from the version being merged. The text after the >>>>>> is the comment of the commit that introduced the conflicting change.\nThat there is a conflict marker means that the base version of this part of the file is different from both \"new\" versions. The base version (last common ancestor) is not shown.\nIf you want a more comfortable merge and have a GUI available, I suggest you take a look at kdiff3."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-diff-index - Compare a tree to the working tree or index --src-prefix=<prefix>"
},
{
"role": "assistant",
"content": "Show the given source prefix instead of \"a/\"."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to pull after a forced git push?\nSuppose I pull changes from a git repo. Then the author of the repo force pushes to the central repo. Now I can't pull since the history is rewritten.\nHow can I pull the new commits (and abandon the old ones), assuming that the author force-pushed the correct version?\nI know this is bad git workflow, but sometimes you can't avoid this."
},
{
"role": "assistant",
"content": "Throwing away your local changes\nIf you want to discard your work, fetch and reset. For example, if you have a remote named origin and a branch named master:\n$ git fetch origin\n$ git reset --hard origin/master # Destroys your work\n\nKeeping your local changes\nIf you don't want to throw away your work, you will have to do a git rebase --onto. Suppose the old origin looks like this:\nA ---> B ---> C\n ^\n origin/master\n\nAnd you have this:\nA ---> B ---> C ---> X ---> Y ---> Z\n ^ ^\n | master\n origin/master\n\nNow, the upstream changes change things:\nA ---> B ---> C ---> X ---> Y ---> Z\n \\ ^\n ---> B'---> C' master\n ^ \n origin/master\n\nYou would have to run git rebase --onto origin/master <C> master, where <C> is the SHA-1 of the old origin/master branch before upstream changes. This gives you this:\nA ---> B ---> C ---> X ---> Y ---> Z\n \\\n ---> B'---> C'---> X'---> Y'---> Z'\n ^ ^\n | master\n origin/master\n\nNotice how B, C, X, Y, and Z are now \"unreachable\". They will eventually be removed from your repository by Git. In the meantime (90 days), Git will keep a copy in the reflog in case it turns out you made a mistake.\nFixing mistakes\nIf you git reset or git rebase wrong and accidentally lose some local changes, you can find the changes in the reflog.\nIn the comments, a user is suggesting git reflog expire with --expire=now but DO NOT RUN THIS COMMAND because this will DESTROY your safety net. The whole purpose of having a reflog is so that Git will sometimes save your neck when you run the wrong command.\nBasically, what this command will do is immediately destroy the B, C, X, Y, and Z commits in the examples above so you can't get them back. There's no real benefit to running this command, except it might save a little bit of disk space, but Git will already purge the data after 90 days so this benefit is short-lived."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Git on custom SSH port\nMy VPS provider recommends that I leave my SSH port to the custom port number they assign it by default (not 22). The thing is, while I know I can provide the port number when creating a remote config, it seems I can't do the same when doing a Git clone. I am using gitolite so the clone commands look like:\ngit clone [email protected]:gitolite-admin\n\nIs there a way to covert this to using the custom SSH port number?\nI should also mention I am running Cygwin on Windows. I have seen multiple places saying to add the custom port to the ~/.ssh/config file:\nHost mydomain.example\n Port 12345\n\nHowever in Cygwin, that file does not seem to exist."
},
{
"role": "assistant",
"content": "git clone ssh://[email protected]:[port]/gitolite-admin\n\nNote that the port number should be there without the square brackets: []"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-rev-parse - Pick out and massage parameters REVERT_HEAD"
},
{
"role": "assistant",
"content": "records the commit which you are reverting when you run git revert ."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Generating SSH keys for 'apache' user\nHow do I add SSH keys for 'apache' user in Linux? \nBACKGROUND \nI am trying to add a service hook to github to notify a URL once I push to my repo. I have the following php page set up:\n<?php `git pull origin master`; \n\nHowever I get the following output:\nsh: git: Permission denied\n\nThis is because the keys I generated for github access were generated by my 'root' user. However when I exectue a command from php it is the 'apache' user that runs it.\nThe keys therefore do not correspond and permission is denied to pull.\nAs I cannot switch user from the terminal to generate keys as 'apache', I am not too sure what to do. Can anyone suggest a solution?"
},
{
"role": "assistant",
"content": "You may have to copy the root generated keys in the .ssh directory of your apache user.\nAssuming the homedir of apache is /var/www (check /etc/passwd) and the named key is id_rsa-git :\nmkdir -p /var/www/.ssh/\ncp /root/.ssh/id_rsa-git /var/www/.ssh/id_rsa\n\nNo need to copy the public key.\nNote : by default the key used are id_rsa or id_dsa. You may change the name of the copied key to match this.\nYou may also change ownership of the id_rsa key and .ssh directory: \nchown -R apache:apache /var/www/.ssh\nchmod 0700 /var/www/.ssh\nchmod 0600 /var/www/.ssh/id_rsa"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Remove last commit from remote Git repository\nHow can I remove the last commit from a remote Git repository such as I don't see it any more in the log?\nIf for example git log gives me the following commit history\nA->B->C->D[HEAD, ORIGIN]\n\nhow can I go to\nA->B->C[HEAD,ORIGIN]"
},
{
"role": "assistant",
"content": "Be aware that this will create an \"alternate reality\" for people who have already fetch/pulled/cloned from the remote repository. But in fact, it's quite simple:\ngit reset HEAD^ # remove commit locally\ngit push origin +HEAD # force-push the new HEAD commit\n\nIf you want to still have it in your local repository and only remove it from the remote, then you can use:\ngit push origin +HEAD^:\"$name_of_your_branch\" # e.g. +HEAD^:master\n\nSome shells interpret the ^ character. For those shells, either quote/escape or use ~:\nHEAD\\^\n'HEAD^'\nHEAD~"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "configure Git to accept a particular self-signed server certificate for a particular https remote\nThe sysadmin for a project I'm on has decided that SSH is \"too much trouble\"; instead, he has set up Git to be accessible via an https:// URL (and username/password authentication). The server for this URL presents a self-signed certificate, so he advised everyone to turn off certificate validation. This does not strike me as a good setup, security-wise.\nIs it possible to tell Git that for remote X (or better, any remote in any repository that happens to begin with https://$SERVERNAME/) it is to accept a particular certificate, and only that certificate? Basically reduplicate SSH's server-key behavior."
},
{
"role": "assistant",
"content": "Briefly:\n\nGet the self signed certificate\nPut it into some (e.g. ~/git-certs/cert.pem) file\nSet git to trust this certificate using http.sslCAInfo parameter\n\nIn more details:\nGet self signed certificate of remote server\nAssuming, the server URL is repos.sample.com and you want to access it over port 443.\nThere are multiple options, how to get it.\nGet certificate using openssl\n$ openssl s_client -connect repos.sample.com:443\n\nCatch the output into a file cert.pem and delete all but part between (and including) -BEGIN CERTIFICATE- and -END CERTIFICATE-\nContent of resulting file ~/git-certs/cert.pem may look like this:\n-----BEGIN CERTIFICATE-----\nMIIDnzCCAocCBE/xnXAwDQYJKoZIhvcNAQEFBQAwgZMxCzAJBgNVBAYTAkRFMRUw\nEwYDVQQIEwxMb3dlciBTYXhvbnkxEjAQBgNVBAcTCVdvbGZzYnVyZzEYMBYGA1UE\nChMPU2FhUy1TZWN1cmUuY29tMRowGAYDVQQDFBEqLnNhYXMtc2VjdXJlLmNvbTEj\nMCEGCSqGSIb3DQEJARYUaW5mb0BzYWFzLXNlY3VyZS5jb20wHhcNMTIwNzAyMTMw\nOTA0WhcNMTMwNzAyMTMwOTA0WjCBkzELMAkGA1UEBhMCREUxFTATBgNVBAgTDExv\nd2VyIFNheG9ueTESMBAGA1UEBxMJV29sZnNidXJnMRgwFgYDVQQKEw9TYWFTLVNl\nY3VyZS5jb20xGjAYBgNVBAMUESouc2Fhcy1zZWN1cmUuY29tMSMwIQYJKoZIhvcN\nAQkBFhRpbmZvQHNhYXMtc2VjdXJlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEP\nADCCAQoCggEBAMUZ472W3EVFYGSHTgFV0LR2YVE1U//sZimhCKGFBhH3ZfGwqtu7\nmzOhlCQef9nqGxgH+U5DG43B6MxDzhoP7R8e1GLbNH3xVqMHqEdcek8jtiJvfj2a\npRSkFTCVJ9i0GYFOQfQYV6RJ4vAunQioiw07OmsxL6C5l3K/r+qJTlStpPK5dv4z\nSy+jmAcQMaIcWv8wgBAxdzo8UVwIL63gLlBz7WfSB2Ti5XBbse/83wyNa5bPJPf1\nU+7uLSofz+dehHtgtKfHD8XpPoQBt0Y9ExbLN1ysdR9XfsNfBI5K6Uokq/tVDxNi\nSHM4/7uKNo/4b7OP24hvCeXW8oRyRzpyDxMCAwEAATANBgkqhkiG9w0BAQUFAAOC\nAQEAp7S/E1ZGCey5Oyn3qwP4q+geQqOhRtaPqdH6ABnqUYHcGYB77GcStQxnqnOZ\nMJwIaIZqlz+59taB6U2lG30u3cZ1FITuz+fWXdfELKPWPjDoHkwumkz3zcCVrrtI\nktRzk7AeazHcLEwkUjB5Rm75N9+dOo6Ay89JCcPKb+tNqOszY10y6U3kX3uiSzrJ\nejSq/tRyvMFT1FlJ8tKoZBWbkThevMhx7jk5qsoCpLPmPoYCEoLEtpMYiQnDZgUc\nTNoL1GjoDrjgmSen4QN5QZEGTOe/dsv1sGxWC+Tv/VwUl2GqVtKPZdKtGFqI8TLn\n/27/jIdVQIKvHok2P/u9tvTUQA==\n-----END CERTIFICATE-----\n\nGet certificate using your web browser\nI use Redmine with Git repositories and I access the same URL for web UI and for git command line access. This way, I had to add exception for that domain into my web browser.\nUsing Firefox, I went to Options -> Advanced -> Certificates -> View Certificates -> Servers, found there the self-signed host, selected it and using Export button I got exactly the same file, as created using openssl.\nNote: I was a bit surprised, there is no name of the authority visibly mentioned. This is fine.\nHaving the trusted certificate in dedicated file\nPrevious steps shall result in having the certificate in some file. It does not matter, what file it is as long as it is visible to your git when accessing that domain. I used ~/git-certs/cert.pem\nNote: If you need more trusted self-signed certificates, put them into the same file:\n-----BEGIN CERTIFICATE-----\nMIIDnzCCAocCBE/xnXAwDQYJKoZIhvcNAQEFBQAwgZMxCzAJBgNVBAYTAkRFMRUw\n...........\n/27/jIdVQIKvHok2P/u9tvTUQA==\n-----END CERTIFICATE-----\n-----BEGIN CERTIFICATE-----\nAnOtHeRtRuStEdCeRtIfIcAtEgOeShErExxxxxxxxxxxxxxxxxxxxxxxxxxxxxxw\n...........\n/27/jIdVQIKvHok2P/u9tvTUQA==\n-----END CERTIFICATE-----\n\nThis should work (but I tested it only with single certificate).\nConfigure git to trust this certificate\n$ git config --global http.sslCAInfo /home/javl/git-certs/cert.pem\n\nYou may also try to do that system wide, using --system instead of --global.\nTest it. You should now be able to communicate with your server without resorting to:\n$ git config --global http.sslVerify false # NO NEED TO USE THIS\n\nIf you already set your git to ignore ssl certificates, unset that:\n$ git config --global --unset http.sslVerify\n\nYou may also check that you did it all correctly, without spelling errors:\n$ git config --global --list\n\nThat should list all variables, you have set globally."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Configure Gitlab account in Pycharm\n\nCan anyone explain how to configure a Gitlab account on PyCharm 3.4?\nIn the options I can see Github, but nothing about how to configure a Gitlab account."
},
{
"role": "assistant",
"content": "Install gitlab Integration plugin from settings menu"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git - the stupid content tracker --bare"
},
{
"role": "assistant",
"content": "Treat the repository as a bare repository. If GIT_DIR\nenvironment is not set, it is set to the current working\ndirectory."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-send-email - Send a collection of patches as emails sendemail.multiEdit"
},
{
"role": "assistant",
"content": "If true (default), a single editor instance will be spawned to edit\nfiles you have to edit (patches when --annotate is used, and the\nsummary when --compose is used). If false, files will be edited one\nafter the other, spawning a new editor each time."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Git rebase interactive drop vs deleting the commit line\nWhat is the difference from drop in the Git interactive rebase and just deleting the line of the commit?"
},
{
"role": "assistant",
"content": "There is no difference by default; it's just another way to say the same thing.\nBut, if you set rebase.missingCommitsCheck to warn or error, then removing a line will trigger a warning (useful for detecting a messed-up cut-and-paste).\nThen setting the line to drop explicitly tells Git that you want to drop that commit, and no warning is shown for it."
}
] |
[
{
"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 objectsize[:padded]"
},
{
"role": "assistant",
"content": "The object size of the file which is recorded in the index\n(\"-\" if the object is a commit or tree ).\nIt also supports a padded format of size with \"%(objectsize:padded)\"."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-rev-parse - Pick out and massage parameters <rev>^@ , e.g. HEAD^@"
},
{
"role": "assistant",
"content": "A suffix ^ followed by an at sign is the same as listing\nall parents of <rev> (meaning, include anything reachable from\nits parents, but not the commit itself)."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-diff - Show changes between commits, commit and working tree, etc diff.relative"
},
{
"role": "assistant",
"content": "If set to true , git diff does not show changes outside of the directory\nand show pathnames relative to the current directory."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git - the stupid content tracker"
},
{
"role": "assistant",
"content": "File/Directory Structure Please see the gitrepository-layout document. Read githooks for more details about each hook. Higher level SCMs may provide and manage additional information in the $GIT_DIR ."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git - the stupid content tracker --no-replace-objects"
},
{
"role": "assistant",
"content": "Do not use replacement refs to replace Git objects.\nThis is equivalent to exporting the GIT_NO_REPLACE_OBJECTS environment variable with any value.\nSee git-replace for more information."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "gitignore all files of extension in directory\nIs there a way to ignore all files of a type in a directory?\n** is apparently meaningless to git, so this doesn't work:\n/public/static/**/*.js\n\nThe idea is to match arbitrary nested folders."
},
{
"role": "assistant",
"content": "It would appear that the ** syntax is supported by git as of version 1.8.2.1 according to the documentation.\n\nTwo consecutive asterisks (\"**\") in patterns matched against full pathname may have special meaning:\n\nA leading \"**\" followed by a slash means match in all directories. For\n example, \"**/foo\" matches file or directory \"foo\" anywhere, the same\n as pattern \"foo\". \"**/foo/bar\" matches file or directory \"bar\"\n anywhere that is directly under directory \"foo\".\nA trailing \"/**\" matches everything inside. For example, \"abc/**\"\n matches all files inside directory \"abc\", relative to the location of\n the .gitignore file, with infinite depth.\nA slash followed by two consecutive asterisks then a slash matches\n zero or more directories. For example, \"a/**/b\" matches \"a/b\",\n \"a/x/b\", \"a/x/y/b\" and so on.\nOther consecutive asterisks are considered invalid."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-shortlog - Summarize git log output --all-match"
},
{
"role": "assistant",
"content": "Limit the commits output to ones that match all given --grep ,\ninstead of ones that match at least one."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Git: Create a branch from unstaged/uncommitted changes on master\nContext: I'm working on master adding a simple feature. After a few minutes I realize it was not so simple and it should have been better to work into a new branch.\nThis always happens to me and I have no idea how to switch to another branch and take all these uncommited changes with me leaving the master branch clean. I supposed git stash && git stash branch new_branch would simply accomplish that but this is what I get:\n~/test $ git status\n# On branch master\nnothing to commit (working directory clean)\n\n~/test $ echo \"hello!\" > testing \n\n~/test $ git status\n# On branch master\n# Changed but not updated:\n# (use \"git add <file>...\" to update what will be committed)\n# (use \"git checkout -- <file>...\" to discard changes in working directory)\n#\n# modified: testing\n#\nno changes added to commit (use \"git add\" and/or \"git commit -a\")\n\n~/test $ git stash\nSaved working directory and index state WIP on master: 4402b8c testing\nHEAD is now at 4402b8c testing\n\n~/test $ git status\n# On branch master\nnothing to commit (working directory clean)\n\n~/test $ git stash branch new_branch\nSwitched to a new branch 'new_branch'\n# On branch new_branch\n# Changed but not updated:\n# (use \"git add <file>...\" to update what will be committed)\n# (use \"git checkout -- <file>...\" to discard changes in working directory)\n#\n# modified: testing\n#\nno changes added to commit (use \"git add\" and/or \"git commit -a\")\nDropped refs/stash@{0} (db1b9a3391a82d86c9fdd26dab095ba9b820e35b)\n\n~/test $ git s\n# On branch new_branch\n# Changed but not updated:\n# (use \"git add <file>...\" to update what will be committed)\n# (use \"git checkout -- <file>...\" to discard changes in working directory)\n#\n# modified: testing\n#\nno changes added to commit (use \"git add\" and/or \"git commit -a\")\n\n~/test $ git checkout master\nM testing\nSwitched to branch 'master'\n\n~/test $ git status\n# On branch master\n# Changed but not updated:\n# (use \"git add <file>...\" to update what will be committed)\n# (use \"git checkout -- <file>...\" to discard changes in working directory)\n#\n# modified: testing\n#\nno changes added to commit (use \"git add\" and/or \"git commit -a\")\n\nDo you know if there is any way of accomplishing this?"
},
{
"role": "assistant",
"content": "No need to stash.\nUpdate 2020 / Git 2.23\n\nGit 2.23 adds the new switch subcommand, in an attempt to clear some of the confusion caused by the overloaded usage of checkout (switching branches, restoring files, detaching HEAD, etc.)\nStarting with this version of Git, replace the git checkout command below with:\ngit switch -c <new-branch>\n\nThe behavior remains unchanged.\nBefore Update 2020 / Git 2.23\n\ngit checkout -b new_branch_name\n\ndoes not touch your local changes. It just creates the branch from the current HEAD and sets the HEAD there.\nSo I guess that's what you want.\n--- Edit to explain the result of checkout master ---\nAre you confused because checkout master does not discard your changes?\nSince the changes are only local, git does not want you to lose them too easily. Upon changing branch, git does not overwrite your local changes. The result of your checkout master is:\nM testing\n\n, which means that your working files are not clean. git did change the HEAD, but did not overwrite your local files. That is why your last status still show your local changes, although you are on master.\nIf you really want to discard the local changes, you have to force the checkout with -f.\ngit checkout master -f\n\nSince your changes were never committed, you'd lose them.\nTry to get back to your branch, commit your changes, then checkout the master again.\ngit checkout new_branch\ngit commit -a -m\"edited\"\ngit checkout master\ngit status\n\nYou should get a M message after the first checkout, but then not anymore after the checkout master, and git status should show no modified files.\n--- Edit to clear up confusion about working directory (local files)---\nIn answer to your first comment, local changes are just... well, local. Git does not save them automatically, you must tell it to save them for later.\nIf you make changes and do not explicitly commit or stash them, git will not version them. If you change HEAD (checkout master), the local changes are not overwritten since unsaved."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-rev-list - Lists commit objects in reverse chronological order --exclude-first-parent-only"
},
{
"role": "assistant",
"content": "When finding commits to exclude (with a ^ ), follow only\nthe first parent commit upon seeing a merge commit.\nThis can be used to find the set of changes in a topic branch\nfrom the point where it diverged from the remote branch, given\nthat arbitrary merges can be valid topic branch changes."
}
] |
[
{
"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?\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": "why `git diff` reports no file change after `git add`\nWhy is that git diff thinks there are no changes\n..even if git status reports them as modified?\n$ git status\nOn branch master\nYour branch is ahead of 'origin/master' by 2 commits.\n (use \"git push\" to publish your local commits)\n\nChanges to be committed:\n (use \"git reset HEAD <file>...\" to unstage)\n\n new file: file-added\n modified: file-with-changes << it knows there are changes\n\nbut in order to see the difference, I need to explicitly add the last reversion hash..\n$ git diff\n (nothing)\n\n$ git diff rev-hash\ndiff --git a/file-with-changes b/file-with-changes\nindex d251979..a5fff1c 100644\n--- a/file-with-changes\n+++ b/file-with-changes\n.\n.."
},
{
"role": "assistant",
"content": "Please try git diff --staged command.\nAlternative options available are listed below.\n\ngit diff\n\nshows changes between index/staging and working files. Since, in your case, git add moved your files-with-changes to staging area, there were no modifications shown/seen.\n\ngit diff --staged\n\nshows changes between HEAD and index/staging. git diff --cached also does the same thing. staged and cached can be used interchangeably.\n\ngit diff HEAD\n\nshows changes between HEAD and working files\n\ngit diff $commit $commit\n\nshows changes between 2 commits\n\ngit diff origin\n\nshows diff between HEAD & remote/origin"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-checkout - Switch branches or restore working tree files"
},
{
"role": "assistant",
"content": "SYNOPSIS git checkout [-q] [-f] [-m] [<branch>] git checkout [-q] [-f] [-m] --detach [<branch>] git checkout [-q] [-f] [-m] [--detach] <commit> git checkout [-q] [-f] [-m] [[-b|-B|--orphan] <new-branch>] [<start-point>] git checkout [-f] <tree-ish> [--] <pathspec>… git checkout [-f] <tree-ish> --pathspec-from-file=<file> [--pathspec-file-nul] git checkout [-f|--ours|--theirs|-m|--conflict=<style>] [--] <pathspec>… git checkout [-f|--ours|--theirs|-m|--conflict=<style>] --pathspec-from-file=<file> [--pathspec-file-nul] git checkout (-p|--patch) [<tree-ish>] [--] [<pathspec>…]"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-rev-list - Lists commit objects in reverse chronological order %ar"
},
{
"role": "assistant",
"content": "author date, relative"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to get (only) author name or email in git given SHA1?\nI would like to check for author's e-mail and name, surname to verify who's pushing to my repo.\nIs there any way that I can come up with a command in git to show commiter's name/e-mail given only SHA1 of the commit?\nThis is what I came up with but it's far from ideal solution (the first solution is for git hook that's why it's using 2 SHA1s with rev-list. The second one simply uses git show):\ngit rev-list -n 1 --pretty=short ccd3970..6ddf170 | grep Author | cut -d ' ' -f2- | rev | cut -d ' ' -f2- | rev\ngit show 6ddf170 | grep Author | cut -d ' ' -f2- | rev | cut -d ' ' -f2- | rev"
},
{
"role": "assistant",
"content": "You can use the following command:\n git log --format='%ae' HASH^!\n\nIt works with git show as well. You need to include -s to suppress the diff.\ngit show -s --format='%ae' HASH"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Adding git submodule that contains another submodule?\nI'm working on a project in one git repository (A) that is including another git repository (B), which in turn includes a third git repository (C). In A, I added B via:\ngit submodule add https://github.com/blt04/sfDoctrine2Plugin.git plugins/sfDoctrine2Plugin\n\nClick here, and you can see where B references C: https://github.com/doctrine/doctrine2\nAfter doing my git submodule add, my plugins/sfDoctrine2Plugin/lib/vendor/doctrine folder (should contain C) is empty. I tried doing a git submodule update --recursive as per this StackOverflow answer, but it still didn't import the files to that path. I'm at a loss as to what to do here."
},
{
"role": "assistant",
"content": "You need to do git submodule update --init --recursive. The problem here is the submodule C is never being initialized in the first place."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to use Git's default commit message when resolving merge conflicts?\nAfter doing a merge and resolving conflicts, is there an \"easy\" way to just accept the default generated commit message from the command line?\nOne of our developers will resolve all the conflicts, and then do a git commit -m\"Merge Commit\" which replaces the generated commit message that listed all the conflict files. I would like to have a different flag that would just take the current file without modification. I know there is a -F or --file= option, but that requires knowing the file name all the time."
},
{
"role": "assistant",
"content": "Per the docs, I just tried this simple command and it worked for me:\ngit commit --no-edit\n\nAfterward, run git log to confirm that the default message has been used."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-config - Get and set repository or global options core.sparseCheckoutCone"
},
{
"role": "assistant",
"content": "Enables the \"cone mode\" of the sparse checkout feature. When the\nsparse-checkout file contains a limited set of patterns, this\nmode provides significant performance advantages. The \"non-cone\nmode\" can be requested to allow specifying more flexible\npatterns by setting this variable to false . See git-sparse-checkout for more information."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "gitglossary - A Git Glossary tree-ish (also treeish)"
},
{
"role": "assistant",
"content": "A tree object or an object that can\nbe recursively dereferenced to a tree object.\nDereferencing a commit object yields the tree\nobject corresponding to the revision 's top directory .\nThe following are all tree-ishes:\na commit-ish ,\na tree object,\na tag object that points to a tree object,\na tag object that points to a tag object that points to a tree\nobject,\netc."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-filter-branch - Rewrite branches"
},
{
"role": "assistant",
"content": "PERFORMANCE The performance of git-filter-branch is glacially slow; its design makes it\nimpossible for a backward-compatible implementation to ever be fast: In editing files, git-filter-branch by design checks out each and\nevery commit as it existed in the original repo. If your repo has 10^5 files and 10^5 commits, but each commit only modifies five\nfiles, then git-filter-branch will make you do 10^10 modifications,\ndespite only having (at most) 5*10^5 unique blobs. If you try and cheat and try to make git-filter-branch only work on\nfiles modified in a commit, then two things happen you run into problems with deletions whenever the user is simply\ntrying to rename files (because attempting to delete files that\ndon’t exist looks like a no-op; it takes some chicanery to remap\ndeletes across file renames when the renames happen via arbitrary\nuser-provided shell) even if you succeed at the map-deletes-for-renames chicanery, you\nstill technically violate backward compatibility because users\nare allowed to filter files in ways that depend upon topology of\ncommits instead of filtering solely based on file contents or\nnames (though this has not been observed in the wild). Even if you don’t need to edit files but only want to e.g. rename or\nremove some and thus can avoid checking out each file (i.e. you can\nuse --index-filter), you still are passing shell snippets for your\nfilters. This means that for every commit, you have to have a\nprepared git repo where those filters can be run. That’s a\nsignificant setup. Further, several additional files are created or updated per commit\nby git-filter-branch. Some of these are for supporting the\nconvenience functions provided by git-filter-branch (such as map()),\nwhile others are for keeping track of internal state (but could have\nalso been accessed by user filters; one of git-filter-branch’s\nregression tests does so). This essentially amounts to using the\nfilesystem as an IPC mechanism between git-filter-branch and the\nuser-provided filters. Disks tend to be a slow IPC mechanism, and\nwriting these files also effectively represents a forced\nsynchronization point between separate processes that we hit with\nevery commit. The user-provided shell commands will likely involve a pipeline of\ncommands, resulting in the creation of many processes per commit.\nCreating and running another process takes a widely varying amount\nof time between operating systems, but on any platform it is very\nslow relative to invoking a function. git-filter-branch itself is written in shell, which is kind of slow.\nThis is the one performance issue that could be backward-compatibly\nfixed, but compared to the above problems that are intrinsic to the\ndesign of git-filter-branch, the language of the tool itself is a\nrelatively minor issue. Side note: Unfortunately, people tend to fixate on the\nwritten-in-shell aspect and periodically ask if git-filter-branch\ncould be rewritten in another language to fix the performance\nissues. Not only does that ignore the bigger intrinsic problems\nwith the design, it’d help less than you’d expect: if\ngit-filter-branch itself were not shell, then the convenience\nfunctions (map(), skip_commit(), etc) and the --setup argument\ncould no longer be executed once at the beginning of the program\nbut would instead need to be prepended to every user filter (and\nthus re-executed with every commit). The git filter-repo tool is\nan alternative to git-filter-branch which does not suffer from these\nperformance problems or the safety problems (mentioned below). For those\nwith existing tooling which relies upon git-filter-branch, git\nfilter-repo also provides filter-lamely ,\na drop-in git-filter-branch replacement (with a few caveats). While\nfilter-lamely suffers from all the same safety issues as\ngit-filter-branch, it at least ameliorates the performance issues a\nlittle."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-diff-index - Compare a tree to the working tree or index 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": "Run Github Actions when pull requests have a specific label\n\nAfter reading the documentation of the Events that trigger workflows, I wonder if it's possible to run a workflow with a given label name, like RFR or WIP. \nI know we can run a workflow when the pull request is labeled, but there is nothing more for a specifc label name :\non:\n pull_request:\n types: [labeled]\n\nHas anyone done this before ?"
},
{
"role": "assistant",
"content": "You can achieve running a workflow on labeling a Pull Request using a conditional expression like \nif: ${{ github.event.label.name == 'label_name' }}\n\nSo if you have your GitHub action config as below\nname: CI\n\non:\n pull_request:\n types: [ labeled ]\n\njobs:\n build:\n if: ${{ github.event.label.name == 'bug' }}\n runs-on: ubuntu-latest\n\n steps:\n - uses: actions/checkout@v2\n - name: Run a one-line script\n run: echo Hello, world!\n\nIt would trigger the workflow whenever a PR is labeled and run the job only if the label is bug and would skip if the label is anything else. You can also use github.event.action == 'labeled' as an extra check but that is not required if you have only types: [ labeled ] for the pull_request as shown in the config above.\nNote: Just for your information, the github event has the following info (removed the irrelevant data for brevity) regarding the label in case of labelling a PR\n\"event\": {\n \"action\": \"labeled\",\n \"label\": {\n \"color\": \"d73a4a\",\n \"default\": true,\n \"description\": \"Something isn't working\",\n \"id\": 1519136641,\n \"name\": \"bug\",\n \"node_id\": \"abcd\",\n \"url\": \"https://api.github.com/repos/owner/repo/labels/bug\"\n }\n}\n\nGitHub actions documentation regarding conditional expressions is here."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Why does git care about trailing whitespace in my files?\nWhat business is it of whatever VCS I'm using to worry about what I put in my files? I don't get what the point here is. Is git version control or syntax checker?"
},
{
"role": "assistant",
"content": "It is because one of the very common uses for Git is sending patch series via email. Trailing spaces cause trouble in email, and are thus usually stripped out, which means any trailing spaces will be lost in the process of sending the patch via email and applying it. This in turn means that if there are trailing spaces on lines in the repo, but not in the patch being applied, you may get spurious conflicts, or extra changes that weren't intended, when applying a patch.\nThis pre-commit hook used to be enabled by default, but is no longer. It seems I have misremembered; it was never deliberately enabled by default. As others have pointed out, this has always been a sample pre-commit hook; it used to be disabled by not giving it the execute bit, but that's something that can get screwed up fairly easily (for instance, running under Cygwin on Windows), so in newer versions of Git (since over a year ago) the samples have been disabled by being named pre-commit.sample. You can delete or move your .git/hooks/pre-commit to prevent this hook from executing if you don't like the behavior. You should also update your Git to something more recent, as this has been fixed for quite a while."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git svn clone malformed index info error\nWhen I run git svn clone I get the following error :\n\n 0 [main] perl 24432 cygwin_exception::open_stackdumpfile: Dumping stack trace to perl.exe.stackdump\n fatal: malformed index info 100644 362f1c18ceed5d593eb021432545685283a93 \n\n\nWhen I open the file I see the following : \n\nException: STATUS_ACCESS_VIOLATION at rip=0048360C537\n rax=00000006039F81E0 rbx=000000005219E248 rcx=000000060003A3C0\n rdx=0000000000000000 rsi=000000000000FDB4 rdi=0000000000000004\n r8 =0000000000000000 r9 =0000000000000000 r10=0000000000230000\n r11=000000048D785FBA r12=0000000000000003 r13=000006FFFF7FEDB8\n r14=00000006014D4030 r15=000006FFFF7FEDD0\n rbp=000000000007EDA8 rsp=000000000022BE80\n program=C:\\Program Files\\Git\\usr\\bin\\perl.exe, pid 24432, thread main\n cs=0033 ds=002B es=002B fs=0053 gs=002B ss=002B\n\nI checked the following links : \nError with Git SVN clone\nProblem cloning a single SVN Branch via git svn\nPython SVN bindings for Windows\nsubversion python bindings documentation?\nUnfortunately, I'm not familiar enough for the underlying technologies to figure out exactly what I should be doing. Would could be causing this and how might I be able to resolve?"
},
{
"role": "assistant",
"content": "I got this error while migrating huge svn repository to git using svn2git tool. I added below lines in my .git/config file and it started working:\n[core]\n repositoryformatversion = 0\n filemode = false\n bare = false\n logallrefupdates = true\n symlinks = false\n ignorecase = true\n hideDotFiles = dotGitOnly\n packedGitLimit = 256m\n packedGitWindowSize = 256m\n longpaths = true\n[http]\n postBuffer = 524288000\n[pack]\n deltaCacheSize = 256m\n packSizeLimit = 256m\n windowMemory = 1024m\n\nThese settings are explained at the git-config man page."
}
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.