messages
listlengths 3
3
|
---|
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "GitLab CI vs. Jenkins [closed]\n\nClosed. This question is seeking recommendations for software libraries, tutorials, tools, books, or other off-site resources. It does not meet Stack Overflow guidelines. It is not currently accepting answers.\n \n \n\n\n\n\n\n\n\n\n\n\n\n We don’t allow questions seeking recommendations for software libraries, tutorials, tools, books, or other off-site resources. You can edit the question so it can be answered with facts and citations.\n\n\nClosed 3 years ago.\n\n\n\n\n\n\n\n Improve this question\n \n\n\n\nWhat is the difference between Jenkins and other CI like GitLab CI, drone.io coming with the Git distribution. On some research I could only come up that GitLab community edition doesn't allow Jenkins to be added, but GitLab enterprise edition does. Are there any other significant differences?"
},
{
"role": "assistant",
"content": "This is my experience:\nAt my work we manage our repositories with GitLab EE and we have a Jenkins server (1.6) running.\nIn the basis they do pretty much the same. They will run some scripts on a server/Docker image.\nTL;DR;\n\nJenkins is easier to use/learn, but it has the risk to become a plugin hell\nJenkins has a GUI (this can be preferred if it has to be accessible/maintainable by other people)\nIntegration with GitLab is less than with GitLab CI\nJenkins can be split off your repository\n\nMost CI servers are pretty straight forward (concourse.ci, gitlab-ci, circle-ci, travis-ci, drone.io, gocd and what else have you). They allow you to execute shell/bat scripts from a YAML file definition. Jenkins is much more pluggable, and comes with a UI. This can be either an advantage or disadvantage, depending on your needs.\nJenkins is very configurable because of all the plugins that are available. The downside of this is that your CI server can become a spaghetti of plugins.\nIn my opinion chaining and orchestrating of jobs in Jenkins is much simpler (because of the UI) than via YAML (calling curl commands). Besides that Jenkins supports plugins that will install certain binaries when they are not available on your server (don't know about that for the others).\nNowadays (Jenkins 2 also supports more \"proper ci\" with the Jenkinsfile and the pipline plugin which comes default as from Jenkins 2), but used to be less coupled to the repository than i.e. GitLab CI.\nUsing YAML files to define your build pipeline (and in the end running pure shell/bat) is cleaner.\nThe plug-ins available for Jenkins allow you to visualize all kinds of reporting, such as test results, coverage and other static analyzers. Of course, you can always write or use a tool to do this for you, but it is definitely a plus for Jenkins (especially for managers who tend to value these reports too much).\nLately I have been working more and more with GitLab CI. At GitLab they are doing a really great job making the whole experience fun. I understand that people use Jenkins, but when you have GitLab running and available it is really easy to get started with GitLab CI. There won't be anything that will integrate as seamlessly as GitLab CI, even though they put quite some effort in third-party integrations.\n\nTheir documentation should get you started in no time.\nThe threshold to get started is very low.\nMaintenance is easy (no plugins).\nScaling runners is simple.\nCI fully part of your repository.\nJenkins jobs/views can get messy.\n\nSome perks at the time of writing:\n\nOnly support for a single file in the community edition. Multiples files in the enterprise edition."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git cherry-pick not working\nI'm trying to cherry-pick a commit from master and get it into the current production branch. However, when I execute git cherry-pick <SHA-hash>, I just get this message:\n# On branch prod_20110801\n# Untracked files:\n# (use \"git add <file>...\" to include in what will be committed)\n# site/test-result/\n nothing added to commit but untracked files present (use \"git add\" to track)\n The previous cherry-pick is now empty, possibly due to conflict resolution.\nIf you wish to commit it anyway, use:\n\n git commit --allow-empty\n\nOtherwise, please use 'git reset'\n\nNote: I've tried doing a reset and a reset --hard HEAD^, and neither seemed to change anything.\nI'm confused as to why this isn't working for me.\nAny insight, advice, or ideas on how to resolve this would be helpful~!"
},
{
"role": "assistant",
"content": "Git is resolving the cherry-pick as a no-op -- all of the changes introduced by that commit have been introduced by some commit on your current branch. (Or that's what Git thinks, anyway.) Verify that the commit you are cherry-picking hasn't already been merged somehow, as either a proper merge, rebase/cherry-pick, or piecemeal patch. (Use git show <commit-id> to see the diff.)"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to make GitLab Runner in Docker see a custom CA Root certificate\n\nI have installed and configured: \n\nan on-premises GitLab Omnibus on ServerA running on HTTPS\nan on-premises GitLab-Runner installed as Docker Service in ServerB\n\nServerA certificate is generated by a custom CA Root\nThe Configuration\nI've have put the CA Root Certificate on ServerB:\n/srv/gitlab-runner/config/certs/ca.crt\n\nInstalled the Runner on ServerB as described in Run GitLab Runner in a container - Docker image installation and configuration:\ndocker run -d --name gitlab-runner --restart always \\\n -v /srv/gitlab-runner/config:/etc/gitlab-runner \\\n -v /var/run/docker.sock:/var/run/docker.sock \\\n gitlab/gitlab-runner:latest\n\nRegistered the Runner as described in Registering Runners - One-line registration command:\ndocker run --rm -t -i \n -v /srv/gitlab-runner/config:/etc/gitlab-runner \n --name gitlab-docker-runner gitlab/gitlab-runner register \\\n --non-interactive \\\n --executor \"docker\" \\\n --docker-image alpine:latest \\\n --url \"https://MY_PRIVATE_REPO_URL_HERE/\" \\\n --registration-token \"MY_PRIVATE_TOKEN_HERE\" \\\n --description \"MyDockerServer-Runner\" \\\n --tag-list \"TAG_1,TAG_2,TAG_3\" \\\n --run-untagged \\\n --locked=\"false\"\n\nThis command gave the following output:\n\nUpdating CA certificates...\nRuntime platform arch=amd64 os=linux pid=5 revision=cf91d5e1 version=11.4.2\n Running in system-mode.\nRegistering runner... succeeded runner=8UtcUXCY\n Runner registered successfully. Feel free to start it, but if it's running already the config should be automatically reloaded!\n\nI checked with\n$ docker exec -it gitlab-runner bash \n\nand once in the container with\n$ awk -v cmd='openssl x509 -noout -subject' '\n/BEGIN/{close(cmd)};{print | cmd}' < /etc/ssl/certs/ca-certificates.crt\n\nand the custom CA root is correctly there.\nThe Problem\nWhen running Gitlab-Runner from GitLab-CI, the pipeline fails miserably telling me that:\n\n$ git clone https://gitlab-ci-token:${CI_BUILD_TOKEN}@ServerA/foo/bar/My-Project.wiki.git\n Cloning into 'My-Project.wiki'...\n fatal: unable to access 'https://gitlab-ci-token:xxxxxxxxxxxxxxxxxxxx@ServerA/foo/bar/My-Project.wiki.git/': server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crt CRLfile: none\n ERROR: Job failed: exit code 1\n\nIt does not recognize the Issuer (my custom CA Root), but according to The self-signed certificates or custom Certification Authorities, point n.1, it should out-of-the-box:\n\nDefault: GitLab Runner reads system certificate store and verifies the GitLab server against the CA’s stored in system.\n\nI've then tried the solution from point n.3, editing \n/srv/gitlab-runner/config/config.toml:\n\nand adding: \n[[runners]]\ntls-ca-file = \"/srv/gitlab-runner/config/certs/ca.crt\"\n\nBut it still doesn't work.\nHow can I make Gitlab Runner read the CA Root certificate?"
},
{
"role": "assistant",
"content": "You have two options:\nIgnore SSL verification\nPut this at the top of your .gitlab-ci.yml:\nvariables:\n GIT_SSL_NO_VERIFY: \"1\"\n\nPoint GitLab-Runner to the proper certificate\nAs outlined in the official documentation, you can use the tls-*-file options to setup your certificate, e.g.:\n[[runners]]\n ...\n tls-ca-file = \"/etc/gitlab-runner/ssl/ca-bundle.crt\"\n [runners.docker]\n ...\n\nAs the documentation states, \"this file will be read every time when runner tries to access the GitLab server.\"\nOther options include tls-cert-file to define the certificate to be used if needed."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How can I show the name of branches in `git log`?\nHow can I show the name of branches in the output of git log?\nFor example with, git log --graph --all I get a nice overview of the commits, but get confused which line is master, and which is my branch for example."
},
{
"role": "assistant",
"content": "Try the decorate option.\ngit log --graph --all --decorate\n\nIt annotates commits which are pointed to by tags or branches."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-cherry-pick - Apply the changes introduced by some existing commits git cherry-pick master"
},
{
"role": "assistant",
"content": "Apply the change introduced by the commit at the tip of the\nmaster branch and create a new commit with this change."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "GitHub commits aren't recorded in the 'Your Contributions` calendar\nI've been making continuous commits to my GitHub repos from my Linux shell and they show up nicely on the website just as they should. The only problem is that \"Your Contributions\" section doesn't show any recent activity. I have one green square from some day in November which I don't know how I got but all the other contributions don't show up in the calendar (but again, they do show up in their repos).\nWhat am I missing here?\nMy github site"
},
{
"role": "assistant",
"content": "For me this problem was caused by me committing from my work computer where I was using a different email in my gitconfig. Adding my work email address to my github account didn't make the past commits show up in the summary, but new commits are now showing up as they should.\nYou can find the email address you are using for a repository with git config user.email."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-fetch - Download objects and refs from another repository -"
},
{
"role": "assistant",
"content": "for a successfully pruned ref;"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Not able to checkout branch even after removing worktree and running worktree prune\nI create a worktree for branch using the following command:\nGit add worktree <path> <branch-name>\n\nThis created a new worktree for me and checked out the branch at the path \nNow I thought of deleting/removing the worktree. Ran following commands:\nrm -rf <path>\ngit worktree prune\n\nThis should ideally remove the worktree and remove the reference for that path too. So now I should be able to checkout the branch. But when I run following command to checkout to that branch:\ngit checkout <branch-name>\n\nI get this error:\nfatal: '<branch-name>' is already checked out at ''\n\nCould someone help me with what is going on."
},
{
"role": "assistant",
"content": "I worked around this by erasing .git/worktrees/<branch-name> from the repository directory."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Put current changes in a new Git branch [duplicate]\n\nThis question already has answers here:\n \n \n\n\n\n\nMove existing, uncommitted work to a new branch in Git\n\n (14 answers)\n \n\nClosed 10 years ago.\n\n\n\nI've been editing some modules on the master branch but I haven't committed them. I'm now thinking that these changes should really be on an experimental branch and not the master branch.\nHow can I get these edits into an experimental branch? Copy them to some temp location, create the branch, and then copy them back in?\nAnd how do I configure things so that when I do a git push from the new experimental branch it will it go into a branch of the same name in my GitHub repo?"
},
{
"role": "assistant",
"content": "You can simply check out a new branch, and then commit:\ngit checkout -b my_new_branch\ngit commit\n\nChecking out the new branch will not discard your changes."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-diff - Show changes between commits, commit and working tree, etc default"
},
{
"role": "assistant",
"content": "Is a synonym for zebra . This may change to a more sensible mode\nin the future."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-diff - Show changes between commits, commit and working tree, etc ignore-space-change"
},
{
"role": "assistant",
"content": "Ignore changes in amount of whitespace. This ignores whitespace\nat line end, and considers all other sequences of one or\nmore whitespace characters to be equivalent."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git - the stupid content tracker git-show-index"
},
{
"role": "assistant",
"content": "Show packed archive index"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git - the stupid content tracker git-show-branch"
},
{
"role": "assistant",
"content": "Show branches and their commits"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How can I automatically deploy my app after a git push ( GitHub and node.js)?\nI have my application (node.js) deployed on a VPS (linux). I'm using git hub as a repository. How can I deploy the application automatically, on git push ?"
},
{
"role": "assistant",
"content": "Example in PHP:\nNavigate to github into your github repository add click \"Admin\"\nclick tab 'Service Hooks' => 'WebHook URLs' \nand add\nhttp://your-domain-name/git_test.php\n\nthen create git_test.php \n<?php \ntry\n{\n $payload = json_decode($_REQUEST['payload']);\n}\ncatch(Exception $e)\n{\n exit(0);\n}\n\n//log the request\nfile_put_contents('logs/github.txt', print_r($payload, TRUE), FILE_APPEND);\n\n\nif ($payload->ref === 'refs/heads/master')\n{\n // path to your site deployment script\n exec('./build.sh');\n}\n\nIn the build.sh you will need to put usual commands to retrieve your site from github"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Git prevents pushing after amending a commit\nUsually, I just run \ngit add file\ngit commit\ngit push\n\nbut if I amend the commit before pushing it (with git commit --amend), the next push fails with \nhint: Updates were rejected because the tip of your current branch is behind\nhint: its remote counterpart. Integrate the remote changes (e.g.\nhint: 'git pull ...') before pushing again.\nhint: See the 'Note about fast-forwards' in 'git push --help' for details.\n\nHow can I let git push the changes without merging branches? I only have one branch (master) and I'm the only person using this repo so why is it saying this?\ngit branch -a:\n* master\n remotes/origin/HEAD -> origin/master\n remotes/origin/master\n\nEDIT: Using gitk HEAD @{u}, I see that I have 2 branches, one with the original commit and another with the amended commit."
},
{
"role": "assistant",
"content": "This should only be the case if you're amending an already-pushed commit. Generally you should never do that as you're then modifying published history. In your case however, you should be able to get away with push -f, which will overwrite the remote commit with your amended revision."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-fast-import - Backend for fast Git data importers"
},
{
"role": "assistant",
"content": "PARALLEL OPERATION Like git push or git fetch , imports handled by fast-import are safe to\nrun alongside parallel git repack -a -d or git gc invocations,\nor any other Git operation (including git prune , as loose objects\nare never used by fast-import). fast-import does not lock the branch or tag refs it is actively importing.\nAfter the import, during its ref update phase, fast-import tests each\nexisting branch ref to verify the update will be a fast-forward\nupdate (the commit stored in the ref is contained in the new\nhistory of the commit to be written). If the update is not a\nfast-forward update, fast-import will skip updating that ref and instead\nprints a warning message. fast-import will always attempt to update all\nbranch refs, and does not stop on the first failure. Branch updates can be forced with --force, but it’s recommended that\nthis only be used on an otherwise quiet repository. Using --force\nis not necessary for an initial import into an empty repository."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-log - Show commit logs --no-color-moved"
},
{
"role": "assistant",
"content": "Turn off move detection. This can be used to override configuration\nsettings. It is the same as --color-moved=no ."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git - the stupid content tracker GIT_TRACE_PERFORMANCE"
},
{
"role": "assistant",
"content": "Enables performance related trace messages, e.g. total execution\ntime of each Git command.\nSee GIT_TRACE for available trace output options."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to fix \"ssh: connect to host github.com port 22: Connection timed out\" for git push/pull/... commands?\nI am under a proxy and I am pushing in to git successfully for quite a while.\nNow I am not able to push into git all of a sudden.\nI have set the RSA key and the proxy and double checked them, with no avail and git is throwing me the error shown in the title of the page."
},
{
"role": "assistant",
"content": "For me none of the suggested solutions worked so I tried to fix it myself and I resolved it. I was getting this error on my AWS EC2 UBUNTU instance. I edited the ssh config (or add it if it does not exist).\nnano ~/.ssh/config\nAnd I added the following\nHost github.com\n Hostname ssh.github.com\n Port 443\n\nThen, run the command ssh -T [email protected] to confirm if the issue is fixed.\nAccording to this\n\nSometimes, firewalls refuse to allow SSH connections entirely. If using HTTPS cloning with credential caching is not an option, you can attempt to clone using an SSH connection made over the HTTPS port. Most firewall rules should allow this, but proxy servers may interfere\n\nHopefully this helps anyone else who's having the same issue I did."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Git short branch name in teamcity\nI'm using teamcity 8.x.x version.I configured my Teamcity for continuous deployment. I'm need a feature branching deployment. I see this document \"http://confluence.jetbrains.com/display/TCD8/Working+with+Feature+Branches\".\nI'm trying this document implementing on my Teamcity. I have a problem.\nMy deployment config use \"OctoPack\" (nuget). My nuget package needs build count and branch name. example: 1.0.0.356-feature-1.\nI'm try this versioning,\n%build.number%-%teamcity.build.vcs.branch.VCS_ROOT_ID% ----> 1.0.0.356-refs/head/feature-1\n\nthis version not support nuget versioning. nuget not comparative \"/\".\nI need this,\n%build.number%-%teamcity.build.vcs.SHORT_BRANCH_NAME.VCS_ROOT_ID% ---> 1.0.0.356-feature-1\n\nhow can I?"
},
{
"role": "assistant",
"content": "I believe what you need is another variable. Try using %vcsroot.branch%. There is also %teamcity.build.branch%, but that one will contain \"<default>\" on the default branch. If you want more flexibility to choose exactly which part of the branch name gets selected, you can follow the instructions on this page: \nhttp://confluence.jetbrains.com/display/TCD7/Working+with+Feature+Branches#WorkingwithFeatureBranches-branchSpec."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-submodule - Initialize, update or inspect submodules status [--cached] [--recursive] [--] [<path>…]"
},
{
"role": "assistant",
"content": "Show the status of the submodules. This will print the SHA-1 of the\ncurrently checked out commit for each submodule, along with the\nsubmodule path and the output of git describe for the\nSHA-1. Each SHA-1 will possibly be prefixed with - if the submodule is\nnot initialized, + if the currently checked out submodule commit\ndoes not match the SHA-1 found in the index of the containing\nrepository and U if the submodule has merge conflicts. If --cached is specified, this command will instead print the SHA-1\nrecorded in the superproject for each submodule. If --recursive is specified, this command will recurse into nested\nsubmodules, and show their status as well. If you are only interested in changes of the currently initialized\nsubmodules with respect to the commit recorded in the index or the HEAD, git-status and git-diff will provide that information\ntoo (and can also report changes to a submodule’s work tree)."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git diff - show me line ending changes?\nMy editor is changing the line endings of my source files. When I do git diff, I see the same line twice -- once with - and once with + -- with no visible difference.\nHow do I get git diff to show me what this change actually was?"
},
{
"role": "assistant",
"content": "First, make sure you're using the coloured output (e.g. with git diff --color) and that you've enabled whitespace highlighting with (e.g.)\ngit config color.diff.whitespace \"red reverse\"\n\nThis might not work in all cases, however, as git doesn't appear to highlight trailing whitespace for removed lines. To see whitespace that you've deleted, simply use\ngit diff -R\n\nto put the whitespace on the 'added' side of the comparison, where it does get highlighted.\nFor more detail, see the answers at this SO question."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "If I fork someone else's private Github repo into my account, is it going to appear in my account as a public repo?\n\nSomeone gave me access to one of their private repo on Github. What I want to do is to fork that project into my own account, so I could make use of Github's pull request feature.\nI only have a basic account on Github, so I cannot make private repos on my own, but if I fork someone else's private repo into my account, is it going to appear in my account as public?"
},
{
"role": "assistant",
"content": "No. You can fork it and it still remains private.\n\nPrivate collaborators may fork any private repository you’ve added\n them to without their own paid plan. Their forks do not count against\n your private repository quota.\n\nhttps://github.com/plans"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "GitLab CI/CD pipeline, deploy to Windows Server\n\nUsing GitLab Runner I have on Linux, I am trying to connect to a Windows Server and run some basic commands there such as git pull.\nDoes GitLab runner provide any capabilities for accessing windows server?\nWhat other options are there to get such requirement done?"
},
{
"role": "assistant",
"content": "I think you have a few options\n\ninstall openssh and configure server on your windows machine/vm and connect from your gitlab runner with ssh ( https://learn.microsoft.com/en-us/windows-server/administration/openssh/openssh_install_firstuse )\n( as Wojciech Wirzbicki commented) install a gitlab runner instance on windows. https://docs.gitlab.com/runner/install/windows.html . I think this option more secure and easy win\nconnect to windows server with winrm"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-show-ref - List references in a local repository --exclude-existing[=<pattern>]"
},
{
"role": "assistant",
"content": "Make git show-ref act as a filter that reads refs from stdin of the\nform ^(?:<anything>\\s)?<refname>(?:\\^{})?$ and performs the following actions on each:\n(1) strip ^{} at the end of line if any;\n(2) ignore if pattern is provided and does not head-match refname;\n(3) warn if refname is not a well-formed refname and skip;\n(4) ignore if refname is a ref that exists in the local repository;\n(5) otherwise output the line."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How can I generate a Git patch for a specific commit?\nI want to create a patch for a specific commit hash, <rev>.\nI tried using git format-patch <rev>, but that generated a patch for each commit since the <rev> commit. Is there a way to generate a patch only for <rev>?"
},
{
"role": "assistant",
"content": "Try:\ngit format-patch -<n> <rev>\nFor example:\ngit format-patch -1 HEAD\n\nThe -1 flag indicates how many commits should be included in the patch:\n\n-<n>\n \nPrepare patches from the topmost <n> commits.\n\n\nApply the patch with the command:\ngit am < file.patch\n\nAlternatively you can also apply (should work on all OSes including Windows) with:\ngit apply --verbose file.patch\n\nThe -v or --verbose will show what failed, if any. Giving you a clue on how to fix."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Nested git repositories without remotes (a.k.a. git submodule without remotes)\nI have a project of which I am interested in breaking out portions as open-source. I've set up nested git repositories main, one, two and three:\nmain/\n├── one\n├── three\n└── two\n\nI thought that by going into \"main\" and doing\ngit add one\ngit add two\ngit add three\n\n(note the lack of trailing slashes), I'd set up submodules with the sub-repositories and be good to go.\nHowever, as noted in How to track untracked content?, this only creates gitlinks and not real submodules.\nUnfortunately, that answer doesn't help, as it assumes that there is a \"master\" repository somewhere else for \"main/one\", \"main/two\", and \"main/three\". I'd like these sub-repo's to be the master repositories. I'm considering fake submodules (as per Git fake submodules), but that's not a particularly ideal situation for cloning.\nAny other suggestions out there?"
},
{
"role": "assistant",
"content": "You can do what you want, but your one, two, and three would need to be accessible to whoever will need to clone them—this is not usually the case for “random” development repositories.\nIf you do set this up, you will need to be very careful not to delete “your” repository (or make it otherwise inaccessible) since it is not just “yours”: it will be origin in your collaborator’s clones and it will serve as the “central”/“upstream” repository (as specified in .gitmodules).\n\nIf all your collaborators are local (and can read from the repositories), you can add your existing sub-repositories as submodules by giving their local paths as URLs:\ngit rm --cached one two three\ngit submodule add `pwd`/one\ngit submodule add `pwd`/two\ngit submodule add `pwd`/three\n\nIf not all your collaborators will be working on the same machine, then that will probably not work correctly (since it will store a local path in .gitmodules; non-local collaborators would have to adjust the URLs after git submodule init).\nIf your one, two, and three are remotely Git-accessible, then you can specify their effecive URLs instead:\ngit rm --cached one two three\ngit -c protocol.file.allow=always submodule add server:/path/to/your/main/one\ngit -c protocol.file.allow=always submodule add server:/path/to/your/main/two\ngit -c protocol.file.allow=always submodule add server:/path/to/your/main/three\n\nIn both cases, since you already have a sub-repository in place, git submodule add will use that instead of trying to clone from the specified path/URL."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "What will `* text=auto eol=lf` in gitattributes do?\nWe have this in our .gitattributes file:\n* text=auto eol=lf\n\nI'd like to precisely understand what this does.\nThe first part is text=auto. From the documentation:\n\nThis ensures that all files that Git considers to be text will have normalized (LF) line endings in the repository.\n\nThe important part is that Git does the normalization only for files that it detects as text files.\nHowever, I'm not sure about the eol=lf part. I would think that it will also do the normalization only for text files but I can't find support for it in the documentation and we had an instance when our PNG files were normalized too, making them invalid.\nIs there a settings like the above that would basically say \"do the normalization in both directions for text files, and leave binary files alone\"?"
},
{
"role": "assistant",
"content": "Git 2.10 fixed this and now behaves as one would expect."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-log - Show commit logs %Creset"
},
{
"role": "assistant",
"content": "reset color"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-rebase - Reapply commits on top of another base tip apply backend"
},
{
"role": "assistant",
"content": "When applying a patch, ignore changes in whitespace in context\nlines. Unfortunately, this means that if the \"old\" lines being\nreplaced by the patch differ only in whitespace from the existing\nfile, you will get a merge conflict instead of a successful patch\napplication."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Internal certificate used when installing Helm Tiller Kubernetes\n\nThe error below is triggered when executing kubectl -n gitlab-managed-apps logs install-helm. \nI've tried regenerating the certificates, and bypassing the certificate check. Somehow it is using my internal certificate instead of the certificate of the source.\nroot@dev # kubectl -n gitlab-managed-apps logs install-helm\n+ helm init --tiller-tls --tiller-tls-verify --tls-ca-cert /data/helm/helm/config/ca.pem --tiller-tls-cert /data/helm/helm/config/cert.pem --tiller-tls-key /data/helm/helm/config/key.pem\nCreating /root/.helm \nCreating /root/.helm/repository \nCreating /root/.helm/repository/cache \nCreating /root/.helm/repository/local \nCreating /root/.helm/plugins \nCreating /root/.helm/starters \nCreating /root/.helm/cache/archive \nCreating /root/.helm/repository/repositories.yaml \nAdding stable repo with URL: https://kubernetes-charts.storage.googleapis.com \nError: Looks like \"https://kubernetes-charts.storage.googleapis.com\" is not a valid chart repository or cannot be reached: Get https://kubernetes-charts.storage.googleapis.com/index.yaml: x509: certificate is valid for *.tdebv.nl, not kubernetes-charts.storage.googleapis.com\n\nWhat might be the issue here? Screenshot below is the error Gitlab is giving me (not much information either)."
},
{
"role": "assistant",
"content": "After having the same issue I finally found the solution for it:\nIn the /etc/resolv.conf file on your Master and Worker nodes you have to search and remove the search XYZ.com entry.\nIf you are using Jelastic you have to remove this entry every time after a restart. It gets added by Jelastic automatically. I already contacted them so maybe they will fix it soon."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Choose Git merge strategy for specific files (\"ours\", \"mine\", \"theirs\")\nI am in the middle of rebasing after a git pull --rebase. I have a few files that have merge conflicts. How can I accept \"their\" changes or \"my\" changes for specific files?\n$ git status\n# Not currently on any branch.\n# You are currently rebasing.\n# (fix conflicts and then run \"git rebase --continue\")\n# (use \"git rebase --skip\" to skip this patch)\n# (use \"git rebase --abort\" to check out the original branch)\n#\n# Changes to be committed:\n# (use \"git reset HEAD <file>...\" to unstage)\n#\n# modified: CorrectlyMergedFile\n#\n# Unmerged paths:\n# (use \"git reset HEAD <file>...\" to unstage)\n# (use \"git add <file>...\" to mark resolution)\n#\n# both modified: FileWhereIWantToAcceptTheirChanges\n# both modified: FileWhereIWantToAcceptMyChanges\n\nNormally I just open the file or a merge tool and manually accept all \"their\" or \"my\" changes. However, I suspect I'm missing a convenient git command.\nAlso, note that I will only be able to choose a merge strategy for each file when I see what files hit conflicts an possibly what the conflicts are."
},
{
"role": "assistant",
"content": "For each conflicted file you get, you can specify\ngit checkout --ours -- <paths>\n# or\ngit checkout --theirs -- <paths>\n\nFrom the git checkout docs\n\ngit checkout [-f|--ours|--theirs|-m|--conflict=<style>] [<tree-ish>] [--] <paths>... \n--ours\n--theirs\n When checking out paths from the index, check out stage #2 (ours) or #3 (theirs) for unmerged paths.\nThe index may contain unmerged entries because of a previous failed merge. By default, if you try to check out such an entry from the index, the checkout operation will fail and nothing will be checked out. Using -f will ignore these unmerged entries. The contents from a specific side of the merge can be checked out of the index by using --ours or --theirs. With -m, changes made to the working tree file can be discarded to re-create the original conflicted merge result."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-format-patch - Prepare patches for e-mail submission minimal"
},
{
"role": "assistant",
"content": "Spend extra time to make sure the smallest possible diff is\nproduced."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-diff - Show changes between commits, commit and working tree, etc --pickaxe-all"
},
{
"role": "assistant",
"content": "When -S or -G finds a change, show all the changes in that\nchangeset, not just the files that contain the change\nin <string>."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Differences for a certain folder between Git branches [duplicate]\nThis question already has answers here:\n \n \n\n\n\n\nHow do I 'git diff' on a certain directory?\n\n (11 answers)\n \n\nClosed 6 years ago.\n\n\n\nHow can I get a diff file for a certain folder between the master branch and a branch I have created?"
},
{
"role": "assistant",
"content": "You can use\ngit diff master..yourbranch -- path/to/folder"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Symbolic link to a hook in git\nI wrote my own custom post-merge hook, now I added a \"hooks\" directory to my main project folder (since git doesn't track changes in .git/hooks), somewhere I read that I can make a symbolic link from hooks to .git/hooks so I don't have to copy the file from one folder to the other every time someone changes it so I tried:\nln -s -f hooks/post-merge .git/hooks/post-merge\nBut it doesn't seem to work, any ideas why? \"ln hooks/post-merge .git/hooks/post-merge\" works fine but making a hard link is the same as copyin I guess...."
},
{
"role": "assistant",
"content": "you just used wrong path, it should be:\nln -s -f ../../hooks/post-merge .git/hooks/post-merge"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Github actions, schedule operation on branch\n\nI am trying to configure a github workflow, I have managed to configure it on push event. However what if I need it to run on after a time period has passed?\nWhat I have understood from the documentation is that it can be achieved using a schedule.\nname: Release Management\n\non: \n schedule:\n - cron: \"*/5 * * * *\"\n\nHow do I specify the branch that the action will run on ?\nMy end goal is to automate releases."
},
{
"role": "assistant",
"content": "If you take a look at the documentation here you will see that the GITHUB_SHA associated with the on: schedule event is \"Last commit on default branch.\" This is what will be checked out by default when you use the actions/checkout action.\nIf your repository's default branch is master (which in general is the case) this workflow will checkout the last commit on master when it triggers.\nname: Release Management\non: \n schedule:\n - cron: \"*/5 * * * *\"\njobs:\n build:\n runs-on: ubuntu-latest\n steps:\n - uses: actions/checkout@v2\n\nIf you want to checkout a different branch you can specify with parameters on the checkout action. This workflow will checkout the last commit on the some-branch branch.\nname: Release Management\non: \n schedule:\n - cron: \"*/5 * * * *\"\njobs:\n build:\n runs-on: ubuntu-latest\n steps:\n - uses: actions/checkout@v2\n with:\n ref: some-branch\n\nSee documentation for the actions/checkout action for other options."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git - the stupid content tracker git-send-pack"
},
{
"role": "assistant",
"content": "Push objects over Git protocol to another repository"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How do I get last commit date from git repository? [duplicate]\nThis question already has answers here:\n \n \n\n\n\n\nHow to get the last commit date for a bunch of files in Git?\n\n (6 answers)\n \n\nClosed last year.\n\n\n\nI need the last commit date in git. This means the latest update date in my program.\nI used the command : $ git log -1 but this command will give me the date from the local repository. Rather I need date from remote repository. \nI tried some commands as follow.\ngit log -n 1 origin/Sprint-6.\ngit rev-parse --verify HEAD"
},
{
"role": "assistant",
"content": "Get the last commit date:\nYou want the \"repository wide last commit date for a given git user and git project, for a given branch. For example the date is shown at the top when you visit your repo and go to commits -> master for example:\nhttps://github.com/sentientmachine/TeslaAverageGainByMonthWeekDay/commits/master\nGet the last local commit date in git using terminal\nUse git help log for more info on format codes to pass to --format to tell git log what kind of data to fetch.\nThe last commit date in git:\ngit log -1 --format=\"%at\" | xargs -I{} date -d @{} +%Y/%m/%d_%H:%M:%S\n#prints 2018/07/18 07:40:52\n\nBut as you pointed out, you have to run that command on the machine that performed the last commit. If the last commit date was performed on another machine, the above command only reports local last commit... So:\nOr Repository wide: Get the last git commit date\nSame as above, but do a git pull first\ngit pull; \ngit log -1 --format=\"%at\" | xargs -I{} date -d @{} +%Y/%m/%d_%H:%M:%S\n#prints 2018/07/18 09:15:10\n\nOr use the JSON API:\nDoing git pulls is very slow and you're banging GitHub with a heavy operation. Just query the GitHub rest api:\n#assuming you're using github and your project URL is visible to public:\n# https://github.com/yourusername/your_repo_name\n\n#then do:\ncurl https://api.github.com/repos/yourusername/your_repo_name/commits/master\n\nThat blasts you in the face with a screen full of json, so send it your favorite json parser and get the field called date:\ncurl https://api.github.com/repos/<your_name>/<your_repo>/commits/master 2>&1 | \\\ngrep '\"date\"' | tail -n 1\n#prints \"date\": \"2019-06-05T14:38:19Z\"\n\nFrom comments below, gedge has handy dandy improvements to incantations:\ngit log -1 --date=format:\"%Y/%m/%d %T\" --format=\"%ad\"\n2019/11/13 15:25:44\n\nOr even simpler: ( https://git-scm.com/docs/git-log/1.8.0 )\ngit --no-pager log -1 --format=\"%ai\"\n2019-12-13 09:08:38 -0500\n\nYour choices are north, south, east, and \"Dennis\"."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to exclude file only from root folder in Git\nI am aware of using .gitignore file to exclude some files being added, but I have several config.php files in source tree and I need to exclude only one, located in the root while other keep under revision control. \nWhat I should write into .gitignore to make this happen?"
},
{
"role": "assistant",
"content": "From the documentation:\n\nIf the pattern does not contain a slash /, git treats it as a shell glob pattern and checks for a match against the pathname relative to the location of the .gitignore file (relative to the toplevel of the work tree if not from a .gitignore file).\nA leading slash matches the beginning of the pathname. For example, \"/*.c\" matches \"cat-file.c\" but not \"mozilla-sha1/sha1.c\".\n\nSo you should add the following line to your root .gitignore:\n/config.php"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-show - Show various types of objects %GF"
},
{
"role": "assistant",
"content": "show the fingerprint of the key used to sign a signed commit"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-config - Get and set repository or global options core.abbrev"
},
{
"role": "assistant",
"content": "Set the length object names are abbreviated to. If\nunspecified or set to \"auto\", an appropriate value is\ncomputed based on the approximate number of packed objects\nin your repository, which hopefully is enough for\nabbreviated object names to stay unique for some time.\nIf set to \"no\", no abbreviation is made and the object names\nare shown in their full length.\nThe minimum length is 4."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Is there a way to lock individual files or directories on fork when using git?\n\nWe are a team of 60+ developers working on the same product and are moving from SVN to Git and GitHub. We have a process in SVN where in individual files are locked and whenever a developer wants to commit code, he needs to get it unlocked by the owner of the file. Three of us are the owners of the total 150+ files. The unlocking is preceded by a code review. \nIn Github, we are planning to use the Fork-Clone model - each project a group of dev is working on will do a fork, each developer will do a clone of the fork, write the code & commit to origin, the lead of the feature will do a pull request to upstream.\nThough this seems fine, the problem is when a big project gets delivered, it brings in lots of changes for review and hence, increases the load for the file owners. Also, this might happen in the later cycles of development and hence the project might be jeopardized.\nOne method we thought might work is to have hooks when the git push is done to the origin (fork). There can be one final review git pull to upstream. \nHowever, we could not find any github extensions or push hooks for the same. Is there a quick way (read, existing extension) to do this with Github or should we use the same hooks that we would use with git?"
},
{
"role": "assistant",
"content": "No chance, if file is not mergeable and you need to lock it, use a centralized solution instead of GIT, i.e. SVN or ClearCase."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-svn - Bidirectional operation between a Subversion repository and Git create-ignore"
},
{
"role": "assistant",
"content": "Recursively finds the svn:ignore property on directories and\ncreates matching .gitignore files. The resulting files are staged to\nbe committed, but are not committed. Use -r/--revision to refer to a\nspecific revision."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-log - Show commit logs %cD"
},
{
"role": "assistant",
"content": "committer date, RFC2822 style"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git - the stupid content tracker --literal-pathspecs"
},
{
"role": "assistant",
"content": "Treat pathspecs literally (i.e. no globbing, no pathspec magic).\nThis is equivalent to setting the GIT_LITERAL_PATHSPECS environment\nvariable to 1 ."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-reflog - Manage reflog information --rewrite"
},
{
"role": "assistant",
"content": "If a reflog entry’s predecessor is pruned, adjust its \"old\"\nSHA-1 to be equal to the \"new\" SHA-1 field of the entry that\nnow precedes it."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-diff-index - Compare a tree to the working tree or index 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-status - Show the working tree status -u[<mode>] --untracked-files[=<mode>]"
},
{
"role": "assistant",
"content": "Show untracked files. The mode parameter is used to specify the handling of untracked files.\nIt is optional: it defaults to all , and if specified, it must be\nstuck to the option (e.g. -uno , but not -u no ). The possible options are: no - Show no untracked files. normal - Shows untracked files and directories. all - Also shows individual files in untracked directories. When -u option is not used, untracked files and directories are\nshown (i.e. the same as specifying normal ), to help you avoid\nforgetting to add newly created files. Because it takes extra work\nto find untracked files in the filesystem, this mode may take some\ntime in a large working tree.\nConsider enabling untracked cache and split index if supported (see git update-index --untracked-cache and git update-index\n--split-index ), Otherwise you can use no to have git status return more quickly without showing untracked files.\nAll usual spellings for Boolean value true are taken as normal and false as no . The default can be changed using the status.showUntrackedFiles\nconfiguration variable documented in git-config ."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Gitlab pipeline jobs in the same stage are not running in parallel\n\nWe have 4 deploy jobs in the same stage that can be run concurrently. From the Gitlab docs:\n\nThe ordering of elements in stages defines the ordering of jobs' execution:\n\nJobs of the same stage are run in parallel.\n\nJobs of the next stage are run after the jobs from the previous stage complete successfully.\n\n\n\nWhat happens, however, is that only one of the jobs run at a time and the others stay on pending. Is there perhaps other things that I need to do in order to get it to execute in parallel. I'm using a runner with a shell executor hosted on an Ubuntu 16.04 instance."
},
{
"role": "assistant",
"content": "Your runner should be configured to enable concurrent jobs( see https://docs.gitlab.com/runner/configuration/advanced-configuration.html) \nconcurrent = 4\n\nor you may want to setup several runners."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to revert a \"git rm -r .\"?\nI accidentely said git rm -r .. How do I recover from this?\nI did not commit.\nI think all files were marked for deletion and were also physically removed from my local checkout.\nEDIT: I could (if I knew the command) revert to the last commit. But it would be a lot better if I could just undo the git rm -r .. Because I am not really sure what I did after the last commit and before the git rm -r .."
},
{
"role": "assistant",
"content": "git reset HEAD\n\nShould do it. If you don't have any uncommitted changes that you care about, then\ngit reset --hard HEAD\n\nshould forcibly reset everything to your last commit. If you do have uncommitted changes, but the first command doesn't work, then save your uncommitted changes with git stash:\ngit stash\ngit reset --hard HEAD\ngit stash pop"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-verify-pack - Validate packed Git archive files <pack>.idx …"
},
{
"role": "assistant",
"content": "The idx files to verify."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Combining multiple commits before pushing in Git [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 have a bunch of commits on my local repository which are thematically similar. I'd like to combine them into a single commit before pushing up to a remote. How do I do it? I think rebase does this, but I can't make sense of the docs."
},
{
"role": "assistant",
"content": "What you want to do is referred to as \"squashing\" in git. There are lots of options when you're doing this (too many?) but if you just want to merge all of your unpushed commits into a single commit, do this:\ngit rebase -i origin/master\n\nThis will bring up your text editor (-i is for \"interactive\") with a file that looks like this:\npick 16b5fcc Code in, tests not passing\npick c964dea Getting closer\npick 06cf8ee Something changed\npick 396b4a3 Tests pass\npick 9be7fdb Better comments\npick 7dba9cb All done\n\nChange all the pick to squash (or s) except the first one:\npick 16b5fcc Code in, tests not passing\nsquash c964dea Getting closer\nsquash 06cf8ee Something changed\nsquash 396b4a3 Tests pass\nsquash 9be7fdb Better comments\nsquash 7dba9cb All done\n\nSave your file and exit your editor. Then another text editor will open to let you combine the commit messages from all of the commits into one big commit message.\nVoila! Googling \"git squashing\" will give you explanations of all the other options available."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "\"You must type a file name\" error thrown, when I create a .gitignore file on Windows\nWhen I try to do this, I get the following error:\n\nObviously, Windows Explorer doesn't allow me to create this type of file patterns. How can I overcome this problem?"
},
{
"role": "assistant",
"content": "In the File Explorer, the trick is to call your file .gitignore. and it will remove the ending .\nA strange behavior but, hey!, it works 😅\nOr create it from a text editor..."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Difference between organisation member and outside collaborator in github\n\nThe github docs are a bit unclear about the semantic difference between organisation member and outside collaborator. What is the distinction?\nI run an github organisation for my school. I create repos and allocate them to students. Should the students be members of the org or outside collaborators?"
},
{
"role": "assistant",
"content": "This particular GitHub Help Doc page may help clear it up. Outside collaborators only have access to repositories that their team membership allows. Outside collaborators cannot create teams or view all the organization's members and teams.\n\nOutside collaborators and bot accounts will count toward your organization's total of paid seats if they are given access to a private repository."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git fatal:No tags can describe <sha1 number>\nI am using tags by applying them to nightly builds. Then later, I want to use the output of describe --tags --match <latest tag> to tell me how far from the nightly build my images are. This is for QA testing.\nI just ran into an error in a clone that is older than the current tag. I ran git fetch --tags, so I see the tag in git tag output, but when I run git describe --tags --match <tagname>, I get fatal: No tags can describe <head sha1 version number>. I cannot do a git pull to update the workspace at this point. Why does this happen and is there a workaround? Thanks very much"
},
{
"role": "assistant",
"content": "I just ran into this error with git version 2.8.3 and command git describe --abbrev=0. \nThe problem was that while the tag existed in the origin and my local repository was up to date, the tag did not have a commit message.\nThe error was resolved after I re-tagged the commit with a tag message:\ngit tag v1.1.1 -m 'some message'"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Repository Name as a GitHub Action environment variable?\n\nHow would you get the repository name (not the user or organization) as an environment variable in GitHub Actions?\nI found github.repository but that contains the owner as the first part like so: owner/repo."
},
{
"role": "assistant",
"content": "Try github.event.repository.name\n- run: echo \"REPO_NAME=${{ github.event.repository.name }}\" >> $GITHUB_ENV\n\n\nDocumentation aside, i'd really recommend dumping contexts (maybe in some test repo) just to get familiar with them, as there is lot of data which might or might not be useful when writing non-trivial workflows.\n- name: Dump github context\n run: echo \"$GITHUB_CONTEXT\"\n shell: bash\n env:\n GITHUB_CONTEXT: ${{ toJson(github) }}\n\nBe aware that parts of github context changes depends which event triggered workflow, so it might be a good idea to double check if data you want to use is available for all events used in workflow."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to update a git clone --mirror?\nI have created a git repository to mirror a live site (which is a non-bare git repository):\ngit clone --mirror ssh://[email protected]/path/to/repo\n\nNow, to keep this mirror clone updated with all changes from its remote origin, which command or commands I must use?\nI'd like to keep everything updated: commits, refs, hooks, branches, etc.\nThanks!"
},
{
"role": "assistant",
"content": "This is the command that you need to execute on the mirror:\ngit remote update"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Commit to multiple branches at the same time\nI want to make a single commit on different branches at the same time, since, in my project, I have different branches for different clients.\nSay, I have made a new feature commit on Branch A. Can I also make this commit on Branch B, Branch C and D at the same time as well? Is there any short cut command for this? This is very troublesome to checkout one branch, and cherrypick the commit everytime, sometime, if the commit is necessary on many branches, it would be a nightmare for me.\nAny simple bash script for this operation?\nThere is a similar question in there. But rebasing is not that I want."
},
{
"role": "assistant",
"content": "The cherry-pick feature will do the job and will only apply the last commit:\nConsidering branches A, B\ngit checkout A\ngit commit -m \"Fixed the bug x\"\ngit checkout B\ngit cherry-pick A\n\nhope this helps!"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-merge - Join two or more development histories together merge.tool"
},
{
"role": "assistant",
"content": "Controls which merge tool is used by git-mergetool .\nThe list below shows the valid built-in values.\nAny other value is treated as a custom merge tool and requires\nthat a corresponding mergetool.<tool>.cmd variable is defined."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-config - Get and set repository or global options git diff"
},
{
"role": "assistant",
"content": "compares the (i)ndex and the (w)ork tree;"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "What is the .git folder?\nWhat is the folder called .git?\nIt's created in a repository. What is contained within it and why is it created?"
},
{
"role": "assistant",
"content": "Folder .git is initialized by git init.\n.git contains all information required for version control. If you want to clone your repository, copying .git is enough.\nFour sub-directories:\n\nhooks/ : example scripts\ninfo/ : exclude file for ignored patterns\nobjects/ : all \"objects\"\nrefs/ : pointers to commit objects\n\nFour files:\n\nHEAD : the current branch\nconfig : configuration options\ndescription\nindex : staging area\n\nHere \"object\" includes:\n\nblobs (files)\ntrees (directories)\ncommits (reference to a tree, parent commit, etc.)"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Can we commit on branch that's already been merged with master?\nI have a branch, say \"XYZ\", I worked and did a few commits on that branch and later merged it with my master branch. Now, I want to do some more changes in my code and want to use that same branch. I have not deleted the branch.\nCan I use the same branch again? Can I then merge the new commits with master again? Or is the only solution to create another branch?"
},
{
"role": "assistant",
"content": "You can still work on that branch as it still exists. \nThe git-merge documentation says:\n\nIncorporates changes from the named commits (since the time their\n histories diverged from the current branch) into the current branch.\n\nYou can continue working on your branch and then when you merge with master again, it will bring the commits that are missing on master."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Custom domain for GitHub project pages\n\nI have a gh-pages branch in one of my http://github.com repos. The GitHub project pages works fine if I go to http://myuser.github.com/myrepo\nI want to setup a custom domain (myexample.com) that will serve up these project pages. I want both myexample.com and www.myexample.com to serve up these project pages.\nGitHub pages help says to make an A record and a CNAME record in your DNS. The A record makes sense, but I do not know what CNAME record to make in my DNS.\nThe gh-pages docs say to make a CNAME record for 'charlie.github.com' which is a user page repository. I do not have a user page repository - I only have a project repository and a gh-pages branch that I want to use for myexample.com and www.myexample.com.\nDo I need to make a user page repository just so I can use my project page for www.myexample.com and myexample.com?\nI would just try it, but I want to make sure this will work as I already have www.myexample.com live and don't want to make a mistake.\nI emailed GitHub support and their response was\n\nYou can't have both point to the same gh-pages as far as I know.\n\nI find it hard to believe they would only support A records for project pages.\nHas anyone successfully done this before?"
},
{
"role": "assistant",
"content": "1/23/19 UPDATE:\nThings have changed quite a bit (for the better) since my last answer. This updated answer will show you how to configure:\n\nRoot apex (example.com)\nSub-domain (www.example.com)\nHTTPS (optional but strongly encouraged)\n\nIn the end, all requests to example.com will be re-directed to https://www.example.com (or http:// if you choose NOT to use HTTPS). I always use www as my final landing. Why(1,2), is for another discussion.\nThis answer is long but it is not complicated. I was verbose for clarity as the GitHub docs on this topic are not clear or linear.\nStep 1: Enable GitHub pages in GitHub settings\n\nFrom your repo, click on the tab\nScroll down to the GitHub Pages section. You have two options: \nChoosing master branch will treat /README.md as your web index.html. Choosing master branch /docs folder will treat /docs/README.md as your web index.html.\nChoose a theme.\nWait a minute while GitHub publishes your site. Verify it works by clicking on the link next to Your site is ready to be published at\n\nStep 2: Specify custom domain in GitHub settings\nEnter your custom domain name here and hit save:\n\nThis is a subtle, but important step.\n\nIf the custom domain you added to your GitHub Pages site is example.com, then www.example.com will redirect to example.com\nIf the custom domain you added to your GitHub Pages site is www.example.com, then example.com will redirect to www.example.com.\n\nAs mentioned before, I recommend always landing at www so I entered www.example.com as pictured above.\nStep 3: Create DNS entries\nIn your DNS provider's web console, create four A records and one CNAME.\n\nA Records for @ (aka root apex):\n\nSome DNS providers will have you specify @, others (like AWS Route 53) you will leave the sub-domain blank to indicate @. In either case, these are the A records to create:\n185.199.108.153\n185.199.109.153\n185.199.110.153\n185.199.111.153\n\nCheck the Github docs to confirm these are the most up-to-date IPs.\n\nCreate a CNAME record to point www.example.com to YOUR-GITHUB-USERNAME.github.io.\n\nThis is the most confusing part.\nNote the YOUR-GITHUB-USERNAME NOT the GitHub repo name! The value of YOUR-GITHUB-USERNAME is determined by this chart.\nFor a User pages site (most likely what you are), CNAME entry will be username.github.io, ex:\n\nFor a Organization pages site, CNAME entry will be orgname.github.io, ex:\n\nStep 5: Confirm DNS entries\n\nConfirm your A records by running dig +noall +answer example.com. It should return the four 185.x.x.x IP addresses you entered.\n\nConfirm your CNAME record by running dig www.example.com +nostats +nocomments +nocmd. It should return a CNAME YOUR-GITHUB-USERNAME.github.io\n\n\nIt may take an hour or so for these DNS entries to resolve/propagate. Once they do, open up your browser to http://example.com and it should re-direct to http://www.example.com\nStep 6: SSL (HTTPS) Configuration. Optional, but highly recommended\nAfter you have the custom domain working, go back to the repo settings. If you already have the settings page open, hard refresh the page.\nIf there is a message under the Enforce HTTPS checkbox, stating that it is still processing you will need to wait. You may also need to hit the save button in the Custom domain section to kick off the Enforce HTTPS processing.\nOnce processing is completed, it should look like this:\n\nJust click on the Enforce HTTPS checkbox, and point your browser to https://example.com. It should re-direct and open https://www.example.com\nTHATS IT!\nGitHub will automatically keep your HTTPS cert up-to-date AND should handle the apex to www redirect over HTTPS."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-ls-files - Show information about files in the index and the working tree"
},
{
"role": "assistant",
"content": "DESCRIPTION This command merges the file listing in the index with the actual working\ndirectory list, and shows different combinations of the two. Several flags can be used to determine which files are\nshown, and each file may be printed multiple times if there are\nmultiple entries in the index or if multiple statuses are applicable for\nthe relevant file selection options."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-config - Get and set repository or global options http.lowSpeedLimit, http.lowSpeedTime"
},
{
"role": "assistant",
"content": "If the HTTP transfer speed, in bytes per second, is less than http.lowSpeedLimit for longer than http.lowSpeedTime seconds,\nthe transfer is aborted.\nCan be overridden by the GIT_HTTP_LOW_SPEED_LIMIT and GIT_HTTP_LOW_SPEED_TIME environment variables."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to push a single file in a subdirectory to Github (not master)\nI have changed a single file in a subdirectory of my repository and I want to push just that file to Github. \nI've made a small change to one file, and I don't want to re-upload the entire repository.\nIt seems like all of the instructions that I've seen so far require me to merge locally with the master and then push my local master to the remote origin. \nHow can I push just that one file?"
},
{
"role": "assistant",
"content": "When you do a push, git only takes the changes that you have committed.\nRemember when you do a git status it shows you the files you changed since the last push? \nOnce you commit those changes and do a push they are the only files that get pushed so you don't have to worry about thinking that the entire master gets pushed because in reality it does not.\nHow to push a single file:\ngit commit yourfile.js\ngit status\ngit push origin master"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How can I see the changes in a Git commit?\nWhen I do git diff COMMIT I see the changes between that commit and HEAD (as far as I know), but I would like to see the changes that were made by that single commit.\nI haven't found any obvious options on diff / log that will give me that output."
},
{
"role": "assistant",
"content": "To see the diff for a particular COMMIT hash, where COMMIT is the hash of the commit:\ngit diff COMMIT~ COMMIT will show you the difference between that COMMIT's ancestor and the COMMIT. See the man pages for git diff for details about the command and gitrevisions about the ~ notation and its friends.\nAlternatively, git show COMMIT will do something very similar. (The commit's data, including its diff - but not for merge commits.) See the git show manpage.\n(also git diff COMMIT will show you the difference between that COMMIT and the head.)"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Why should I use tags vs. release/beta branches for versioning?\nI've been using git for about a year and would like to use tagging to, well, tag commits at different versions. I've found lots of info on the commands to use to work with tags, but what I'd like to know is why use tagging at all if I can just create a new branch called 1.1.0 and not have to cloud my mind with a whole new set of git commands?\nThere has to be a lot of good reasons for tagging rather than branching but I'd like to know what those advantages are."
},
{
"role": "assistant",
"content": "A tag is immutable.\nWhereas you can create a branch named \"1.0.0\" - you, or anyone with commit rights, can also then simply push to that branch (deliberately or not) and change what 1.0.0 means.\nYou can't do that with a tag, once you create a tag - that's it; Tag 1.0.0 means exactly that and can't be changed*.\nThat's the main practical difference between a tag and a branch\n* You can delete and recreate a tag thereby changing a tag, but certainly not by accident."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git find fat commit\nIs it possible to get info about how much space is wasted by changes in every commit — so I can find commits which added big files or a lot of files. This is all to try to reduce git repo size (rebasing and maybe filtering commits)"
},
{
"role": "assistant",
"content": "You could do this:\ngit ls-tree -r -t -l --full-name HEAD | sort -n -k 4\n\nThis will show the largest files at the bottom (fourth column is the file (blob) size.\nIf you need to look at different branches you'll want to change HEAD to those branch names. Or, put this in a loop over the branches, tags, or revs you are interested in."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "What is the public URL for the Github public keys\nI heard that there was a public URL for all users on github where you can access their public keys or they can supply that URL of all their public keys. Is this true? If so what is that URL. Does it exist for bitbucket as well?"
},
{
"role": "assistant",
"content": "You can get with:\ncurl https://github.com/<username>.keys\n\nReplace <username> with the actual username of the GitHub user.\nThis is useful when you set login permission to other servers. Just save its output into ~/.ssh/authorized_keys. To append it to the end from the command line:\ncurl https://github.com/<username>.keys | tee -a ~/.ssh/authorized_keys\n\nIt can also be done using Github API\ncurl -i https://api.github.com/users/<username>/keys\n\nFor bit bucket you can use the following: (This call requires authentication.)\ncurl -i https://bitbucket.org/api/1.0/users/<accountname>/ssh-keys"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "gitglossary - A Git Glossary topic branch"
},
{
"role": "assistant",
"content": "A regular Git branch that is used by a developer to\nidentify a conceptual line of development. Since branches are very easy\nand inexpensive, it is often desirable to have several small branches\nthat each contain very well defined concepts or small incremental yet\nrelated changes."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-config - Get and set repository or global options pushFetchFirst"
},
{
"role": "assistant",
"content": "Shown when git-push rejects an update that\ntries to overwrite a remote ref that points at an\nobject we do not have."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Git includeIf for personal and work profiles doesn't work\nI've been googling about this, trying different methods from different sources... but it doesn't work.\nI want to push commits with my personal profile (defined with \"git config --global user.email ...\") unless I'm on my work folder.\nThe content of my .gitconfig is located at C:/Users/my-user/\n[user]\n name = Personal\n email = [email protected]\n\n[includeIf \"gitdir: F:/Work/CompanyName/\"]\n path = F:/Work/CompanyName/.gitconfig-work\n \n\nContent of my .gitconfig-work is located at F:/Work/CompanyName/\n[user]\n name = Work\n email = [email protected]\n\nWhen I go to a cloned repository from work located at:\nF:/Work/CompanyName/Project\nI use:\ngit config --show-origin --get user.email\nAnd it shows:\nfile:C:/Users/<my-user>/.gitconfig \nInstead of the route I defined to work.\nThanks for your help.\n✨ For the future googlers\nI created a gist explaining the steps."
},
{
"role": "assistant",
"content": "You need to remove one space in:\n[includeIf \"gitdir: F:/Work/CompanyName/\"]\n\ni.e., make this read:\n[includeIf \"gitdir:F:/Work/CompanyName/\"]\n\nNote the lack of a blank between the colon after gitdir and the path name to be tested.\n(Your Git also needs to be at least version 2.13. You might consider using gitdir/i:f:/work/companyname/ so that you are not case-sensitive here, assuming your host system is also not case-sensitive, as the F: part suggests. The final slash is important as well; don't omit it without understanding what it does)"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git - Is it possible to exclude file from `git push`, but keep them in the local repository?\nIn my home directory I have files in a local git repository, because I want track them all under version control.\nMost of these files I want to push to a remote repository, but a few I want to keep in my local repository only (they contain mildly sensitive information). \nHow can I achieve this with git? Can I configure a \".gitignore-for-push\" file? I cannot use the local .gitignore file, because it would exclude these files completely from being tracked. \nps: I am aware of question Is there an exclude file-equivalent..., but the answer goes down the .gitignore path which I cannot use. The other question Exclude specific files when pushing... answers only a specific case for git+heroku, not git alone."
},
{
"role": "assistant",
"content": "You can go ahead and actually track these files (sans the sensitive info), but then use:\ngit update-index --assume-unchanged <file>\non each file. Then you can go ahead and add the sensitive info to each file, but Git will not see the file as changed, and not try to commit (and thus push) that sensitive info.\nTo get Git to update the info again, you'd use:\ngit update-index --no-assume-unchanged <file>"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Programmatically (not manually) finding the path where Git is installed on a Windows system\nI'd like to write a small build helper tool that shall read some properties of the current Git working directory, like the last commit hash, whether there's modified files and so on. I found that it is easier to use the installed Git binaries instead of reading the .git directory with its compressed files in an unknown format. But my tools must be as portable as possible. It's intended for .NET applications, so the only requirement should be .NET 2.0 or newer.\nNow how can I find the path where Git is installed? There's a default one that is used if the user has just clicked through the Git installer. But it may be different. And when I see all the programme files in git/bin, I really don't want that to be in my %PATH% (which other tools like TortoiseGit don't seem to require, too). I haven't found any path clues in the registry.\nWhat algorithm could I use to find Git, that is not a full file system scan? (Did I already say it needs to be fast?)"
},
{
"role": "assistant",
"content": "If you are inside of (or if you can open) your git bash shell, you can use pwd -W\n$ cd / && pwd -W\nC:/Program Files (x86)/Git\n\n(I know, this is probably not what you want, and it's quite elementary, but I spent some time to find this, and perhaps it's useful for other people)."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-am - Apply a series of patches from a mailbox --continue -r --resolved"
},
{
"role": "assistant",
"content": "After a patch failure (e.g. attempting to apply\nconflicting patch), the user has applied it by hand and\nthe index file stores the result of the application.\nMake a commit using the authorship and commit log\nextracted from the e-mail message and the current index\nfile, and continue."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git - the stupid content tracker -p --paginate"
},
{
"role": "assistant",
"content": "Pipe all output into less (or if set, $PAGER) if standard\noutput is a terminal. This overrides the pager.<cmd> configuration options (see the \"Configuration Mechanism\" section\nbelow)."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Easy way to setup GitLab with existing Gitolite configuration\n\nI have an existing Gitolite configuration with many users and repositories. It is setup in the default way as the Gitolite installation guide suggests.\nNow I would like to add GitLab to be able to do code reviews and bug tracking.\nWhat's the most convenient way to achieve this?"
},
{
"role": "assistant",
"content": "Original answer (January 2013)\nYou can follow the standard installation, and indicate in your gitlab.yml config file the location of your gitolite repo, as well as the gitolite admin user.\nHowever, GitLab requires from the user to register themselves in GitLab and copy their public ssh key.\nThat means you might need to adapt the way gitolite has stored existing gitolite users, since the name you have used is likely to be different than the name used by GitLab (it uses a name based on the login_email_auuid).\n\nUpdate (August 2018, 5 years later):\nAs commented below by Thomas, a few months after this answer, GitLab released GitLab 5.0, without gitolite.\n\nNow I would like to add GitLab to be able to do code reviews and bug tracking.\n What's the most convenient way to achieve this?\n\nThese days (2018, GitLab 11.2.x), code review is supported through merge request (it has been so since a few years already).\nSee:\n\n\"Demo: Mastering code review with GitLab\" from Emily von Hoffmann,\n\"Code Review Via GitLab Merge Requests\" from Maxim Letushov."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How do I escape characters in GitHub code search? [duplicate]\n\nThis question already has answers here:\n \n \n\n\n\n\nHow to search on GitHub to get exact string matches, including special characters\n\n (12 answers)\n \n\nClosed 2 years ago.\n\n\n\nI'm trying to use GitHub's code search to search for some lines of code containing characters like =, +, etc.\nI understand from https://help.github.com/articles/searching-code/#considerations-for-code-search that these characters are wildcards and have to be escaped, otherwise they will be ignored.\nHere's an example: \"if \\(done is True\\)\", and another: \"if (done is True)\". \nBoth return the same \"your query contains a character that is ignored\" warning on the right side of the search bar. My escaping doesn't seem to be doing anything and the results I get are with the characters ignored."
},
{
"role": "assistant",
"content": "I dont think you can escape characters for github\nFrom searching code doc:\n\nYou can't use the following wildcard characters as part of your search\n query: . , : ; / \\ ` ' \" = * ! ? # $ & + ^ | ~ < > ( ) { } [ ]. The\n search will simply ignore these symbols."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-pull - Fetch from and integrate with another repository or a local branch --negotiation-tip=<commit|glob>"
},
{
"role": "assistant",
"content": "By default, Git will report, to the server, commits reachable\nfrom all local refs to find common commits in an attempt to\nreduce the size of the to-be-received packfile. If specified,\nGit will only report commits reachable from the given tips.\nThis is useful to speed up fetches when the user knows which\nlocal ref is likely to have commits in common with the\nupstream ref being fetched. This option may be specified more than once; if so, Git will report\ncommits reachable from any of the given commits. The argument to this option may be a glob on ref names, a ref, or the (possibly\nabbreviated) SHA-1 of a commit. Specifying a glob is equivalent to specifying\nthis option multiple times, one for each matching ref name. See also the fetch.negotiationAlgorithm and push.negotiate configuration variables documented in git-config , and the --negotiate-only option below."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git update-index --assume-unchanged on directory\ngit 1.7.12\nI want to mark all files below a given directory as assume-unchanged.\n\ngit update-index --assume-unchanged dir/ gives \"Ignoring path.\"\n\ngit update-index --assume-unchanged dir/* quickly fails because it will encounter files which are not being tracked, hence it gives \"fatal: Unable to mark file\" and quits.\n\nTry generating a list of files to mark. cd into the desired directory and then run git ls-files | tr '\\n' ' ' | git update-index --assume-unchanged. This produces no error message, but it does not successfully mark the files. The first portion of the command, git ls-files | tr '\\n' ' ', correctly produces a space delimited list of all the files I want to mark. If I copy and paste the output of that command onto the command-line, then the git update-index command works. What is not working with the pipes?\n\n\nNo, it is not sufficient for me to add dir to .gitignore. I need these files to be in the repository, but undesired changes will be made locally that need to be ignored so that users can do pulls."
},
{
"role": "assistant",
"content": "git update-index wants the file names on its command line, not on its standard input. \nStep 1:\ncd into the folder you want to assume is unchanged\nStep 2:\nYou can do either this:\ngit update-index --assume-unchanged $(git ls-files | tr '\\n' ' ')\n\nor\ngit ls-files | tr '\\n' ' ' | xargs git update-index --assume-unchanged\n\nAlthough, with either case, file names with spaces will be problematic. If you have those, you can use this:\ngit ls-files -z | xargs -0 git update-index --assume-unchanged\n\nEdit: incorporated input from @MatthewScharley regarding git ls-files -z.\nWindows Commands\n\nNote: If you're on windows, use Git Bash to run these commands"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to fork a branch and not the repository?\n\nHow can I fork a branch instead of a complete repository?\nI wish to copy only the branch https://github.com/COMSYS/contiki/tree/split-buffer and not the complete repository https://github.com/jenshiller/contiki. \nHow to fork a branch in Git? won't work in my case. I don't want to clone the branch."
},
{
"role": "assistant",
"content": "In github (and in git's mental framework) you clone and fork repositories. \nThere's no way to fork a branch; that doesn't make sense. Just fork the project, and work off the branch you're interested in. You don't lose anything by doing so. \n\"Working off a branch\" usually means you \n\nclone a repository (e.g. git clone http://repository), then\ncheck out the branch you're interested in (git checkout awesome-branchname), \nand create a new branch based of that (git checkout -b new-even-more-awesome-branch-name)"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "how to reset develop branch to master\nI have develop & master branches, my develop branch is messy now and i would like to reset it and make it as a copy of my master. i'm not sure if merging the master into develop will make both of them identical. after trying to merge i got many conflicts i solved them using:\ngit checkout develop\ngit merge origin/master\n//got many conflicts\ngit checkout . --theirs\n\nis this enough for develop branch to be an identical copy to master ?\nThanks"
},
{
"role": "assistant",
"content": "If you want the two branches to be the same then\n// from Develop and assuming your master is up to date with origin/master\ngit reset --hard master"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "GitLab not sending notifications to merge request approvers\n\nI have written an entire software development course, and until recently we've been using Bitbucket. I recently rewrote the course to use GitLab instead, mostly because GitLab the username isn't tied to a particular email like Bitbucket. I had heard good things. But I'm running into problems already.\nThe first is that merge requests (what the other hosting services call \"pull requests\") are not sending out notifications to approvers. We just had the lesson where I taught my students to create merge requests. I had them add me as \"Reporter\" to their projects. Then I had them create a merge request, and add me as an \"Approver\".\nYet I received no email notifying me that two student had created merge requests with me as an approver on each. I double-checked, and my global notifications are set to \"Participate\".\nI reported this issue in a comment to a GitLab ticket, but received no response. I even filed a new official GitLab bug report; someone finally looked at it, and created another ticket for GitLab EE. So far no one has actually found the problem.\nSo as a workaround I went into my GitLab nofication settings and set the notification level for each student repository to \"Watch\" so that I (in theory) should be notified of any activity at all. Sure enough, I was notified when my students created merge requests.\nUnfortunately even with a notification level of \"watch\", I was not notified when a student updated a merge request by making a new commitment to the branch and pushing it to GitLab.\nAm I doing something wrong? Why am I not getting notifications of merge requests on which I am approver—not even when I'm watching the project? If I can't get this simple, core functionality to work I guess we'll move to Github, now that they introduced private repositories.\nUpdate: I finally abandoned GitLab, primarily because of basic issues like this one. I rewrote the software development course again, this time using GitHub."
},
{
"role": "assistant",
"content": "Role \"Reporter\" cannot accept/manager Merge Requests in the repository. See the whole list of permissions but basically they are:\n\nGuest: Read only access\nReporter: Issues and comments\nDeveloper: Push, actions to the repository\nMaintainer: Admin\n\nI did not test myself but maybe GitLab notifications check this internally. My recommendation is to protect the master branch or develop depending on your Git Workflow. Ideally only Maintainers can push or merge to protected branches after code review, so you should be assigned this role in the repos to approved things and hopefully receive the notifications. The global notification should be \"Participate\" and this is propagated to all your repos to avoid be overwhelmed by notifications (\"Watch\" notify all the activities in the repos). Developers should create feature or bugfix branches from master/develop and push always to this branch.\nSuggestion\nI would research some Git Workflow: Github, GitLab or GitFlow are very good examples to analyse. You can adapt the workflow to your own needs. Another MUST should be to configure GitLab CI/CD before merging into the protected branches to assure the robustness and quality of the code and teach the students good practices from the beginning.\nUPDATE 2\nThis is happening in the CE and EE. No emails are sent when pushing new commits to Merge Requests. I tested with \"Watch\", \"Custom\", \"Participate\", \"Developer\", \"Maintainer\" and no emails have been sent. Actually \"Custom\" has an specific option for \"Push to Merge Requests\". However even not ideal, there is a workaround if you want to use it. Actually it also sends the diff between commits inside the email. In Settings/Integration there is an option Emails on push. You can configure there a list of emails to send the notifications. See the image below. If you want to be informed when someone push new commits to the MR another workaround is to configure the CI pipeline. You will receive an email if the pipeline fails or succeeds (this is the way we are doing). Let's wait until GitLab people answers to your GitLab ticket. If this is a NO GO issue for you and none of the workarounds work for you, I would move to GitHub Private Repositories."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "GitHub \"can't automatically merge\"?\nSometimes when i try to merge the head fork into my base fork, or my base fork into the head fork, I get the following message on GitHub: \n\n\"Can’t automatically merge. Don’t worry, you can still create the pull request.\" \n\nHow do I view the conflicts, if there are any for this?\nI have read about 10 different examples with various commands but I can't tell what the names in the examples apply to in my situation as different names for bases, forks, branches, etc, exist.\nAfter all of this, I can't believe there isn't a command you can type to see the conflicts, edit the conflicts and go on with merging. \nIf there is, I haven't found it yet."
},
{
"role": "assistant",
"content": "Let's say there is your-branch and the master branch. You want to merge changes from your-branch into the master for others to see them, but someone else did conflicting changes to the master (e.g. merging their PR) in the meantime. It is often useful to merge master into your-branch (i.e. do the merge the other way round) before creating the PR.\nIn the command line, you can:\ngit checkout master\ngit pull\ngit checkout your-branch\ngit merge master\n\nNow you can see the list of conflicts. Follow the messages you get from git to resolve the conflicts. You can use your favorite tools, so it is way easier. Finally, you commit&push. When you re-create the PR, there should be no conflicts."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to see commits that were merged in to a merge commit?\nIf my-feature-branch was merged into my-main-branch, how can I see what commits were merged in from my-feature-branch?"
},
{
"role": "assistant",
"content": "git log abc123^..abc123\nshows the commits that got merged into merge-commit abc123.\nCreate a git alias log-merge for easy reuse:\n$ git config --global alias.log-merge \\\n'!f() { git log --stat \"$1^..$1\"; }; f'\n$ git log-merge abc123\n\nFor a one-line version:\n$ git config --global alias.log-merge-short \\\n'!f() { git log --pretty=oneline \"$1^..$1\"; }; f'"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Git Clone from GitHub over https with two-factor authentication\n\nI recently began using two-factor authentication on GitHub, and I am now unable to use git over https on private repos in the usual way:\npeter@computer:~$ git clone https://github.com/[...]/MyPrivateRepo\nCloning into 'MyPrivateRepo'...\nUsername for 'https://github.com': [...]\nPassword for 'https://[...]@github.com': \nremote: Invalid username or password.\nfatal: Authentication failed for 'https://github.com/[...]/MyPrivateRepo/'\n\nIf I disable two-factor authentication I can use it as before:\npeter@computer:~$ git clone https://github.com/[...]/MyPrivateRepo\nCloning into 'MyPrivateRepo'...\nUsername for 'https://github.com': [...]\nPassword for 'https://[...]@github.com': \nremote: Counting objects: 147, done.\nremote: Total 147 (delta 0), reused 0 (delta 0), pack-reused 147\nReceiving objects: 100% (147/147), 22.70 KiB | 0 bytes/s, done.\nResolving deltas: 100% (87/87), done.\nChecking connectivity... done.\n\nI know I can use SSH and everything works, but is there a way I can keep two-factor authentication while still being able to use GitHub over HTTPS, for example by sending an auth token with my request?"
},
{
"role": "assistant",
"content": "Find out how to fix this here:\nhttps://github.com/blog/1614-two-factor-authentication#how-does-it-work-for-command-line-git\n\nHow does it work for command-line Git?\nIf you are using SSH for Git authentication, rest easy: you don't need to do anything. If you are using HTTPS Git, instead of entering your password, enter a personal access token. These can be created by going to your personal access tokens page."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How do I use 'git rebase -i' to rebase all changes in a branch?\nHere's an example:\n>git status\n# On branch master\nnothing to commit (working directory clean)\n>git checkout -b test-branch\n>vi test.c\n>git add test.c\n>git commit -m \"modified test.c\"\n>vi README\n>git add README\n>git commit -m \"modified README\"\n\nNow I want to do a 'git rebase -i' that will let me rebase all commits for this branch. Is there something like 'git rebase -i HEAD~MASTER' or similar. I figure I could do 'git rebase -i HEAD~2', but I really don't want to have to count how many commits have been made. I could also do 'git rebase -i sha1' but I don't want to comb through git log to find the first commit sha1. Any ideas?"
},
{
"role": "assistant",
"content": "Ok, I'm asuming the branch is called \"feature\" and it was branched from \"master\".\nThere's this little git command called merge-base. It takes two commits and gives you the first common ancestor of both of those. So...\ngit merge-base feature master\n\n...will give you the first common ancestor of those two commits. Guess what happens when you pass that commit to git rebase -i, like...\ngit rebase -i `git merge-base feature master`\n\nInteractive rebase from the first common ancestor of both master and feature branch.\nProfit! ;)"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Move Git LFS tracked files under regular Git\nI have a project where I stored video files with Git LFS. Now I ran into some complications with my build server that doesn't yet support Git LFS. As it's an external service, I can't really affect the build process, and thus would want to move the files from under Git LFS back to \"regular\" Git. I managed to untrack the file types with git lfs untrack '<file-type>' but git lfs ls-files still gives a list of the files previously added.\nI imagine I could remove the files, push the changes and then manually re-add them, but is this really the recommended way of doing things?"
},
{
"role": "assistant",
"content": "I have just recently run into this problem where assets were accidentally added to git-lfs on one branch that shouldn't have been. My solution was:\ngit lfs untrack '<file-type>'\ngit rm --cached '<file-type>'\ngit add '<file-type>'\ngit commit -m \"restore '<file-type>' to git from lfs\"\n\nThe result is a rewrite of the git-lfs oid sha256 pointers with the standard file contents.\n\n(Edit 2019-03): The accepted answer was changed to provide an easy solution for simpler cases. See also the edits in the answer by VonC for alternate solutions in case you have a more complex case on hand."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git - the stupid content tracker git-update-ref"
},
{
"role": "assistant",
"content": "Update the object name stored in a ref safely"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Should I git ignore xcodeproject/project.pbxproj file?\nin a XCode project, I offen got xcodeproject/project.pbxproj file changed, but useless info for me, it for compile.\nShould I git ignore this file and xcodeproject/projectxworkspace/username.xcuserdata/UserInterfaceState.xcuserstate file?"
},
{
"role": "assistant",
"content": "Update in the light of Swift Package Manager: If you're building a project as a Swift package - you should definitely ignore this file as it can be generated using file system as source of truth. You can do that by using the following command:\n$ cd ~/Projects/MyProjectFolder/\n$ swift package generate-xcodeproj\n\nFor non-SwiftPM answer - see below.\nThis file holds the list of all the files in the project, settings of targets and which files belong to which targets. It's probably the meatiest file in project bundle. You should not ignore this file. There are few points for this:\n\nYou may not want to work on this project alone or;\nYou're planning on working on project from different machines;\nYou'll want to share your code base with others;"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How can I prevent git from thinking I did a rename\nI have two files index.html and template.html. I moved most of index.html into template.html and now git thinks that I did a rename when I add both files. Is it possible to prevent this in specific cases?"
},
{
"role": "assistant",
"content": "Why Git Thinks Your Files Are Copies\nGit tracks content, not filenames. As a result, if two files have substantially similar content, git will think you copied or renamed the file. If you read git-log(1), you will learn:\n\nThe similarity index is the percentage of unchanged lines, and the dissimilarity index is the percentage of changed lines. It is a rounded down integer, followed by a percent sign. The similarity index value of 100% is thus reserved for two equal files, while 100% dissimilarity means that no line from the old file made it into the new one.\n\nSo, assuming your similarity index is 100%, git will think that's a copy. Your best bet is to add a sensible log message or note (see git-notes(1) for more on that) to explain what's going on if you don't think git is doing the right thing.\nAdjusting the Similarity Index\nYou might also try adjusting the values git uses for considering something a copy or rename. The manual for git-log(1) says:\n-M[<n>], --find-renames[=<n>]\n\nIf generating diffs, detect and report renames for each commit. For\nfollowing files across renames while traversing history, see --follow. If\nn is specified, it is a threshold on the similarity index (i.e. amount\nof addition/deletions compared to the file’s size). For example, -M90%\nmeans git should consider a delete/add pair to be a rename if more than\n90% of the file hasn’t changed.\n\n-C[<n>], --find-copies[=<n>] \n\nDetect copies as well as renames. See also --find-copies-harder.\nIf n is specified, it has the same meaning as for -M<n>.\n\nAgain, this won't help you if the files are mostly similar, but you can certainly use these values to tune how similar they need to be in order to be considered copies or renames. Your mileage may vary."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-log - Show commit logs %B"
},
{
"role": "assistant",
"content": "raw body (unwrapped subject and body)"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-config - Get and set repository or global options guitool.<name>.noRescan"
},
{
"role": "assistant",
"content": "Don’t rescan the working directory for changes after the tool\nfinishes execution."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-grep - Print lines matching a pattern grep.threads"
},
{
"role": "assistant",
"content": "Number of grep worker threads to use. If unset (or set to 0), Git will\nuse as many threads as the number of logical cores available."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How do I use vimdiff to resolve a git merge conflict?\nI just merged a branch into my master in git and I got Automatic merge failed; fix conflicts and then commit the result. Now I ran git mergetool and vimdiff opened with the image below. I don't know how to use vimdiff. What does each panel here mean and how should I proceed to fix the merge conflict?"
},
{
"role": "assistant",
"content": "@chepner's answer is great, I would like to add some details on \"how should I proceed to fix the merge conflict\" part of the question. If you look into how to actually use vimdiff in this case, it goes below.\n\nFirst, to address the \"abort everything\" option - if you do not want to use \"vimdiff\" and want to abort the merge: press Esc, then type :qa! and hit Enter. (see also How do I exit the Vim editor?). Git will ask you if the merge was complete, reply with n.\n\nIf you want to use vimdiff, here are some useful shortcuts. This assumes you know basics of Vim (navigation and insert/normal mode):\n\nnavigate to the bottom buffer (merge result): Ctrl-W j\nnavigate to next diff with j/k; or, better, use ] c and [ c to navigate to the next and previous diff respectively\nuse z o while on a fold to open it, if you want to see more context\nfor each diff, as per @chepner's answer, you can either get the code from a local, remote or base version, or edit it and redo as you see fit\n\n\nto get it from the local version, use :diffget LO\nfrom remote: :diffget RE\nfrom base: :diffget BA\nor, if you want to edit code yourself, get a version from local/remote/base first, and then go to the insert mode and edit the rest\n\nonce done, save the merge result, and quit all windows :wqa\n\nif you want to abort merging the current file and not mark it as resolved, quit with :cquit instead: How do you cancel an external git diff?\n\nnormally, git detects that the merge was made and creates the merge commit\n\nIt does not appear to be possible to add both local and remote conflict hunks without copy pasting or custom shortcuts: https://vi.stackexchange.com/questions/10534/is-there-a-way-to-take-both-when-using-vim-as-merge-tool which is a shame since add add is such a common conflict type.\nTo prevent vimdiff from asking you to press enter every time it starts, add to your .vimrc:\nset shortmess=Ot\n\nas mentioned at: https://vi.stackexchange.com/questions/771/how-can-i-suppress-the-press-enter-prompt-when-opening-files-in-diff-mode\nYou can search the Internet for other vimdiff shortcuts. I have found this one useful: https://gist.github.com/hyamamoto/7783966"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Grouping repos on GitHub? [duplicate]\n\nThis question already has answers here:\n \n \n\n\n\n\nCan I arrange repositories into folders on Github?\n\n (8 answers)\n \n\nClosed 5 years ago.\n\n\n\nHere's the situation: I'm migrating a bunch of repos to github. The repos are currently organized into groups/directories like 'stack', 'websites', 'applications', etc.\nThere's no way (I've found) to create groups or folders on GitHub for repos, except with organizations, which seems a poor choice. But maybe not? The problem here is that some of the groups are very small, while others are large... with sub-groups, and I'd like to keep all the projects in one root bucket.\nSo, I'm left with maybe using a naming convention. Like: 'stack-apache', 'website-foo.com', 'application-some-project'. Or just giving up on organizing them in github and let the project pages / website handle the organization.\nRe. scale, I'm looking at 20+ repos initially, with new repos added over time at an estimated rate of 2-5 /year for the next few years.\nAnyone have experience with this kind of thing?"
},
{
"role": "assistant",
"content": "Update 2024\nThere (still) isn't a concrete way of grouping in Github.\nInstead, I use an Organization profile readme and manually group relevant repos.\nIts not ideal, and its manual, but it gives me full control - including linking down to common items like Actions.\n\n\nUpdate 2023\nGithub added the lists-feature (still in beta).\nIf you star a repository you can add it to an existing list or create a new one.\nStill not a very intuitive way to group your own repositories but it works.\n\n\nUpdate 2020\nI'm not sure exactly when, but Github has (somewhat recently) added the concept of projects, which kind of fill the missing gap. I would argue they aren't quite the same as Bitbucket Projects but they are better suited to grouping related repo's in Github than Orgs\n\n\nOriginal answer\nOrganisations in my opinion fit a different purpose in Github than grouping repos (although they do serve to group repos). Organisations are more about fine grained control around repo access (thats my understanding).\nBitbucket has introduced the concept of \"Projects\", with the following hierarchy (with a comparison to Github):\nBitbucket: Team -> has N -> Projects -> has N -> Repos\nGithub: Organisation -> has N -> Repos\n\nBitbucket still allows Repos to not be assigned to an team or project, I am guessing to support older repos that existed before the concept of a project.\nTo answer the question, no, not directly. There are outstanding requests with Github to add groups, but it doesn't seem likely (at this point in time).\nPrefixing works as a so-so solution:\nRepo name: [project]__[repo name]\nLets say you have a client \"acme\" with two repos:\nEg: acme__api\nEg: acme__landing\nGithub's search is quick and inline, so doing a search for acme__ in your repo list will list all repos for the acme__ project."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to preserve all ignored files in git clean -fd?\nWhen I have .gitignore data/* and run git clean -fd, the data folder and all its content files are deleted.\nWhat I want is to delete all unrevisioned files in a git repo while excluding all ignored files (i.e. DON'T delete gitignored files). What could I do?"
},
{
"role": "assistant",
"content": "Git normally doesn't clean ignored files unless the -x flag is specified, but strangely it cleans out when configured as you did (folder/*).\nAs @VonC pointed out, you should change your .gitignore-file to ignore the directory (data/) rather than its contents (data/*).\nIt's a subtle difference, but it matters to git."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-submodule - Initialize, update or inspect submodules rebase"
},
{
"role": "assistant",
"content": "the current branch of the submodule will be rebased\nonto the commit recorded in the superproject."
}
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.