messages listlengths 3 3 |
|---|
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-log - Show commit logs --abbrev-commit"
},
{
"role": "assistant",
"content": "Instead of showing the full 40-byte hexadecimal commit object\nname, show a prefix that names the object uniquely.\n\"--abbrev=<n>\" (which also modifies diff output, if it is displayed)\noption can be used to specify the minimum length of the prefix. This should make \"--pretty=oneline\" a whole lot more readable for\npeople using 80-column terminals."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "SSH-Keygen \"no such file or directory\"\nTrying to Generate a public key for my git. Using Powershell. \nPS>ssh-keygen -t rsa -b 4096 -C \"[email protected]\"\nGenerating public/private rsa key pair.\nEnter file in which to save the key (//.ssh/id_rsa):\nCould not create directory '//.ssh': Read-only file system\nEnter passphrase (empty for no passphrase):\nEnter same passphrase again:\nSaving key \"//.ssh/id_rsa\" failed: No such file or directory\n\nIf I give a location for the file and run\nssh -vT [email protected]\n\nIt doesn't check the custom location for the public key to use\nOpenSSH_7.1p1, OpenSSL 1.0.2d 9 Jul 2015\ndebug1: Reading configuration data /etc/ssh/ssh_config\ndebug1: Connecting to github.com [<<ANIPADDRESS>>] port 22.\ndebug1: Connection established.\ndebug1: key_load_public: No such file or directory\ndebug1: identity file /.ssh/id_rsa type -1\ndebug1: key_load_public: No such file or directory\ndebug1: identity file /.ssh/id_rsa-cert type -1\ndebug1: key_load_public: No such file or directory\ndebug1: identity file /.ssh/id_dsa type -1\ndebug1: key_load_public: No such file or directory\ndebug1: identity file /.ssh/id_dsa-cert type -1\ndebug1: key_load_public: No such file or directory\ndebug1: identity file /.ssh/id_ecdsa type -1\ndebug1: key_load_public: No such file or directory\ndebug1: identity file /.ssh/id_ecdsa-cert type -1\ndebug1: key_load_public: No such file or directory\ndebug1: identity file /.ssh/id_ed25519 type -1\ndebug1: key_load_public: No such file or directory\ndebug1: identity file /.ssh/id_ed25519-cert type -1\ndebug1: Enabling compatibility mode for protocol 2.0\ndebug1: Local version string SSH-2.0-OpenSSH_7.1\ndebug1: Remote protocol version 2.0, remote software version libssh-0.7.0\ndebug1: no match: libssh-0.7.0\ndebug1: Authenticating to github.com:22 as 'git'\ndebug1: SSH2_MSG_KEXINIT sent\ndebug1: SSH2_MSG_KEXINIT received\ndebug1: kex: server->client [email protected] <implicit> none\ndebug1: kex: client->server [email protected] <implicit> none\ndebug1: expecting SSH2_MSG_KEX_ECDH_REPLY\ndebug1: Server host key: ssh-rsa SHA256:<<SCAREDTOPUBLISH>>\ndebug1: Host 'github.com' is known and matches the RSA host key.\ndebug1: Found key in /.ssh/known_hosts:1\ndebug1: SSH2_MSG_NEWKEYS sent\ndebug1: expecting SSH2_MSG_NEWKEYS\ndebug1: SSH2_MSG_NEWKEYS received\ndebug1: Roaming not allowed by server\ndebug1: SSH2_MSG_SERVICE_REQUEST sent\ndebug1: SSH2_MSG_SERVICE_ACCEPT received\ndebug1: Authentications that can continue: publickey\ndebug1: Next authentication method: publickey\ndebug1: Trying private key: /.ssh/id_rsa\ndebug1: Trying private key: /.ssh/id_dsa\ndebug1: Trying private key: /.ssh/id_ecdsa\ndebug1: Trying private key: /.ssh/id_ed25519\ndebug1: No more authentication methods to try.\nPermission denied (publickey)."
},
{
"role": "assistant",
"content": "The command could not save your key, likely because it was unable to determine your $HOME directory. Specify a file, at a location where you have write access:\nssh-keygen -t rsa -b 4096 -C \"[email protected]\" -f /path/to/key\n\nThis will save your private key in /path/to/key and the public key in /path/to/key.pub.\nWhen successful,\ninstead of an error message, you will see something like:\n\nYour identification has been saved in /path/to/key.\nYour public key has been saved in /path/to/key.pub.\nThe key fingerprint is:\n76:f7:82:04:1e:64:eb:9c:df:dc:0a:6b:26:73:1b:2c\nThe key's randomart image is:\n+--[ RSA 2048]----+\n| o |\n| o . |\n| + |\n| + + |\n| S o . |\n| . = = o |\n| E * + o |\n| o.++ o |\n| *o.. |\n+-----------------+\n\n\nAnd then, to make ssh look for the file at the custom location,\nuse the -i flag:\nssh -i /path/to/key -vT [email protected]\n\n\nAlternatively,\nif you have an authentication agent running,\nyou can add your key to the agent with:\nssh-add /path/to/key\n\nOnce your key is stored by the agent, you can simply do:\nssh -T [email protected]\n\nThe response should look something like:\n\nHi USER! You've successfully authenticated, but GitHub does not provide shell access.\n\n\nAnd you can go ahead and clone your repository with:\ngit clone [email protected]:USER/REPO"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Git push results in \"Authentication Failed\"\n\nI have been using GitHub for a little while, and I have been fine with git add, git commit, and git push, so far without any problems. Suddenly I am having an error that says:\n\nfatal: Authentication Failed\n\nIn the terminal I cloned a repository, worked on a file and then I used git add to add the file to the commit log and when I did git commit, it worked fine. Finally, git push asks for username and password. I put those in correctly and every time I do this, it says the same error.\nWhat is the cause of this problem and how can I fix it?\nThe contents of .git/config are:\n[core]\n repositoryformatversion = 0\n filemode = true\n bare = false\n logallrefupdates = true\n[remote \"origin\"]\n url = http://www.github.com/######/Random-Python-Tests\n fetch = +refs/heads/*:refs/remotes/origin/*\n[branch \"master\"]\n remote = origin\n merge = refs/heads/master\n[user]\n name = #####\n email = ############"
},
{
"role": "assistant",
"content": "If you enabled two-factor authentication in your GitHub account you\nwon't be able to push via HTTPS using your accounts password. Instead\nyou need to generate a personal access token. This can be done in the\napplication settings of your GitHub account. Using this token as your\npassword should allow you to push to your remote repository via HTTPS.\nUse your username as usual.\n\nCreating a personal access token\nYou may also need to update the origin for your repository if it is set to HTTPS. Do this to switch to SSH:\ngit remote -v\ngit remote set-url origin [email protected]:USERNAME/REPONAME.git"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git - the stupid content tracker git-describe"
},
{
"role": "assistant",
"content": "Give an object a human readable name based on an available ref"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to publish html report\n\nI am using a GitLab pipeline to run some tests and produce a coverage report.\nWhat I would like to do is be able to publish the produced coverage folder (that includes an html page and an src folder) to some internal GitLab static page, viewable by some team members.\nI am aware of the gitlab pages concept, but the steps indicate that I have to use a static site generator for this purpose.\nMy questions are the following:\n\nis the concept usable only when publishing on the official GitLab website (gitlab.io) or can I make use of my on-prem GetLab installation (i.e. so that my pages are available in my.local.gitlab.server/mynamespace/thepagesproject)?\ncan I just upload an index.html file with the folder of its contents and make it accessible?\nwhat is the optimal way of making use of an EXISTING project, so that just to add some html pages to it (ideally I would like to avoid creating a new project just for this purpose)"
},
{
"role": "assistant",
"content": "Can I use GitLab Pages on self-hosted instance?\nYes, GitLab Pages works on self-hosted instances. You may need to register a wildcard domain name for *.pages.<your-gitlab-domain-name>, and generate SSL certs if you are running gitlab over https only.\nOnce you have a domain, edit /etc/gitlab/gitlab.rb and add the extra settings, and run a gitlab-ctl reconfigure (leave out the pages_nginx settings if you are running over http only):\ngitlab_pages['enable'] = true\npages_external_url \"https://pages.<your-gitlab-domain-name>\"\npages_nginx['redirect_http_to_https'] = true\npages_nginx['ssl_certificate'] = \"/etc/gitlab/ssl/pages.<your-gitlab-domain-name>.crt\"\npages_nginx['ssl_certificate_key'] = \"/etc/gitlab/ssl/pages.<your-gitlab-domain-name>.key\"\n\nOnce that is done you will be able to access per-project pages via <group>.pages.<your-gitlab-domain-name>/<project>\nCan I upload whatever I want to pages?\nYes. Each GitLab CI job can create content to publish in GitLab pages by writing it into a public folder, and registering public as an artifact directory. A final pages job should be added to the CI pipeline which causes the pages content to be published (overwriting anything that was there before). All the content of the public directory will be available via the <group>.pages.<your-gitlab-domain-name>/<project> URL, which means you have full control over content.\nNote that the pages job in CI doesn't need to have any script, it just needs to be present with the job name \"pages\". This is a magic job name that triggers the pages publish. You may want to add job restrictions so that this only runs on master branch pipelines.\nCan I add pages publish to an existing project?\nYes. Any steps that create content you want to publish should write the content to a public subdirectory, and register the public directory as an artifact directory.\nmy job:\n stage: build\nscript:\n - echo \"Do some things and write them to public directory\" > public/index.html\nartifacts:\n paths:\n - public\n expire_in: 2 weeks\n\nNote: I like to add expire_in: 2 weeks to limit the length of time artifacts are kept around. Once the pages have been published the artifacts aren't really needed.\nFinally you need to add a pages job to trigger the pages publish:\n# This job does nothing but collect artifacts from other jobs and triggers the pages build\n# The artifacts are picked up by the pages:deploy job.\npages:\n stage: deploy\n script:\n - ls -l public\n artifacts:\n paths:\n - public\n only:\n - master\n\nUsually you will only want to publish on master branch, but you have freedom to choose when you want the pages publish to run. It is important to note that when the pages publish runs it will fully replace any content that was previously published, so you can't append to existing content (although there are some hacks that allow you to achieve something similar)."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "'git stash apply' with Interactive Mode\nI have a serie of files into a stash (stash{0}) and I would like to git apply just some parts/hunks of these files (usually known as Interactive mode).\nIs it possible?\nI've seen that is possible to perform a\ngit stash save -p 'Stash name'\n\nbut it seems not possible to do\ngit stash apply -p 'Stash name'\n\nDo you know a way to achieve it?"
},
{
"role": "assistant",
"content": "Is it possible?\n\nYes it is!\ngit checkout -p stash@{0}\n\nWhere you can replace the 0 in stash@{0} with the index of the stash you want to apply.\nUse git stash list and git show -p stash@{n} if unsure which n is the stash you want to apply.\nDon't forget to git stash drop stash@{n} when you know you won't need that stash anymore, since git checkout obviously will not drop the stash for you.\nWhy does it work?\nThe key is to realize that stashes are, in essence, references to commits just like tags and branches.\nIndeed, they're stored in .git/refs/stash, one line per stash hash.\nCaveats\nAs @mgadda mentioned in the comments below, git checkout -p tries to apply the whole difference between a commit and the current workspace.\nIn the case of a git stash, if the stash you're trying to apply was done against a different commit, then git checkout -p stash@{n} will try to apply interactively all the differences between the commit stash@{n} and the commit of the current workspace, including all their parent commits that are different.\nFor example, if you're trying to apply a stash that was saved \"many commits ago\" into the current workspace, git checkout -p stash@{n} will try to apply not only the changes in the stash proper, but will also try to revert all changes that happened between the commit on which the stash is based and the current commit.\nConversely, if you're trying to apply a stash \"from the future\", i.e. into a branch that is a number of commits from before the commit on which the stash is based, then git checkout -p stash@{n} will try to also apply all the other changes that happened between the current commit and the commit from the future, besides the changes from the stash itself.\n(In case you're wondering, git checkout -p stash@{n} a stash from a parallel branch will try to revert all changes between the current commit and the original branching point and also apply all changes between the branching point and the other branch, besides the change in the stash).\nWorkarounds\nThere are a few workarounds, none of them are perfect for every situation:\n\n\n\nBe really careful with the patches you accept when you do git checkout -p stash@{n}\n\n\n\n\nDo a git stash pop, then git stash again before doing git checkout -p .... But if you wanted to do a partial apply of your stash to avoid conflicts, this won't really help. In that case, see solution 4 below.\n\n\n\n\nIf you have a graphical diff tool supported by git (like meld), you can use git difftool and \"apply left\" only the changes you're interested in:\n\n\ngit difftool -d stash@{n} to compare a whole stash and all its files\n\ngit difftool stash@{n} -- path/to/file to compare a single file\n\n\n\n\n\n(Based on @andrew's answer) On a detached head, go back to the \"parent\" commit of the stash you're interested in, apply the stash, re-stash interactively only the parts you're interested in, go back and reapply the smaller stash.\n\n\n\nStep by step:\ngit checkout stash@{n}^ # notice the \"^\". \n\n# Now you're in a detached head in the parent commit of the stash.\n# It can be applied cleanly:\ngit stash apply stash@{n}\n\n# Now save only the diffs you're interested in:\ngit stash -p\n\n# remove the rest of the old stash\ngit checkout -- . # be careful or you could remove unrelated changes\n\n# go back to the branch where you want to apply the smaller stash\ngit checkout <my previous branch>\n\n# apply the smaller stash\ngit stash pop"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to view shared runner queue\n\nI'm using Gitlab's shared runner. Build has been in 'pending' state for over 20 minutes.\nHow to debug this? is it something to do with the runner availability or script execution issue.. Is it possible to gain more insight by any means?"
},
{
"role": "assistant",
"content": "I don't think the UI supports viewing a shared runner's queue. However, this 'pending' state can be caused by things other than a queue.\nCheck the tags for that pipeline stage against the tags supported by the runners available to the runners activated for your project:\n\nRemember, tags can vary from stage to stage, so it's possible for the first few stages to work before your pipeline is blocked.\nGitlab-ci will indicate 'pending' when a runner cannot be found with tags matching a given stage."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Add all files using git add except one directory\nI am trying to add all the files to my git index using \ngit add -A\n\nHowever, there is one directory with very large files that is causing this error:\nfatal: confused by unstable object source data for 9f8c02a8d2a04d7fffed08b299a0cb8996ab7ecb\n\nTherefore, the adding process is broken! How can I tell git I want to exclude this directory while adding everything else? Available online solutions first add everything and then remove some files. Obviously, I cannot do this because git crashes while adding the files in that specific directory."
},
{
"role": "assistant",
"content": "If your Git version is new enough,\ngit add -- . ':!<path>'\n\n. means all under the current directory, and ':!<path>' means to exclude the path. So it means to add all except path.\nThe term for . ':!<path>' is pathspec. However, the doc is a bit obscure and lack of abundant examples. I find this post very helpful to understand pathspec."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Gitlab CI how to deploy an application via SSH\n\nI'm using Hosted Gitlab to host my Git repositories, and more recently I've been using it to build/deploy PHP and Java applications to servers.\nWhat I'd like to do is once a build is complete, deploy the application using SSH. Sometimes this might just be uploading the contents of the final build (PHP files) to a server via SSH, or other times it may be uploading a compiled .jar file and then executing a command on the remote server to restart a service.\nI've set up my own Docker container as a build environment, this includes things such as Java, PHP, Composer, and Maven all that I need for builds to complete. I'm using this image to run builds.\nWhat I'd like to know is, how can I SSH into an external server in order to perform deployment commands that I can specify in my gitlab-ci.yaml file?"
},
{
"role": "assistant",
"content": "You can store your SSH key as a secret variable within gitlab-ci.yaml and use it during your build to execute SSH commands, for more details please see our documentation here.\nOnce you have SSH access you can then use commands such as rsync and scp to copy files onto your server. I found an example of this in another post here which you can use as a reference."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to create a default branch in GitLab?\n\nI am not able to push code to GitLab for the first time. \nI have created a Gitlab project on the web interface.\nI have created an ASP MVC project.\nI did \"git init\" in that directory.\nI added remote origin.\nI added and committed the changes and then, when I want to push the changes to remote I get the following error:\nremote: A default branch (e.g. master) does not yet exist for\n...\nremote: Ask a project Owner or Maintainer to create a default branch:\n...\nerror: failed to push some refs to\n\nSo I want to know if I can create a branch with the role Developer?\nIf yes how to create a default branch?\nIf no, what should my next steps be?"
},
{
"role": "assistant",
"content": "This is followed by issue 54155\n\nIt seems as though 'developer' should not be able to create projects if it does not have permission to then populate that project without asking an admin to intervene.\nI don't understand, why I have enough permissions to create a project, but not to make it ready enough so I can push into it, and need to use another persons time in my organization to get ready to work.\nIMHO it would be logical to either allow users with status developer to create a project in a way that it's ready to push code to - or just don't let developers create a project and tell them they have to ask a maintainer or owner.\n\nIssue 51688 mentions:\n\nThen I have to login with gitlab admin admin...Aggregate access to user test to test6.git as a dev or maintainer... and finally I can make push... But if user test creates another repo, I have to repeat all these steps again....\nMaintainer can create new branch. Please use maintainer account to push the new project.\nBut it doesn't make sense that a user has permissions to create empty repositories but not initialize a default branch or push to their newly created repository."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-rev-list - Lists commit objects in reverse chronological order --all-match"
},
{
"role": "assistant",
"content": "Limit the commits output to ones that match all given --grep ,\ninstead of ones that match at least one."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "What is the difference between git am and git apply?\nBoth git am and git apply can be used to apply patches.\nIt seems that git am automatically commits, whereas git apply only touches the files but doesn't create a commit. Is that the only difference?"
},
{
"role": "assistant",
"content": "Both the input and output are different:\n\ngit apply takes a patch (e.g. the output of git diff) and applies it to the working directory (or index, if --index or --cached is used).\ngit am takes a mailbox of commits formatted as email messages (e.g. the output of git format-patch) and applies them to the current branch.\n\ngit am uses git apply behind the scenes, but does more work before (reading a Maildir or mbox, and parsing email messages) and after (creating commits)."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to undo a merge on Bitbucket?\nI've created a merge (into the 'master' branch) that's now on a Bitbucket repo. Long story short: I need to undo that merge. \nI know that you can do this at the Github site itself, but Bitbucket doesn't have that feature. I'm not clear on how to do this with Git without causing a mess."
},
{
"role": "assistant",
"content": "You need to first clone the repository on your local system (you can get the repo URL in SSH or HTTPS format from the \"Overview\" page of the repository in Bitbucket): \ngit clone [email protected]:my/repo.git\n-or-\ngit clone https://[email protected]/my/repo.git\n\ngit checkout master\n\n.. then revert the most recent commit. First list the available commits with:\ngit log\n\n.. then select the commit before the merge:\ngit reset --hard 72ead1c4c1778c23c277c4f15bbb68f3bb205f54\n\n.. where the hash is the hash of the commit before the merge (from the log). Finally, force-push the changes back to Bitbucket, overwriting history.\ngit push -f\n\nNaturally if the repo is shared, and its other users have pulled your most recent commit and built atop it, they won't be happy. So in that case be sure to notify everybody of what you're doing.\nrevert, as mentioned in the other answers is another option; it keeps the commit you made, but modifies the repository further (with a new commit) in such way that it undoes the changes you made. Whether you want to use revert depends on whether you want the information in your commit to remain in the repo history or not.\nFor more detail on undoing changes in git, see a good tutorial page by Atlassian."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "What are the git concepts of HEAD, master, origin?\nAs I'm learning about git, I keep coming across the terms HEAD, master, origin, and I'm not sure what the differences are. If I understand correctly, HEAD is always equal to the latest revision? And if so, is that the latest revision of the whole repository, or of a specific branch or tag? This is so confusing. I've read so many tutorials on this and things like branching/merging, but still can't wrap my head around it."
},
{
"role": "assistant",
"content": "I highly recommend the book \"Pro Git\" by Scott Chacon. Take time and really read it, while exploring an actual git repo as you do. \nHEAD: the current commit your repo is on. Most of the time HEAD points to the latest commit in your current branch, but that doesn't have to be the case. HEAD really just means \"what is my repo currently pointing at\".\nIn the event that the commit HEAD refers to is not the tip of any branch, this is called a \"detached head\".\nmaster: the name of the default branch that git creates for you when first creating a repo. In most cases, \"master\" means \"the main branch\". Most shops have everyone pushing to master, and master is considered the definitive view of the repo. But it's also common for release branches to be made off of master for releasing. Your local repo has its own master branch, that almost always follows the master of a remote repo.\norigin: the default name that git gives to your main remote repo. Your box has its own repo, and you most likely push out to some remote repo that you and all your coworkers push to. That remote repo is almost always called origin, but it doesn't have to be.\nHEAD is an official notion in git. HEAD always has a well-defined meaning. master and origin are common names usually used in git, but they don't have to be."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "What causes git push to fail all of a sudden with \"User was holding a relation lock for too long\"? [closed]\nClosed. This question is not reproducible or was caused by typos. It is not currently accepting answers.\n \n \n\n\n\n\n\n\n\n\n\n\n\n This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.\n\n\nClosed 8 years ago.\n\n\n\n\n\n\n\n Improve this question\n \n\n\n\nI came back to some code I had open after a few hours and made some changes to the code and then pushed it. All of a sudden, I am getting this error:\nsura@raitorial:~/workspace/conse (master) $ git push \nCounting objects: 15, done.\nDelta compression using up to 8 threads.\nCompressing objects: 100% (6/6), done.\nWriting objects: 100% (6/6), 492 bytes | 0 bytes/s, done.\nTotal 6 (delta 5), reused 0 (delta 0)\nremote: canceling statement due to conflict with recovery\nremote: LINE 1: ...er\".\"date_joined\" FROM \"bb_repository\" INNER JOIN \"auth_user...\nremote: ^\nremote: DETAIL: User was holding a relation lock for too long.\nremote: \nTo [email protected]:sureumar__/conse.git\n ! [remote rejected] master -> master (pre-receive hook declined)\nerror: failed to push some refs to '[email protected]:sureumar__/conse.git'\nsura@raitorial:~/workspace/conse (master) $ \n\nHow can I diagnose the cause of this error?"
},
{
"role": "assistant",
"content": "As the message indicates, this is a problem on Bitbucket's end. You can check the status of their services by visiting http://status.bitbucket.org/, which will inform you (for example):\n\nVerifying - We are gradually restoring inbox content to mitigate any further replication issues. Any messages you'd expect to be there should re-appear slowly as we incrementally complete scheduled maintenance.\nJun 16, 03:22 UTC \nUpdate - Maintenance on the primary database caused excessive lag on replicas used for authenticating Git and Mercurial operations over HTTPS. We've failed over to a spare replica and restored service. Please contact our support team if you're still experiencing problems with your pushes or pulls. \nJun 16, 02:48 UTC\nIn progress - We're seeing unanticipated complications on gitweb and hgweb traffic, which we are currently working to resolve. Please watch this page for updates. \nJun 16, 02:03 UTC\n\nIf no current issues are listed there, contact support."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-blame - Show what revision and author last modified each line of a file -e --show-email"
},
{
"role": "assistant",
"content": "Show the author email instead of the author name (Default: off).\nThis can also be controlled via the blame.showEmail config\noption."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-log - Show commit logs notes.mergeStrategy"
},
{
"role": "assistant",
"content": "Which merge strategy to choose by default when resolving notes\nconflicts. Must be one of manual , ours , theirs , union , or cat_sort_uniq . Defaults to manual . See the \"NOTES MERGE STRATEGIES\"\nsection of git-notes for more information on each strategy. This setting can be overridden by passing the --strategy option to git-notes ."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-log - Show commit logs blocks"
},
{
"role": "assistant",
"content": "Blocks of moved text of at least 20 alphanumeric characters\nare detected greedily. The detected blocks are\npainted using either the color.diff.{old,new}Moved color.\nAdjacent blocks cannot be told apart."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "SourceTree error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version\n\nI'm using SourceTree and try to clone from a general github repository, but I got this error:\n\nfatal: unable to access 'https://github.com/mfitzp/15-minute-apps.git/': error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version\n Completed with errors, see above.\n\nHow to solve it?"
},
{
"role": "assistant",
"content": "Check Tools > Options > Git in SourceTree, if you're using Use Embedded Git, you can see the git version is 1.9.5 which is old, latest version of git is 2.16.2.\nSo click Use System Git, if you install the newer version of git, after Use system Git it'll show newer version, then try to clone again it should work fine.\nAlso see another answer HERE."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-log - Show commit logs %>>( <N> ) , %>>|( <M> )"
},
{
"role": "assistant",
"content": "similar to %>( <N> ) , %>|( <M> ) respectively, except that if the next\nplaceholder takes more spaces than given and\nthere are spaces on its left, use those\nspaces"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-svn - Bidirectional operation between a Subversion repository and Git --no-minimize-url"
},
{
"role": "assistant",
"content": "When tracking multiple directories (using --stdlayout,\n--branches, or --tags options), git svn will attempt to connect\nto the root (or highest allowed level) of the Subversion\nrepository. This default allows better tracking of history if\nentire projects are moved within a repository, but may cause\nissues on repositories where read access restrictions are in\nplace. Passing --no-minimize-url will allow git svn to\naccept URLs as-is without attempting to connect to a higher\nlevel directory. This option is off by default when only\none URL/branch is tracked (it would do little good)."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Can gitconfig options be set conditionally?\nVia Github I use the same set of \"dot files\" on several different computers and servers. On the Macs and Linux boxes under my direct control I have Sublime Text 2 installed and set up as my git merge and commit editor of choice. However, on remote (i.e., not under my direct control) servers I would select to use vim. \nI would rather not create and maintain a second .gitconfig for those remote servers. Is there a way to do something like this:\n[core]\n if [[ $IS_REMOTE -eq 1 ]]; then\n editor = \"vim\"\n else\n editor = \"subl -n -w\"\n fi\n\nwhere I've somehow set $IS_REMOTE based on the hostname?"
},
{
"role": "assistant",
"content": "You can conditionally include another Git config file based on your Git directory or branch in Git 2.13 and later.\nPut your default configuration in file ~/.gitconfig as usual. At the end, conditionally include another configuration file:\n[user]\n email = [email protected]\n name = John McGehee\n\n# All work Git repositories are in a subdirectory of ~/work.\n# All other Git repositories are outside ~/work.\n[includeIf \"gitdir:~/work/\"]\n path = .gitconfig.work\n\nThen, in ~/.gitconfig.work add or override configuration values you want when using a repository located in ~/work or any subdirectory thereof:\n[user]\n email = [email protected]\n\nYou can observe the difference by changing to a Git directory under ~/work, and running:\ngit config user.email\n\nTry the same command in a Git directory that is not under ~/work."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Merge and delete branch in one step/command\nIs it possible, to merge a branch and automatically delete it with a single command? The delete step should only be executed if merging was successful."
},
{
"role": "assistant",
"content": "No, git doesn't support this at the same time.\nHowever, you can run the commands in a shell conditionally:\ngit merge source-branch && git branch -d source-branch\n\nEdit:\n-d will only remove merged branches while -D will also remove unmerged branches, so -d will ensure that the branch is merged and you don't delete a branch by accident."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-daemon - A really simple server for Git repositories --user=<user> --group=<group>"
},
{
"role": "assistant",
"content": "Change daemon’s uid and gid before entering the service loop.\nWhen only --user is given without --group , the\nprimary group ID for the user is used. The values of\nthe option are given to getpwnam(3) and getgrnam(3) and numeric IDs are not supported. Giving these options is an error when used with --inetd ; use\nthe facility of inet daemon to achieve the same before spawning git daemon if needed. Like many programs that switch user id, the daemon does not reset\nenvironment variables such as $HOME when it runs git programs,\ne.g. upload-pack and receive-pack . When using this option, you\nmay also want to set and export HOME to point at the home\ndirectory of <user> before starting the daemon, and make sure any\nGit configuration files in that directory are readable by <user> ."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Gitlab CI not caching\n\nI have the following gitlab ci yaml file:\nimage: steveedson/ci\n\nstages:\n - build\n\ncache:\n untracked: true\n key: \"$CI_PROJECT_ID\"\n paths:\n - node_modules/\n - _site/vendor/\n - .bundled/\n - .yarn\n\nbuild:\n stage: build\n script:\n - ls -l\n - yarn config set cache-folder .yarn\n - yarn install\n - ...\n\nWhen my successful builds finish, they show:\nCreating cache 1970478...\nCreated cache\n\nAnd when the next commit triggers a build, I get:\nChecking cache for 1970478...\nSuccessfully extracted cache\n\nBut the ls -l in my first step doesn't show the cached directories. I've tried caching the cache key but this doesn't help.\nThis is running on gitlab.com, not a private server."
},
{
"role": "assistant",
"content": "So, my configuration is correct, and Gitlab does support caches between jobs, however they have not added this to shared runners on gitlab.com, yet.\nThe issue is here https://gitlab.com/gitlab-com/infrastructure/issues/919 and should be added soon."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Fetching all tags from a remote with git pull\nI currently have a git remote setup like the following:\n[remote \"upstream\"]\n url = <redacted>\n fetch = +refs/heads/*:refs/remotes/upstream/*\n\nWhen I issue git pull on branch master, all remote heads are fetched into remotes/upstream, then remotes/upstream/master is merged into master. Any tags that can be reached are also fetched at the same time, which is very convenient.\nI'd like git pull to additionally fetch all tags from the remote, not just those that are directly reachable from the heads. I originally tried seting tagopt == --tags, but found this caused only tags to be fetch and thus broke everything. (Junio even says that's a horrendous misconfiguation).\nIs there a way to make git pull fetch all remote tags by default, in addition to the remote heads?"
},
{
"role": "assistant",
"content": "A simple git fetch --tags worked for me."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to unlock a runner?\n\nContext\nI am the (beginner) admin of my company GitLab server and I have a shared runner that is locked for an unknown reason. I couldn't find any information about what it means to be locked (and the difference with \"paused\") or how a runner can get locked. I also tried to find a way to unlock it, but all I could find was \"how to register an unlocked runner in the first place\".\nWhat I did\n\nRemove the runner from https://gitlab.my-company.com/admin/runners.\nUnregister the runner with gitlab-runner unregister the-runner-name.\nRegister a new one with gitlab-runner register --locked=false.\nClean everything with gitlab-runner verify --delete.\n\nWhat I wanted to do\nEdit the current runner with something like gitlab-runner edit the-runner-name --locked=false.\nWhat I wanted to do even more\nGo to https://gitlab.my-company.com/admin/runners and click on Unlock runner.\nQuestion\nIs there a way to unlock a runner or do I have to unregister it each time it's locked and register a new one?"
},
{
"role": "assistant",
"content": "Just go to runners page and click you runner (or Edit icon next to its name). It should lead you to a screen where you can remove Locked status. \nYou may be using some old version of gitlab or have no sufficient permissions if you can't access this screen."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to host image at https://user-images.githubusercontent.com/{path}/{filename}?\n\nI'm a developer, I need many screenshots to put in readme.md file where to store or host it? I found out that some people use https://user-images.githubusercontent.com/{path}/{filename} to host their image and link them with readme.md file. How to put images there?"
},
{
"role": "assistant",
"content": "You can create a .github/images directory in your repo and add all your assets there.\nAssets added here will be available on\nhttps://raw.githubusercontent.com/{github_user_name}/{repo_name}/{branch}/.github/images/{asset_name}.{asset_extension}\n\nOnce you push .github/images directory to remote your assets should be available through the mentioned link.\nAnd https://user-images.githubusercontent.com/ is used by GitHub to store images added in issues, PR's, etc.,\nHope it helps!\nUPDATE:\nYou can also create an assets directory in the root of your repo and use a relative path to the image.\n/assets/{asset_name}.{asset_extension}\n\n\n\nWith this, images can be previewed without actually pushing to remote.\nHosting on user-images.githubusercontent.com subdomain\nIf you do not intend to store any images in your repository, you can always use this https://user-images.githubusercontent.com/\nTo host your images in user-images subdomain you can do the following\n\nClick New Issue this will open up the issue creator.\nDrag and Drop or Upload your image in the body content\nWait for upload completion and copy the URL for the image.\nCancel the issue creation and continue.\n\nBut you will not have access to these images once uploaded, you cannot delete them. You can always contact GitHub Support if required to delete."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-revert - Revert some existing commits git revert -n master~5..master~2"
},
{
"role": "assistant",
"content": "Revert the changes done by commits from the fifth last commit\nin master (included) to the third last commit in master\n(included), but do not create any commit with the reverted\nchanges. The revert only modifies the working tree and the\nindex."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git - the stupid content tracker <commit-ish>"
},
{
"role": "assistant",
"content": "Indicates a commit or tag object name. A\ncommand that takes a <commit-ish> argument ultimately wants to\noperate on a <commit> object but automatically dereferences\n<tag> objects that point at a <commit>."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Deleting Files using Git/GitHub\n\nFirst off, I'm new to Git.\nI deleted a bunch of files locally on my Mac using Finder. I want the files that I deleted to no longer show in the current branch, but they do. \nAny Git users know a command to update the index?"
},
{
"role": "assistant",
"content": "I think this would be a simpler way to do what you want:\ngit add . -A \n\nThen you would just do:\ngit commit -m \"removed some files\"\n\nAs noted above."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Searching code in a specific GitHub branch\n\nI am trying to search some code in a branch in a GitHub repository.\nHowever this indicates that I can only search the default branch.\nIs there a way I can search code in non-default branch in my GitHub repository?"
},
{
"role": "assistant",
"content": "Not from the GitHub web interface itself, as mentioned in \"How can I search for a commit message on GitHub?\": only the default branch (generally master) is indexed.\nYour best bet is to clone the repository, and there, search in all branches (with git log -S for instance)."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-log - Show commit logs -E --extended-regexp"
},
{
"role": "assistant",
"content": "Consider the limiting patterns to be extended regular expressions\ninstead of the default basic regular expressions."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-fetch - Download objects and refs from another repository -u --update-head-ok"
},
{
"role": "assistant",
"content": "By default git fetch refuses to update the head which\ncorresponds to the current branch. This flag disables the\ncheck. This is purely for the internal use for git pull to communicate with git fetch , and unless you are\nimplementing your own Porcelain you are not supposed to\nuse it."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to change a git submodule to point to a subfolder?\nSkimming through the SubModule tutorial, I created a submodule out of the boto project. Then, I discovered that I actually need only a subset of this project - specifically, the boto folder.\nI would like to change my submodule to point to this folder. When I look in .gitmodules, I see\n[submodule \"backup/src/boto\"]\n path = backup/src/boto\n url = https://github.com/boto/boto.git\n\nWhat URL should I use instead of https://github.com/boto/boto.git? After I change the URL, should I delete the boto folder locally and re-pull?"
},
{
"role": "assistant",
"content": "I'm afraid the URL for submodules always just points to the repository - you can't specify that you only want a subfolder of a repository, in the same way that git doesn't support \"narrow clones\" in general.\nIf you can't live with having the whole repository as a submodule, you could always create a new repository that's cloned from boto and then set up a cron job to: \n\ngit fetch that repository into a directory\nUse git filter-branch to update a branch where the subdirectory is at the top level. \nAdd that branch of the repository as the submodule. However, that's all a bit fiddly and my preference would just be to live with having the whole repository as a submodule."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-log - Show commit logs --children"
},
{
"role": "assistant",
"content": "Print also the children of the commit (in the form \"commit child…\").\nAlso enables parent rewriting, see History Simplification above."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "What is the difference / relationship between GitHub Projects and Milestones?\n\nThe recent update to GitHub added something called Projects into the GitHub workflow, and because I don't have any particular experience with project tracking tools such as Jira or Trello (hey, at least I noticed the similarity), could anyone, please, elaborate on the (key) differences between GitHub's Milestones and the new Projects?\nIf I understand correctly, Milestones are a way of organizing issues into smaller \"sub-projects\" - smaller than the whole \"project\" (which, in my world view, is represented by the repository). When all issues are done/closed, the milestone can be regarded as complete.\nThe newly introduced Projects are also, as I see it, a way of organizing issues into smaller-than-the-repository \"sub-projects\" (albeit called Projects). I understand the workflow is supposed to be slightly different and more fine-grained than with \"mere\" Milestones.\nSo, are Projects something that supplements Milestones (or rather Milestones supplement Projects now?) or should I rather view Projects as a replacement of Milestones?\nWhere exactly do the Projects actually fall into the repository[-milestone]-issue hierarchy?\nSadly, GitHub's blog entry about the introduction of the Projects doesn't mention any relationship (https://github.com/blog/2256-a-whole-new-github-universe-announcing-new-tools-forums-and-features).\nI somehow feel there is one, but I can't put a finger on it."
},
{
"role": "assistant",
"content": "I'm wondering the exact same thing. Here is what I came up with.\nFirst, let's review the main similarities and differences:\n\nAn issue can belong to multiple Projects, but only one Milestone.\nProjects are never complete. There is no progress bar, or deadline. Projects have no progress bar or deadline (they do now, though it is hidden inside the project's menu as a \"Track project progress\" checkmark, and there's no percentage calculation of progress), but can now be closed (as pointed out by @Sheen)\nMilestones on the other hand have all that, but lack any form of organization. An issue is either in a milestone, or isn't. (They can be ordered as pointed out by @Nick McCurdy)\nIssues can be filtered by Milestone, but not by Project. As pointed out by @cmonkey, issues can now be filtered by Project as well as Milestone.\nProjects can contain Notes (which can be converted as issues) so it doesn't pollute the issue tracker with vague ideas\nA Project can span over multiple Milestones, and a Milestone can contains parts of different Projects.\nAn Organization can have Projects as well. These projects can include tickets from any repository in the organization, which makes it quite useful.\n\nSo the way I see it, is that Projects are a completely separate way to visualize and organize your work on an higher level (think \"project management\", multiple teams, multiple repository, etc.), while Milestones are a way to organize your deadlines and releases on a more basic level (think \"release management\", \"versions\", etc.). With this in mind, it makes sense that an issue only belongs to one Milestone (it's only released or pushed to production once) but can be part of different Projects.\nI'm sure they are other ways to look at it though, and I'm interested to hear other opinions.\nEdit December 2017\nSome time ago, after working with Milestones and Projects for over a year, I realized there is another important aspect I had completely overlooked.\n\nMilestones is a tool for Scrum methodology. Milestones are good for timeboxed iterations and working in sprints with batches of issues.\nProjects is a tool for Kanban methodology. Projects are good for continuous delivery and steady flow of work."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-config - Get and set repository or global options column.clean"
},
{
"role": "assistant",
"content": "Specify the layout when listing items in git clean -i , which always\nshows files and directories in columns. See column.ui for details."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Git Push ERROR: Repository not found\n\nI am having a very strange problem with git and github. When I try and push, I am getting:\ngit push -u origin master\nERROR: Repository not found.\nfatal: The remote end hung up unexpectedly\n\nI added the remote:\ngit remote add origin [email protected]:account-name/repo-name.git\n\nAny ideas?"
},
{
"role": "assistant",
"content": "Check to see if you have read-write access.\nThe Git error message is misleading. I had a similar issue. I had been added to an existing project. I cloned it and committed a local change. I went to push and got the ERROR: Repository not found. error message.\nThe person who added me to the project gave me read-only access to the repository. A change by them and I was able to push."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "What are the ethics & etiquette of forking someone else's github project to release it as a gem?\n\nI'm doing some spare time coding around CultureGrid. They have a SOLR API to access 1.2m cultural artefacts. I've released a gem to consume their service, but I've got a nice idea about using Datamapper with a SOLR adapter backend to do it in a better way.\nI just found a project from last year on Github handily called dm-solr-adapter. It's a fork of someone else's work from 2008 and to use it you have to clone the project and run a rake task to install it (not much use on heroku, so I'd have to vendor it). Unfortunately that task is now broken because they didn't pin their gem versions, and Bones has changed considerably between version 2 and 3.\nBasically - it needs a bit of a recode to get it to be a gem, and if I'm going to do that I might as well release it myself and do it the way I know - using Jeweler instead.\nSo, of course I'll drop all of the authors a line, but I just wondered what the ethics and etiquette are here. Do I include my username in the gem or do I use the original gem name? Could that potentially trash someone else's installation, even though the gem is not listed on Rubygems.org? Do I follow their numbering convention? They seem to have chosen \"1.0.0\" and stuck with it, with no further activity. Or do I just start again from version 0.1.0?\nFailing that, do I just grab the bits I want, include it in my new project and give a hat tip? That doesn't sound very useful for others who might want to do the same things.\nOr perhaps I take the bits I find useful, make an entirely new gem called something like dm-solr-backend and go from scratch?\nOh, the dilemmas - what would you do?"
},
{
"role": "assistant",
"content": "So, if you're not going to release a gem, just go ahead and fork (assuming the license allows it) and don't worry about it. That's 100% OK and even expected behavior at this point. Forks are actually one of the easiest ways to accept patches from contributors. The network graph is often a good way to evaluate both the health of a project as well as the potential areas for improvement.\nIf you intend to release a gem because the original has become unmaintained, you should either:\n\nRelease it as username-originalgemname\nContact the original author and offer to take it over. Then push new gems under the original name.\n\nIf you intend to release a gem because you need changes to the gem that would not benefit the community as a whole, you should either:\n\nUnpack the gem into a vendor directory and never release\nRelease it as username-originalgemname\n\nIn most cases, there is no problem with a gem release named username-originalgemname. This was the model that the GitHub gem repository took, so that's how most people handle forks at this point."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-config - Get and set repository or global options merge.guitool"
},
{
"role": "assistant",
"content": "Controls which merge tool is used by git-mergetool when the\n-g/--gui flag is specified. The list below shows the valid built-in values.\nAny other value is treated as a custom merge tool and requires that a\ncorresponding mergetool.<guitool>.cmd variable is defined. araxis bc codecompare deltawalker diffmerge diffuse ecmerge emerge examdiff guiffy gvimdiff kdiff3 meld nvimdiff opendiff p4merge smerge tkdiff tortoisemerge vimdiff winmerge xxdiff"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-config - Get and set repository or global options --comment <message>"
},
{
"role": "assistant",
"content": "Append a comment at the end of new or modified lines. If _<message>_ begins with one or more whitespaces followed\nby \"#\", it is used as-is. If it begins with \"#\", a space is\nprepended before it is used. Otherwise, a string \" # \" (a\nspace followed by a hash followed by a space) is prepended\nto it. And the resulting string is placed immediately after\nthe value defined for the variable. The _<message>_ must\nnot contain linefeed characters (no multi-line comments are\npermitted)."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to generate patch for all commits in a branch?\nHow can I generate patch for all commits in a given branch by knowing only the branch name?\nThis step is part of a complex workflow all of which is being automated. Hence requiring someone to manually determine the first commit in the branch is not an option.\nNote that anything relying on reflog is not an option either because changes in the branch are not made locally."
},
{
"role": "assistant",
"content": "If you know from which branch your \"given branch\" has been created, then making a patch is easy:\ngit diff master Branch1 > ../patchfile\ngit checkout Branch2 \ngit apply ../patchfile\n\n(and you can generate a patch applicable without git too)\nBut finding the right \"creation commit\" of a branch can be complex: see \"Finding a branch point with Git?\"\nThe OP akirekadu used:\ngit format-patch $(git merge-base --fork-point master)..branchB \n\nYou can see it used in \"git diff between working copy and branch base\"\nlegends2k adds in the comments:\n\nOne can verify the generated patch with git apply --stat patchfile\nThis won't apply, but give the details of the patch.\n\n\nWarning: AGP notes in the comments that:\n\n$(git merge-base --fork-point master)..branchB command may not find the correct branch root revision every time\n\n\nijoseph points out in the comments\n\nIncidentally, Phabricator handles this kind of stuff seamlessly by automatically generating those patch files for each push."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-archive - Create an archive of files from a named tree"
},
{
"role": "assistant",
"content": "SYNOPSIS git archive [--format=<fmt>] [--list] [--prefix=<prefix>/] [<extra>]\n\t [-o <file> | --output=<file>] [--worktree-attributes]\n\t [--remote=<repo> [--exec=<git-upload-archive>]] <tree-ish>\n\t [<path>…]"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Has anyone implemented a git clone or interface library using nodejs? [closed]\nIt's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.\n \n \n\n\n\nClosed 11 years ago.\n\n\n\nI'm looking for an implementation of git which is accessible from nodejs - does such a beast exist?"
},
{
"role": "assistant",
"content": "Looks like there are now several options for using git from node: \n\ngift: simple Node.js wrapper for the Git CLI with an API based on Grit (npm / github)\nnode-git: a node.js git implementation modeled on grit (npm / github)\nnodegit: libgit2 asynchronous native bindings (npm / github)\nnode-git: a thin wrapper around the command-line git command (github)"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Stop gitlab runner to not remove a directory\n\nI have a directory which is generated during a build and it should not be deleted in the next builds. I tried to keep the directory using cache in .gitlab-ci.yml:\ncache:\n key: \"$CI_BUILD_REF_NAME\"\n untracked: true\n paths:\n - target_directory/\nbuild-runner1:\n stage: build\n script:\n - ./build-platform.sh target_directory\n\nIn the first build a cache.zip is generated but for the next builds the target_directory is deleted and the cache.zip is extracted which takes a very long time. Here is a log of the the second build:\nRunning with gitlab-ci-multi-runner 1.11.\n on Runner1\nUsing Shell executor...\nRunning on Runner1...\nFetching changes...\nRemoving target_directory/\nHEAD is now at xxxxx Update .gitlab-ci.yml\nFrom xxxx\nChecking out xxx as master...\nSkipping Git submodules setup\nChecking cache for master...\nSuccessfully extracted cache\n\nIs there a way that gitlab runner not remove the directory in the first place?"
},
{
"role": "assistant",
"content": "What you need is to use a job artifacts:\n\nArtifacts is a list of files and directories which are attached to a\njob after it completes successfully.\n\n.gitlab-ci.yml file:\nyour job:\n before_script:\n - do something\n script:\n - do another thing\n - do something to generate your zip file (example: myFiles.zip)\n artifacts:\n paths:\n - myFiles.zip\n\nAfter a job finishes, if you visit the job's specific page, you can see that there is a button for downloading the artifacts archive.\nNote\n\nIf you need to pass artifacts between different jobs, you need to use dependencies.\nGitlab has a good documentation about that if you really have this need http://docs.gitlab.com/ce/ci/yaml/README.html#dependencies"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Coloring white space in git-diff's output\nRegarding code formatting I'm kind of purist :). I very often remove unnecessary white spaces (lines with only ws, ws at the end of lines etc). I even have set vim to show that kind of lines colored to red.\nMy problem is that using git-diff I often see something like this:\n- else{ \n+ else{\n\nEven if I have git-diff colored I can't see difference (in that particular situation I removed 1 ws at the end of line). Is there any way to tell git-diff to show that ws colored to red? (for example those matched with /\\s+$/ regexp)."
},
{
"role": "assistant",
"content": "With with Git 2.11 (Q4 2016) and after, you can do:\ngit config diff.wsErrorHighlight all\n\nSee doc on git diff and on git config.\n\nFor versions older than that, you can set the color.diff.whitespace config setting, e.g. with:\ngit config color.diff.whitespace \"red reverse\"\n\n(I'm assuming that you already have color.diff or color.ui set to auto since you say that you see coloured patches from git diff anyway.)\nIf you want to fine tune the type of whitespace errors that are highlighted in red, you can then change core.whitespace, but blank-at-eol is enabled by default so you probably won't need to change that for the example you mention.\nA possible source of confusion is that in the output of git diff, whitespace errors are only highlighted in the lines that are introduced, not those that are removed. (Update: as Paul Whittaker points out in his answer, which you should up-vote :), you can see these by reversing the sense of the diff with git diff -R.)\nYou can find more documentation on these config options in the git config man page\nIf you don't want to use the -R kludge you can use the WhiteSpace Error Highlight option from the diff man page.\n\n--ws-error-highlight=\nHighlight whitespace errors on lines specified by in the color specified by color.diff.whitespace.\n is a comma\nseparated list of old, new, context. When this option is not given,\nonly whitespace errors in new lines are highlighted. E.g.\n--ws-error-highlight=new,old highlights whitespace errors on both deleted and added lines. all can be used as a short-hand for\nold,new,context.\n\ngit diff --ws-error-highlight=new,old <file>\nor\ngit diff --ws-error-highlight=all <file>\nWith versions older than 2.11, there’s no way to permanently turn this on and store this in config aside from using an alias:\ngit config alias.df 'diff --ws-error-highlight=all'\nNow you can use:\ngit df <file>\nTo see the changes in red."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-svn - Bidirectional operation between a Subversion repository and Git branch"
},
{
"role": "assistant",
"content": "Create a branch in the SVN repository. -m --message Allows to specify the commit message. -t --tag Create a tag by using the tags_subdir instead of the branches_subdir\nspecified during git svn init. -d<path> --destination=<path> If more than one --branches (or --tags) option was given to the init or clone command, you must provide the location of the branch (or\ntag) you wish to create in the SVN repository. <path> specifies which\npath to use to create the branch or tag and should match the pattern\non the left-hand side of one of the configured branches or tags\nrefspecs. You can see these refspecs with the commands git config --get-all svn-remote.<name>.branches\ngit config --get-all svn-remote.<name>.tags where <name> is the name of the SVN repository as specified by the -R option to init (or \"svn\" by default). --username Specify the SVN username to perform the commit as. This option overrides\nthe username configuration property. --commit-url Use the specified URL to connect to the destination Subversion\nrepository. This is useful in cases where the source SVN\nrepository is read-only. This option overrides configuration\nproperty commiturl . git config --get-all svn-remote.<name>.commiturl --parents Create parent folders. This parameter is equivalent to the parameter\n--parents on svn cp commands and is useful for non-standard repository\nlayouts."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Why is the `git subtree` not working even though I have git 1.8.3.2 installed on Ubuntu 12.10?\nI am about to deploy my AngularJS based static site as a Github Page with Yeoman. Step 3 of the deployment instructions tell me to do\ngit subtree push --prefix dist origin gh-pages\nbut when I enter that I get \ngit: 'subtree' is not a git command. See 'git --help'.\nThis SO answer provided me instructions on how to upgrade to the latest git-core and ensure it always get upgraded to the latest stable release. \nsudo add-apt-repository ppa:git-core/ppa\nsudo apt-get update\nsudo apt-get install git\n\nAfter running those commands I did git --version to make sure I had the latest version and apparently I did since git version 1.8.3.2 was the output. Now when I tried running \ngit subtree push --prefix dist origin gh-pages \nagain I still got the same following error \ngit: 'subtree' is not a git command. See 'git --help'. \nFinally I just restarted Ubuntu 12.10 and tried to run the command again but once again, I got the same error. \nHow come the git subtree command is still not working even though I have upgraded to the current stable release?"
},
{
"role": "assistant",
"content": "It actually is installed on Ubuntu but for some reason it's not put anyplace where git can find it. Easiest way is to create a symlink:\nsudo chmod +x /usr/share/doc/git/contrib/subtree/git-subtree.sh\nsudo ln -s /usr/share/doc/git/contrib/subtree/git-subtree.sh /usr/lib/git-core/git-subtree\n\nUPDATE 1: looks like a patch has been submitted upstream to fix this but it hasn't yet been merged.\nUPDATE 2: the patch to fix this in Debian has been merged, but since they went the route of a separate git-subtree package I don't think this will make it to Ubuntu 12.04. Seems to not be an issue in 14.04 as /usr/lib/git-core/git-subtree is already created correctly by the git package."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Difference between .gitignore rules with and without trailing slash like /dir and /dir/\nIs there a difference between /dir and /dir/ in the .gitignore file within a Git repository?\nHow are the following different?\n/dir\n/dir/\n/dir/*"
},
{
"role": "assistant",
"content": "Yes, these rules are different.\n\n/dir will match a file, directory, link, anything named dir\n/dir/ will match only a directory named dir\n/dir/* will match all files, directories and anything else inside\na directory named dir (but not the dir directory itself).\n\n/dir, /dir/ and /dir/* are NOT equivalent. The difference\nis very clear when using overriding rules, like the famous !.gitkeep\nto get around the limitation of tracking empty directories. Suppose\nthe existence of the file dir/.gitkeep\n\nWith /dir and /dir/, Git won't even look inside the directory\nso the .gitkeep won't be seen.\nWith /dir/*, the file will be detected by Git and the directory\nwill be kept if this .gitkeep is committed, because the rule\ndoesn't apply to the directory itself, only to its contents.\n\nOBSERVATION: All the rules mentioned above are anchored at the current directory\n(the place where the .gitignore is), because of the / prefix.\nWithout the prefix, the rules would apply not only for that specific directory, but also for the sub-directories or everywhere in the repository,\nif the .gitignore is located at the root level."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to disable auto pipelines in gitlab\n\nSince gitlab limited free tier minutes on gitlab CI/CD. I would like to disable auto start for my pipeline after commit.\nI would like to run pipeline only manually by click in gitlab interface.\nHow can I do it?"
},
{
"role": "assistant",
"content": "You can disable the Gitlab CI/CD Pipelines in project by following steps:\n\nGo to Project's Settings >> General >> Visibility, project features, permissions\nExpand the Repository section\nEnable or Disable the CI/CD toggle\nThen, click on Save Changes\n\nYou can verify the same, the CI/CD option has been disappeared from left-hand side panel.\n\n\n\nI have now updated the answer with reference to question:\nAdding [ci skip] or [skip ci] inside the commit message will not trigger a pipeline on push.\nMore reference: https://docs.gitlab.com/ee/ci/yaml/#skip-pipeline"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-log - Show commit logs notes.rewriteRef"
},
{
"role": "assistant",
"content": "When copying notes during a rewrite, specifies the (fully\nqualified) ref whose notes should be copied. May be a glob,\nin which case notes in all matching refs will be copied. You\nmay also specify this configuration several times. Does not have a default value; you must configure this variable to\nenable note rewriting. Set it to refs/notes/commits to enable\nrewriting for the default commit notes. Can be overridden with the GIT_NOTES_REWRITE_REF environment variable.\nSee notes.rewrite.<command> above for a further description of its format."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-log - Show commit logs git log -p -m --first-parent"
},
{
"role": "assistant",
"content": "Shows the history including change diffs, but only from the\n“main branch” perspective, skipping commits that come from merged\nbranches, and showing full diffs of changes introduced by the merges.\nThis makes sense only when following a strict policy of merging all\ntopic branches when staying on a single integration branch."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-rev-list - Lists commit objects in reverse chronological order --exclude-hidden=[fetch|receive|uploadpack]"
},
{
"role": "assistant",
"content": "Do not include refs that would be hidden by git-fetch , git-receive-pack or git-upload-pack by consulting the appropriate fetch.hideRefs , receive.hideRefs or uploadpack.hideRefs configuration along with transfer.hideRefs (see git-config ). This option affects the next pseudo-ref option --all or --glob and is cleared after processing them."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-grep - Print lines matching a pattern grep.fallbackToNoIndex"
},
{
"role": "assistant",
"content": "If set to true, fall back to git grep --no-index if git grep is executed outside of a git repository. Defaults to false."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-apply - Apply a patch to files and/or to the index --intent-to-add"
},
{
"role": "assistant",
"content": "When applying the patch only to the working tree, mark new\nfiles to be added to the index later (see --intent-to-add option in git-add ). This option is ignored unless\nrunning in a Git repository and --index is not specified.\nNote that --index could be implied by other options such\nas --cached or --3way ."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Git \"does not appear to be a git repository\" ip and port instead of domain?\n\nI'm trying to commit my first Git repository to a gitlab instance, which I've set up on a debian-VM. Everything is going to happen via local network. The following commands are shown in gitlab after creating a new repo.\nmkdir test\ncd test\ngit init\ntouch README\ngit add README\ngit commit -m 'first commit'\ngit remote add origin [email protected]:1337:Matt/test.git\ngit push -u origin master\n\nAfter entering git push -u origin master this happens:\n[email protected]'s password:\nfatal: '1337:Matt/test.git' does not appear to be a Git repository\nfatal: Could not read from remote repository.\n\nPlease make sure you have the correct access rights\nand the repository exists.\n\nCould the problem be the port on which Git is running at? Gitlab is accessible through port 617 so I'am able to reach the GUI via http://xxx.xxx.xxx.xxx:617/Matt/test\nThe password I've entered seems to be correct, because a wrong password will end up in a \"permission denied\" message. OT: I don't know why I've to enter a passwd, because I've generated and added ssh-keys, as described in gitlab, but that's an other problem."
},
{
"role": "assistant",
"content": "I've solved my problem. The given port 1337 wasn't the problem, although it was wrong too, because ssh does not seem to be able to handle a port in url:\nUsing a remote repository with non-standard port\nThe Git-url which worked for me was:\n[email protected]:repositories/Matt/test.git\n\nMy Git user home dir is located in /home/git/ and the repositories are stored in /home/git/repositories so i had to add repositories to my Git-path.\nThe reason why GitLab told me to use the url [email protected]:1337:Matt/test.git seems to be a wrong configured Git path in GitLab. I'll try to fix this now.\nEdit:\nThe wrong host was configured in /home/git/gitlab/config/gitlab.yml. The \"host\" there must be without port... There is an extra option for the port if needed.\nEdit3:\nStill unable to push or fetch my test-repository without repositories in path..\nhttps://github.com/gitlabhq/gitlab-public-wiki/wiki/Trouble-Shooting-Guide#could-not-read-from-remote-repository\nMaybe something to do with rsa-keys but I don't understand how this belongs together.\nEdit4: (Problem(s) seem to be solved)\nMy rsa-keys were ok. The problem was that I've configured my sshd_config to allow only a certain user for ssh-login. I've simply added Git to the list of allowed users AllowUsers mylogin git\nNow I don't have to login via password anymore (You never have to login via password if ssh rsa keys are set up correctly) and the path works without \"repositories\" as it should. Now I understand, that this is just a normal ssh-connection - I hadn't realized this before..\nThe way I figured it out:\nlogin via terminal as root:\nservice ssh stop #Current SSH-Connection won't be closed..\n/usr/sbin/sshd -d\n\n====debugging mode===\n\nThen in Git Bash:\nssh -Tv [email protected]\n\nAfterwards the terminal with sshd running in debug mode has thrown an error that Git is not allowed to login because of AllowUsers...\nDon't forget to start your ssh service afterwards:\nservice ssh start"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-log - Show commit logs log.diffMerges"
},
{
"role": "assistant",
"content": "Set diff format to be used when --diff-merges=on is\nspecified, see --diff-merges in git-log for\ndetails. Defaults to separate ."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "gitglossary - A Git Glossary bare repository"
},
{
"role": "assistant",
"content": "A bare repository is normally an appropriately\nnamed directory with a .git suffix that does not\nhave a locally checked-out copy of any of the files under\nrevision control. That is, all of the Git\nadministrative and control files that would normally be present in the\nhidden .git sub-directory are directly present in the repository.git directory instead,\nand no other files are present and checked out. Usually publishers of\npublic repositories make bare repositories available."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-log - Show commit logs -C[<n>] --find-copies[=<n>]"
},
{
"role": "assistant",
"content": "Detect copies as well as renames. See also --find-copies-harder .\nIf n is specified, it has the same meaning as for -M<n> ."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-config - Get and set repository or global options http.postBuffer"
},
{
"role": "assistant",
"content": "Maximum size in bytes of the buffer used by smart HTTP\ntransports when POSTing data to the remote system.\nFor requests larger than this buffer size, HTTP/1.1 and\nTransfer-Encoding: chunked is used to avoid creating a\nmassive pack file locally. Default is 1 MiB, which is\nsufficient for most requests. Note that raising this limit is only effective for disabling chunked\ntransfer encoding and therefore should be used only where the remote\nserver or a proxy only supports HTTP/1.0 or is noncompliant with the\nHTTP standard. Raising this is not, in general, an effective solution\nfor most push problems, but can increase memory consumption\nsignificantly since the entire buffer is allocated even for small\npushes."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Gitlab test coverage visualization is not working\n\nHi guys I have a express application and I'm playing around with gitlab to add Gitlab test coverage visualization\nHere is my .gitlab-ci.yml\nstages:\n - test\n - dockerize\n - staging\n - production\n\nunit-tests:\n stage: test\n script:\n - npm install\n - npm run test\n - npm run test-coverage\n - cat coverage/cobertura-coverage.xml\n - \"echo 'Code coverage: 90.90'\" \n coverage: '/Code coverage: \\d+\\.\\d+/'\n rules:\n - if: '$CI_PIPELINE_SOURCE == \"merge_request_event\"'\n - if: '$CI_COMMIT_BRANCH == \"master\"'\n - if: '$CI_COMMIT_BRANCH == \"release-v1\"'\n artifacts:\n reports:\n cobertura: coverage/cobertura-coverage.xml\n tags:\n - demo\n\ndockerize-application:\n stage: dockerize\n script:\n - echo \"dockerizing application\"\n rules:\n - if: '$CI_PIPELINE_SOURCE == \"merge_request_event\"'\n - if: '$CI_COMMIT_BRANCH == \"master\"'\n - if: '$CI_COMMIT_BRANCH == \"release-v1\"'\n tags:\n - demo\n\n\ndeploy_to_staging:\n stage: staging\n script:\n - echo \"deploying to staging\"\n rules:\n - if: '$CI_COMMIT_BRANCH == \"master\"'\n tags:\n - demo\n\ndeploy_to_production:\n stage: staging\n script:\n - echo \"deploying to production\"\n rules:\n - if: '$CI_COMMIT_BRANCH == \"release-v1\"'\n tags:\n - demo\n\nIn my package json, here is the important part:\n\"scripts\": {\n \"start\": \"node ./bin/www\",\n \"debug\": \"nodemon ./bin/www\",\n \"test\": \"npx nyc --reporter text mocha\",\n \"test-coverage\": \"npx nyc --reporter cobertura mocha\"\n }\n\nIn the logs, I can see that the coverage file is uploaded.\nRuntime platform arch=amd64 os=windows pid=19548 revision=775dd39d version=13.8.0\ncoverage/cobertura-coverage.xml: found 1 matching files and directories \nUploading artifacts as \"cobertura\" to coordinator... ok id=1097622443 responseStatus=201 Created token=6wcrN_d_\n\nI did a lot of research and I still can't figure out why! I figured that was a feature flag turning this feature off by default but not any more:\nhttps://gitlab.com/gitlab-org/gitlab/-/merge_requests/43711\nHere is the link to my project: I mainly created to experiment with gitlab ci/cd"
},
{
"role": "assistant",
"content": "It's now working. The issue was that I needed to wait for the WHOLE pipeline to succeed before I could actually see the visualization.\nHere is an issue open in Gitlab:\nhttps://gitlab.com/gitlab-org/gitlab/-/issues/236248"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Get commit list between tags in git\nIf I've a git repository with tags representing the versions of the releases. \nHow can I get the list of the commits between two tags (with a pretty format if is possible) ?"
},
{
"role": "assistant",
"content": "git log --pretty=oneline tagA...tagB (i.e. three dots)\nIf you just wanted commits reachable from tagB but not tagA:\ngit log --pretty=oneline tagA..tagB (i.e. two dots) \nor\ngit log --pretty=oneline ^tagA tagB"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "What is the difference between author and committer in Git?\n\nI just came across the following commit on GitHub:\nhttps://github.com/felixge/node-formidable/commit/0a0b150668daa3c6f01626d2565b898e5da12392\nHow does one go about having multiple authors on the same commit like that?"
},
{
"role": "assistant",
"content": "That's not really two authors - that's an author and a committer. The two fields have different meanings. The author is the one who created the content, and the committer is the one who committed it. When you do a normal commit, you are both. (And both come with an associated email and timestamp.)\nBut they can become different in a few key ways:\n\ngit format-patch / git am - this pair lets you turn commits into patches, generally submitted by email, then have someone else apply them. You remain the author; the person who applies them is the committer. This is pretty definitely what happened on github there.\ngit commit --amend, git rebase, git filter-branch - These are all basically variants on history rewriting, ranging from single commit to some history of a branch to the entire history. They can potentially modify the committer information - in particular, they always rewrite the committer timestamp. The original author remains in place (in default modes of operation), and if the author is also the one doing the rewriting, their name and email stay, but the timestamp is naturally different."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How do I connect a local folder to an existing github repo?\nI made a repo on my laptop. It has a project page on github.com.\nI'm now working on my desktop computer. I manually copied over some files because I didn't think I would need every file from the repo (so I didn't clone the repo onto my desktop). How can I connect my desktop local folder with the existing repo so that I can push the files on my desktop to the repo (the desktop files are now the most recent versions of those files, since I stopped working from my laptop)"
},
{
"role": "assistant",
"content": "Adding an existing project to GitHub using the command line:\n# Initialize the local directory as a Git repository.\ngit init\n\n# Add files\ngit add .\n\n# Commit your changes\ngit commit -m \"First commit\"\n\n# Add remote origin\ngit remote add origin <Remote repository URL>\n# <Remote repository URL> looks like: https://github.com/user/repo.git\n\n# Verifies the new remote URL\ngit remote -v\n\n# Push your changes\ngit push origin master\n\nAnd 2nd way as @evolutionxbox suggest you:\n\nClone git repo\nCopy and paste into it\nPush your change at origin\n\nIf in any case git reject your push you can use git push origin master --force\nUPDATE (10-23-2020):\nBear in mind that since October 1st, 2020, Github renamed the default repository from master to main https://github.com/github/renaming"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Can I recover a branch after its deletion in Git?\nIf I run git branch -d XYZ, is there a way to recover the branch? Is there a way to go back as if I didn't run the delete branch command?"
},
{
"role": "assistant",
"content": "Yes, you should be able to do git reflog --no-abbrev and find the SHA1 for the commit at the tip of your deleted branch, then just git checkout [sha]. And once you're at that commit, you can just git checkout -b [branchname] to recreate the branch from there.\n\nCredit to @Cascabel for this condensed/one-liner version and @Snowcrash for how to obtain the sha.\nIf you've just deleted the branch you'll see something like this in your terminal Deleted branch <your-branch> (was <sha>). Then just use that <sha> in this one-liner:\ngit checkout -b <your-branch> <sha>"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-format-patch - Prepare patches for e-mail submission changes"
},
{
"role": "assistant",
"content": "Compute the dirstat numbers by counting the lines that have been\nremoved from the source, or added to the destination. This ignores\nthe amount of pure code movements within a file. In other words,\nrearranging lines in a file is not counted as much as other changes.\nThis is the default behavior when no parameter is given."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-clone - Clone a repository into a new directory --also-filter-submodules"
},
{
"role": "assistant",
"content": "Also apply the partial clone filter to any submodules in the repository.\nRequires --filter and --recurse-submodules . This can be turned on by\ndefault by setting the clone.filterSubmodules config option."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "why did gitlab 6 switch back to unicorn?\n\nGitlab 6.0 was released yesterday. I am curious to know why they switched to Unicorn from Puma.\nVersions prior to 5 were using Unicorn. I thought switch to Puma was for the better. \nIs there a technical reason for this switch?"
},
{
"role": "assistant",
"content": "Update April 2020, GitLab 12.10:\n\nPuma will become the default application server\nGitLab will be switching default application servers from Unicorn to Puma in 13.0. \n\nAnd with GitLab 13.0 (May 2020):\n\nReduced memory consumption of GitLab with Puma\n\nRead the last sections below.\n\nOriginal answer 2013\nThe commit 3bc484587 offers some clues from Mathieu 'OtaK' Amiot:\n\nWe switched from Puma in GitLab 5.4 to unicorn in GitLab 6.0.\n\nwhy switch back to Unicorn again?\n\nPuma caused 100% CPU and greater memory leaks when running mult-ithreaded on systems with many concurrent users.\n That's because people used MRI. You MUST use JRuby or Rubynius when using Puma. Or else the world breaks apart.\n\nMathieu adds in the comments:\n\nYes, Unicorn is better (but more memory-eager) on MRI setups.\n Puma is better on Rubinius & JRuby, that's all. \nThey can't force people to use other implementations of the Ruby Runtime, so they just fell back to the best setup for most setups :) –\n\n\nLight controversy ensues around:\n\nPuma: Hongli comments:\n\n\nPuma's multithreading works just fine with MRI.\n I say this as one of the authors behind Ruby Enterprise Edition, so I know Ruby's threading system inside-out.\nEvan Phoenix, Puma's author, has also stated that using Puma with MRI works just fine. \nIf there are issues then they are likely in Gitlab's code.\n\nThat being said, in Apr. 2020, Puma is now available as an alternative web server to Unicorn with GitLab 12.9\n(mentioned by mbomb007 in the comments)\n\nPhusion Passenger Enterprise:\n\nMathieu 'OtaK' Amiot comments:\n\nPassenger is not as stable as most people think. A nginx + Unicorn is more stable IMHO. – \n\nHongli answers:\n\nWe have lots and lots of large users using Phusion Passenger, both open source and Enterprise, on a daily basis with great stability and success.\n Think New York Times, 37signals, Motorola, UPS, Apple, AirBnB. Some of them even switched away from Unicorn in favor of Passenger (either open source or Enterprise)\n\n\nUpdate August 2014: there is an article on \"Running GitLab 7.1 using Puma instead of a Unicorn\"\n\nUpdate April 2020, GitLab 12.10:\n\nPuma will become the default application server\nGitLab will be switching default application servers from Unicorn to Puma in 13.0.\n Puma is a multithreaded application server, allowing GitLab to reduce it’s memory consumption by about 40%.\n\nA> s part of the GitLab 13.0 upgrade, users who have customized Unicorn settings will need to manually migrate these settings to Puma.\nIt will also be possible to remain on Unicorn, by disabling Puma and re-enabling Unicorn until Unicorn support is removed in a future release.\nThis is thanks to Dmitry Chepurovskiy, who has made a major contribution adding the Puma web server to the GitLab unicorn Helm chart (soon to be the webservice chart). \n\nThis work provides users of the GitLab Helm chart with the option to use Puma instead of Unicorn.\n In testing, we have observed a 40% reduction in memory usage when using Puma as the web server.\n\nSee Epic.\n\nWith GitLab 13.0 (May 2020):\n\nReduced memory consumption of GitLab with Puma\nPuma is now the default web application server for both the Omnibus-based and Helm-based installations. Puma reduces the memory footprint of GitLab by about 40% compared to Unicorn, increasing the efficiency of GitLab and potentially saving costs for self-hosted instances.\n\n\n\nInstallations which have customized the number of Unicorn processes, or use a slower NFS drive, may have to adjust the default Puma configuration.\n See the Important notes on upgrading and GitLab chart improvements for additional details.\n\nSee documentation and Epic."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Gitlab CI/CD job's log exceeded limit\n\nWhen I run my job on Gitlab CI/CD, after a while I obtain the following error message:\nJob's log exceeded limit of 4194304 bytes.\n\nHow to change this limit?"
},
{
"role": "assistant",
"content": "To change the build log size of your jobs in Gitlab CI/CD, you can edit your config.toml file and add a new limit in kilobytes:\n[[runners]]\n output_limit = 10000\n\nAccording to the documentation\n\noutput_limit : Maximum build log size in kilobytes. Default is 4096 (4MB).\n\nFor this to take effect, you need to restart the gitlab runner:\nsudo gitlab-runner restart"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Git Clone - Repository not found\n\ngit clone <url>\n\ngives the message fatal: repository 'url' not found\nI tried the options in the link, but it didn't work."
},
{
"role": "assistant",
"content": "As mentioned by others the error may occur if the url is wrong.\nHowever, the error may also occur if the repo is a private repo and you do not have access or wrong credentials.\nInstead of\ngit clone https://github.com/REPO_NAME/repo.git\ntry\ngit clone https://username:[email protected]/REPO_NAME/repo.git\n\nYou can also use\ngit clone https://[email protected]/REPO_NAME/repo.git\nand git will prompt for the password (thanks to leanne for providing this hint in the comments)."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-fetch - Download objects and refs from another repository -t --tags"
},
{
"role": "assistant",
"content": "Fetch all tags from the remote (i.e., fetch remote tags refs/tags/* into local tags with the same name), in addition\nto whatever else would otherwise be fetched. Using this\noption alone does not subject tags to pruning, even if --prune\nis used (though tags may be pruned anyway if they are also the\ndestination of an explicit refspec; see --prune )."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "\"Will not add file alias 'samefile' ('SameFile' already exists in index)\" when `git add` operation\nI download linux' kernel source, and want to git add them all.\nWhen I git add ., git starts add them. But soon it returns an error:\nfatal: Will not add file alias 'include/linux/netfilter/xt_connmark.h' ('include/linux/netfilter/xt_CONNMARK.h' already exists in index)\n\nThat's weird, xt_connmark.h and xt_CONNMARK.h are TOTALLY DIFFERENT, why it complains that error? Those situations occur at other folders, too. I can't just change their names separately to solve this problem.\nEven I try git add --ignore-errors ., it doesn't works,too. It just stopped without ignoring this error. Anyone knows solutions?"
},
{
"role": "assistant",
"content": "Edit .git/config to set ignorecase to false\n[core]\n ignorecase = false\n\nCan be set globally\n$ git config --global core.ignorecase false"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-rebase - Reapply commits on top of another base tip --no-keep-empty --keep-empty"
},
{
"role": "assistant",
"content": "Do not keep commits that start empty before the rebase\n(i.e. that do not change anything from its parent) in the\nresult. The default is to keep commits which start empty,\nsince creating such commits requires passing the --allow-empty override flag to git commit , signifying that a user is very\nintentionally creating such a commit and thus wants to keep\nit. Usage of this flag will probably be rare, since you can get rid of\ncommits that start empty by just firing up an interactive rebase and\nremoving the lines corresponding to the commits you don’t want. This\nflag exists as a convenient shortcut, such as for cases where external\ntools generate many empty commits and you want them all removed. For commits which do not start empty but become empty after rebasing,\nsee the --empty flag. See also INCOMPATIBLE OPTIONS below."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Remove local git tags that are no longer on the remote repository\nWe use tags in git as part of our deployment process. From time to time, we want to clean up these tags by removing them from our remote repository.\nThis is pretty straightforward. One user deletes the local tag and the remote tag in one set of commands. We have a little shell script that combines both steps.\nThe 2nd (3rd, 4th,...) user now has local tags that are no longer reflected on the remote. \nI am looking for a command similar to git remote prune origin which cleans up locally tracking branches for which the remote branch has been deleted.\nAlternatively, a simple command to list remote tags could be used to compare to the local tags returned via git tag -l."
},
{
"role": "assistant",
"content": "This is great question, I'd been wondering the same thing.\nI didn't want to write a script so sought a different solution. The key is discovering that you can delete a tag locally, then use git fetch to \"get it back\" from the remote server. If the tag doesn't exist on the remote, then it will remain deleted.\nThus you need to type two lines in order:\ngit tag -l | xargs git tag -d\ngit fetch --tags\n\nThese:\n\nDelete all tags from the local repo. FWIW, xargs places each tag output by \"tag -l\" onto the command line for \"tag -d\". Without this, git won't delete anything because it doesn't read stdin (silly git).\nFetch all active tags from the remote repo.\n\nThis even works a treat on Windows."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-config - Get and set repository or global options color.interactive"
},
{
"role": "assistant",
"content": "When set to always , always use colors for interactive prompts\nand displays (such as those used by \"git-add --interactive\" and\n\"git-clean --interactive\"). When false (or never ), never.\nWhen set to true or auto , use colors only when the output is\nto the terminal. If unset, then the value of color.ui is\nused ( auto by default)."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-commit - Record changes to the repository -e --edit"
},
{
"role": "assistant",
"content": "The message taken from file with -F , command line with -m , and from commit object with -C are usually used as\nthe commit log message unmodified. This option lets you\nfurther edit the message taken from these sources."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-rev-list - Lists commit objects in reverse chronological order --object-names"
},
{
"role": "assistant",
"content": "Only useful with --objects ; print the names of the object IDs\nthat are found. This is the default behavior. Note that the\n\"name\" of each object is ambiguous, and mostly intended as a\nhint for packing objects. In particular: no distinction is made between\nthe names of tags, trees, and blobs; path names may be modified\nto remove newlines; and if an object would appear multiple times\nwith different names, only one name is shown."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-log - Show commit logs --show-linear-break[=<barrier>]"
},
{
"role": "assistant",
"content": "When --graph is not used, all history branches are flattened\nwhich can make it hard to see that the two consecutive commits\ndo not belong to a linear branch. This option puts a barrier\nin between them in that case. If <barrier> is specified, it\nis the string that will be shown instead of the default one."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-log - Show commit logs --diff-filter=[(A|C|D|M|R|T|U|X|B)…[*]]"
},
{
"role": "assistant",
"content": "Select only files that are Added ( A ), Copied ( C ),\nDeleted ( D ), Modified ( M ), Renamed ( R ), have their\ntype (i.e. regular file, symlink, submodule, …) changed ( T ),\nare Unmerged ( U ), are\nUnknown ( X ), or have had their pairing Broken ( B ).\nAny combination of the filter characters (including none) can be used.\nWhen * (All-or-none) is added to the combination, all\npaths are selected if there is any file that matches\nother criteria in the comparison; if there is no file\nthat matches other criteria, nothing is selected. Also, these upper-case letters can be downcased to exclude. E.g. --diff-filter=ad excludes added and deleted paths. Note that not all diffs can feature all types. For instance, copied and\nrenamed entries cannot appear if detection for those types is disabled."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git - the stupid content tracker GIT_TRACE_PACKET"
},
{
"role": "assistant",
"content": "Enables trace messages for all packets coming in or out of a\ngiven program. This can help with debugging object negotiation\nor other protocol issues. Tracing is turned off at a packet\nstarting with \"PACK\" (but see GIT_TRACE_PACKFILE below).\nSee GIT_TRACE for available trace output options."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-log - Show commit logs --topo-order"
},
{
"role": "assistant",
"content": "Show no parents before all of its children are shown, and\navoid showing commits on multiple lines of history\nintermixed. For example, in a commit history like this: ---1----2----4----7\n\t\\\t \\\n\t 3----5----6----8--- where the numbers denote the order of commit timestamps, git\nrev-list and friends with --date-order show the commits in the\ntimestamp order: 8 7 6 5 4 3 2 1. With --topo-order , they would show 8 6 5 3 7 4 2 1 (or 8 7 4 2 6 5\n3 1); some older commits are shown before newer ones in order to\navoid showing the commits from two parallel development track mixed\ntogether."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-diff - Show changes between commits, commit and working tree, etc diff.noPrefix"
},
{
"role": "assistant",
"content": "If set, git diff does not show any source or destination prefix."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-config - Get and set repository or global options commit.verbose"
},
{
"role": "assistant",
"content": "A boolean or int to specify the level of verbosity with git commit .\nSee git-commit ."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-difftool - Show changes using common diff tools difftool.trustExitCode"
},
{
"role": "assistant",
"content": "Exit difftool if the invoked diff tool returns a non-zero exit status. See the --trust-exit-code option in git-difftool for more details."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-diff - Show changes between commits, commit and working tree, etc git diff [<options>] <commit>..<commit> [--] [<path>…]"
},
{
"role": "assistant",
"content": "This is synonymous to the earlier form (without the .. ) for\nviewing the changes between two arbitrary <commit>. If <commit> on\none side is omitted, it will have the same effect as\nusing HEAD instead."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How do I reverse a specific hunk of a commit in git?\nI'm wondering if there is a way to quickly reverse specific hunk of a commit.\nI can generate a diff between two commits or HEAD to see the difference.\nHow do I reverse just one of those hunks (or better yet, a set of specific hunks)?"
},
{
"role": "assistant",
"content": "git checkout -p $REF -- path/to/file\n\ne.g.,\ngit checkout -p HEAD^ myfile\n\nWhere $REF is a ref name or commit ID that specifies the commit you want to take the file state from. For example, to selectively revert changes made in the last commit, use HEAD^."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to get certain commit from GitHub project\n\nI need to download the Facebook API from GitHub. Normally, I just click on the 'Downloads\" tab to download the latest source code. In this case, I need an older commit: 91f256424531030a454548693c3a6ca49ca3f35a, but I have no idea how to get the entire project from that commit...\nCan someone please tell me how to do this?\n(BTW, im on a mac. Don't know if that makes any difference)."
},
{
"role": "assistant",
"content": "First, clone the repository using git, e.g. with:\ngit clone git://github.com/facebook/facebook-ios-sdk.git\n\nThat downloads the complete history of the repository, so you can switch to any version. Next, change into the newly cloned repository:\ncd facebook-ios-sdk\n\n... and use git checkout <COMMIT> to change to the right commit:\ngit checkout 91f25642453\n\nThat will give you a warning, since you're no longer on a branch, and have switched directly to a particular version. (This is known as \"detached HEAD\" state.) Since it sounds as if you only want to use this SDK, rather than actively develop it, this isn't something you need to worry about, unless you're interested in finding out more about how git works."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Move the most recent commit(s) to a new branch with Git\nHow do I move my recent commits on master to a new branch, and reset master to before those commits were made? e.g. From this:\nmaster A - B - C - D - E\n\nTo this:\nnewbranch C - D - E\n /\nmaster A - B"
},
{
"role": "assistant",
"content": "WARNING: You need to store uncommitted edits to your stash before doing this, using git stash. Once complete, you can retrieve the stashed uncommitted edits with git stash pop. git reset hard command will remove all changes!\nMoving to an existing branch\nIf you want to move your commits to an existing branch, it will look like this:\ngit checkout existingbranch\ngit merge branchToMoveCommitFrom\ngit checkout branchToMoveCommitFrom\ngit reset --hard HEAD~3 # Go back 3 commits. You *will* lose uncommitted work.\ngit checkout existingbranch\n\nMoving to a new branch\nWARNING: This method works because you are creating a new branch with the first command: git branch newbranch. If you want to move commits to an existing branch you need to merge your changes into the existing branch before executing git reset --hard HEAD~3 (see Moving to an existing branch above). If you don't merge your changes first, they will be lost.\nUnless there are other circumstances involved, this can be easily done by branching and rolling back.\n# Note: Any changes not committed will be lost.\ngit branch newbranch # Create a new branch, saving the desired commits\ngit checkout master # checkout master, this is the place you want to go back\ngit reset --hard HEAD~3 # Move master back by 3 commits (Make sure you know how many commits you need to go back)\ngit checkout newbranch # Go to the new branch that still has the desired commits\n\nBut do make sure how many commits to go back. Alternatively, you can instead of HEAD~3, simply provide the hash of the commit (or the reference like origin/master) you want to \"revert back to\" on the master (/current) branch, e.g:\ngit reset --hard a1b2c3d4\n\nNote: You will only be \"losing\" commits from the master branch, but don't worry, you'll have those commits in newbranch! An easy way to check that, after completing the 4 step sequence of commands above, is by looking at git log -n4 which will show the history of newbranch actually retained the 3 commits (and the reason is that newbranch was created at the time those changes were already commited on master!). They have only been removed from master, as git reset only affected the branch that was checked out at the time of its execution, i.e. master (see git reset description: Reset current HEAD to the specified state). git status however will not show any checkouts on the newbranch, which might be surprising at first but that is actually expected.\nLastly, you may need to force push your latest changes to main repo:\ngit push origin master --force\n\nWARNING: With Git version 2.0 and later, if you later git rebase the new branch upon the original (master) branch, you may need an explicit --no-fork-point option during the rebase to avoid losing the carried-over commits. Having branch.autosetuprebase always set makes this more likely. See John Mellor's answer for details."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git svn clone of a single directory of SVN repository\nI am attempting to use git svn to clone a single directory of a SVN repository into a Git repository.\nIf I use git svn clone svn+ssh://path/to/repo/trunk/directory, I get a Git repo without branches that mirror the branches in the source SVN repo.\nIf I use git svn --stdlayout svn+ssh://path/to/repo/trunk/directory, I get an empty Git repo. The following is the output of the command:\nInitialized empty Git repository in /directory/.git/\nUsing higher level of URL: svn+ssh://path/to/repo/trunk/directory => svn+ssh://path/to/repo\nW: Ignoring error from SVN, path probably does not exist: (160013): Filesystem has no item: File not found: revision 100, path '/trunk/directory'\nW: Do not be alarmed at the above message git-svn is just searching aggressively for old history.\nThis may take a while on large repositories\n\nI had read that the way to fix the above was to add a revision range like -r 1000:HEAD, this still produces an empty repo. The output is:\nInitialized empty Git repository in /directory/.git/\nUsing higher level of URL: svn+ssh://path/to/repo/trunk/directory => svn+ssh://path/to/repo\n\nAny ideas on how to clone a subdirectory of an SVN repository using git-svn that still grabs all of the branches & tags from the source SVN respository?"
},
{
"role": "assistant",
"content": "You don't want the standard layout, you want something like this:\ngit svn clone svn+ssh://path/to/repo/ --trunk=trunk/directory --branches=branches/*/directory --tags=tags/*/directory"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git command to show all (lightweight) tags creation dates\nIs there a one liner that shows me the dates where all git lightweight tags where created ?\nSomething like: git show tags --format=date ?"
},
{
"role": "assistant",
"content": "I found in this link a solution that fits my needs:\ngit log --tags --simplify-by-decoration --pretty=\"format:%ai %d\"\n\nI've put that command in an alias in my ~/.alias, so now everytime I run gitshowtagbydate I get what I needed."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-pull - Fetch from and integrate with another repository or a local branch <repository>"
},
{
"role": "assistant",
"content": "The \"remote\" repository that is the source of a fetch\nor pull operation. This parameter can be either a URL\n(see the section GIT URLS below) or the name\nof a remote (see the section REMOTES below)."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-log - Show commit logs --patch-with-raw"
},
{
"role": "assistant",
"content": "Synonym for -p --raw ."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Shell variable expansion in git config\nI have a shell variable which points to the directory where all my configuration files are located. Let's assume the variable is created with export RC=$HOME/rc. I have a global ignore file in the configuration directory: ~/rc/globalgitignore.\nMy Question is, how can I expand the RC variable in my .gitconfig file?\nI already tried the following:\n\nexcludesfile = $RC/globalgitignore\nexcludesfile = !$RC/globalgitignore\nexcludesfile = !echo $RC/globalgitignore\nexcludesfile = !$(echo $RC/globalgitignore)\n\nNone of these solutions work.\nThe only way this works if I enter the full path: excludesfile = ~/rc/globalgitignore, but then I have to change the path if move my rc directory to a different location."
},
{
"role": "assistant",
"content": "You can't. git-config(1) does not support environment variable expansion, but only limited type conversion and path expansion:\n\nThe type specifier can be either --int or --bool, to make git config ensure that the variable(s) are of the given type and convert the value to the canonical form (simple decimal number for int, a \"true\" or \"false\" string for bool), or --path, which does some path expansion (see --path below). If no type specifier is passed, no checks or transformations are performed on the value.\n\nThe documentation for --path states:\n\n--path\ngit-config will expand leading ~ to the value of $HOME, and ~user to the home directory for the specified user. This option has no effect when setting the value (but you can use git config bla ~/ from the command line to let your shell do the expansion).\n\nThe term \"expansion\" does not appear in any different context in git-config(1). So how did you even get the idea that it should, given that no such feature is documented anywhere?\nIn order to expand environment variables you have to pre-process the Git config file yourself, i.e. by creating a template file, and expand variables with a script before copying the file to your $HOME directory.\nIf it's about dotfile management, then do, what all people do: Put them in a directory, and add symlinks to this directory from your $HOME."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Do GitHub raw urls expire?\n\nDo GitHub raw urls for private repositories expire? I'm referring to the link generated when you click the Raw button while viewing a file on github.com.\nThe link includes a token but there's no info about where that token comes from."
},
{
"role": "assistant",
"content": "No one has clearly mentioned this, but the github raw urls expire in 7 days.\nYou can use longer lasting personal access tokens generated here: https://github.com/settings/tokens but those can only be used via curl:\ncurl -H 'Authorization: token <personal_token>' <raw_url>\n\nNote that the personal access tokens expire if unused for an entire year."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Error with 'Git push heroku master' command\n\nI am trying to update the code from my application to my repository and an error appears.\nHow can I fix it?\nC:\\Sites\\ecozap>git push heroku master\nEnter passphrase for key '/c/Users/Diseño2/.ssh/id_rsa':\nFetching repository, done.\nTo [email protected]:ecozap.git\n! [rejected] master -> master (non-fast-forward)\nerror: failed to push some refs to '[email protected]:ecozap.git'\nhint: Updates were rejected because the tip of your current branch is behind\nhint: its remote counterpart. Merge the remote changes (e.g. 'git pull')\nhint: before pushing again.\nhint: See the 'Note about fast-forwards' in 'git push --help' for details."
},
{
"role": "assistant",
"content": "This error means that the master branch on Heroku contains commits that are not in your local branch.\nYou can either pull the missing commits from Heroku and merge them into your local copy:\ngit pull heroku master\n\nOr, if you don't care about the missing commits you can force push to Heroku. This will overwrite the remote repo on Heroku with your local commits.\ngit push --force heroku master\n\nMake sure you really don't care about them as you will lose them from Heroku by doing this. Normally this doesn't matter as Heroku is not normally the canonical repo, somewhere else such as GitHub is."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-commit - Record changes to the repository"
},
{
"role": "assistant",
"content": "EXAMPLES When recording your own work, the contents of modified files in\nyour working tree are temporarily stored to a staging area\ncalled the \"index\" with git add . A file can be\nreverted back, only in the index but not in the working tree,\nto that of the last commit with git restore --staged <file> ,\nwhich effectively reverts git add and prevents the changes to\nthis file from participating in the next commit. After building\nthe state to be committed incrementally with these commands, git commit (without any pathname parameter) is used to record what\nhas been staged so far. This is the most basic form of the\ncommand. An example: $ edit hello.c\n$ git rm goodbye.c\n$ git add hello.c\n$ git commit Instead of staging files after each individual change, you can\ntell git commit to notice the changes to the files whose\ncontents are tracked in\nyour working tree and do corresponding git add and git rm for you. That is, this example does the same as the earlier\nexample if there is no other change in your working tree: $ edit hello.c\n$ rm goodbye.c\n$ git commit -a The command git commit -a first looks at your working tree,\nnotices that you have modified hello.c and removed goodbye.c,\nand performs necessary git add and git rm for you. After staging changes to many files, you can alter the order the\nchanges are recorded in, by giving pathnames to git commit .\nWhen pathnames are given, the command makes a commit that\nonly records the changes made to the named paths: $ edit hello.c hello.h\n$ git add hello.c hello.h\n$ edit Makefile\n$ git commit Makefile This makes a commit that records the modification to Makefile .\nThe changes staged for hello.c and hello.h are not included\nin the resulting commit. However, their changes are not lost — they are still staged and merely held back. After the above\nsequence, if you do: $ git commit this second commit would record the changes to hello.c and hello.h as expected. After a merge (initiated by git merge or git pull ) stops\nbecause of conflicts, cleanly merged\npaths are already staged to be committed for you, and paths that\nconflicted are left in unmerged state. You would have to first\ncheck which paths are conflicting with git status and after fixing them manually in your working tree, you would\nstage the result as usual with git add : $ git status | grep unmerged\nunmerged: hello.c\n$ edit hello.c\n$ git add hello.c After resolving conflicts and staging the result, git ls-files -u would stop mentioning the conflicted path. When you are done,\nrun git commit to finally record the merge: $ git commit As with the case to record your own changes, you can use -a option to save typing. One difference is that during a merge\nresolution, you cannot use git commit with pathnames to\nalter the order the changes are committed, because the merge\nshould be recorded as a single commit. In fact, the command\nrefuses to run when given pathnames (but see -i option)."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Automated heroku deploy from subfolder\nI know you can deploy automatically to heroku from github, but I haven't found a way to only push a subfolder from github to heroku.\nFrom the command-line I know it is possible to do this with:\ngit subtree push --prefix <subfolder> heroku master\n\nHowever, I would like to know if there is a way to use the github integration with heroku to make it pull a specific subfolder automatically when a commit is added to a branch."
},
{
"role": "assistant",
"content": "2018 Update! To enable automated deployments with heroku, you need to have admin access for the github repo you want to deploy. \nIn the Heroku dashboard:\nStep 1) - Connect github repository to Heroku\nInside the Deploy tab, scroll to Deployment method and connect your Github account. find the repo and hit connect. heroku should be authorized as an Oauth app in your github now. \nIf you cannot find the repo: Either your github has not authorized Heroku or you did not create this repo and need to make sure you have admin access to it. If this is not possible, invite an admin of the repo to your heroku app by going to Access tab in Heroku Dashboard and adding the admin as a collaborator. The admin then logs into heroku and completes Step 1 here. Afterwards you can finish the following steps.\nStep 2) - Set Heroku Config Var PROJECT_PATH to your server folder\nInside the Settings tab, set a config var to tell Heroku the path to find the server code you want deployed.\nExample: lets say your repo name is MyRepo and it has 2 sub-folders. back-end contains a Node.js server and front-end contains a React app. Your github directory looks like this: \nMyRepo/front-end/package.json\nMyRepo/back-end/package.json\nThen you should set your config var to PROJECT_PATH in the left box and back-end in the right box. \nStep 3) - Set a Heroku Buildpack that will deploy the PROJECT_PATH folder\nAgain inside the Settings tab, you need to add a Buildpack that will tell heroku to look for your folder instead of deploying the repo root. There should already be 1 buildpack there to tell heroku what type of server it is (javascript/node.js, python/django, etc...). \nEnter this url to add buildpack https://github.com/timanovsky/subdir-heroku-buildpack.git and make sure this is at the top of the buildpack chain (drag the lines on the left to make it above any other buildpacks you have added.\nStep 4) - Enable auto deploy\nInside the Deploy tab, scroll to Automatic Deploys and click the black button to enable automatic deploys\nAuto Deploy complete! Now check the build logs and make sure you don't have any errors"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-diff - Show changes between commits, commit and working tree, etc diff.wsErrorHighlight"
},
{
"role": "assistant",
"content": "Highlight whitespace errors in the context , old or new lines of the diff. Multiple values are separated by comma, none resets previous values, default reset the list to new and all is a shorthand for old,new,context . The\nwhitespace errors are colored with color.diff.whitespace .\nThe command line option --ws-error-highlight=<kind> overrides this setting."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-shortlog - Summarize git log output --remotes[=<pattern>]"
},
{
"role": "assistant",
"content": "Pretend as if all the refs in refs/remotes are listed\non the command line as <commit> . If <pattern> is given, limit\nremote-tracking branches to ones matching given shell glob.\nIf pattern lacks ? , * , or [ , /* at the end is implied."
}
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.