messages
listlengths 3
3
|
---|
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Cloning an older version of github repo\n\nI have an Amazon EC2 machine. I would like to clone an older version of github repo on this machine. Normally I use git clone https://linktomyrepo.git How can I clone an older version, say an update from 14 days ago? I can see the exact version I need in the commit history of repository, but do not know how to clone it onto the EC2 machine. Do I need to use the little SHA code next to each commit?"
},
{
"role": "assistant",
"content": "You can always check out any given state by using a commit hash.\nFor instance, by looking at the log, you identified that 233ab4ef was the state you were interested in: issue a git checkout 233ab4ef to check out that state.\nAnother way to achieve this is by using git checkout @{14.days.ago}"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Reset other branch to current without a checkout\nI'm writing some scripts for my Git workflow.\nI need to reset other (existing) branch to the current one, without checkout.\nBefore:\n CurrentBranch: commit A\n OtherBranch: commit B\n\nAfter:\n CurrentBranch: commit A\n OtherBranch: commit A\n\nEquivalent of\n $ git checkout otherbranch \n $ git reset --soft currentbranch\n $ git checkout currentbranch\n\n(Note --soft: I do not want to affect working tree.)\nIs this possible?"
},
{
"role": "assistant",
"content": "Set otherbranch to point at the same commit as currentbranch by running\ngit branch -f otherbranch currentbranch\n\nThe -f (force) option tells git branch yes, I really mean to overwrite any existing otherbranch reference with the new one.\nFrom the documentation:\n\n-f\n --force\nReset to if exists already. Without -f git branch refuses to change an existing branch."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Username and password in command for git push\nIt's possible to clone down a git repository, specifying username and password in the command. Example:\ngit clone https://username:[email protected]/file.git\nIs it is possible to also specify the username and password when pushing? So that, for example, running git push origin --all will then output asking for a password. I want this in one command.\n(I am aware of the ability to set up keys and other solutions, but I want to know if there is a way to just keep using username and password with one command.) I am running Git Bash on Windows 8.1."
},
{
"role": "assistant",
"content": "Yes, you can do\ngit push https://username:[email protected]/file.git --all\nin this case https://username:[email protected]/file.git replace the origin in git push origin --all\nTo see more options for git push, try git help push"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-log - Show commit logs --full-diff"
},
{
"role": "assistant",
"content": "Without this flag, git log -p <path>... shows commits that\ntouch the specified paths, and diffs about the same specified\npaths. With this, the full diff is shown for commits that touch\nthe specified paths; this means that \"<path>…\" limits only\ncommits, and doesn’t limit diff for those commits. Note that this affects all diff-based output types, e.g. those\nproduced by --stat , etc."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-diff - Show changes between commits, commit and working tree, etc --ignore-space-at-eol"
},
{
"role": "assistant",
"content": "Ignore changes in whitespace at EOL."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-reflog - Manage reflog information"
},
{
"role": "assistant",
"content": "NAME git-reflog - Manage reflog information"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-merge - Join two or more development histories together <commit>…"
},
{
"role": "assistant",
"content": "Commits, usually other branch heads, to merge into our branch.\nSpecifying more than one commit will create a merge with\nmore than two parents (affectionately called an Octopus merge). If no commit is given from the command line, merge the remote-tracking\nbranches that the current branch is configured to use as its upstream.\nSee also the configuration section of this manual page. When FETCH_HEAD (and no other commit) is specified, the branches\nrecorded in the .git/FETCH_HEAD file by the previous invocation\nof git fetch for merging are merged to the current branch."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "gitcli - Git command-line interface and conventions"
},
{
"role": "assistant",
"content": "NAME gitcli - Git command-line interface and conventions"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git create patch with diff\nI tried doing \ngit diff 13.1_dev sale_edit > patch.diff\n\nThen I tried doing git apply patch.diff in another branch, but I got patch does not apply. How do I create patch files from diffs that I can use with git apply?\nErrors received:\n$ git apply --ignore-space-change --ignore-whitespace diff.diff \ndiff.diff:9: trailing whitespace.\n\ndiff.diff:10: trailing whitespace.\n function set_change_sale_date() \ndiff.diff:12: space before tab in indent.\n $this->sale_lib->set_change_sale_date($this->input->post('change_sale_date'));\ndiff.diff:14: trailing whitespace.\n\ndiff.diff:15: trailing whitespace.\n function set_change_sale_date_enable() \nwarning: application/controllers/sales.php has type 100755, expected 100644\nerror: patch failed: application/controllers/sales.php:520\nerror: application/controllers/sales.php: patch does not apply\nwarning: application/language/english/sales_lang.php has type 100755, expected 100644\nerror: patch failed: application/language/english/sales_lang.php:134\nerror: application/language/english/sales_lang.php: patch does not apply\nwarning: application/libraries/Sale_lib.php has type 100755, expected 100644\nerror: patch failed: application/models/sale.php:170\nerror: application/models/sale.php: patch does not apply\nwarning: application/views/sales/register.php has type 100755, expected 100644\nerror: patch failed: application/views/sales/register.php:361\nerror: application/views/sales/register.php: patch does not apply\n\nI'm trying this on Mac"
},
{
"role": "assistant",
"content": "Try a:\ngit apply --ignore-space-change --ignore-whitespace patch.diff\n\nAs mentioned in \"git: patch does not apply\", this can be caused by:\n\nthe line endings differing between the local file system and the remote repo.\nUser core.eol in .gitattributes file is a good approach (see \"git force file encoding on commit\")\nthe execution bit ('x').\nThat can lead you to set git config core.filemode false, followed by a git reset --hard HEAD (make sure you don't have uncommitted changes, or they would be lost)."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-for-each-ref - Output information on each ref signature:fingerprint"
},
{
"role": "assistant",
"content": "The fingerprint of the GPG signature of a commit."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-log - Show commit logs --bisect"
},
{
"role": "assistant",
"content": "Pretend as if the bad bisection ref refs/bisect/bad was listed and as if it was followed by --not and the good\nbisection refs refs/bisect/good-* on the command\nline."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-push - Update remote refs along with associated objects <repository>"
},
{
"role": "assistant",
"content": "The \"remote\" repository that is the destination of a push\noperation. This parameter can be either a URL\n(see the section GIT URLS below) or the name\nof a remote (see the section REMOTES below)."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "gitglossary - A Git Glossary dirty"
},
{
"role": "assistant",
"content": "A working tree is said to be \"dirty\" if\nit contains modifications which have not been committed to the current branch ."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Android studio - should the entire .idea directory be in git ignore?\nI saw a lot of examples for .gitignore files for AndroidStudio, some have .idea in them, and some don't.\nIs there a good reason not to add the entire .idea dir to .gitignore?\nIf it should not be completely ignored, are there specific files inside .idea (such as .iml) that should be in .gitignore?"
},
{
"role": "assistant",
"content": "You can take a look at this page :\nIntelliJ doc about project configuration files\nIn the \"Directory-based format\", a particular line is interesting :\n\nThe .idea directory contains a set of configuration files (.xml). Each file contains only a portion of configuration data pertaining to a certain functional area which is reflected in the name of a file, for example, compiler.xml, encodings.xml, modules.xml.\nAlmost all of the files contain information core to the project itself, such as names and locations of its component modules, compiler settings, etc. Thus, these files may (and should) be kept under version control.\n\nHowever, I properly HATE to make project IDE-dependent (I am currently working on a project made with NetBeans and it hurts to use it with Eclipse which becomes the standard of my company).\nSo, to answer your question :\n\nIf you do not use something like Maven or Gradle to manage dependencies and build : keep the directory under version control. This way, the correct configuration of the project and dependencies will be available for everyone. In the counterpart, all developers will have to set their environment exactly the same way that you define it in the config files.\nIf you do use something like Maven or Gradle : correctly configure these tools and do not keep the directory under version control. Actually, all the information contained inside config files should be stored in Maven/Gradle files. Then let your developers configure their IDE depending of their environment. This way, using Eclipse, IntelliJ, Linux, Windows ... will not be a problem anymore."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "github: Adding commits to existing pull request\n\nI opened a pull request to rails repo on github by using Fork & Edit this file file button.\nNow, \nAfter getting feedback on my PR, I wanted to add some more commits. so here is what I ended by doing\n$ git clone [email protected]:gaurish/rails.git #my forked repo\n$ git rebase -i 785a2e5 #commit hash of my commit using which PR was opened\n$ git checkout patch-3 #branch name I had to send my commits under to be shown in that PR\n$ git commit -am \"Changes done as per feedback\"\n$ git push origin patch-3\n\nThis worked fine but seems quite a complex workflow. Maybe I am wrong something wrong here? \nmy question is:\nAm I doing this the correct way? if not, then what is the proper way to do this?"
},
{
"role": "assistant",
"content": "Since you're using GitHub's tools and just changing one file, you could also browse to the file on GitHub, select the proper branch from the upper left corner under the \"tree:\" dropdown (patch-3 in your case), and now choose \"Edit this file\". Now your changes will be committed to this branch and will show up in your pull request"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Github remote push pack size exceeded\nI am new to Git and have a fairly large project that I want to push to a remote repo (Repo B) on Github. The original project was on Github as well but from a different repo (Repo A). I have to make some changes to files from Repo A before I can setup the project up on Repo B. I have setup the remotes, ssh keys etc. and I run into an issue when pushing the codebase to Repo B.\nI get the following error all the time:\n$ git push <remote_repo_name> master\nEnter passphrase for key '/c/ssh/.ssh/id_rsa':\nCounting objects: 146106, done.\nDelta compression using up to 4 threads.\nCompressing objects: 100% (35519/35519), done.\nfatal: pack exceeds maximum allowed size00 GiB | 154 KiB/s\nfatal: sha1 file '<stdout>' write error: Invalid arguments\nerror: failed to push some refs to '[email protected]:<repo>.git\n\nI changed the following settings in my local gitconfig\ngit config pack.packSizeLimit 1g\ngit config pack.windowMemory 1g\n\n... and ran git gc (which I see reorganized the packs so that each pack stayed within the packsize of 1GB). This did not work and I get the error seen above.\nI tried to lower the size of each pack as well ....\ngit config pack.packSizeLimit 500m\ngit config pack.windowMemory 500m\n\n... and ran git gc (which I see reorganized the packs so that each pack stayed within the packsize of 500MB). This did not work either and I ran into the same error.\nI am not sure of what Github's default packsize limits are (if any). The account is a micro account if that matters."
},
{
"role": "assistant",
"content": "The packsize limit does not affect git protocol commands (your push).\nFrom git-config under \npack.packSizeLimit:\n\nThe maximum size of a pack. This setting only affects packing to a file when repacking, i.e. the git:// protocol is unaffected.\n\nWhen executing a push git will always create exactly one pack no matter the size!\nTo fix this use two (or more) pushes:\ngit push remoteB <some previous commit on master>:master\n...\ngit push remoteB <some previous commit after the last one>:master\ngit push remoteB master\n\nThese pushes will all have smaller packs and will succeed."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-for-each-ref - Output information on each ref match=<pattern>"
},
{
"role": "assistant",
"content": "Only consider tags matching the given glob(7) pattern,\nexcluding the \"refs/tags/\" prefix; see the corresponding option\nin git-describe for details."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Squash all my commits into one for GitHub pull request [duplicate]\nThis question already has answers here:\n \n \n\n\n\n\nHow do I squash my last N commits together?\n\n (46 answers)\n \n\nClosed 6 years ago.\n\n\n\nI made a pull request on GitHub. Now the owner of the repository is saying to squash all the commits into one.\nWhen I type git rebase -i Notepad opens with the following content:\nnoop\n\n# Rebase 0b13622..0b13622 onto 0b13622\n#\n# Commands:\n# p, pick = use commit\n# r, reword = use commit, but edit the commit message\n# e, edit = use commit, but stop for amending\n# s, squash = use commit, but meld into previous commit\n# f, fixup = like \"squash\", but discard this commit's log message\n# x, exec = run command (the rest of the line) using shell\n#\n# These lines can be re-ordered; they are executed from top to bottom.\n#\n# If you remove a line here THAT COMMIT WILL BE LOST.\n#\n# However, if you remove everything, the rebase will be aborted.\n#\n# Note that empty commits are commented out\n\nI searched on Google but I do not understand how to do this."
},
{
"role": "assistant",
"content": "Just a simple addition to help someone else looking for this solution. You can pass in the number of previous commits you would like to squash. for example,\ngit rebase -i HEAD~3 \n\nThis will bring up the last 3 commits in the editor."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Gitlab CI Build failed gitlab-runner-prebuilt.tar.xz: no such file or directory\n\nI just installed Gitlab Runner on my dev machine (Ubuntu 17.10) for testing.\nWhen I run the runner I got:\n$: sudo gitlab-runner exec docker test \n Running with gitlab-ci-multi-runner dev (1.4.2)\n Using Docker executor with image php:5.6 ...\n ERROR: Build failed (system failure): open /var/lib/gitlab-runner/gitlab-runner-prebuilt.tar.xz: no such file or directory\n FATAL: open /var/lib/gitlab-runner/gitlab-runner-prebuilt.tar.xz: no such file or directory \n\n.gitlab-ci.yml file:\nimage: php:5.6\n\nbefore_script:\n - php -v\n\nstages:\n - test\n\ntest:\n script:\n - php -v\n\nCurrent installation process:\nsudo apt-get install gitlab-runner\n\nOutput:\n...\nConfiguring gitlab-ci-multi-runner (1.4.2+dfsg-1) ...\nI: generating GitLab Runner Docker image. This may take a while...\nE: No mirror specified and no default available\nW: please run 'sudo /usr/lib/gitlab-runner/mk-prebuilt-images.sh' to generate Docker image.\n...\n\nSo I did:\n$: sudo /usr/lib/gitlab-runner/mk-prebuilt-images.sh\n I: generating GitLab Runner Docker image. This may take a while...\n E: No mirror specified and no default available"
},
{
"role": "assistant",
"content": "Got the same problem today. Turns out cdebootstrap command in usr/lib/gitlab-runner/mk-prebuilt-images.sh is causing this error message:\ncdebootstrap \\\n --flavour=minimal \\\n --exclude=\"dmsetup,e2fsprogs,init,systemd-sysv,systemd,udev\" \\\n --include=\"bash,ca-certificates,git,netcat-traditional\" \\\n stable ./debian-minbase\n\nChange the last line to:\n stable ./debian-minbase https://deb.debian.org/debian/ \n\nThe script should now proceed without any errors. More info on debootstrap can be found here."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to use issues of Gitlab from terminal?\n\nI know you can use Github issues on the command line by installing ghi.\n\nghi\n\nHowever, is there any way to use similar tools for listing/adding/removing/editing issues of repositories on Gitlab ?"
},
{
"role": "assistant",
"content": "GLab seems to be a great option.\n\nGLab is an open source Gitlab Cli tool written in Go (golang) to help work seamlessly with Gitlab from the command line. Work with issues, merge requests, watch running pipelines directly from your CLI among other features.\n\nhttps://github.com/profclems/glab"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-am - Apply a series of patches from a mailbox -i --interactive"
},
{
"role": "assistant",
"content": "Run interactively."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git - the stupid content tracker git-rev-list"
},
{
"role": "assistant",
"content": "Lists commit objects in reverse chronological order"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-log - Show commit logs %><( <N> ) , %><|( <M> )"
},
{
"role": "assistant",
"content": "similar to %<( <N> ) , %<|( <M> ) respectively, but padding both sides\n(i.e. the text is centered)"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Push all local branches to origin in git [duplicate]\nThis question already has answers here:\n \n \n\n\n\n\nSet up git to pull and push all branches\n\n (14 answers)\n \n\nClosed 10 years ago.\n\n\n\nLet's say that I have A LOT of local branches in my git not pushed on the remote repository. \nHow can I push all of them to origin with a single command?"
},
{
"role": "assistant",
"content": "Have you tried \ngit push --all -u \n\nThe git man states \n\n--all \nInstead of naming each ref to push, specifies that all refs under refs/heads/ be pushed.\n-u, --set-upstream \nFor every branch that is up to date or successfully pushed, add upstream (tracking) reference,\n\nthe -u is useful if you intent to pull from these branches later"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Push from github to heroku without downloading repo\n\nI have a github repo that I want to push to a heroku node. A 3rd host will be co-ordinating this. As I'm going to be doing this on a large scale I want to avoid having to download the contents of the repo onto the 3rd host. How do I do it?"
},
{
"role": "assistant",
"content": "You can't push straight from Github to Heroku.\nYou're going to have to use the third host to coordinate the push. This could be fired from a Github post-receive hook.\nTo sync straight across use something like:\ngit remote add github [email protected]:user/repo.git\ngit remote add heroku [email protected]:app.git\n\ngit push heroku refs/remotes/github/master:refs/heads/master"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-show - Show various types of objects %ct"
},
{
"role": "assistant",
"content": "committer date, UNIX timestamp"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-branch - List, create, or delete branches -C"
},
{
"role": "assistant",
"content": "Shortcut for --copy --force ."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-show - Show various types of objects %cD"
},
{
"role": "assistant",
"content": "committer date, RFC2822 style"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to add line break to 'git commit -m' from the command line?\nI am using Git from the command line and am trying to add a line break to the commit message (using git commit -m \"\") without going into Vim.\nIs this possible?"
},
{
"role": "assistant",
"content": "Certainly, how it's done depends on your shell. In Bash, you can use single quotes around the message and can just leave the quote open, which will make Bash prompt for another line, until you close the quote. Like this:\ngit commit -m 'Message\n\ngoes\nhere'\n\nAlternatively, you can use a \"here document\" (also known as heredoc):\ngit commit -F- <<EOF\nMessage\n\ngoes\nhere\nEOF"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-config - Get and set repository or global options core.sshCommand"
},
{
"role": "assistant",
"content": "If this variable is set, git fetch and git push will\nuse the specified command instead of ssh when they need to\nconnect to a remote system. The command is in the same form as\nthe GIT_SSH_COMMAND environment variable and is overridden\nwhen the environment variable is set."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git - the stupid content tracker git-sparse-checkout"
},
{
"role": "assistant",
"content": "Reduce your working tree to a subset of tracked files"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-log - Show commit logs --full-index"
},
{
"role": "assistant",
"content": "Instead of the first handful of characters, show the full\npre- and post-image blob object names on the \"index\"\nline when generating patch format output."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to change GitHub repository in IDEA Intellij?\n\nI've lost access to my previous account on GitHub, so created new one and now, when I am trying to share my project ( which was shared on GitHub before), I get this message:\nCan't get repository info: {myRepositoryName}\n404: Not Found - Not Found\n\nHow to tell IDEA Intellij that I want to share project on different repository? thanks"
},
{
"role": "assistant",
"content": "Update or add Git repository URL in Intellij\nVCS - > Git - > Remotes\nPopup will open with all repository URLs configured, you can simply edit them or add new one."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-revert - Revert some existing commits --no-edit"
},
{
"role": "assistant",
"content": "With this option, git revert will not start the commit\nmessage editor."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Select Git branch for TeamCity Build\nI'm wondering how to select the branch to build against using Team City 8.1.\nMy VCS root (Git) is set to Default: \"master\" and Branch specifications are\n+:refs/heads/develop\n+:refs/heads/feature/*\n+:refs/heads/hotfix/*\n+:refs/heads/master\n+:refs/heads/release/*\n\nI have a CI build set up that automatically builds anything that is checked in, which is working exactly how I want.\nWhat I'd like to do is create a scheduled QA build/deployment against the \"develop\" branch. I see that if I click the ellipsis next to the run button, I can choose the branch on the \"Changes\" tab, but I'm unable to determine how to make this \"stick\". Is this possible, or am I going about this wrong?\nThanks,\nJoe"
},
{
"role": "assistant",
"content": "Based on @biswajit-86 's feedback and some other information I found while googling this, I was able to get this to work. Here's what I did (image-heavy, sorry). It's based on Team City 8.2 which seems to be set up a little differently than the examples I came across.\n1) Set up a VCS root. Key here is the %BranchName% parameter.\n\n2) Create a Build template and use the VCS root that was just created. I also added an MSBuild step as all of my builds need to run this.\n\n3) Create a new build, based on the template. As you can see here, the %BrachName% parameter that was created in step 1 is available.\n\n4) If you need to change this later, it's available here\n\nAnd that's pretty much it. For my CI build, I left the branch name empty so any branch that is checked in triggers the MSBuild step. For my QA build, I pass in \"develop\" as shown here and I have this set up on a daily schedule. I also have a \"release\" build set up, but based on our naming conventions it looks like I need to update the build to point to the specific branch per release."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Git error fatal: unable to stat '*': No such file or directory\n\nI ran into this error, and found very little documentation on how to fix it online. I got the error by trying to run the command git add ., and received this response:\nfatal: unable to stat 'myPathToAFile': No such file or directory"
},
{
"role": "assistant",
"content": "To solve the problem, I removed the file from git, then re-added it by doing the following:\ngit rm \"myPathToAFile\"\ngit add .\ngit commit -am 'my commit'\nHope this helps someone else!"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to re-merge a file in the git?\nI have 10 files which have conflicts when merging branches. I've resolved all conflicts of the 10 files(took long time). Unfortunately before the commit, I find out that one file has been merged wrong and need start again for this file. :(\nin the Git, How to mark the file which has been merged unmerged, in other word, how to re-merge that one file?"
},
{
"role": "assistant",
"content": "git checkout -m <filename>\n\nThis will remove it from the index, and revert back to a \"conflicted\" file that has all of the markers required to then do a merge.\nFrom the git help checkout man page:\n-m, --merge\n When switching branches, if you have local modifications to\n one or more files that are different between the current\n branch and the branch to which you are switching, the command\n refuses to switch branches in order to preserve your\n modifications in context. However, with this option, a\n three-way merge between the current branch, your working tree\n contents, and the new branch is done, and you will be on the\n new branch.\n\n When a merge conflict happens, the index entries for\n conflicting paths are left unmerged, and you need to resolve\n the conflicts and mark the resolved paths with git add (or git\n rm if the merge should result in deletion of the path).\n\n When checking out paths from the index, this option lets you\n recreate the conflicted merge in the specified paths.\n\n(The last sentence is the most important one).\nHere is a blog post that describes why it was added and how it is not possible with older versions of git: http://gitster.livejournal.com/43665.html"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "You have not concluded your merge (MERGE_HEAD exists)\nI made a branch called 'f' and did a checkout to master. When I tried the git pull command I got this message:\nYou have not concluded your merge (MERGE_HEAD exists).\nPlease, commit your changes before you can merge.\n\nWhen I try the git status, it gave me the following:\nOn branch master\n# Your branch and 'origin/master' have diverged,\n# and have 1 and 13 different commit(s) each, respectively.\n#\n# Changes to be committed:\n#\n# modified: app/assets/images/backward.png\n# modified: app/assets/images/forward.png\n# new file: app/assets/images/index_background.jpg\n# new file: app/assets/images/loading.gif\n# modified: app/assets/images/pause.png\n# modified: app/assets/images/play.png\n# new file: app/assets/javascripts/jquery-ui-bootstrap.js\n# new file: app/assets/stylesheets/jquery-ui-bootstrap.css\n# modified: app/controllers/friends_controller.rb\n# modified: app/controllers/plays_controller.rb\n# modified: app/mailers/invite_friends_mailer.rb\n# modified: app/mailers/send_plays_mailer.rb\n# modified: app/mailers/shot_chart_mailer.rb\n# modified: app/views/friends/show_plays.html.erb\n# modified: app/views/layouts/application.html.erb\n# modified: app/views/plays/_inbox_table.html.erb\n# modified: app/views/plays/show.html.erb\n# modified: app/views/welcome/contact_form.html.erb\n# modified: app/views/welcome/index.html.erb\n# modified: log/development.log\n# modified: log/restclient.log\n# new file: tmp/cache/assets/C1A/C00/sprockets%2Fb7901e0813446f810e560158a1a97066\n# modified: tmp/cache/assets/C64/930/sprockets%2F65aa1510292214f4fd1342280d521e4c\n# new file: tmp/cache/assets/C73/C40/sprockets%2F96912377b93498914dd04bc69fa98585\n# new file: tmp/cache/assets/CA9/090/sprockets%2Fa71992733a432421e67e03ff1bd441d8\n# new file: tmp/cache/assets/CCD/7E0/sprockets%2F47125c2ebd0e8b29b6511b7b961152a1\n# modified: tmp/cache/assets/CD5/DD0/sprockets%2F59d317902de6e0f68689899259caff26\n# modified: tmp/cache/assets/CE3/080/sprockets%2F5c3b516e854760f14eda2395c4ff2581\n# new file: tmp/cache/assets/CED/B20/sprockets%2F423772fde44ab6f6f861639ee71444c4\n# new file: tmp/cache/assets/D0C/E10/sprockets%2F8d1f4b30c6be13017565fe1b697156ce\n# new file: tmp/cache/assets/D12/290/sprockets%2F93ae21f3cdd5e24444ae4651913fd875\n# new file: tmp/cache/assets/D13/FC0/sprockets%2F57aad34b9d3c9e225205237dac9b1999\n# new file: tmp/cache/assets/D1D/DE0/sprockets%2F5840ff4283f6545f472be8e10ce67bb8\n# new file: tmp/cache/assets/D23/BD0/sprockets%2F439d5dedcc8c54560881edb9f0456819\n# new file: tmp/cache/assets/D24/570/sprockets%2Fb449db428fc674796e18b7a419924afe\n# new file: tmp/cache/assets/D28/480/sprockets%2F9aeec798a04544e478806ffe57e66a51\n# new file: tmp/cache/assets/D3A/ED0/sprockets%2Fcd959cbf710b366c145747eb3c062bb4\n# new file: tmp/cache/assets/D3C/060/sprockets%2F363ac7c9208d3bb5d7047f11c159d7ce\n# new file: tmp/cache/assets/D48/D00/sprockets%2Fe23c97b8996e7b5567a3080c285aaccb\n# new file: tmp/cache/assets/D6A/900/sprockets%2Fa5cece9476b21aa4d5f46911ca96c450\n# new file: tmp/cache/assets/D6C/510/sprockets%2Fb086a020de3c258cb1c67dfc9c67d546\n# new file: tmp/cache/assets/D70/F30/sprockets%2Facf9a6348722adf1ee7abbb695603078\n# new file: tmp/cache/assets/DA3/4A0/sprockets%2F69c26d0a9ca8ce383e20897cefe05aa4\n# new file: tmp/cache/assets/DA7/2F0/sprockets%2F61da396fb86c5ecd844a2d83ac759b4b\n# new file: tmp/cache/assets/DB9/C80/sprockets%2F876fbfb9685b2b8ea476fa3c67ae498b\n# new file: tmp/cache/assets/DBD/7A0/sprockets%2F3640ea84a1dfaf6f91a01d1d6fbe223d\n# new file: tmp/cache/assets/DC1/8D0/sprockets%2Fe5ee1f1cfba2144ec00b1dcd6773e691\n# new file: tmp/cache/assets/DCC/E60/sprockets%2Fd6a95f601456c93ff9a1bb70dea3dfc0\n# new file: tmp/cache/assets/DF1/130/sprockets%2Fcda4825bb42c91e2d1f1ea7b2b958bda\n# new file: tmp/cache/assets/E23/DE0/sprockets%2Fb1acc25c28cd1fabafbec99d169163d3\n# new file: tmp/cache/assets/E23/FD0/sprockets%2Fea3dbcd1f341008ef8be67b1ccc5a9c5\n# modified: tmp/cache/assets/E4E/AD0/sprockets%2Fb930f45cfe7c6a8d0efcada3013cc4bc\n# new file: tmp/cache/assets/E63/7D0/sprockets%2F77de495a665c3ebcb47befecd07baae6\n# modified: tmp/pids/server.pid\n#\n# Untracked files:\n# (use \"git add <file>...\" to include in what will be committed)\n#\n# Coachbase/\n# log/development.log.orig\n# log/restclient.log.orig\n\nWhat should I do?"
},
{
"role": "assistant",
"content": "The problem is your previous pull failed to merge automatically and went to conflict state. And the conflict wasn't resolved properly before the next pull.\n\nUndo the merge and pull again.\nTo undo a merge:\ngit merge --abort [Since git version 1.7.4]\ngit reset --merge [prior git versions]\n\nResolve the conflict.\n\nDon't forget to add and commit the merge.\n\ngit pull now should work fine."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git - the stupid content tracker git-pack-redundant"
},
{
"role": "assistant",
"content": "Find redundant pack files"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Delete file from Pull Request on GitHub\n\nI have make pull request on git (with \"xcodeproj/project.pbxproj\" file - my fault), so can I delete this file from created Pull Request? Thanks.."
},
{
"role": "assistant",
"content": "You probably will merge this pull request on master,\nso you can checkout just this specific file again, from master,\non your branch, just type:\ngit checkout master -- xcodeproj/project.pbxproj\ngit commit -m \"removing a file from PR\"\ngit push origin {YOUR BRANCH}"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to get certain commit from GitHub project\nI need to download the Facebook API from GitHub. Normally, I just click on the 'Downloads\" tab to download the latest source code. In this case, I need an older commit: 91f256424531030a454548693c3a6ca49ca3f35a, but I have no idea how to get the entire project from that commit...\nCan someone please tell me how to do this?\n(BTW, im on a mac. Don't know if that makes any difference)."
},
{
"role": "assistant",
"content": "First, clone the repository using git, e.g. with:\ngit clone git://github.com/facebook/facebook-ios-sdk.git\n\nThat downloads the complete history of the repository, so you can switch to any version. Next, change into the newly cloned repository:\ncd facebook-ios-sdk\n\n... and use git checkout <COMMIT> to change to the right commit:\ngit checkout 91f25642453\n\nThat will give you a warning, since you're no longer on a branch, and have switched directly to a particular version. (This is known as \"detached HEAD\" state.) Since it sounds as if you only want to use this SDK, rather than actively develop it, this isn't something you need to worry about, unless you're interested in finding out more about how git works."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Why does git keep telling me it's \"Auto packing the repository in background for optimum performance\"?\nNote: I don't think this is a duplicate of this question, which is talking about a non-background pack which hangs git with a subtly different error message.\n\nIn one of my git repositories, each time I invoke (for example) git fetch, git prints:\nAuto packing the repository in background for optimum performance.\nSee \"git help gc\" for manual housekeeping.\n\nIt appears to print this every time if I do a git fetch repeatedly, even when there are no changes and nothing for git fetch to do. This doesn't make a lot of sense to me. It also seems to happen with other network operations, such as git push and git pull.\nThe command returns back to the prompt instantly with no further output, and I cannot find any git process running on my machine. It seems to happen only with this repository, and only on this machine. git config -l | grep gc returns nothing.\nWhat can I do to diagnose or fix this problem?\n$ git --version \ngit version 2.0.1\n\nI am using OS X 10.9."
},
{
"role": "assistant",
"content": "I found the solution from the second comment you provided, Trengot, thanks. It turns out that I had some dangling blobs, which were in .git/objects/17 and hence triggering the packing:\n$ git fsck\ndangling blob d9ff0aeac4aa8b4e0907daed675ebf60278bc977\ndangling blob dbff2d073741f9775c815d4a3c623736af224dad\ndangling blob e1ffbab1c5b985cd1cd3bc0281075ea2ed80744a\ndangling blob fdff59878ccb3a75689f4acca615cfb635288774\n\nThis cleaned them up:\n$ git gc --prune=now\n\nBe aware, as per Henrik's comment below, this may be a little dangerous. Take care!"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-check-ignore - Debug gitignore / exclude files"
},
{
"role": "assistant",
"content": "OUTPUT By default, any of the given pathnames which match an ignore pattern\nwill be output, one per line. If no pattern matches a given path,\nnothing will be output for that path; this means that path will not be\nignored. If --verbose is specified, the output is a series of lines of the form: <source> <COLON> <linenum> <COLON> <pattern> <HT> <pathname> <pathname> is the path of a file being queried, <pattern> is the\nmatching pattern, <source> is the pattern’s source file, and <linenum>\nis the line number of the pattern within that source. If the pattern\ncontained a \" ! \" prefix or \" / \" suffix, it will be preserved in the\noutput. <source> will be an absolute path when referring to the file\nconfigured by core.excludesFile , or relative to the repository root\nwhen referring to .git/info/exclude or a per-directory exclude file. If -z is specified, the pathnames in the output are delimited by the\nnull character; if --verbose is also specified then null characters\nare also used instead of colons and hard tabs: <source> <NULL> <linenum> <NULL> <pattern> <NULL> <pathname> <NULL> If -n or --non-matching are specified, non-matching pathnames will\nalso be output, in which case all fields in each output record except\nfor <pathname> will be empty. This can be useful when running\nnon-interactively, so that files can be incrementally streamed to\nSTDIN of a long-running check-ignore process, and for each of these\nfiles, STDOUT will indicate whether that file matched a pattern or\nnot. (Without this option, it would be impossible to tell whether the\nabsence of output for a given file meant that it didn’t match any\npattern, or that the output hadn’t been generated yet.) Buffering happens as documented under the GIT_FLUSH option in git . The caller is responsible for avoiding deadlocks\ncaused by overfilling an input buffer or reading from an empty output\nbuffer."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-rev-list - Lists commit objects in reverse chronological order --alternate-refs"
},
{
"role": "assistant",
"content": "Pretend as if all objects mentioned as ref tips of alternate\nrepositories were listed on the command line. An alternate\nrepository is any repository whose object directory is specified\nin objects/info/alternates . The set of included objects may\nbe modified by core.alternateRefsCommand , etc. See git-config ."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-submodule - Initialize, update or inspect submodules -q --quiet"
},
{
"role": "assistant",
"content": "Only print error messages."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to get another branch instead of default branch with go get\n\nI have 2 repositories. Let say them repo_a and repo_b. I imported repo_a in repo_b\nWhen I ran go get, it will get repo_a master branch.\nIs there any way to get develop branch using go get or another command from repo_b?\nI do not want to git pull on each specific package (in this case repo_a)"
},
{
"role": "assistant",
"content": "Starting with Go 1.11, this is possible when using Go modules. When installing a dependency for a Go module, you can specify a module query which may contain a branch or tag name:\n$ go get <path-to-repo>@<branch>"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-config - Get and set repository or global options hasconfig:remote.*.url:"
},
{
"role": "assistant",
"content": "The data that follows this keyword is taken to\nbe a pattern with standard globbing wildcards and two\nadditional ones, **/ and /** , that can match multiple\ncomponents. The first time this keyword is seen, the rest of\nthe config files will be scanned for remote URLs (without\napplying any values). If there exists at least one remote URL\nthat matches this pattern, the include condition is met. Files included by this option (directly or indirectly) are not allowed\nto contain remote URLs. Note that unlike other includeIf conditions, resolving this condition\nrelies on information that is not yet known at the point of reading the\ncondition. A typical use case is this option being present as a\nsystem-level or global-level config, and the remote URL being in a\nlocal-level config; hence the need to scan ahead when resolving this\ncondition. In order to avoid the chicken-and-egg problem in which\npotentially-included files can affect whether such files are potentially\nincluded, Git breaks the cycle by prohibiting these files from affecting\nthe resolution of these conditions (thus, prohibiting them from\ndeclaring remote URLs). As for the naming of this keyword, it is for forwards compatibility with\na naming scheme that supports more variable-based include conditions,\nbut currently Git only supports the exact keyword described above."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to commit only modified (and not new or deleted) files?\ngit status shows a bunch of files which were modified and some which were deleted. I want to first commit the modified files and then the deleted ones. I don't see any option in git add that enables me to do this. How can I do it?\nEDIT: As pointed out, git add wouldn't have staged the deleted files anyway, so git add . would do. But it has the side-effect of including files which weren't tracked, which I would also like to avoid. I have changed the title of the question accordingly."
},
{
"role": "assistant",
"content": "The following command should do the trick:\ngit commit -a\n\nor\ngit commit -am \"commit message\"\n\nFrom the Pro Git book:\n\nProviding the -a option to the git commit command makes Git automatically stage every file that is already tracked before doing the commit"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-gc - Cleanup unnecessary files and optimize the local repository gc.repackFilter"
},
{
"role": "assistant",
"content": "When repacking, use the specified filter to move certain\nobjects into a separate packfile. See the --filter=<filter-spec> option of git-repack ."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Gitlab - Xcode Can't connect with remote repository\n\nI am having troubles when I connect with my repository through Xcode.\nI have a Gitlab version (full pre-)installed on TurnkeyLinux Virtual Appliance on a remote server. \nIn the Gitlab Web interface, I've created a new test user: \"testuser\" with a password \"password\" and a new project \"testproject\". This user was assigned to this project.\nThe git url project are:\nHTTP: http://example.com/testuser/testproject.git\nSSH: [email protected]:testuser/testproject.git\n\nI can see the repositories folder rightly created with a \"Terminal\" through SSH connection.\nNow, I want add this git repository to my Xcode repositories.\nSo, In\nXCode > Preferences > Account \n\nI'm trying add it, using both urls and my user credentials, but always receive the following message:\n\"Authentication failed because the name or password was incorrect.\"\n\nCould anyone help me?"
},
{
"role": "assistant",
"content": "The user/password would only be needed for an http url, not an ssh one.\nWhen using the http url to add a repo in your XCode Accounts, make sure there is no proxy which would prevent the resolution of the example.com server.\nIf it is still not working, then, as in \"Authentification issue when pushing Xcode project to GitHub\", try to use an url like: \nhttps://testuser:[email protected]/testuser/testproject.git"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-fsck - Verifies the connectivity and validity of the objects in the database badType"
},
{
"role": "assistant",
"content": "(ERROR) Found an invalid object type."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git - the stupid content tracker git-merge-one-file"
},
{
"role": "assistant",
"content": "The standard helper program to use with git-merge-index"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Deleting a badly named git branch\nI know this isn't strictly a programming question, but it is related to git. I accidentally have created a branch in git called --track (I got the order of options wrong when merging a remote branch)\nThe regular command doesn't work:\ngit branch -D \"--track\" \n\nI have tried to escape with quotes and backward slashes, however neither work.\nAny ideas?"
},
{
"role": "assistant",
"content": "Did you try\ngit branch -D -- --track\n\n? the \"--\" is usually the convention for \"what follows is not an option, whatever its name\"\n\nFrom \"The Art of Unix Programming\", section \"Command-Line Options\":\n\nIt is also conventional to recognize a double hyphen as a signal to stop option interpretation and treat all following arguments literally.\n\nYou will find that convention in other (not necessary Unix-related) CLI (Command Line Interface) like cleartool:\n\nIf a nonoption argument begins with a hyphen (–) character, you may need to precede it with a double-hyphen argument, to prevent it from being interpreted as an option:\n\ncleartool rmtype -lbtype -- -temporary_label- \n\nThe P18 (a fast and flexible file preprocessor with macro processing capabilities and special support for internationalization) mentions that also and gives a good description of the general idea behind that convention:\n\nAll option arguments passed to the commands start with a single hyphen.\n All option arguments (if any) must precede all non-option arguments.\n The end of the option arguments may be signaled using a double hyphen, this is useful if a non-option argument starts with a hyphen. Terminating the list of option arguments with a double hyphen works for all commands, even those that don't take any option arguments.\n\nThe OptionParser tool written in ruby also lays it out quite plainly:*\nOption Parsing Termination\n\nIt is convention that a double hyphen is a signal to stop option interpretation and to read the remaining statements on the command line literally. So, a command such as: \n\n app -- -x -y -z\n\n\nwill not ‘see’ the three mode-flags. Instead, they will be treated as arguments to the application: \n\n #args = [\"-x\", \"-y\", \"-z\"]\n\n\nNote: sometimes, it takes three dashes and not two, especially when the CLI follows strictly the Gnu options styles:\n\nThe Gnu style command line options provide support for option words (or keywords), yet still maintain compatibility with the Unix style options.\n The options in this style are sometimes referred to as long_options and the Unix style options as short_options.\n The compatibility is maintained by preceding the long_options with two dashes\nSimilar to the Unix style double-hyphen ’--’, the Gnu style has a triple-hyphen ’---’ to signal that option parsing be halted and to treat the remaining text as arguments (that is, read literally from the command line) \n\nSo... if ' -- ' is not enough (it should be with Git commands), try ' --- '"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-config - Get and set repository or global options blame.showRoot"
},
{
"role": "assistant",
"content": "Do not treat root commits as boundaries in git-blame .\nThis option defaults to false."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-daemon - A really simple server for Git repositories --export-all"
},
{
"role": "assistant",
"content": "Allow pulling from all directories that look like Git repositories\n(have the objects and refs subdirectories), even if they\ndo not have the git-daemon-export-ok file."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Is it possible to find out the users who have checked out my project on GitHub?\n\nI'm wondering if there is any way to know who has checked out my project hosted on GitHub? This would include people who have forked the project directly on GitHub, as well as people who may have cloned the repository using standard git clone commands."
},
{
"role": "assistant",
"content": "If by \"checked out\" you mean people who have cloned your project, then no it is not possible. You don't even need to be a GitHub user to clone a repository, so it would be infeasible to track this."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Git push error pre-receive hook declined\n\nI have run gitlabhq rails server on virtual machine, following 1-6 steps from this tutorial https://github.com/gitlabhq/gitlab-recipes/blob/master/install/centos/README.md and starts rails server executing command sudo -u git -H bundle exec rails s -e production. After that I created user, using admin tools and created new project under this user. Then I'm trying to push the existing project to this repo as always. But in the last step, git push origin master fails with the error \n\n[remote rejected] master -> master (pre-receive hook declined)\n\nAdditional info:\n1) I haven't activated user (project owner) via email activation link, because I haven't configured post service on server-side and I didn't find instructions how to do that in this manual.\n2) Gitlab server generates tips how to push project to repo and there is not repositories/ in path. I mean it generates git@mygitlabhost:user/repo.git instead of git@mygitlabhost:repositories/user/repo.git which is correct.\n3) When i tried to debug it, I opened pre-receive script inside repo on server and tried to output variables (there is 3 of them): refs = ARGF.read, key_id = ENV['GL_ID'] and repo_path = Dir.pwd and found, that key_id is always empty. Maybe the problem is here... If so, please give me suggestions on how to fix that. Thanks"
},
{
"role": "assistant",
"content": "GitLab by default marks master branch as protected (See part Protecting your code in https://about.gitlab.com/2014/11/26/keeping-your-code-protected/ why). If so in your case, then this can help:\n\nOpen your project > Settings > Repository and go to \"Protected branches\", find \"master\" branch into the list and click \"Unprotect\" and try again.\n\nvia https://gitlab.com/gitlab-com/support-forum/issues/40\nFor version 8.11 and above how-to here: https://docs.gitlab.com/ee/user/project/protected_branches.html#restricting-push-and-merge-access-to-certain-users"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "integrating Git Bash with Visual Studio\nI have a windows version of Git Bash, and I want to use it with my Visual Studio Projects. What I want is a way of tweaking some setting so that one click can get Bash opened with the directory on the current visual studio project.\nIt would be great if there's a way to set up short cut in Git Bash for directories, so that one command can get me to a preset directory."
},
{
"role": "assistant",
"content": "Launch Git Bash from Visual Studio\nIn Visual Studio Menu Bar:\nTools -> External Tools -> Add New\nConfiguration:\nName: Git Bash\nCommand: c:\\Program Files (x86)\\git\\bin\\sh.exe\nArgs: --login -i\nInitial Dir : $(SolutionDir)"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "HEAD and ORIG_HEAD in Git\nWhat do these symbols refer to and what do they mean? \n(I can't find any explanation in official documentation)"
},
{
"role": "assistant",
"content": "HEAD is (direct or indirect, i.e. symbolic) reference to the current commit. It is a commit that you have checked in the working directory (unless you made some changes, or equivalent), and it is a commit on top of which \"git commit\" would make a new one. Usually HEAD is symbolic reference to some other named branch; this branch is currently checked out branch, or current branch. HEAD can also point directly to a commit; this state is called \"detached HEAD\", and can be understood as being on unnamed, anonymous branch.\nAnd @ alone is a shortcut for HEAD, since Git 1.8.5\nORIG_HEAD is previous state of HEAD, set by commands that have possibly dangerous behavior, to be easy to revert them. It is less useful now that Git has reflog: HEAD@{1} is roughly equivalent to ORIG_HEAD (HEAD@{1} is always last value of HEAD, ORIG_HEAD is last value of HEAD before dangerous operation).\nFor more information read git(1) manpage / [gitrevisions(7) manpage][git-revisions], Git User's Manual, the Git Community Book and Git Glossary"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Overwrite single file in my current branch with the same file in the main branch?\nSay I have two branches - master and redesign. How would I go about overwriting the file default.aspx.cs in my redesign branch with the one from master?\nI found this question but it seems to go over how to revert a file back to it's previous version in the same branch. I also considered using a merge, but I don't want to merge, I want to overwrite. Suggestions?"
},
{
"role": "assistant",
"content": "git checkout master path/to/default.aspx.cs\nBefore doing this, you probably have to : git checkout redesign\nSo, just git checkout FROM_BRANCH_NAME path/to/file"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Push to GitHub without a password using ssh-key\n\nI generated an SSH key pair without a password and added the public key to GitHub.\nConnection with\nuser@dev:/var/www/project# ssh -T [email protected]\nHi User! You've successfully authenticated, but GitHub does not provide shell access.\n\nwas successful and when I rename the key, it fails.\nBut when I want to push my changes, it stills ask me for my username and password combination.\nIs there a way to push without a password?"
},
{
"role": "assistant",
"content": "If it is asking you for a username and password, your origin remote is pointing at the HTTPS URL rather than the SSH URL.\nChange it to ssh.\nFor example, a GitHub project like Git will have an HTTPS URL:\nhttps://github.com/<Username>/<Project>.git\n\nAnd the SSH one:\n[email protected]:<Username>/<Project>.git\n\nYou can do:\ngit remote set-url origin [email protected]:<Username>/<Project>.git\n\nto change the URL."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How do I get git to default to ssh and not https for new repositories\n\nThese days when I create a new repository on GitHub on the setup page I get:\ngit remote add origin https://github.com/nikhilbhardwaj/abc.git\ngit push -u origin master\n\nAnd whenever I have to push a commit I need to enter my GitHub username and password.\nI can manually change that to \n[email protected]:nikhilbhardwaj/abc.git\n\nin the .git/config. I find this quite irritating - is there some way I can configure git to use SSH by default?"
},
{
"role": "assistant",
"content": "Set up a repository's origin branch to be SSH\nThe GitHub repository setup page is just a suggested list of commands (and GitHub now suggests using the HTTPS protocol). Unless you have administrative access to GitHub's site, I don't know of any way to change their suggested commands.\nIf you'd rather use the SSH protocol, simply add a remote branch like so (i.e. use this command in place of GitHub's suggested command). To modify an existing branch, see the next section.\n$ git remote add origin [email protected]:nikhilbhardwaj/abc.git\n\n\nModify a pre-existing repository\nAs you already know, to switch a pre-existing repository to use SSH instead of HTTPS, you can change the remote url within your .git/config file.\n[remote \"origin\"]\n fetch = +refs/heads/*:refs/remotes/origin/*\n -url = https://github.com/nikhilbhardwaj/abc.git\n +url = [email protected]:nikhilbhardwaj/abc.git\n\nA shortcut is to use the set-url command:\n$ git remote set-url origin [email protected]:nikhilbhardwaj/abc.git\n\n\nMore information about the SSH-HTTPS switch\n\n\"Why is Git always asking for my password?\" - GitHub help page.\nGitHub's switch to Smart HTTP - relevant StackOverflow question\nCredential Caching for Wrist-Friendly Git Usage - GitHub blog post about HTTPS, and how to avoid re-entering your password"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Git-Repo searching for String in all committed files (unknown branch and commit)\nI have a piece of code in another than my current branch in my git repo, and I am not sure which commit and which branch. How can I search in all files that I committed until now for a specific string (and afterwards show the surrounding of that line of code)?"
},
{
"role": "assistant",
"content": "Use git grep to locate the commit:\ngit grep \"string\" $(git rev-list --all)\n\nThe git rev-list --all makes it search the entire history of the project.\nThat will give an output like this:\n<commit>:<path>:<matched line>\n\nThen you can use git branch --contains to find out which branch the commit is on:\ngit branch --contains <commit>"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to reattach a detached HEAD in GIT\n\n(I can see there are many questions about this but I haven't found one that solves my exact problem).\nI'm running gitlab-ci and when the runner checks out my code it does so as a detached head. Here is what I get when running a git status command in the runners directory.\ngit status\n# HEAD detached at 847fe59\nnothing to commit, working directory clean\n\nWhat I need to do for what I am working on is to re-attach this head back to my develop branch and then git pull in the full repo for use in a docker container. I guess gitlab ci only checks out the last commit to save cloning down the full repo which is understandable.\nIn my .gitlab-ci.yml file I've tried the following...\n- git checkout origin/$CI_BUILD_REF_NAME\n- git pull\n\nWhich gives the following output in the console...\n $ git checkout $CI_BUILD_REF_NAME\n Switched to a new branch 'develop'\n Branch develop set up to track remote branch develop from origin.\n$ git pull\nYou are not currently on a branch. Please specify which\nbranch you want to merge with. See git-pull(1) for details.\n\nIs there an easy way to reattach the head? Most of the solutions I've seen deal with the fact a change has been committed onto the detached head however this isn't the case for me. I just want to get my full develop branch in my docker container with all of my git history.\nOr if there is a way to stop gitlab ci from checking out the detached head that would also be great."
},
{
"role": "assistant",
"content": "A detached HEAD is simply a HEAD containing the raw hash ID of a commit. As noted in the comments, it's generally pretty reasonable to use this for a build system, whether that's some sort of continuous integration or not: you might check out a specific commit by hash ID, or check out a tag name, but either way HEAD winds up containing the commit hash ID and is now guaranteed to be steady.\nIf you do want to have an \"attached\" (not-detached) HEAD, though, all you have to do in Git terms is to run git checkout <branch-name>. This writes the name of the branch into HEAD, and now HEAD is attached to that branch. This means that it's not HEAD at all, but rather the branch name, that determines which commit is current. Anything that updates the branch name, changes the current commit.\nNote that this property only applies to branch names, i.e., with names that live in the refs/heads/ name-space. The name origin/branch is typically shorthand for refs/remotes/origin/branch, which is not a branch name; it's a remote-tracking name (sometimes called a remote-tracking branch, which is a poor set of words because that sure sounds like \"branch\", doesn't it?). Supplying any name to git checkout that can be resolved to a commit, but is not a branch name, results in a detached HEAD (if the checkout works at all, anyway).\nIf you want to have an attached HEAD, it must be attached to a branch name, i.e., a reference whose name starts with refs/heads/."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "What is \"origin\" in Git?\nWhen I run:\ngit push origin branchname\n\nWhat exactly is origin and why do I have to type it before the branch name?"
},
{
"role": "assistant",
"content": "origin is an alias on your system for a particular remote repository. It's not actually a property of that repository.\nBy doing\ngit push origin branchname\n\nyou're saying to push to the origin repository. There's no requirement to name the remote repository origin: in fact the same repository could have a different alias for another developer.\nRemotes are simply an alias that store the URL of repositories. You can see what URL belongs to each remote by using\ngit remote -v\n\nIn the push command, you can use remotes or you can simply use a URL directly. An example that uses the URL:\ngit push [email protected]:git/git.git master"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-revert - Revert some existing commits -s --signoff"
},
{
"role": "assistant",
"content": "Add a Signed-off-by trailer at the end of the commit message.\nSee the signoff option in git-commit for more information."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to stash changes in current folder?\nI would like to stash only the changes in the current folder and its subfolders.\nHow can I achieve that?\nI have tried the obvious approach - git stash . but it doesn't seem to work.\nI know I can create temporary commits and delete them afterward, but I want to know if git stash supports stashing specific folders."
},
{
"role": "assistant",
"content": "git stash push -- path/to/folder\n\nDoes the trick for me."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-config - Get and set repository or global options gitdir/i"
},
{
"role": "assistant",
"content": "This is the same as gitdir except that matching is done\ncase-insensitively (e.g. on case-insensitive file systems)"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-format-patch - Prepare patches for e-mail submission files"
},
{
"role": "assistant",
"content": "Compute the dirstat numbers by counting the number of files changed.\nEach changed file counts equally in the dirstat analysis. This is\nthe computationally cheapest --dirstat behavior, since it does\nnot have to look at the file contents at all."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-config - Get and set repository or global options receive.fsck.<msg-id>"
},
{
"role": "assistant",
"content": "Acts like fsck.<msg-id> , but is used by git-receive-pack instead of git-fsck . See the fsck.<msg-id> documentation for\ndetails."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How do I get the hash for the current commit in Git?\nHow do I get the hash of the current commit in Git?"
},
{
"role": "assistant",
"content": "To turn any extended object reference into a hash, use git-rev-parse:\ngit rev-parse HEAD\n\nor\ngit rev-parse --verify HEAD\n\nTo retrieve the short hash:\ngit rev-parse --short HEAD\n\nTo turn references (e.g. branches and tags) into hashes, use git show-ref and git for-each-ref."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Search code inside a Github project\nIs there a way to grep for something inside a Github project's code?\nI could pull the source and grep it locally, but I was wondering if it's possible through the web interface or a 3rd-party alternative.\nIdeas?"
},
{
"role": "assistant",
"content": "Update May 2023:\n\nThe new code search and code view is now generally available (May. 2023)\n\n(As noted by holydragon in the comments, that does require to sign in to GitHub first)\n\nAt GitHub Universe last year, we announced a total redesign of GitHub's code search and navigation experience, powered by our all-new code search engine that we built from scratch.\nAnd in February, we announced our public beta.\nToday, we are rolling out this feature to all GitHub users.\n\nCheck out our blog post to learn more about how GitHub's new code search and code view can help you search, navigate, and understand your code.\nAnd if you have feedback, please share it with us in our feedback discussion.\n\n\nUpdate Dec. 2021: search has been improved again, with Search for an exact string, with support for substring matches and special characters, or regexps.\n\nBut only on cs.github.com, and still in beta (waitlist applies)\n\nUpdate January 2013: a brand new search has arrived!, based on elasticsearch.org:\nA search for stat within the ruby repo will be expressed as stat repo:ruby/ruby, and will now just workTM.\n(the repo name is not case sensitive: test repo:wordpress/wordpress returns the same as test repo:Wordpress/Wordpress)\n\nWill give:\n\nAnd you have many other examples of search, based on followers, or on forks, or...\n\nUpdate July 2012 (old days of Lucene search and poor code indexing, combined with broken GUI, kept here for archive):\nThe search (based on SolrQuerySyntax) is now more permissive and the dreaded \"Invalid search query. Try quoting it.\" is gone when using the default search selector \"Everything\":)\n(I suppose we can all than Tim Pease, which had in one of his objectives \"hacking on improved search experiences for all GitHub properties\", and I did mention this Stack Overflow question at the time ;) )\nHere is an illustration of a grep within the ruby code: it will looks for repos and users, but also for what I wanted to search in the first place: the code!\n\n\nInitial answer and illustration of the former issue (Sept. 2012 => March 2012)\nYou can use the advanced search GitHub form:\n\nChoose Code, Repositories or Users from the drop-down and\nuse the corresponding prefixes listed for that search type.\n\nFor instance, Use the repo:username/repo-name directive to limit the search to a code repository.\nThe initial \"Advanced Search\" page includes the section:\n\nCode Search:\nThe Code search will look through all of the code publicly hosted on GitHub. You can also filter by :\n\nthe language language:\nthe repository name (including the username) repo:\nthe file path path:\n\n\nSo if you select the \"Code\" search selector, then your query grepping for a text within a repo will work:\n\n\nWhat is incredibly unhelpful from GitHub is that:\n\nif you forget to put the right search selector (here \"Code\"), you will get an error message:\n\"Invalid search query. Try quoting it.\"\n\n\n\nthe error message doesn't help you at all.\nNo amount of \"quoting it\" will get you out of this error.\n\nonce you get that error message, you don't get the sections reminding you of the right association between the search selectors (\"Repositories\", \"Users\" or \"Language\") and the (right) search filters (here \"repo:\").\nAny further attempt you do won't display those associations (selectors-filters) back. Only the error message you see above...\nThe only way to get back those arrays is by clicking the \"Advance Search\" icon:\n\n\n\n\nthe \"Everything\" search selector, which is the default, is actually the wrong one for all of the search filters! Except \"language:\"...\n(You could imagine/assume that \"Everything\" would help you to pick whatever search selector actually works with the search filter \"repo:\", but nope. That would be too easy)\n\nyou cannot specify the search selector you want through the \"Advance Search\" field alone!\n(but you can for \"language:\", even though \"Search Language\" is another combo box just below the \"Search for\" 'type' one...)\n\n\n\n\nSo, the user's experience usually is as follows:\n\nyou click \"Advanced Search\", glance over those sections of filters, and notice one you want to use: \"repo:\"\nyou make a first advanced search \"repo:jruby/jruby stat\", but with the default Search selector \"Everything\"\n=> FAIL! (and the arrays displaying the association \"Selectors-Filters\" is gone)\nyou notice that \"Search for\" selector thingy, select the first choice \"Repositories\" (\"Dah! I want to search within repositories...\")\n=> FAIL!\ndejected, you select the next choice of selectors (here, \"Users\"), without even looking at said selector, just to give it one more try...\n=> FAIL!\n\"Screw this, GitHub search is broken! I'm outta here!\"\n...\n(GitHub advanced search is actually not broken. Only their GUI is...)\n\n\nSo, to recap, if you want to \"grep for something inside a Github project's code\", as the OP Ben Humphreys, don't forget to select the \"Code\" search selector..."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Rename master branch for both local and remote Git repositories\nI have the branch master which tracks the remote branch origin/master.\nI want to rename them to master-old both locally and on the remote. Is this possible? \nFor other users who tracked origin/master (and who always updated their local master branch via git pull), what would happen after I renamed the remote branch?\nWould their git pull still work or would it throw an error that it couldn't find origin/master anymore?\nThen, further on, I want to create a new master branch (both locally and remote). Again, after I did this, what would happen now if the other users do git pull?\nI guess all this would result in a lot of trouble. Is there a clean way to get what I want? Or should I just leave master as it is and create a new branch master-new and just work there further on?"
},
{
"role": "assistant",
"content": "The closest thing to renaming is deleting and then recreating on the remote. For example:\ngit branch -m master master-old\ngit push remote :master # Delete master\ngit push remote master-old # Create master-old on remote\n\ngit checkout -b master some-ref # Create a new local master\ngit push remote master # Create master on remote\n\nHowever, this has a lot of caveats. First, no existing checkouts will know about the rename - Git does not attempt to track branch renames. If the new master doesn't exist yet, git pull will error out. If the new master has been created. the pull will attempt to merge master and master-old. So it's generally a bad idea unless you have the cooperation of everyone who has checked out the repository previously.\nNote: Newer versions of Git will not allow you to delete the master branch remotely by default. You can override this by setting the receive.denyDeleteCurrent configuration value to warn or ignore on the remote repository. Otherwise, if you're ready to create a new master right away, skip the git push remote :master step, and pass --force to the git push remote master step. Note that if you're not able to change the remote's configuration, you won't be able to completely delete the master branch!\nThis caveat only applies to the current branch (usually the master branch); any other branch can be deleted and recreated as above."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-diff - Show changes between commits, commit and working tree, etc Limiting the diff output"
},
{
"role": "assistant",
"content": "$ git diff --diff-filter=MRC (1) $ git diff --name-status (2) $ git diff arch/i386 include/asm-i386 (3) Show only modification, rename, and copy, but not addition\nor deletion. Show only names and the nature of change, but not actual\ndiff output. Limit diff output to named subtrees."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Why does GitHub call foreign submissions, a \"Pull Request\"?\n\nI'm curious why GitHub calls submissions to merge, \"Pull requests.\"\nFrom my understanding, git pull will pull all changes, from a remote repository, into a current working branch. Then merge those changes with FETCH_HEAD. (Git Pull)\nSo taking a look at git push... a push would actually push committed changes to a repository. And isn't that what you are doing with a Git repo? Submitting a \"request\" to merge your code? So why isn't it called a \"Push request\"?"
},
{
"role": "assistant",
"content": "The term “pull requests” comes from the distributed nature of how many open source projects organize themselves. Instead of just pushing your changes into the repository (like you would do with a centralized repository, e.g. with Subversion), you are publishing your changes separately and ask the maintainer to pull in your changes. The maintainer then can look over the changes and do said pull."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Should \"node_modules\" folder be included in the git repository\nI'm wondering if we should be tracking node_modules in our repo or doing an npm install when checking out the code?"
},
{
"role": "assistant",
"content": "The answer is not as easy as Alberto Zaccagni suggests. If you develop applications (especially enterprise applications), including node_modules in your git repo is a viable choice and which alternative you choose depends on your project.\nBecause he argued very well against node_modules I will concentrate on arguments for them.\nImagine that you have just finished enterprise app and you will have to support it for 3-5 years. You definitely don't want to depend on someone's npm module which can tomorrow disappear and you can't update your app anymore.\nOr you have your private modules which are not accessible from the internet and you can't build your app on the internet. Or maybe you don't want to depend on your final build on npm service for some reason.\nYou can find pros and cons in this Addy Osmani article (although it is about Bower, it is almost the same situation). And I will end with a quote from Bower homepage and Addy's article:\n\n“If you aren’t authoring a package that is intended to be consumed by others (e.g., you’re building a web app), you should always check installed packages into source control.”"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-remote - Manage set of tracked repositories"
},
{
"role": "assistant",
"content": "EXAMPLES Add a new remote, fetch, and check out a branch from it $ git remote\norigin\n$ git branch -r\n origin/HEAD -> origin/master\n origin/master\n$ git remote add staging git://git.kernel.org/.../gregkh/staging.git\n$ git remote\norigin\nstaging\n$ git fetch staging\n...\nFrom git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging\n * [new branch] master -> staging/master\n * [new branch] staging-linus -> staging/staging-linus\n * [new branch] staging-next -> staging/staging-next\n$ git branch -r\n origin/HEAD -> origin/master\n origin/master\n staging/master\n staging/staging-linus\n staging/staging-next\n$ git switch -c staging staging/master\n... Imitate git clone but track only selected branches $ mkdir project.git\n$ cd project.git\n$ git init\n$ git remote add -f -t master -m master origin git://example.com/git.git/\n$ git merge origin"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to merge branch to master?\nI do have a local branch with some changes, and I want to merge it to remote master. When I run: git merge master I get: \n\nAlready up-to-date\n\nbut I still can see that the master doesn't contain the new changes. \nI checked the following issue Git merge reports “Already up-to-date” though there is a difference Ask, but it seems in one hand to be outdated, and on the other hand, none of the hints there were helpful.\nAny idea or hint?"
},
{
"role": "assistant",
"content": "If you want to merge your branch to master on remote, follow the below steps:\n\npush your branch say 'br-1' to remote using git push origin br-1.\nswitch to master branch on your local repository using git checkout master.\nupdate local master with remote master using git pull origin master.\nmerge br-1 into local master using git merge br-1. This may give you conflicts which need to be resolved and changes committed before moving further.\nOnce merge of br-1 to master on local is committed, push local master to remote master using git push origin master."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git push not send changes to remote git repository\nI am making changes to some file in my local git repository and then want to send the changes to the remote git repository from which the local was cloned via ssh. \nAfter run \"git commit -a\" on my local side, to send the changes to the remote, I run\n$ git push\nEverything up-to-date\n\nHowever I checked the remote files and they are not changed!\nAny idea?\nThanks and regards!"
},
{
"role": "assistant",
"content": "I found that the issue was that I had not added the files to the update as well as a message. I fixed this by using the following commands:\ngit add .\n\nand then \ngit commit -m \"updates done by...\"\n\nand then\ngit push origin <repo_name>\n\nHope this helps someone ;)"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "What's the difference \"origin master\" vs \"origin/master\"\nWhat is the difference between a space and a slash when running git commands?\nI sometimes see\ngit push origin master (which is a space)\nand other times I see\ngit rebase origin/master (which uses a slash)\nWhat is the difference in this convention? Is it that the slash notation accesses a local cached copy whereas the space version actually reaches out to the remote repo (github) ?"
},
{
"role": "assistant",
"content": "This is not a \"convention\". The former is two separate arguments in different positions with different meanings to git push, and the latter is a single argument which identifies the remote-tracking branch origin/master."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git - fatal: Unknown index entry format\nWhen I'm trying use git status or git checkout master or git pull, \nI'm getting an error :- \n\n\"fatal: Unknown index entry format 61740000\".\n\nI've tried to Reinitialize existing Git repository. But it did not fix the problem.\nI'm new to git, and I have just made a first branch and make some changes and trying to commit the changes.\nTried searching on Google but can't find the right solution for the code 61740000.\nEdit: Deleted the whole local repository and then again cloned from remote repository (git status worked), created a branch (git status worked) and made changes to files (git status error).\nPlease help."
},
{
"role": "assistant",
"content": "When your index is broken you can normally delete the index file and reset it.\nrm -f .git/index\ngit reset\n\nor you clone the repo again."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-send-email - Send a collection of patches as emails --smtp-user=<user>"
},
{
"role": "assistant",
"content": "Username for SMTP-AUTH. Default is the value of sendemail.smtpUser ;\nif a username is not specified (with --smtp-user or sendemail.smtpUser ),\nthen authentication is not attempted."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to push changes to branch?\n\nCan you explain me how to use git in case, when I have access to repository:\n\nHow to download repository\nHow to push changes in selected branch\nHow to select branch to push\n\nI tried these steps\ngit init\ngit clone git.repository\ngit pull develop (where develop is branch)\ngit add .\ngit commit -m \"m\"\ngit push origin develop\n\nResult is:\n* branch develop -> FETCH_HEAD\nfatal: refusing to merge unrelated histories\n\nWhat I do wrong?"
},
{
"role": "assistant",
"content": "3 Steps to Commit your changes\nSuppose you have created a new branch on GitHub with the name feature-branch.\n\nFETCH\n git pull --all Pull all remote branches\n git branch -a List all branches now\n\nCheckout and switch to the feature-branch directory. You can simply copy the branch name from the output of branch -a command above\n\ngit checkout -b feature-branch\n\nVALIDATE\nNext use the git branch command to see the current branch. It will show feature-branch with * In front of it\ngit branch check current branch\ngit status check the state of your codebase \n\nCOMMIT\ngit add . add all untracked files\ngit commit -m \"Rafactore code or use your message\"\n\nTake update and the push changes on the origin server \n git pull origin feature-branch\n git push origin feature-branch\n\nOR you can rebase with the master before commit\ngit fetch\ngit rebase origin/master\ngit push origin feature-branch"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-show - Show various types of objects histogram"
},
{
"role": "assistant",
"content": "This algorithm extends the patience algorithm to \"support\nlow-occurrence common elements\"."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-show - Show various types of objects -w --ignore-all-space"
},
{
"role": "assistant",
"content": "Ignore whitespace when comparing lines. This ignores\ndifferences even if one line has whitespace where the other\nline has none."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "What is the difference between Forking and Cloning on GitHub?\n\nI'd like to know the differences between doing a Fork of a project and doing a clone of it.\nCan I only send pull requests via GitHub if I've forked a project?"
},
{
"role": "assistant",
"content": "When you say you are Forking a repository you are basically creating a copy of the repository under your GitHub ID. The main point to note here is that any changes made to the original repository will be reflected back to your forked repositories(you need to fetch and rebase). However, if you make any changes to your forked repository you will have to explicitly create a pull request to the original repository. If your pull request is approved by the administrator of the original repository, then your changes will be committed/merged with the existing original code-base. Until then, your changes will be reflected only in the copy you forked. \nIn short:\nThe Fork & Pull Model lets anyone fork an existing repository and push changes to their personal fork without requiring access be granted to the source repository. The changes must then be pulled into the source repository by the project maintainer. \nNote that after forking you can clone your repository (the one under your name) locally on your machine. Make changes in it and push it to your forked repository. However, to reflect your changes in the original repository your pull request must be approved.\nCouple of other interesting dicussions - \nAre git forks actually git clones?\nHow do I update a GitHub forked repository?"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-bundle - Move objects and refs by archive create [options] <file> <git-rev-list-args>"
},
{
"role": "assistant",
"content": "Used to create a bundle named file . This requires the <git-rev-list-args> arguments to define the bundle contents. options contains the options specific to the git bundle create subcommand. If file is - , the bundle is written to stdout."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-show - Show various types of objects zebra"
},
{
"role": "assistant",
"content": "Blocks of moved text are detected as in blocks mode. The blocks\nare painted using either the color.diff.{old,new}Moved color or color.diff.{old,new}MovedAlternative . The change between\nthe two colors indicates that a new block was detected."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Error installing charlock_holmes : Error installing GITLAB\n\nI am trying to install GITLAB. I get this error executing \"sudo gem install charlock_holmes --version '0.6.9'\" (section Install Gems) \nGEOGIT:/geogit/Administrative_Tools # sudo gem install charlock_holmes --version '0.6.9'\nBuilding native extensions. This could take a while...\nERROR: Error installing charlock_holmes:\n ERROR: Failed to build gem native extension.\n\n /usr/bin/ruby1.9 extconf.rb\nchecking for main() in -licui18n... no\nwhich: no brew in (/usr/sbin:/bin:/usr/bin:/sbin)\nchecking for main() in -licui18n... no\n\n***************************************************************************************\n*********** icu required (brew install icu4c or apt-get install libicu-dev) ***********\n***************************************************************************************\n*** extconf.rb failed ***\nCould not create Makefile due to some reason, probably lack of\nnecessary libraries and/or headers. Check the mkmf.log file for more\ndetails. You may need configuration options.\n\nProvided configuration options:\n --with-opt-dir\n --without-opt-dir\n --with-opt-include\n --without-opt-include=${opt-dir}/include\n --with-opt-lib\n --without-opt-lib=${opt-dir}/\n --with-make-prog\n --without-make-prog\n --srcdir=.\n --curdir\n --ruby=/usr/bin/ruby1.9\n --with-icu-dir\n --without-icu-dir\n --with-icu-include\n --without-icu-include=${icu-dir}/include\n --with-icu-lib\n --without-icu-lib=${icu-dir}/\n --with-icui18nlib\n --without-icui18nlib\n --with-icui18nlib\n --without-icui18nlib\n\nGem files will remain installed in /usr/lib64/ruby/gems/1.9.1/gems/charlock_holmes-0.6.9 for inspection.\nResults logged to /usr/lib64/ruby/gems/1.9.1/gems/charlock_holmes-0.6.9/ext/charlock_holmes/gem_make.out\n\nSomeone, can help me debug those logs and error?"
},
{
"role": "assistant",
"content": "This looks like issue 1952\n\nIt was actually weirdness with the way my ubuntu VPS is commissioned. Mine did not come with a C compiler or libdev obviously.\nThe problem fix I found was to install libdev first, then the GCC\nThen apt-get install libicu-dev.\n\nUpdate 2015: additional comments include:\n\nyum install libicu-devel worked for me\nYou just need to make sure \"patch\" is installed (yum install patch) then it should work"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Gitlab CI SAST access to gl-sast-report.json artifact in subsequent stage\n\nI am wanting to use the gl-sast-report.json file created during the SAST process in a subsequent stage of my CI but it is not found.\nci.yml\ninclude:\n - template: Security/SAST.gitlab-ci.yml\n\nstages:\n - test\n - .post\nsast:\n rules:\n - if: $CI_COMMIT_TAG\n\nsend-reports:\n stage: .post\n dependencies: \n - sast\n script: \n - ls\n - echo \"in post stage\"\n - cat gl-sast-report.json\n\noutput:\nRunning with gitlab-runner 13.2.1 (efa30e33)\non blah blah blah\nPreparing the \"docker\" executor\n00:01\n.\n.\n.\n\nPreparing environment\n00:01\nRunning on runner-zqk9bcef-project-4296-concurrent-0 via ff93ba7b6ee2...\nGetting source from Git repository\n00:01\nFetching changes with git depth set to 50...\nReinitialized existing Git repository in blah blah\nChecking out 9c2edf67 as 39-test-dso...\nRemoving gl-sast-report.json\nSkipping Git submodules setup\nExecuting \"step_script\" stage of the job script\n00:03\n$ ls\n<stuff in the repo>\n$ echo \"in .post stage\"\nin post stage\n$ cat gl-sast-report.json\ncat: can't open 'gl-sast-report.json': No such file or directory\nERROR: Job failed: exit code 1\n\nYou can see the line Removing gl-sast-report.json which I assume is the issue.\nI don't see that anywhere in the SAST.gitlab-ci.yml at https://gitlab.com/gitlab-org/gitlab/-/blob/v11.11.0-rc2-ee/lib/gitlab/ci/templates/Security/SAST.gitlab-ci.yml#L33-45\nAny ideas on how to use this artifact in the next stage of my CI pipeline?\nUPDATE:\nSo I tried out k33g_org's suggestion below but to no avail. Seems that this is due to limitations in the sast template specifically. Did the following test.\ninclude:\n - template: Security/SAST.gitlab-ci.yml\n\nstages:\n - test\n - upload\n\nsomething:\n stage: test\n script:\n - echo \"in something\"\n - echo \"this is something\" > something.txt\n artifacts:\n paths: [something.txt]\n\nsast:\n before_script:\n - echo \"hello from before sast\"\n - echo \"this is in the file\" > test.txt\n artifacts:\n reports:\n sast: gl-sast-report.json\n paths: [gl-sast-report.json, test.txt]\n\nsend-reports:\n stage: upload\n dependencies:\n - sast\n - something\n before_script:\n - echo \"This is the send-reports before_script\"\n script:\n - echo \"in send-reports job\"\n - ls\n artifacts:\n reports:\n sast: gl-sast-report.json\n\nThree changes:\n\nUpdated code with k33g_org's suggestion\nCreated another artifact in the sast job (to see if it would pass through to send-reports job)\nCreated a new job (something) where I created a new something.txt artifact (to see if it would pass through to send-reports job)\n\nOutput:\nPreparing environment\n00:01\nRunning on runner-zqx7qoq-project-4296-concurrent-0 via e3fe672984b4...\nGetting source from Git repository\nFetching changes with git depth set to 50...\nReinitialized existing Git repository in /<repo>\nChecking out 26501c44 as <branch_name>...\nRemoving something.txt\nSkipping Git submodules setup\nDownloading artifacts\n00:00\nDownloading artifacts for something (64950)...\nDownloading artifacts from coordinator... ok id=64950 \nresponseStatus=200 OK token=zoJwysdq\nExecuting \"step_script\" stage of the job script\n00:01\n$ echo \"This is the send-reports before_script\"\nThis is the send-reports before_script\n$ echo \"in send-reports job\"\nin send-reports job\n$ ls\n...<other stuff in repo>\nsomething.txt\nUploading artifacts for successful job\n00:01\nUploading artifacts...\nWARNING: gl-sast-report.json: no matching files \nERROR: No files to upload \nCleaning up file based variables\n00:01\nJob succeeded\n\nNotes:\n\nsomething.txt made it to this job\nall artifacts from the sast job to not make it to subsequent jobs\n\nI can only conclude that there is something internal to the sast template that is not allowing artifacts to propagate to subsequent jobs."
},
{
"role": "assistant",
"content": "I spent a full day banging my head against this, trying to access the gl-sast-report.json file generated by the built-in IaC scanner. Here's what ultimately worked for me:\nFirst and foremost, DO NOT use this code suggested by GitLab's documentation:\ninclude:\n - template: Security/SAST-IaC.latest.gitlab-ci.yml\n\nThe above code works fine if all you want to do is scan for IaC vulnerabilities and download the report from the GitLab UI later. But who wants to do that?! I want to access the report in my next job and fail the pipeline if there are medium+ vulnerabilities in the report!\nIf that's what you want to do, you'll need to add all of the code from the official GitLab IaC scanner template to your pipeline, and then make some modifications. You can find the latest template code here, or use my example below.\nModified template:\n# Read more about this feature here: https://docs.gitlab.com/ee/user/application_security/iac_scanning/\n#\n# Configure SAST with CI/CD variables (https://docs.gitlab.com/ee/ci/variables/index.html).\n# List of available variables: https://docs.gitlab.com/ee/user/application_security/iac_scanning/index.html\n\nvariables:\n # Setting this variable will affect all Security templates\n # (SAST, Dependency Scanning, ...)\n TEMPLATE_REGISTRY_HOST: 'registry.gitlab.com'\n SECURE_ANALYZERS_PREFIX: \"$TEMPLATE_REGISTRY_HOST/security-products\"\n SAST_IMAGE_SUFFIX: \"\"\n\n SAST_EXCLUDED_PATHS: \"spec, test, tests, tmp\"\n\niac-sast:\n stage: test\n artifacts:\n name: sast\n paths:\n - gl-sast-report.json\n #reports:\n # sast: gl-sast-report.json\n when: always\n rules:\n - when: never\n # `rules` must be overridden explicitly by each child job\n # see https://gitlab.com/gitlab-org/gitlab/-/issues/218444\n variables:\n SEARCH_MAX_DEPTH: 4\n allow_failure: true\n script:\n - /analyzer run\n\nkics-iac-sast:\n extends: iac-sast\n image:\n name: \"$SAST_ANALYZER_IMAGE\"\n variables:\n SAST_ANALYZER_IMAGE_TAG: 3\n SAST_ANALYZER_IMAGE: \"$SECURE_ANALYZERS_PREFIX/kics:$SAST_ANALYZER_IMAGE_TAG$SAST_IMAGE_SUFFIX\"\n rules:\n - if: $SAST_DISABLED\n when: never\n - if: $SAST_EXCLUDED_ANALYZERS =~ /kics/\n when: never\n - if: $CI_COMMIT_BRANCH\n \n\nEnforce Compliance:\n stage: Compliance\n before_script:\n - apk add jq\n script:\n - jq -r '.vulnerabilities[] | select(.severity == \"Critical\") | (.severity, .message, .location, .identifiers[].url)' gl-sast-report.json > results.txt\n - jq -r '.vulnerabilities[] | select(.severity == \"High\") | (.severity, .message, .location, .identifiers[].url)' gl-sast-report.json >> results.txt\n - jq -r '.vulnerabilities[] | select(.severity == \"Medium\") | (.severity, .message, .location, .identifiers[].url)' gl-sast-report.json >> results.txt\n - chmod u+x check-sast-results.sh\n - ./check-sast-results.sh\n\nYou'll also need to make sure to add two stages to your pipeline (if you don't have them already):\nstages:\n # add these to whatever other stages you already have\n - test\n - Compliance\n\nNote: it's extremely important that your job which is trying to access gl-sast-report.json (\"Compliance\" in this case) is not in the same stage as the sast scans themselves (\"test\" in this case). If they are, then your job will try to access the report before it exists and fail.\nI'll include my shell script referenced in the pipeline in case you want to use that too:\n#!/bin/sh\n\nif [ -s results.txt ]; then\n echo \"\"\n echo \"\"\n cat results.txt\n echo \"\"\n echo \"ERROR: SAST SCAN FOUND VULNERABILITIES - FIX ALL VULNERABILITIES TO CONTINUE\"\n echo \"\"\n exit 1\nfi\n\nThis is a basic script that checks to see if the \"results.txt\" file has any contents. If it does, it exits with code 1 to break the pipeline and print the vulnerabilities. If there are no contents in the file, the script exits with code 0 and the pipeline continues (allowing you to deploy your infra). Save the file above as \"check-sast-results.sh\" in the root directory of your GitLab repository (the same level where \".gitlab-ci.yml\" resides).\nHope this helps someone out there."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-tag - Create, list, delete or verify a tag object signed with GPG --color[=<when>]"
},
{
"role": "assistant",
"content": "Respect any colors specified in the --format option. The <when> field must be one of always , never , or auto (if <when> is absent, behave as if always was given)."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-pull - Fetch from and integrate with another repository or a local branch"
},
{
"role": "assistant",
"content": "DEFAULT BEHAVIOUR Often people use git pull without giving any parameter.\nTraditionally, this has been equivalent to saying git pull\norigin . However, when configuration branch.<name>.remote is\npresent while on branch <name> , that value is used instead of origin . In order to determine what URL to use to fetch from, the value\nof the configuration remote.<origin>.url is consulted\nand if there is not any such variable, the value on the URL: line\nin $GIT_DIR/remotes/<origin> is used. In order to determine what remote branches to fetch (and\noptionally store in the remote-tracking branches) when the command is\nrun without any refspec parameters on the command line, values\nof the configuration variable remote.<origin>.fetch are\nconsulted, and if there aren’t any, $GIT_DIR/remotes/<origin> is consulted and its Pull: lines are used.\nIn addition to the refspec formats described in the OPTIONS\nsection, you can have a globbing refspec that looks like this: refs/heads/*:refs/remotes/origin/* A globbing refspec must have a non-empty RHS (i.e. must store\nwhat were fetched in remote-tracking branches), and its LHS and RHS\nmust end with /* . The above specifies that all remote\nbranches are tracked using remote-tracking branches in refs/remotes/origin/ hierarchy under the same name. The rule to determine which remote branch to merge after\nfetching is a bit involved, in order not to break backward\ncompatibility. If explicit refspecs were given on the command\nline of git pull , they are all merged. When no refspec was given on the command line, then git pull uses the refspec from the configuration or $GIT_DIR/remotes/<origin> . In such cases, the following\nrules apply: If branch.<name>.merge configuration for the current\nbranch <name> exists, that is the name of the branch at the\nremote site that is merged. If the refspec is a globbing one, nothing is merged. Otherwise the remote branch of the first refspec is merged."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Mysysgit \"(END)\" displays, how do I proceed?\nWhile using mysysgit under Windows, I do not know how to regain control of the console windows after running git log in Git Bash. This seems simple yet I cannot find the key combination or command, so I find myself having to close the console window and relaunching a new instance of Git Bash to interact with git. \nWhat is the key combination and/or command I need to exit the log viewer?"
},
{
"role": "assistant",
"content": "As said in the comments already, press the Q key."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-diff - Show changes between commits, commit and working tree, etc blocks"
},
{
"role": "assistant",
"content": "Blocks of moved text of at least 20 alphanumeric characters\nare detected greedily. The detected blocks are\npainted using either the color.diff.{old,new}Moved color.\nAdjacent blocks cannot be told apart."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Undo a Git commit after push using reverse patch?\nI've pushed a commit and I want to revert changes introduced by this commit by applying and committing a reversed patch. How do I do it?"
},
{
"role": "assistant",
"content": "Use\ngit revert HEAD\n\nThis will create a patch that reverts the last commit and commit that patch as a new commit.\nIf you want to revert a specific earlier version, use\ngit revert <revision>\n\nsee also: http://schacon.github.com/git/git-revert.html"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "GitHub: How to make a fork of public repository private?\nHow can I fork a public repository, but make my fork private? I do have the subscription to support private repositories."
},
{
"role": "assistant",
"content": "The answers are correct but don't mention how to sync code between the public repo and the fork.\nHere is the full workflow (we've done this before open sourcing React Native):\n\nFirst, duplicate the repo as others said (details here):\nCreate a new repo (let's call it private-repo) via the Github UI. Then:\ngit clone --bare https://github.com/exampleuser/public-repo.git\ncd public-repo.git\ngit push --mirror https://github.com/yourname/private-repo.git\ncd ..\nrm -rf public-repo.git\n\n\nClone the private repo so you can work on it:\ngit clone https://github.com/yourname/private-repo.git\ncd private-repo\nmake some changes\ngit commit\ngit push origin master\n\n\nTo pull new hotness from the public repo:\ncd private-repo\ngit remote add public https://github.com/exampleuser/public-repo.git\ngit pull public master # Creates a merge commit\ngit push origin master\n\nAwesome, your private repo now has the latest code from the public repo plus your changes.\n\nFinally, to create a pull request private repo -> public repo:\nUse the GitHub UI to create a fork of the public repo (the small \"Fork\" button at the top right of the public repo page). Then:\ngit clone https://github.com/yourname/the-fork.git\ncd the-fork\ngit remote add private_repo_yourname https://github.com/yourname/private-repo.git\ngit checkout -b pull_request_yourname\ngit pull private_repo_yourname master\ngit push origin pull_request_yourname\n\nNow you can create a pull request via the Github UI for public-repo, as described here.\nOnce project owners review your pull request, they can merge it.\nOf course the whole process can be repeated (just leave out the steps where you add remotes)."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Gerrit with Github\n\nI am using github and I am willing to start using Gerrit with it.\nSince Gerrit uses JGit, I am scared of the following text from this link:\n\nEGit/JGit is a reimplementation of git\n in java, due to this GitHub does not\n officially support it. Issues have\n happened and repositories have been\n corrupted by them. While it is usually\n a simple matter to repair these repos\n due to git’s distributed nature, be\n aware that EGit may not work as well\n as the official git binaries.\n\nDid someone already use it?"
},
{
"role": "assistant",
"content": "Gerrit is it's own server and the issues we've seen were with the client and have recently been fixed in the brand new version of JGit. It also didn't corrupt the repository, it just pushed packfiles that were missing objects. The Gerrit server is solid and has been used by the Android project for over a year. \nHowever, since it is its own server and enforces a very specific workflow, it is generally not used in conjunction with public GitHub much, since code contributions on GitHub tend to be pull requests, where contributions on Gerrit are peer-verified patch series through the Gerrit system. Again, you can set them both up for the same project, but most people do not."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "GitLab pull submodules inside CI\n\nI have a GitLab project that utilises GitLab CI.\nThe project also uses submodules, both the project and it's submodules are under the same GitLab account.\nHere is my .gitmodules file\n[submodule \"proto_contracts\"]\n path = proto_contracts\n url = https://gitlab.com/areller/proto_contracts.git\n\nI also have this piece in the .gitlab-ci.yml file\nvariables:\n GIT_SUBMODULE_STRATEGY: recursive\n\nHowever, when i run the CI I get this error\nfatal: could not read Username for 'https://gitlab.com': No such device or address\n\nBoth the project and the submodules are in a private repository so you would expect to be prompted for authentication, but as I've mentioned, the project and the submodule are under the same account and one of the runner's jobs is to clone the original repository\n\nSo it's odd that it's unable to reach the submodule\nIs there a way around it?"
},
{
"role": "assistant",
"content": "You must use relative URLs for submodules. Update your .gitmodules as follow:\n [submodule \"proto_contracts\"]\n path = proto_contracts\n url = ../../areller/proto_contracts.git\n\nFurther reading: Using Git submodules with GitLab CI | GitLab Docs"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How do I use let’s encrypt with gitlab?\n\nI started to look in to ssl certificates when I stumbled upon let's encrypt, and I wanted to use it with gitlab, however being that it is running on a raspberry pi 2 and its running quite perfectly now (so I dont want to mess anything up), he would I go about installing a lets encrypt ssl certificate properly?\nPS: My installation is omnibus"
},
{
"role": "assistant",
"content": "The by far best solution I was able to find for now is described in this blog post. I won't recite everything, but the key points are:\n\nUse the webroot authenticator for Let's Encrypt\nCreate the folder /var/www/letsencrypt and use this directory as webroot-path for Let's Encrypt\nChange the following config values in /etc/gitlab/gitlab.rb and run gitlab-ctl reconfigure after that:\nnginx['redirect_http_to_https'] = true\nnginx['ssl_certificate']= \"/etc/letsencrypt/live/gitlab.yourdomain.com/fullchain.pem\"\nnginx['ssl_certificate_key'] = \"/etc/letsencrypt/live/gitlab.yourdomain.com/privkey.pem\"\nnginx['custom_gitlab_server_config']=\"location ^~ /.well-known {\\n alias /var/www/letsencrypt/.well-known;\\n}\\n\"\n\nIf you are using Mattermost which is shipped with the Omnibus package then you can additionally set these options in /etc/gitlab/gitlab.rb:\nmattermost_nginx['redirect_http_to_https'] = true\nmattermost_nginx['ssl_certificate']= \"/etc/letsencrypt/live/gitlab.yourdomain.com/fullchain.pem\"\nmattermost_nginx['ssl_certificate_key'] = \"/etc/letsencrypt/live/gitlab.yourdomain.com/privkey.pem\"\nmattermost_nginx['custom_gitlab_mattermost_server_config']=\"location ^~ /.well-known {\\n alias /var/www/letsencrypt/.well-known;\\n}\\n\"\n\nAfter requesting your first certificate remember to change the external_url to https://... and again run gitlab-ctl reconfigure\n\nThis method is very elegant since it just mounts the directory /var/www/letsencrypt/.well-known used by the Let's Encrypt authenticator into the Gitlab web-root via a custom Nginx configuration and authentication is always possible when Gitlab is running. This means that you can automatically renew the Let's Encrypt certificates."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Resolve merge conflicts: Force overwrite all files\nI am working on a git repository by myself (so yes, I know the implications and the warnings of doing this) and somehow one of the trees got a commit after being pushed when it shouldn't have.\nNow I'm trying to pull back and it's complaining about hundreds of merge conflicts.\nIs there a way to tell git to forcefully overwrite any and all files locally that are coming from the remote server? Is there a faster way than doing git reset --hard HEAD~1 and then doing the pull?\nOn that same note, is there a way to do the same with with a simple merge? Everything I've seen suggests to check out each and every file during the merge conflict resolution stage, but with hundreds of files it's just not possible to do so manually."
},
{
"role": "assistant",
"content": "There are three simple solutions to copy the last version that is in you remote repository, discarding all changes that you have made locally:\n\nDiscard your repository and clone again. This is the most simple solution, but if your repository is big, it can take a long time, and may require extra effort like reconfigureing, etc. \nDiscard the local changes with git reset --hard <hash> and then do a git pull. The problem is you need to first find a commit that precedes whatever change history you are trying to avoid. After resetting to that commit hash, do a git pull.\nDo a git fetch to bring the updates to your local reference of the remote branch (usually origin/master) and then do a git reset --hard passing this reference, ie, git reset --hard origin/master."
}
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.