messages
listlengths
3
3
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "After a Git merge conflict, a lot of files I didn't touch become changes to be committed\nSo I'm working in a branch, make some changes, and run git merge master. I get a merge conflict on one of the files I modified (which I know how to deal with), but for some reason, a bunch of files I did not touch (but which got updated in master) suddenly enter my list of \"Changes to be committed\".\nWhy is this? And how do I fix this? I don't want any of these not-by-me changes to get committed." }, { "role": "assistant", "content": "I encountered the same problem myself, and came up with an intermediate solution. Need to find a better one down the road.\nFirst to address the question posed by @NoufalIbrahim: As for \" I don't want any of these not-by-me changes to get committed.\", why did you do a merge at all if you don't want any changes?\nYou have misunderstood @grautur intention. The changes are needed, but not as part of a new commit. For example, 1 file was added locally, 100 files came from merge. The new commit should have 1 changed file and not 101 changed file. This is especially important if an automatic merge is not possible, but a pull request is initiated and someone has to review the commit. You want the reviewer to review 1 file, not 101 files.\nWhat I am currently doing is this: let's say we have branch 'master' and 'feature'. 'feature' is created from 'master' and I only make changes to files in 'feature'. When new changes are pulled into 'master', git merge master inside 'feature' will introduce new files (and these are staged automatically in VSCode, which is the IDE I use).\nWhat I do next is unstage all of these files. Basically ignore them. Only add and commit files that I change. Push 'feature' to origin/remote repo, create pull request. When request is accepted and commit is merged to the main branch, delete 'feature' locally and remotely. Pull changes to 'master' local and create a new branch to work on new feature. This new branch will not have a bunch of unstaged files.\nThere could a git command to tell the git to ignore a bunch of files without using .gitignore. Doing further research into this." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Add GitLab private repository as Maven dependency\n\nI have a private repository in GitLab (it's in a group, and I have a Developer role) which I want to add as a dependency for my Maven project.\nI've been looking for a while and all I found was that I have to add the following to my pom.xml:\n<repositories>\n <repository>\n <id>gitlab-maven</id>\n <url>https://gitlab.com/api/v4/projects/.../packages/maven</url>\n </repository>\n</repositories>\n\n<distributionManagement>\n <repository>\n <id>gitlab-maven</id>\n <url>https://gitlab.com/api/v4/projects/.../packages/maven</url>\n </repository>\n <snapshotRepository>\n <id>gitlab-maven</id>\n <url>https://gitlab.com/api/v4/projects/.../packages/maven</url>\n </snapshotRepository>\n</distributionManagement>\n\nHowever, I have no idea how to add the dependency itself (with the groupId and stuff) and I'm not sure how to do authentication to allow Maven to download the project. I've seen something about Personal Access Tokens in GitLab, but I'm not sure how to set that up (I assume I'd only need read-only access?)." }, { "role": "assistant", "content": "First, a few pre-requisites. Since you mentioned you're using a private repository, you'll need to have at least GitLab Silver (hosted on gitlab.com) or GitLab Premium (self-hosted) in order to use the GitLab Maven Packages repository. Also, if you're self-hosted, you'll need to be on GitLab 11.3 or later (should be out this time next week), and have packages_enabled set to true (see Enabling the Packages repository).\nFor private projects, you'll need a Personal Access Token. The token should have the api scope for Maven to upload artifacts to GitLab. Once you have the token, you configure your settings.xml like this.\n<settings>\n <servers>\n <server>\n <id>gitlab-maven</id>\n <configuration>\n <httpHeaders>\n <property>\n <name>Private-Token</name>\n <value>REPLACE_WITH_YOUR_PERSONAL_ACCESS_TOKEN</value>\n </property>\n </httpHeaders>\n </configuration>\n </server>\n </servers>\n</settings>\n\nIn pom.xml, where you have the ellipses, you need to fill in your project ID. To find the ID, just visit the front page of your project on GitLab. It's shown near the top of the pages, just after the name and description of your project. For example, take a look at the mvn-example sample project. Its project ID is 8377576. That goes in the URL.\n<repositories>\n <repository>\n <id>gitlab-maven</id>\n <url>https://gitlab.com/api/v4/projects/8377576/packages/maven</url>\n </repository>\n</repositories>\n\nThe mvn-example project's pom.xml file shows a completed example.\nWith all that set up, you should be able to upload artifacts with mvn deploy." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-commit - Record changes to the repository --long" }, { "role": "assistant", "content": "When doing a dry-run, give the output in the long-format.\nImplies --dry-run ." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to list all tags that contain a commit?\nThis question is similar to How to list all tags pointing to a specific commit in git, but with one difference: I wish to search for all tags that contain a specific commit within the tree of each tag, not specifically the files marked in the tag itself (in this case, only the Makefile change has been tagged)." }, { "role": "assistant", "content": "git tag --contains <commit>" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Creating pull requests in gitlab\nI have a GitLab installation running, and I have a repository that I want to share with my friends. I can't understand the flow of sending pull requests in GitLab.\nA user can't fork my repository or access my project (unless he is my on team). A merge request can be from one branch to another in my repository.\nHow do pull requests work in GitLab?" }, { "role": "assistant", "content": "GitLab.com co-founder here. Forking should work fine in recent versions of GitLab (6.x). You can fork a repo belonging to someone else and then create a merge request (the properly named version of the GitHub pull request)." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to open multiple pull requests on GitHub\n\nWhen I open a pull request on GitHub.\nAll commits since my last request and all new ones are automatically added to this request. \nI can't seem to control which commits are added and which are not.\nWhen I try to open another pull request, I get an \"Oops! There's already a pull request\" error. \nIs there any easy way to open multiple pull requests without having to mess around with the command line?" }, { "role": "assistant", "content": "Pull requests are based on a branch.\nThe only way to open up a pull request for multiple commits is: \n\nIsolate them into their own branch. \nOpen the pull requests from there." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to modify GitHub pull request? [duplicate]\n\nThis question already has answers here:\n \n \n\n\n\n\nPreferred Github workflow for updating a pull request after code review\n\n (2 answers)\n \n\nClosed 2 years ago.\n\n\n\nI've opened a pull request to a project. The maintainer has decided to accept it, but told me to modify some contents. \nHow can I do it? Whether I should keep the commit hash unchanged, how can I do it?" }, { "role": "assistant", "content": "Just push more commits on to the branch the request is for. The pull request will pick this up then.\nExample:\nIf you want to have b merged into master\n\nYou push c1,c2,c3 to b\nthen you make a new request for b\nit gets reviewed and you need more commits\nYou push c11,c21,c31 to b\nThe pull request now shows all 6 six commits" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How do I undo 'git add' before commit?\nWant to improve this post? Provide detailed answers to this question, including citations and an explanation of why your answer is correct. Answers without enough detail may be edited or deleted.\n \n \n\n\n\n\n\n\nI mistakenly added files to Git using the command:\ngit add myfile.txt\n\nI have not yet run git commit. How do I undo this so that these changes will not be included in the commit?" }, { "role": "assistant", "content": "To unstage a specific file\ngit reset <file>\n\nThat will remove the file from the current index (the \"about to be committed\" list) without changing anything else.\nTo unstage all files from the current change set:\ngit reset\n\n\nIn old versions of Git, the above commands are equivalent to git reset HEAD <file> and git reset HEAD respectively, and will fail if HEAD is undefined (because you haven't yet made any commits in your repository) or ambiguous (because you created a branch called HEAD, which is a stupid thing that you shouldn't do). This was changed in Git 1.8.2, though, so in modern versions of Git you can use the commands above even prior to making your first commit:\n\n\"git reset\" (without options or parameters) used to error out when\nyou do not have any commits in your history, but it now gives you\nan empty index (to match non-existent commit you are not even on).\n\nDocumentation: git reset" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Xcode - error: pathspec '...' did not match any file(s) known to git\nI am using a local git repo. When I try to commit changes to the core data model file (.xcdatamodel), I get this message:\nerror: pathspec '.../DataModel.xcdatamodeld/DataModel.xcdatamodel/contents' did not match any file(s) known to git.\n\nHow to fix this and commit the model as I do with any other file?" }, { "role": "assistant", "content": "The problem is, indeed, the changing of a filename's case. For me this was because of my Macbook/OSX. Apparently Windows has the same 'thing'.\nCause: git isn't able to recognise a change from 'filename' to 'FileName'.\nHere's a list of solutions for anyone stumbling upon this. All the solutions should be run at the project root:\nThe Permanent fix that will work on current and future projects\nChange the git case setting. The file should be committed afterwards\ngit config core.ignorecase false --global\n\nThe Project only fix\ngit config core.ignorecase false\n\nThe just give me a line of code so I can move on fix - credit to Bruce\ngit commit -a -m \"pathspec did not match any file(s) known to git fix\"\n\nThe I get paid by the hour fix\nDelete the file. Commit. Push. Add the file again. Commit. Push.\n\nBased on your needs you may want to revert the settings. Do:\ngit config core.ignorecase true" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "SourceTree keeps asking for Github password\n\nMy organization is switching from Bitbucket to Github for project management. Today, I was trying to transfer our most recent project from Bitbucket to Github, by using SourceTree. I added a second remote repository to the project (using the URL of the destination repository on Github), brought everything up to date, and then attempted to push the code to the repository. A box popped up, asking for the password to my Github account. I entered in my (correct) password, and clicked 'OK', and the dialog box popped up again. I entered in my password (correctly) again, and it did the same thing.\nMy username is correctly identified, my password is correct, and I tried updating SourceTree because I had heard that it was an issue with a previous version. The problem persists.\nI am using SourceTree 2.3.1" }, { "role": "assistant", "content": "If you are using two-factor authentication with GitHub you will need to create a personal access token and use it with SourceTree:\n\nTo work with GitHub's two-factor authentication in SourceTree you can simply use your access token instead of your password. The steps to do this are as follows:\n\nGo to your Personal Access Tokens settings in GitHub.\nClick on the Generate new token button.\nName the token something descriptive.\nSelect which scopes you wish to grant this token.\nClick the Generate token button.\nCopy the token and use it as a password in your hosted repositories.\n\nYou can find more information about this on GitHub's help here.\n\nMac Users:\nIf your SourceTree keeps on asking for the password, go to the Terminal and type this:\ngit config --global credential.helper osxkeychain" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "What is a Git commit ID?\nHow are the Git commit IDs generated to uniquely identify the commits?\nExample: 521747298a3790fde1710f3aa2d03b55020575aa\nHow does it work? Are they only unique for each project? Or for the Git repositories globally?" }, { "role": "assistant", "content": "Here's an example of a commit object file, decompressed.\ncommit 238tree 0de83a78334c64250b18b5191f6cbd6b97e77f84\nparent 6270c56bec8b3cf7468b5dd94168ac410eca1e98\nauthor Michael G. Schwern <[email protected]> 1659644787 -0700\ncommitter Michael G. Schwern <[email protected]> 1659644787 -0700\n\nfeature: I did something cool\n\nThe commit ID is a SHA-1 hash of that.\n$ openssl zlib -d < .git/objects/81/2e8c33de3f934cb70dfe711a5354edfd4e8172 | sha1sum \n812e8c33de3f934cb70dfe711a5354edfd4e8172 -\n\nThis includes...\n\nFull content of the commit, not just the diff, represented as a tree object ID.\nThe ID of the previous commit (or commits if it's a merge).\nCommit and author date.\nCommitter and author's name and email address.\nLog message.\n\n(The author is who originally wrote the commit, the committer is who made the commit. This is usually the same, but it can be different. For example, when you rebase or amend a commit. Or if you're committing someone else's patch they emailed to you and want to attribute the author.)\nChange any of that and the commit ID changes. And yes, the same commit with the same properties will have the same ID on a different machine. This serves three purposes. First, it means the system can tell if a commit has been tampered with. It's baked right into the architecture.\nSecond, one can rapidly compare commits just by looking at their IDs. This makes Git's network protocols very efficient. Want to compare two commits to see if they're the same? Don't have to send the whole diff, just send the IDs.\nThird, and this is the genius, two commits with the same IDs have the same history. That's why the ID of the previous commits are part of the hash. If the content of a commit is the same but the parents are different, the commit ID must be different. That means when comparing repositories (like in a push or pull) once Git finds a commit in common between the two repositories it can stop checking. This makes pushing and pulling extremely efficient. For example...\norigin\nA - B - C - D - E [master]\n\nA - B [origin/master]\n\nThe network conversation for git fetch origin goes something like this...\n\nlocal Hey origin, what branches do you have?\norigin I have master at E.\nlocal I don't have E, I have your master at B.\norigin B you say? I have B and it's an ancestor of E. That checks out. Let me send you C, D and E.\n\nThis is also why when you rewrite a commit with rebase, everything after it has to change. Here's an example.\nA - B - C - D - E - F - G [master]\n\nLet's say you rewrite D, just to change the log message a bit. Now D can no longer be D, it has to be copied to a new commit we'll call D1.\nA - B - C - D - E - F - G [master]\n \\\n D1\n\nWhile D1 can have C as its parent (C is unaffected, commits do not know their children) it is disconnected from E, F and G. If we change E's parent to D1, E can't be E anymore. It has to be copied to a new commit E1.\nA - B - C - D - E - F - G [master]\n \\\n D1 - E1\n\nAnd so on with F to F1 and G to G1.\nA - B - C - D - E - F - G\n \\\n D1 - E1 - F1 - G1 [master]\n\nThey all have the same code, just different parents (or in D1's case, a different commit message)." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-diff - Show changes between commits, commit and working tree, etc --anchored=<text>" }, { "role": "assistant", "content": "Generate a diff using the \"anchored diff\" algorithm. This option may be specified more than once. If a line exists in both the source and destination, exists only once,\nand starts with this text, this algorithm attempts to prevent it from\nappearing as a deletion or addition in the output. It uses the \"patience\ndiff\" algorithm internally." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to git-pull a given patch set from Gerrit?\nWhen working with Gerrit (Code Review), I often need to get a copy of a given patch set for testing or validation purpose. The obvious and easiest way is to download the archive or the patch file through the Gerrit Web interface and manually apply it to my local source.\nWhile the above steps are pretty straightforward and fulfill my needs, in the best world I would like to have the patch set appearing as a commit in my local Git.\nI was looking around and didn't find the solution. I found some sparse info that once compiled together gives the following solution.\nSay that you want to pull the patch set 2 of the Gerrit change 1222:\nFind the remote refs we are interested in:\n$ git ls-remote | grep 1220\nFrom http://something.com:8081/MyProject\ne2e0212a59240ac5cd7c11220c35542523f44b59 refs/changes/13/713/1\nb8c4dceea5eaf1bad711b0ea6938c80ec932726a refs/changes/20/1220/1\n6f20c182ec7f54a2aa9e8f6188a0eef1b0790df4 refs/changes/20/1220/2\ned94a98386d224ce3d86004ce99f61220905a077 refs/changes/22/1222/1\n\nPull the refs:\ngit pull origin refs/changes/20/1220/2\n\nThis will create a Git commit point that you could eventually rebase:\ngit rebase" }, { "role": "assistant", "content": "This feature is standard in the Gerrit UI.\nOn the top right of the UI for a patch, click Download, and you will see something like:\n\nWhen you are navigating the patches you go to the download section and copy the command line command for checking out the patch set, for example like this:\ngit fetch https://gerrit.googlesource.com/gerrit refs/changes/03/64403/2 && git checkout FETCH_HEAD\n\nThen I normally create a branch with the review number and patchset as name\ngit checkout -b b64403-2\n\nFor here you can work normally and commit your changes or cherry-pick/rebase your changes on this change.\nOnce the review of r64403 is done your code can be merged or when there is another patchset submitted you will need to do the same thing again.\nIf you do not see the options to download the option to Checkout or Cherry Pick you need to edit the gerrit.config, something like this:\n[download]\n scheme = ssh\n command = checkout\n command = cherry_pick\n\nMore details can be found in the Gerrit Documentation\n\nUpdate:\nAs barryku correctly points out, in the later version you need to download the downloads-commands plugin. This can be done during the initial setup or by using the following command:\njava -jar gerrit-2.11.4.war init -d review_site --batch --install-plugin download-commands" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "What's the git equivalent of \"svn update -r\"?\nI'm a recent git convert. It's great to be able to use git-svn to keep my branches locally without disturbing the svn server. There was a bug that existed in the latest version of the code. I wanted to establish a time when it worked so that I could use git bisect. I couldn't find the right command to move back in time. Thanks." }, { "role": "assistant", "content": "git checkout HEAD~1\n\nThis will move your current HEAD to one revision earlier.\ngit checkout <sha>\n\nThis will move your current HEAD to the given revision. Use git log or gitk to find the revision you’re looking for." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-for-each-ref - Output information on each ref if" }, { "role": "assistant", "content": "Used as %(if)…​%(then)…​%(end) or\n%(if)…​%(then)…​%(else)…​%(end). If there is an atom with\nvalue or string literal after the %(if) then everything after\nthe %(then) is printed, else if the %(else) atom is used, then\neverything after %(else) is printed. We ignore space when\nevaluating the string before %(then), this is useful when we\nuse the %(HEAD) atom which prints either \"*\" or \" \" and we\nwant to apply the if condition only on the HEAD ref.\nAppend \":equals=<string>\" or \":notequals=<string>\" to compare\nthe value between the %(if:…​) and %(then) atoms with the\ngiven string." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to get a new branch in my fork from the original repository?\nI forked a repo and the original repo has gotten a new branch after I forked it.\nOriginalRepo\n |\n +-BranchA\n |\n +-newBranch\n\n\nMyFork\n |\n +-BranchA\n\nI want to get the branch newBranch into my fork, how can I do this?" }, { "role": "assistant", "content": "git remote add OriginalRepo repository-URL\ngit fetch OriginalRepo\ngit checkout newBranch\ngit push origin newBranch" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-stash - Stash the changes in a dirty working directory away drop [-q|--quiet] [<stash>]" }, { "role": "assistant", "content": "Remove a single stash entry from the list of stash entries." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git - the stupid content tracker --info-path" }, { "role": "assistant", "content": "Print the path where the Info files documenting this\nversion of Git are installed and exit." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Merging Issues with Git\n\nI am using git version 1.7.11.msysgit.0\nI created a repository under GitHUB and added a file called as README.md with some text content .\nLater on , I have installed GIT Client , did a clone to get the server contents on to my machine .\nThen I deleted the file README.md on to my local machine .\nNow when I do git commit , I get this error \npraveenk@MSIN-BT-100 /d/workspace/MYTestRepo (master|MERGING)\n$ git commit ;\nU README.md\nerror: 'commit' is not possible because you have unmerged files.\nhint: Fix them up in the work tree,\nhint: and then use 'git add/rm <file>' as\nhint: appropriate to mark resolution and make a commit,\nhint: or use 'git commit -a'.\nfatal: Exiting because of an unresolved conflict.\n\nThis is with git pull:\n$ git pull;\nU README.md\nA One.txt\nPull is not possible because you have unmerged files.\nPlease, fix them up in the work tree, and then use 'git add/rm <file>'\nas appropriate to mark resolution, or use 'git commit -a'.\n\nHow to resolve these errors ?" }, { "role": "assistant", "content": "Do this:\ngit merge --abort\ngit pull (to be sure you're up-to-date)\n\nNow replace the contents of the README.md file with what you want it to say. If you don't want it at all, do git rm README.md\nThen if you replaced the contents, commit and push those contents with:\ngit add README.md\ngit commit -m \"comment\"\ngit push" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "What is the current workflow to debug Travis builds locally?\n\nOne used to be able to download Vagrant boxes to debug Travis builds (for GitHub projects for instance). Apparently, this is no longer possible, so how do people currently debug complex Travis build chains locally?" }, { "role": "assistant", "content": "One way to inspect the build (not to debug, sorry) is to send the build logs to another server on failure.\nHere is an example:\nafter_failure\n - sudo tar -czf /tmp/build-${TRAVIS_BUILD_NUMBER}-logs.tgz your-application-logs/\n - scp /tmp/build-${TRAVIS_BUILD_NUMBER}-logs.tgz [email protected]:~/logs\n\nYou could send them via email, store them on a storage server or whatever.\nThese logs would be useful to you if you run your tests in a debug mode and include our own logs as well in the tarball." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git --git-dir not working as expected\nI am trying to run git from a different directory than I am in. So for example if I am in:\ncd /home/domain/\ngit status << runs perfect ie\n# On branch master\n# Your branch is ahead of 'origin/master' by 6 commits.\n\nSo now I want to run this command from a different directory using the --git-dir option.\nSo lets say I'm in root/ and try this:\ngit --git-dir=\"/home/domain/\" status\n## Error \nfatal: Not a git repository: '/home/domain/'\n\nI've also tried to include the .git folder i.e.\ngit --git-dir=\"/home/domain/.git/\" status\n\nBut this looks like it's trying to run git from the root, i.e. deleting everything from my domain folder and adding everything in root.\nHope someone can advise on what I'm doing wrong." }, { "role": "assistant", "content": "You have to define the working dir as well. Confusing I know but it's a flexibility thing.\ngit --git-dir=/mycode/.git --work-tree=/mycode status\n\nYou can read a little more here" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-rebase - Reapply commits on top of another base tip Easy case: The changes are literally the same." }, { "role": "assistant", "content": "This happens if the subsystem rebase was a simple rebase and\nhad no conflicts." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Completely cancel a rebase\nI performed a rebase like this: \ngit rebase --onto master new_background_processing export_background_processing\n\nThat didn't do what I wanted it to, so I performed a reset: \ngit reset --hard HEAD@{1}\n\nI got my branch back to the state it was, but I received this message when I type git status: \n# You are currently rebasing branch 'export_background_processing' on 'e378641'.\n\nHow do I cancel that rebase completely? Not sure what that means per se." }, { "role": "assistant", "content": "Use git rebase --abort. From the official Linux kernel documentation for git rebase:\ngit rebase --continue | --skip | --abort | --edit-todo | --quit" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "BitBucket Git Error: did not send all necessary objects\nI am using bitbucket and git to revision a project I am currently working on. Today I tried to pull down the latest working copy of the project but was met with an error that I cant seem to find any solution to.\n$ git pull\nPassword for 'bitbucket.org':\nremote: Counting objects: 65, done.\nremote: Compressing objects: 100% (31/31) done.\nremote: Total 34 (delta 19), reused 0 (delta 0)\nUpacking objects: 100% (34/34), done.\nfatal: bad object 4324324....(etc object number)\nerror: https://bitbucket.org/myusername/myproject.git did not send all necessary objects\n\nI have searched for this error \"did not send all necessary objects\" but there doesn't seem to be any documentation regarding this issue can anyone help please?" }, { "role": "assistant", "content": "I had this issue, related to a branch. Following @fnagel's similar approach, I just deleted the following folder, and it fixed the issue:\n.git/refs/remotes/origin/<name of branch>" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git - the stupid content tracker git-mv" }, { "role": "assistant", "content": "Move or rename a file, a directory, or a symlink" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Terraform modules using a git branch as a source\nUsing Terraform modules with a git branch as a source,\nI am referring to:\ngit::ssh://private_server:myport/kbf/my_repository.git//ecs-cluster?ref=v0.0.1\n\nIn my module source parameter, this works great and provides me with my module at tag v0.0.1 on master.\nHowever I'd like to specify a branch, not a tag, but am not sure how to do this." }, { "role": "assistant", "content": "As mentioned in the Terraform documentation here:\ngit::ssh://private_server:myport/kbf/my_repository.git//ecs-cluster?ref=myBranch" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git clone through ssh\nI have a project on which I created a git repository:\n$ cd myproject \n$ git init \n$ git add . \n$ git commit \n\nI the wanted to create a bare clone on another machine:\n$ cd .. \n$ git clone --bare myproject ssh://user@server:/GitRepos/myproject.git \n\nI executed the clone but did not print any answer.\nI logged on to the server machine and tried to see how the files are stored. The path /GitRepos was empty, so I decided to do the clone again: \n$ git clone --bare myproject ssh://user@server:/GitRepos/myproject.git\n\nThis time the answer was :\n\nfatal: destination path 'ssh://user@server:/GitRepos/myproject.git' already exists and is not an empty directory.\n\nBut I saw that the path was empty.\nWhat's going on here ?" }, { "role": "assistant", "content": "This is possibly unrelated directly to the question; but one mistake I just made myself, and I see in the OP, is the URL specification ssh://user@server:/GitRepos/myproject.git - namely, you have both a colon :, and a forward slash / after it signifying an absolute path.\nI then found Git clone, ssh: Could not resolve hostname – git , development – Nicolas Kuttler (as that was the error I was getting, on git version 1.7.9.5), noting:\n\nThe problem with the command I used initially was that I tried to use an scp-like syntax.\n\n... which was also my problem! So basically in git with ssh, you either use\n\nssh://[email protected]/absolute/path/to/repo.git/ - just a forward slash for absolute path on server\n[email protected]:relative/path/to/repo.git/ - just a colon (it mustn't have the ssh:// for relative path on server (relative to home dir of username on server machine)" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-push - Update remote refs along with associated objects -d --delete" }, { "role": "assistant", "content": "All listed refs are deleted from the remote repository. This is\nthe same as prefixing all refs with a colon." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-diff - Show changes between commits, commit and working tree, etc diff.external" }, { "role": "assistant", "content": "If this config variable is set, diff generation is not\nperformed using the internal diff machinery, but using the\ngiven command. Can be overridden with the ‘GIT_EXTERNAL_DIFF’\nenvironment variable. The command is called with parameters\nas described under \"git Diffs\" in git . Note: if\nyou want to use an external diff program only on a subset of\nyour files, you might want to use gitattributes instead." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "What does a red text-background mean in GitHub comparison view?\n\nI created a pull request and was browsing through, the differences are shown with light red/green line-brackgrounds, but some text is bolded with a red text background...\nUpdate: Image changed to show file with some highlighted comments and some not.\n\nWhat does this mean?" }, { "role": "assistant", "content": "The red background-color is definitely being caused by the error-highlighting feature of GitHub's text editor/viewer. You can find the same behaviour occurring to an intended block comment in another JSON file on GitHub:\n\nAs for your comment about some illegal characters not being highlighted: I also found that certain JSON errors aren't caught by GitHub's syntax processor. See this gist as an example:\n\nIn this case, the text outside of the outermost object isn't being highlighted. Whatever reason there is for this may be the same reason that errors aren't being highlighted for you.\nYou can test it out for yourself by copy-pasting your code into a new Gist. Note that the ACE Editor has its own highlighting feature that can highlight code as you type, but its processing rules seem to be a bit different from that of GitHub's code viewer." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-for-each-ref - Output information on each ref push" }, { "role": "assistant", "content": "The name of a local ref which represents the @{push} location for the displayed ref. Respects :short , :lstrip , :rstrip , :track , :trackshort , :remotename , and :remoteref options as upstream does. Produces an empty string if no @{push} ref is configured." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-branch - List, create, or delete branches -m --move" }, { "role": "assistant", "content": "Move/rename a branch, together with its config and reflog." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Gitlab CI: npm doesn't like the cached node_modules\n\nThe internet is full of complains about Gitlab not caching, but in my case I think, that Gitlab CI indeed caches correctly. The thing is, that npm seems to install everything again anyway. \ncache:\n key: ${CI_COMMIT_REF_SLUG}\n paths:\n - vendor/\n - bootstrap/\n - node_modules/\n\nbuild-dependencies:\n image: ...\n stage: build\n script:\n - cp .env.gitlab-testing .env\n - composer install --no-progress --no-interaction\n - php artisan key:generate\n - npm install\n - npm run prod\n - npm run prod\n artifacts:\n paths:\n - vendor/\n - bootstrap/\n - node_modules/\n - .env\n - public/mix-manifest.json\n tags:\n - docker\n\nThis is my gitlab-ci.yml file (well.. the relevant part). While the cached composer dependencies are used, the node_modules aren't. I even added everything to cache and artifacts out of desperation.." }, { "role": "assistant", "content": "Updated Answer (Dec 2, 2023, GitLab@^15.12 & >13)\nJust like the comments received, the use of artifacts is not ideal in the original answer, but was the cleanest approach that worked reliably. Now, that GitLab's documentation has been updated around the use of cache and it was also expanded to support multiple cache keys per job (4 maximum unfortunately), there is a better way to handle node_modules across a pipeline.\nThe rationale for implementation is based on understand the quirks of both GitLab and how npm works. These are the fundamentals:\n\nNPM recommends the use of npm ci instead of npm install when running in a CI/CD environment. FYI, this will require the existence of package-lock.json, which is used to ensure 0 packages are automatically version bumped while running in a CI environment (npm i by default will not create the same deterministic build every time, such as on a job re-run).\n\nnpm ci deliberately removes the entirety of node_modules first before re-installing all packages listed in package-lock.json. Therefore, it is best to only configure GitLab to run npm ci once and ensure the resulting node_modules is passed to other jobs.\n\nNPM has its own cache that it stores at ~/.npm/ in case of offline builds and overall speed. You can specify a different cache location with the --cache <dir> option (you will need this). (variation of @Amityo's answer)\n\nGitLab cannot cache any directory outside of the repository! This means the default cache directory ~/.npm cannot be cached.\n\nGitLab's global cache configuration is applied to every job by default. Jobs will need to explicit override the cache config if it doesn't need the globally cached files. Using YAML anchors, the global cache config can be copied & modified.\n\nTo run additional npx or npm run <script> without re-running an install, you should cache node_modules/ folder(s) across the pipeline.\n\nGitLab's expectation is for users to use the cache feature to handle dependencies and only use artifacts for dynamically generated build results. This answer now supports this desire better than possible before. There is the restriction that artifacts should be less than the maximum artifact size or 1GB (compressed) on GitLab.com. And artifacts uses your storage usage quota\n\nThe use of the needs or dependencies directives will influence if artifacts from a previous job will be downloaded (or deleted) automatically on the next job.\n\nGitLab cache's can monitor the hash value of a file and use that as the key so its possible the cache will only update when the package-lock.json updates. You could use package.json but you would invalidate your deterministic builds as it does not update when minor or patches are available.\n\nIf you have a mono-repo and have more than 2 separate packages, you will hit the cache entry limit of 4 during the install job. You will not have the ideal setup but you can combine some cache definitions together. It is also worth noting, GitLab cache.key.files supports a maximum of 2 files to use for the key hash so you likely will need to use another method to determine a useful key. One likely solution will be to use a non-file related key and cache all node_modules/ folders under that key. That way you have only 2 cache entries for the install job and 1 for each subsequent job.\n\nGitLab's cache list unfortunately prepends the index value to the cache key it uses (this is very unintuitive!) which can affect whether or not your cache is matched between jobs. Thank you to @deanharber for bringing this up. As of 3 Dec 2023, this example has been updated to reflect the new order in the install job. The global cache entry must be first in the install job since the global cache key is actually 0_[CACHE_KEY_FOR_NODE_MODULES], and the npm cache second as it will have a key of 1_[CACHE_KEY_FOR_NPM_TARBALLS].\n\n\nSolution\n\nRun a single install job as .pre stage, using cached downloaded packages (tar.gz's) across entire repository.\nCache all node_modules/ folders to following jobs for that pipeline execution. Do not allow any jobs except install to upload cache (lowers pipeline run time & prevents unintended consequences)\nPass the build/ directory via artifacts on to other jobs only when needed\n\n# .gitlab-ci.yml\n\nstages:\n - build\n - test\n - deploy\n\n\n# global cache settings for all jobs\n# Ensure compatibility with the install job\n# goal: the install job loads the cache and\n# all other jobs can only use it\ncache:\n # most npm libraries will only have 1 entry for the base project deps\n - &global_cache_node_mods\n key:\n files:\n - package-lock.json\n paths:\n - node_modules/\n policy: pull # prevent subsequent jobs from modifying cache\n\n# # ATTN mono-repo users: with only additional node_modules, \n# # add up to 2 additional cache entries. \n# # See limitations in #10. \n# - key:\n# files:\n# - core/pkg1/package-lock.json\n# paths:\n# - core/pkg1/node_modules/\n# policy: pull # prevent jobs from modifying cache\n\n\ninstall:\n image: ...\n stage: .pre # always first, no matter if it is listed in stages\n cache:\n # Mimic &global_cache_node_mods config but override policy\n # to allow this job to update the cache at the end of the job\n # and only update if it was a successful job (#5)\n - <<: *global_cache_node_mods\n when: on_success\n policy: pull-push\n\n# # ATTN Monorepo Users: add additional key entries from \n# # the global cache and override the policy as above but\n# # realize the limitations (read #10).\n# - key:\n# files:\n# - core/pkg1/package-lock.json\n# paths:\n# - core/client/node_modules/\n# when: on_success\n# policy: pull-push\n\n # store npm cache for all branches (stores download pkg.tar.gz's)\n # will not be necessary for any other job\n - key: ${CI_JOB_NAME}\n # must be inside $CI_PROJECT_DIR for gitlab-runner caching (#3)\n paths:\n - .npm/\n when: on_success\n policy: pull-push\n\n# before_script:\n# - ...\n script:\n # define cache dir & use it npm!\n - npm ci --cache .npm --prefer-offline\n# # monorepo users: run secondary install actions\n# - npx lerna bootstrap -- --cache .npm/ --prefer-offline\n\n\nbuild:\n stage: build\n # global cache settings are inherited to grab `node_modules`\n script:\n - npm run build\n artifacts:\n paths:\n - dist/ # where ever your build results are stored\n\n\ntest:\n stage: test\n # global cache settings are inherited to grab `node_modules`\n needs:\n # install job is not \"needed\" unless it creates artifacts\n # install job also occurs in the previous stage `.pre` so it\n # is implicitly required since `when: on_success` is the default\n # for subsequent jobs in subsequent stages\n - job: build\n artifacts: true # grabs built files\n # dependencies: could also be used instead of needs\n script:\n - npm test\n\n\ndeploy:\n stage: deploy\n when: on_success # only if previous stages' jobs all succeeded\n # override inherited cache settings since node_modules is not needed\n cache: {}\n needs:\n - job: build\n artifacts: true # grabs dist/\n script:\n - npm publish\n\nGitLab's recommendation for npm can be found in the GitLab Docs.\n\n[DEPRECATED] Original Answer (Oct 27, 2021, GitLab<13.12)\nAll the answers I see so far give only half answers but don't actually fully accomplish the task of caching IMO.\nIn order to fully cache with npm & GitLab, you must be aware of the following:\n\nSee #1 above\n\nnpm ci deliberately removes the entirety of node_modules first before re-installing all packages listed in package-lock.json. Therefore, configuring GitLab to cache the node_modules directory between build jobs is useless. The point is to ensure no preparation hooks or anything else modified node_modules from a previous run. IMO, this is not really valid for a CI environment but you can't change it and maintain the fully deterministic builds.\n\nSee #3-#4 above\n\nIf you have multiple stages, global cache will be downloaded every job. This likely is not what you want!\n\nTo run additional npx commands without re-running an install, you should pass the node_modules/ folder as an artifact to other jobs.\n\n\n[DEPRECATED] Solution\n\nRun a single install job as .pre stage, using cached downloaded packages (tar.gz's) across entire repository.\nPass node_modules & the build directory on to other jobs only when needed\n\n\nstages:\n - build\n - test\n - deploy\n\ninstall:\n image: ...\n stage: .pre # always first, no matter if it is listed in stages\n cache:\n key: NPM_DOWNLOAD_CACHE # a single-key-4-all-branches for install jobs\n paths:\n - .npm/\n before_script:\n - cp .env.gitlab-testing .env\n - composer install --no-progress --no-interaction\n - php artisan key:generate\n script:\n # define cache dir & use it npm!\n - npm ci --cache .npm --prefer-offline\n artifacts:\n paths:\n - vendor/\n - bootstrap/\n - node_modules/\n - .env\n - public/mix-manifest.json\n\nbuild:\n stage: build\n needs:\n - job: install \n artifacts: true # true by default, grabs `node_modules`\n script:\n - npm run build\n artifacts:\n paths:\n - dist/ # whereever your build results are stored\n\ntest:\n stage: test\n needs:\n - job: install\n artifacts: true # grabs node_modules\n - job: build\n artifacts: true # grabs built files\n script:\n - npm test\n\ndeploy:\n stage: deploy\n needs:\n # does not need node_modules so don't state install as a need\n - job: build\n artifacts: true # grabs dist/\n - job: test # must succeed\n artifacts: false # not needed\n script:\n - npm publish" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Best practice for using multiple .gitignore files\n\nThere exists a collection of useful .gitignore files at\nhttps://github.com/github/gitignore. Every ignores file there has an extension .gitignore, e.g. Java.gitignore, vim.gitignore. When I put these files directly into a workdir, they don't work.\nIs it necessary to create a single file .gitignore and merge the constituent files into it?\nAccordingly, when using a --global .gitignore file, it seems the config points to a single file. If for instance I want to apply all .gitignore files in a Global/ directory, should I manually merge them into a single file? If so, it's extra work to keep this merged file up to date with the \"official\" collection.\nTo reiterate, I acknowledge that we can use different .gitignore files in different directories, but it is not what I want. I want to apply multiple .gitignore files in a single directory." }, { "role": "assistant", "content": "To clarify: a projects gitignore file is called .gitignore\n\nBackground:\nA .gitignore refers to the directory that it's in, which is either the top level or descendent of a directory with a .git repository, i.e. a \".git/\" directory.\nThere can be multiple .gitignore files in any sub directories but the Best Practice is to have one .gitignore in a given projects root and have that file reference sub-directories as necessary, e.g. images/yearly/recent Otherwise it is be tricky to know \"which\" .gitignore file to look at to find something that's being ignored. Given that you can use patterns as file names that could be pretty tricky!\nI also recommend avoiding using a global .gitignore file which applies to all projects on your machine, although you might keep a template around for using with new projects. The main consideration here is that your .gitignore will be different from other developers (which may or may not exist) and so the result is undetermined. One example of an exception to this is using a global .gitignore file for IDE files that I don't want in any project that I open on my machine so I use a global .gitigore with an entry for .idea/ files (rubyMine).\n\nThe intent of the templates you see listed is that normally you are writing the code for a given file in a specific language. Given this, a template that is based on the language is frequently sufficient. \nIf there are multiple languages in the code base, then used you will need to combine multiple .gitignore's for those languages, which can be done in a multitude of ways such as:\ncat .gitignore1 .gitignore2 > .gitignore # if .gitignore doesn't exist yet\ncat .gitignore1 >> .gitignore # Add to it if it already exists\npaste .gitignore1 .gitignore # Add to it if it already exists\n\n\nHot(ish) off the press (summer 2014):\nGitignorer is a simple utility that aids in the creation of .gitignore files. It pulls specific (specified) .gitignore templates, with common files to exclude, from github.com/github/gitignore, mashes them together, and saves them to a .gitignore in the current directory.\nExample usage:\ngitignorer create c java python\n\nGitignorer is currently available in the AUR over at https://aur.archlinux.org/packages/gitignorer/ and on GitHub at https://github.com/zachlatta/gitignorer" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-diff - Show changes between commits, commit and working tree, etc git diff --cached" }, { "role": "assistant", "content": "compares a (c)ommit and the (i)ndex;" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-diff - Show changes between commits, commit and working tree, etc --pickaxe-all" }, { "role": "assistant", "content": "When -S or -G finds a change, show all the changes in that\nchangeset, not just the files that contain the change\nin <string>." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "In GitHub URL's: what is the difference between a tree and a blob?\nI keep noticing this whenever I'm trying to add links to github files. You can add a link using blob:\nhttps://github.com/facebook/pop/blob/master/Podfile\nAnd the same doc comes up if you change blob to tree:\nhttps://github.com/facebook/pop/tree/master/Podfile\nWhat is the difference? Whenever I want to add a link for posterity in a doc, which one should I prefer?" }, { "role": "assistant", "content": "GitHub's website currently seems to be:\n\nUsing blob for files, and tree for directories, in URLs;\nRedirecting browsers which request file URLs containing tree to contain blob instead; and\nRedirecting browsers which request directory URLs containing blob to URLs containing tree instead.\n\nIt's possible that GitHub's website, at the time you asked the question, was only rewriting file URLs between tree and blob, instead of properly redirecting them. (Rewriting and redirecting URLs are activities of web servers.) If so, then the change wouldn't appear in your browser's address bar. But maybe you didn't mean that." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-config - Get and set repository or global options blame.ignoreRevsFile" }, { "role": "assistant", "content": "Ignore revisions listed in the file, one unabbreviated object name per\nline, in git-blame . Whitespace and comments beginning with # are ignored. This option may be repeated multiple times. Empty\nfile names will reset the list of ignored revisions. This option will\nbe handled before the command line option --ignore-revs-file ." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Creating pull requests in gitlab\n\nI have a GitLab installation running, and I have a repository that I want to share with my friends. I can't understand the flow of sending pull requests in GitLab.\nA user can't fork my repository or access my project (unless he is my on team). A merge request can be from one branch to another in my repository.\nHow do pull requests work in GitLab?" }, { "role": "assistant", "content": "GitLab.com co-founder here. Forking should work fine in recent versions of GitLab (6.x). You can fork a repo belonging to someone else and then create a merge request (the properly named version of the GitHub pull request)." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git - the stupid content tracker git-check-attr" }, { "role": "assistant", "content": "Display gitattributes information" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Which Git commit stats are easy to pull\nPreviously I have enjoyed TortoiseSvn's ability to generate simple commit stats for a given SVN repository. I wonder what is available in Git and am particularly interested in :\n\nNumber of commits per user\nNumber of lines changed per user\nactivity over time (for instance aggregated weekly changes)\n\nAny ideas?" }, { "role": "assistant", "content": "Actually, git already has a command for this:\ngit shortlog\n\nin your case, it sounds like you're interested in this form:\ngit shortlog -sne\n\nSee the --help for various options.\nYou may also be interested in the GitStats project. They have a few examples, including the stats for the Git project. From the GitStat main page:\nHere is a list of some statistics generated currently:\n\nGeneral statistics: total files, lines, commits, authors.\nActivity: commits by hour of day, day of week, hour of week, month of year, year and month, and year.\nAuthors: list of authors (name, commits (%), first commit date, last commit date, age), author of month, author of year.\nFiles: file count by date, extensions\nLines: Lines of Code by date" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-format-patch - Prepare patches for e-mail submission --line-prefix=<prefix>" }, { "role": "assistant", "content": "Prepend an additional prefix to every line of output." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "format-patch for a single file\nI have a file called test_module.c that has some differences that I want to apply to my local working copy.\nI tried to create patch file from the remote by doing the following. However, git didn't complain about any errors. And didn't create any patch file either.\ngit format-patch master/dev_branch test/test_module.c\n\nIt is possible to create a patch of a single file, that I can apply?\n(Using git version 1.7.5.4)" }, { "role": "assistant", "content": "If you give git format-patch a single revision, it will produce patches for each commit since that revision. If you see no output from that command, then I suspect that there were no changes to that file between origin/master and your current HEAD. As an alternative, you can provide a revision range (e.g. origin/master~3..origin/master) which covers the changes introduced to that file. Or, if the changes you want to produce a patch for are just contained in the single commit at the tip of origin/master, you can use the -1 parameter, as in:\ngit format-patch -1 origin/master test/test_module.c" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-format-patch - Prepare patches for e-mail submission --numbered-files" }, { "role": "assistant", "content": "Output file names will be a simple number sequence\nwithout the default first line of the commit appended." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git - the stupid content tracker gitattributes" }, { "role": "assistant", "content": "Defining attributes per path" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Completely remove files from Git repo and remote on GitHub\nI accidentally added a folder of images and committed. Then, I made one more commit.\nThen I removed those files using git rm -f ./images and committed again. \nRight now, I have made a lot more commits in that branch (master). In my HEAD, I don't have that ./static/images folder.\nDue to this, my repo size has increased a lot. How can I remove those blobs completely? And I want to remove it from my remote GitHub repo too." }, { "role": "assistant", "content": "This is what you're looking for: ignoring doesn't remove a file. I suggest you read that page, but here's the specific command to use:\ngit filter-branch --index-filter \\\n'git rm -r --cached --ignore-unmatch <file/dir>' HEAD\n\nAlso, to remove all the deleted files from caches git creates, use:\nrm -rf .git/refs/original/ && \\\ngit reflog expire --all && \\\ngit gc --aggressive --prune\n\nYou can find more info about the last command, as well as a script that does everything you want in one single action, here: git: forever remove files or folders from history.\nAnother links with lots of explanation: Remove sensitive data.\n[Edit] Also, see this StackOverflow question: Remove sensitive files and their commits from Git history. \n(Commands copied from natacado's answer in the question linked above.) If you have already removed the files from the working copy, the following should work. Find out the hash for the commit that added the unwanted files. Then do:\ngit filter-branch --index-filter \\\n'git update-index --remove filename' <introduction-revision-sha1>..HEAD\ngit push --force --verbose --dry-run\ngit push --force" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How can I fork the original repo when I've already forked a different fork\n\nI've previously forked jockm/vert.x and sent him a pull request. Now I want to fork vert-x/vert.x (the upstream of jockm/vert.x) and send them a different pull request.\nBut when I click the Fork button, unsuprisingly I end up in my tjcrowder/vert.x fork of jockm/vert.x instead. Is it possible to fork both vert-x/vert.x and jockm/vert.x simultaneously such that I can send each pull requests as appropriate?\nI fear the answer may be the same as for this question about the converse situation (\"there's no GitHub way, but you can add a remote repo\") but I'm hoping otherwise — not least because I don't see how the answer there would allow me to send pull requests to the new remote." }, { "role": "assistant", "content": "There's no GitHub way (small lie, see below), but there's also nothing to fear.\nBy definition, your fork of a fork is a fork of the original.\nWhen you open a pull request, you get the option to choose both the origin and the destination for your pull request. The choices available there obviously depend on the fork graph, but as long as there is a path in the graph between the 2 repositories, you should be safe.\nAlso, since pull requests live on the website side, you don't even need to add a remote as long as you don't want to use it from git.\nNow of course, you might want to reconsider your place in that graph, and make yourself a direct child of the real upstream, but that's mostly unrelated.\nAs said earlier there is actually a twisted way to have multiple forks, which is to create organizations and fork in them. That way you can \"own\" multiple repositories in the same graph. But there's really no need to go there." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to remove/uninstall gitlab-runner completely from centos\n\nMy gitlab-runner service is not running no matter what I do. I used to have same problem before and when I used to update, and it used to start running but now it’s not starting at all. \nI have uninstalled and then again installed it’s still the same. I guess I am not uninstalling/removing completely. How to uninstall gitlab runner completely or how to start service?\nI also don’t get home dir of gitlab-runner. when I say gitlab-runner list I get following config details. \nConfigFile=/home/rohith/.gitlab-runner/config.toml\n\nbut I try cd to gitlab-runner user dir I don't find the dir at all." }, { "role": "assistant", "content": "If you install gitlab runner binary on Ubuntu 20.04 you can uninstall it completely by run below commands:\n# Stop and remove the service\nsudo gitlab-runner stop\nsudo gitlab-runner uninstall\nsudo systemctl daemon-reload\n\n# Remove gitlab-runner files and config\nsudo rm -rf /usr/local/bin/gitlab-runner\nsudo userdel gitlab-runner\nsudo rm -rf /home/gitlab-runner/" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-config - Get and set repository or global options receive.fsckObjects" }, { "role": "assistant", "content": "If it is set to true, git-receive-pack will check all received\nobjects. See transfer.fsckObjects for what’s checked.\nDefaults to false. If not set, the value of transfer.fsckObjects is used instead." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-log - Show commit logs %cr" }, { "role": "assistant", "content": "committer date, relative" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "GitHub authentication failing over https, returning wrong email address\nInitiating a push or any other action with GitHub from the command line (over https, not ssh) that calls for the username and password not only fails but, when it does, it returns \nUsername for 'https://github.com': username\nPassword for 'https://[email protected]': \nremote: Invalid username or password.\nfatal: Authentication failed for 'https://github.com/username/repository.git/'\n\nI do not have an @github.com address. The password and username are correct.\nI know I could switch to SSH and use keys but that doesn't answer why the authentication is failing over https." }, { "role": "assistant", "content": "GitHub's support determined the root of the issue right away: Two-factor authorization.\nTo use GitHub over the shell with https, create an OAuth token. As the page notes, I did have to remove my username and password credentials from Keychain but with osx-keychain in place, the token is stored as the password and things work exactly as they would over https without two-factor authorization in place." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Adding git submodule that contains another submodule?\n\nI'm working on a project in one git repository (A) that is including another git repository (B), which in turn includes a third git repository (C). In A, I added B via:\ngit submodule add https://github.com/blt04/sfDoctrine2Plugin.git plugins/sfDoctrine2Plugin\n\nClick here, and you can see where B references C: https://github.com/doctrine/doctrine2\nAfter doing my git submodule add, my plugins/sfDoctrine2Plugin/lib/vendor/doctrine folder (should contain C) is empty. I tried doing a git submodule update --recursive as per this StackOverflow answer, but it still didn't import the files to that path. I'm at a loss as to what to do here." }, { "role": "assistant", "content": "You need to do git submodule update --init --recursive. The problem here is the submodule C is never being initialized in the first place." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How do I exit the results of 'git diff' in Git Bash on windows? [duplicate]\nThis question already has answers here:\n \n \n\n\n\n\nHow to exit a 'git status' list in a terminal?\n\n (17 answers)\n \n\nClosed 8 years ago.\n\n\n\nI'm using Git Bash on Windows 7. When I run git diff, I see this: \n\nHowever, I'm unable to get back to a regular prompt. Pressing Ctrl+C seems to work, but as soon as I start typing a command, it's covered up with (END) as in that image." }, { "role": "assistant", "content": "I think pressing Q should work." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Git - how to handle symlinks\nWhat is the correct way to handle symlinks in git?\nI have the following structure:\nVendors\n Module A\n Module B\n Module C\nApp\n Code\n Modules\n Core Module 1\n Core Module 2\n Module A (symlinked to vendors)\n Module B (symlinked to vendors)\n Module C (symlinked to vendors)\n\nThere is a a main App directory which contains all of the core code in the application. Additionally there is a vendor directory that contains modules which get symlinked into the main app directory and therefore integrated.\nImportantly, both the vendor directory and the main app directory are both versioned in the same repository. \nTherefore, should i let git keep storing the symlinks, or find a way to have it ignore symlinks?" }, { "role": "assistant", "content": "Git can handle symlinks just fine as long as the operating system used by all developers supports them. Since you depend on having these symlinks present I will assume that your development environments all support symlinks.\nTo decide if something should be included in your git repository or not (symlink or otherwise) consider the following:\n\nIs it a file generated by some tool or other process in the repository? If so, it's best to ignore it and let each user generate the file, so that they will always have the latest version.\nIs the file specific to a particular user's development environment, or one that is used in all environments? If it's a quirk of a particular user's environment, like a configuration to ignore Emacs backup files, it doesn't belong in the repo. If it's something all developers will need, and/or something that's needed to build the application for production, it should go in the repository.\n\nIn your case it seems like the symlinks are not generated and they are needed in all environments, so putting them in the repository should be fine.\nHowever, when creating them be sure to create them as relative symlinks rather than absolute symlinks, so that they'll work regardless of where the repository is cloned. The easiest way to do this is to change directory into the Modules directory and create the symlink from there:\ncd App/Code/Modules\nln -s \"../../../Vendors/Module A\" \"Module A\"" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Can github pages CNAME file contain more than one domain?\n\nCan github pages CNAME file contain more than one domain?\nExample file:\nreggi.com\nwww.reggi.com\nblog.reggi.com" }, { "role": "assistant", "content": "No, this is not possible. See the GitHub Help docs that explain this:\n\nEnsure you only have one domain listed in your CNAME file. If you wish to have multiple domains pointing to the same Pages, you will need to set up redirects for the other domains. Most domain registrars and DNS hosts offer this service to their customers." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "github locks up mac terminal when using pull command\n\nI'm in the process of learning github on mac (command-line) and whenever I do git pull origin master i get this\n# Please enter a commit message to explain why this merge is necessary,\n# especially if it merges an updated upstream into a topic branch.\n#\n# Lines starting with '#' will be ignored, and an empty message aborts\n# the commit.\n~ \n~ \n~ \n~ \n~ \n~ \n~ \n~ \n~ \n~ \n~ \n~ \n~ \n~ \n~ \n~ \n\".git/MERGE_MSG\" 7L, 293C\n\nthe terminal seems to lock up and doesn't allow me to enter anything immediately, then when it finally does allow me to enter text it seems like it doesn't recognize git commands.\nIs this a bug in git or am i missing something?" }, { "role": "assistant", "content": "You're in the text editor, vim! It's a modal text editor, so you would need to:\n\nPress i to enter insert mode.\nNow you can type your message, as if you were in a normal\n(non-modal) text editor.\nPress esc to go back to command mode.\nThen type :w followed by enter to save.\nFinally :q followed by enter to quit." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to login docker account in Gitlab-ci\n\nI have subscribed for a Pro plan of docker account to increase rate limit in my self hosted Gitlab CI jobs. Then successfully logged-in using this command on the server:\n$ sudo docker login -u user -p *******\n\nThis is my .gitlab-ci.yml file:\nimage: edbizarro/gitlab-ci-pipeline-php:7.3-alpine\n\nunittest:\n stage: testing\n services:\n - mysql:latest\n script:\n - ./vendor/bin/phpunit --colors --stop-on-failure\n\nBut when jobs get started, I'm still getting this error:\nRunning with gitlab-runner 13.6.0 (8fa89735)\n on fafa-group-runner n7oiBzAk\nPreparing the \"docker\" executor\n30:53\nUsing Docker executor with image edbizarro/gitlab-ci-pipeline-php:7.3-alpine ...\nStarting service mysql:latest ...\nPulling docker image mysql:latest ...\nERROR: Preparation failed: Error response from daemon: toomanyrequests: You have reached your pull rate limit. You may increase the limit by authenticating and upgrading: https://www.docker.com/increase-rate-limit (docker.go:142:4s)\n\nAm I missing something?" }, { "role": "assistant", "content": "You performed the docker login as the root user on the host. However the images are being pulled by the GitLab runner, which will be another user, possibly containerized.\nThe instructions for configuring runner registry credentials has several options, including setting DOCKER_AUTH_CONFIG in either the project's .gitlab-ci.yml or runner's config.toml. That variable contains the content of the ~/.docker/config.json with the registry credentials inside." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to integrate Jira with GitLab CE?\n\nWe have self hosted GitLab CE and Jira, we want\n\nlink git commit with jira issue\nlink git commit with jira issue status, like we can start/move/close issue by git issues\nlimit above operations on specific branches, e.g., change issue status only when commits on master branch since we perform merge request for every single feature/bug\n\nbut only GitLab EE built-in supports Jira integration, how could I do that for GitLab CE?\nI'm on GitLab CE 7.8.2, Jira+Agile 6.4" }, { "role": "assistant", "content": "I think there is now a better way:\nhttps://docs.gitlab.com/ce/user/project/integrations/jira.html\n\nGitLab can be configured to interact with JIRA. Configuration happens via user name and password. Connecting to a JIRA server via CAS is not possible.\nEach project can be configured to connect to a different JIRA instance, see the configuration section. If you have one JIRA instance you can pre-fill the settings page with a default template. To configure the template see the Services Templates document.\nOnce the project is connected to JIRA, you can reference and close the issues in JIRA directly from GitLab." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-svn - Bidirectional operation between a Subversion repository and Git svn-remote.<name>.rewriteRoot" }, { "role": "assistant", "content": "This allows users to create repositories from alternate\nURLs. For example, an administrator could run git svn on the\nserver locally (accessing via file://) but wish to distribute\nthe repository with a public http:// or svn:// URL in the\nmetadata so users of it will see the public URL." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git - the stupid content tracker git-show" }, { "role": "assistant", "content": "Show various types of objects" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git - the stupid content tracker" }, { "role": "assistant", "content": "SECURITY Some configuration options and hook files may cause Git to run arbitrary\nshell commands. Because configuration and hooks are not copied using git clone , it is generally safe to clone remote repositories with\nuntrusted content, inspect them with git log , and so on. However, it is not safe to run Git commands in a .git directory (or\nthe working tree that surrounds it) when that .git directory itself\ncomes from an untrusted source. The commands in its config and hooks\nare executed in the usual way. By default, Git will refuse to run when the repository is owned by\nsomeone other than the user running the command. See the entry for safe.directory in git-config . While this can help protect\nyou in a multi-user environment, note that you can also acquire\nuntrusted repositories that are owned by you (for example, if you\nextract a zip file or tarball from an untrusted source). In such cases,\nyou’d need to \"sanitize\" the untrusted repository first. If you have an untrusted .git directory, you should first clone it\nwith git clone --no-local to obtain a clean copy. Git does restrict\nthe set of options and hooks that will be run by upload-pack , which\nhandles the server side of a clone or fetch, but beware that the\nsurface area for attack against upload-pack is large, so this does\ncarry some risk. The safest thing is to serve the repository as an\nunprivileged user (either via git-daemon , ssh, or using\nother tools to change user ids). See the discussion in the SECURITY section of git-upload-pack ." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-diff - Show changes between commits, commit and working tree, etc changes" }, { "role": "assistant", "content": "Compute the dirstat numbers by counting the lines that have been\nremoved from the source, or added to the destination. This ignores\nthe amount of pure code movements within a file. In other words,\nrearranging lines in a file is not counted as much as other changes.\nThis is the default behavior when no parameter is given." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Git error - gpg failed to sign data\nI just started using git and I install git and gpg via homebrew.\nFor some reason, I get this error when i do git commit\nI looked at so many other stackoverflow questions regarding this topic and none of them worked for me.\nHow can I fix this error so that I can upload successfully. \nerror: gpg failed to sign the data\nfatal: failed to write commit object" }, { "role": "assistant", "content": "For troubleshooting, two things to first try:\n\nrun gpg --version, and make sure you have GnuPG version 2+ (not version 1) installed\nrun echo \"test\" | gpg --clearsign, to make sure gpg itself is working\n\nIf that all looks all right, one next thing to try:\n\nrun brew install pinentry to ensure you have a good tool installed for passphrase entry\n\nIf after that install, you re-try git commit and still get a \"failed to sign the data\" error, do:\n\nrun gpgconf --kill gpg-agent to kill any running agent that might be hung\n\n\nOtherwise, some basic steps to run to check you’ve got a working GnuPG environment:\n\nrun gpg -K --keyid-format SHORT, to check that you have at least one key pair that is not expired\n\nIf the output of that shows you have no secret key for GnuPG to use, you need to create one:\n\nrun gpg --gen-key, to have GnuPG walk you through the steps for creating a key pair\n\n\nIf you get an error message saying “Inappropriate ioctl for device”, do this:\n\nrun export GPG_TTY=$(tty) and/or add that to your ~/.bashrc or ˜/.bash_profile" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-apply - Apply a patch to files and/or to the index --unsafe-paths" }, { "role": "assistant", "content": "By default, a patch that affects outside the working area\n(either a Git controlled working tree, or the current working\ndirectory when \"git apply\" is used as a replacement of GNU\npatch) is rejected as a mistake (or a mischief). When git apply is used as a \"better GNU patch\", the user can pass\nthe --unsafe-paths option to override this safety check. This option\nhas no effect when --index or --cached is in use." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Git branch strategy for small dev team [closed]\nClosed. This question is opinion-based. It is not currently accepting answers.\n \n \n\n\n\n\n\n\n\n\n\n\n\nWant to improve this question? Update the question so it can be answered with facts and citations by editing this post.\n\n\nClosed 9 years ago.\n\n\n\n\n\n\n\n Improve this question\n \n\n\n\nWe have a web app that we update and release almost daily. We use git as our VCS, and our current branching strategy is very simple and broken: we have a master branch and we check changes that we 'feel good about' into it. This works, but only until we check in a breaking change.\nDoes anyone have a favorite git branch strategy for small teams which meets the following requirements:\n\nWorks well for teams of 2 to 3 developers\nLightweight, and not too much process\nAllows devs to isolate work on bug fixes and larger features with ease\nAllows us to keep a stable branch (for those 'oh crap' moments when we have to get our production servers working)\n\nIdeally, I'd love to see your step-by-step process for a dev working on a new bug" }, { "role": "assistant", "content": "You might benefit from the workflow Scott Chacon describes in Pro Git. In this workflow, you have two branches that always exist, master and develop.\nmaster represents the most stable version of your project and you only ever deploy to production from this branch.\ndevelop contains changes that are in progress and may not necessarily be ready for production.\nFrom the develop branch, you create topic branches to work on individual features and fixes. Once your feature/fix is ready to go, you merge it into develop, at which point you can test how it interacts with other topic branches that your coworkers have merged in. Once develop is in a stable state, merge it into master. It should always be safe to deploy to production from master.\nScott describes these long-running branches as \"silos\" of code, where code in a less stable branch will eventually \"graduate\" to one considered more stable after testing and general approval by your team.\nStep by step, your workflow under this model might look like this:\n\nYou need to fix a bug.\nCreate a branch called myfix that is based on the develop branch.\nWork on the bug in this topic branch until it is fixed.\nMerge myfix into develop. Run tests.\nYou discover your fix conflicts with another topic branch hisfix that your coworker merged into develop while you were working on your fix.\nMake more changes in the myfix branch to deal with these conflicts.\nMerge myfix into develop and run tests again.\nEverything works fine. Merge develop into master.\nDeploy to production from master any time, because you know it's stable.\n\nFor more details on this workflow, check out the Branching Workflows chapter in Pro Git." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-log - Show commit logs --binary" }, { "role": "assistant", "content": "In addition to --full-index , output a binary diff that\ncan be applied with git-apply .\nImplies --patch ." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Remove a git commit which has not been pushed\nI did a git commit but I have not pushed it to the repository yet.\nSo when I do git status, I get '# Your branch is ahead of 'master' by 1 commit.\nSo if I want to roll back my top commit, can I just do:\ngit reset --hard eb27bf26dd18c5a34e0e82b929e0d74cfcaab316\n\ngiven that when I do git log I get:\n\ncommit eb27bf26dd18c5a34e0e82b929e0d74cfcaab316\nDate: Tue Sep 29 11:21:41 2009 -0700\n\n\ncommit db0c078d5286b837532ff5e276dcf91885df2296\nDate: Tue Sep 22 10:31:37 2009 -0700" }, { "role": "assistant", "content": "IF you have NOT pushed your changes to remote\ngit reset HEAD~1\n\nCheck if the working copy is clean by git status.\nELSE you have pushed your changes to remote\ngit revert HEAD\n\nThis command will revert/remove the local commits/change and then you can push" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git - the stupid content tracker --config-env=<name>=<envvar>" }, { "role": "assistant", "content": "Like -c <name>=<value> , give configuration variable <name> a value, where <envvar> is the name of an\nenvironment variable from which to retrieve the value. Unlike -c there is no shortcut for directly setting the value to an\nempty string, instead the environment variable itself must be\nset to the empty string. It is an error if the <envvar> does not exist\nin the environment. <envvar> may not contain an equals sign\nto avoid ambiguity with <name> containing one. This is useful for cases where you want to pass transitory\nconfiguration options to git, but are doing so on operating systems\nwhere other processes might be able to read your command line\n(e.g. /proc/self/cmdline ), but not your environment\n(e.g. /proc/self/environ ). That behavior is the default on\nLinux, but may not be on your system. Note that this might add security for variables such as http.extraHeader where the sensitive information is part of\nthe value, but not e.g. url.<base>.insteadOf where the\nsensitive information can be part of the key." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Git command to save a stash without modifying working tree?\nI have been wanting to use a git command that saves a stash without modifying my working tree, as a lightweight backup that's safe from any git resets or whatever I might do to screw up my index. Basically the functional equivalent of \"git stash save && git stash apply\" except that the working copy is never touched, since this can make certain text editors/IDE's cranky.\nSomething like this is approaching what I want, but not quite:\ngit update-ref refs/stash `git stash create \"Stash message\"`\n\nThis works functionally, but the issue I'm having is that no stash message shows up in \"git stash list\" even though the actual stash commit does have my message in it. Considering how large a stash can get, stash messages are pretty important." }, { "role": "assistant", "content": "git stash store \"$(git stash create)\"\nWill create stash entry similar to what you would get with git stash without actually touching and clearing your working directory and index.\nIf you check stash list or look at all commit graph (including stash) you'll see that it's similar result to what you would get with normal call to git stash. Just the message in stash list is different (normally it's something like \"stash@{0}: WIP on master: 14e009e init commit\", here we'll get \"stash@{0}: Created via \"git stash store\"\")\n$ git status --short\nM file.txt\nA file2.txt\n\n$ git stash list\n\n$ git stash store \"$(git stash create)\"\n\n$ git stash list\nstash@{0}: Created via \"git stash store\".\n\n$ git stash show 'stash@{0}'\n file.txt | 2 +-\n file2.txt | 2 ++\n 2 files changed, 3 insertions(+), 1 deletion(-)\n\n$ git log --oneline --graph --all\n* 85f937b (refs/stash) WIP on master: 14e009e init commit\n|\\\n| * 26295a3 index on master: 14e009e init commit\n|/\n* 14e009e (HEAD -> master) init commit\n\n$ git status\nM file.txt\nA file2.txt\n\n\nA bit more explanation:\nA git stash entry is represented using normal commits with some defined structure. Basically it is a regular commit object that has 2 parents (or 3 if you use --include-untracked option) (more info 1,2).\ngit stash create creates this commits that represents stash entry and returns you the object name (SHA-1) of commit object (the one that has 2 or 3 parents). It is a dangling commit (you can verify it by calling git fsck after git stash create). You need to make refs/stash point to this dangling commit and you do it by git stash store (or by git update-ref like in other answers, because git stash store uses git update-ref to do its work).\nIt's good to look at actual source code of git stash push and see that it's basically calling git stash create and git stash store and then does some logic to clean files (which one depends on what options you used in git stash push)." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git selective revert local changes from a file\nIn my git repo which is tracking a svn repo I have made a number of edits to a single file.\nNow I want to revert those changes(like svn revert), but only portions of the file.\nI want to be able to view the diffs on the file, discard(revert) the changes that I don't want and retain the changes I want.\nthe \ngit add -i \n\ncommand seems to have an option to do that but I don't want to stage this yet." }, { "role": "assistant", "content": "I believe you can do it most simply with:\ngit checkout -p <optional filename(s)>\n\nFrom the manpage:\n\n −p, −−patch\n Interactively select hunks in the difference between the <tree−ish>\n (or the index, if unspecified) and the working tree. The chosen\n hunks are then applied in reverse to the working tree (and if a\n <tree−ish> was specified, the index).\n\n\n This means that you can use git checkout −p to selectively discard\n edits from your current working tree." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-shortlog - Summarize git log output --left-only --right-only" }, { "role": "assistant", "content": "List only commits on the respective side of a symmetric difference,\ni.e. only those which would be marked < resp. > by --left-right . For example, --cherry-pick --right-only A...B omits those\ncommits from B which are in A or are patch-equivalent to a commit in A . In other words, this lists the + commits from git cherry A B .\nMore precisely, --cherry-pick --right-only --no-merges gives the exact\nlist." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to push code to Github hiding the API keys?\nI want to push some codes to my GitHub Repository. These codes are in different languages like Javascript, Java, Python etc. Some of those codes contain some private API key that I don't want to publish.\nIs there any way to hide the keys automatically.? Should I remove it from my code manually.? \nThere are many projects that I want to push to GitHub. So, manual removal is not a good option." }, { "role": "assistant", "content": "You should consider using .env files and read the keys from the environmental variables. How to do so depends on the language and tools you use (for node.js, php, etc.).\nYou can exclude .env file from commits by adding .env to the .gitignore. You can also upload an example configuration .env.example with dummy data or blanks to show the schema your application requires." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to merge artifacts across jobs for the same stage in Gitlab CI?\n\nIn Gitlab CI artifacts are segregated based on the jobs which generated them and hence when downloading, you can only download it on a per-job basis.\nIs there a way to download all the artifacts, or pass on the artifacts to some other stage and upload from there? Basically some way to merge all the artifacts of a stage.\nA possible scenario where it can be needed: Let's say in a stage deploy, I am deploying my project on 10 different servers, using 10 different parallel jobs. Each of these generates some artifacts. However, there is no way to download them all from the UI.\nSo does anyone know of a workaround? I am not looking for API based solution, but instead UI based or editing the CI yaml file to make it work." }, { "role": "assistant", "content": "You can create a \"final\" (package) stage in your pipeline which combines all the artifacts together, using the artifacts syntax.\nFor example:\nstages:\n - build\n - package\n\n.artifacts_template:\n artifacts:\n name: linux-artifact\n paths:\n - \"*.txt\"\n expire_in: 5 minutes\n\nbuild:linux-1:\n extends: .artifacts_template\n stage: build\n script:\n - touch hello-world-linux-1.txt\n\nbuild:linux-2:\n extends: .artifacts_template\n stage: build\n script:\n - touch hello-world-linux-2.txt\n\nbuild:linux-3:\n extends: .artifacts_template\n stage: build\n script:\n - touch hello-world-linux-3.txt\n\npackage:\n stage: package\n script:\n - echo \"packaging everything here\"\n needs:\n - build:linux-1\n - build:linux-2\n - build:linux-3\n artifacts:\n name: all-artifacts\n paths:\n - \"*.txt\"\n expire_in: 1 month" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-cat-file - Provide contents or details of repository objects info <object>" }, { "role": "assistant", "content": "Print object info for object reference <object> . This corresponds to the\noutput of --batch-check ." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Mirroring a HG project from Bitbucket to Github\nIs there an efficient workflow to mirror a project that is mainly hosted on bitbucket using Hg, to github?" }, { "role": "assistant", "content": "You could use a tool like hg-git to:\n\n\nsetup a Git repository somewhere that you have push access to, \nand then run hg push [path] from within your project. For example:\n\n\n$ cd hg-git # (a Mercurial repository)\n$ hg bookmark -r default master # make a bookmark of master for default, so a ref gets created\n$ hg push git+ssh://[email protected]/schacon/hg-git.git\n$ hg push\n\n\nThis will convert all our Mercurial data into Git objects and push them up to the Git server.\n You can also put that path in the [paths] section of .hg/hgrc and then push to it by name." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Suppressing diffs for deleted files in git\nI want to get a quick overview of the local changes in my repository, but I don't want a diff that shows deleted files, since every single line is a minus.\nBasically, I want something like 'git diff HEAD <list of modified files only>'. In an ideal world, it would be preceded by the list of deleted and added files, but not show the diffs within them.\nI was most of the way through writing a utility that does this:\ngit diff HEAD `git status | grep modified | cut -d : -f 2`\n\nwhen I wondered if there was some git-y way to do it instead. Is there a flag I'm missing? I'd love to preserve the color output, too." }, { "role": "assistant", "content": "In Git versions 1.8.5 and newer, you can do this using the --diff-filter option and specifying \"d\" (lowercase) to tell it to exclude deleted files.\n\n$ git diff --diff-filter=d\n\nIn Git versions older than 1.8.5, you can do this with the --diff-filter option and specifying all but the \"D\" (deleted) criteria:\n\n$ git diff --diff-filter=ACMRTUXB\n\nFor reference the git documentation of version 2.43.2 says:\n\n--diff-filter=[(A|C|D|M|R|T|U|X|B)…​[*]]\n\n\nSelect only files that are Added (A), Copied (C), Deleted (D), Modified (M), Renamed (R), have their type (i.e. regular file, symlink, submodule, …​) changed (T), are Unmerged (U), are Unknown (X), or have had their pairing Broken (B). Any combination of the filter characters (including none) can be used. When * (All-or-none) is added to the combination, all paths are selected if there is any file that matches other criteria in the comparison; if there is no file that matches other criteria, nothing is selected.\n\n\nAlso, these upper-case letters can be downcased to exclude. E.g. --diff-filter=ad excludes added and deleted paths.\n\n\nNote that not all diffs can feature all types. For instance, copied and renamed entries cannot appear if detection for those types is disabled." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to cherry pick only changes for only one file, not the whole commit\nI need to apply changes introduced in one branch to another branch.\nI can use cherry pick to do that. However, in my case I want to apply changes which are relevant only for one file, I don't need to cherry pick whole commit.\nHow to do that?" }, { "role": "assistant", "content": "You have different options based on what you want to achieve:\nIf you want the contents of the file to be the same as on the target branch, you can use git checkout <branch> -- <filename>. This will however not “cherry-pick” the changes that happened in a single commit, but just take the resulting state of said file. So if you added a line in a commit, but previous commits changed more, and you only want to add that line without those other changes, then a checkout is not what you want.\nOtherwise if you want to apply the patch introduced in a commit to only a single file, you have multiple options. You could run git cherry-pick -n, i.e. without committing it, edit the commit (for example reset all files using git reset -- . and only add the file you actually want to change using git add <filename>). Or you could create the diff for the file and apply the diff then:\ngit diff <branch>^..<branch> -- <filename> | git apply" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to unmerge a Git merge?\n\nI accidentally did a git pull origin master from dev, and master got merged into dev.\nIs it possible to unmerge?\nI've already seen different solutions, i tried this one from both dev and master :\ngit revert -m 1 <commit> (once each)\nBut i got : Everything is up-to-date, each time" }, { "role": "assistant", "content": "You can reset your branch to the state it was in just before the merge if you find the commit it was on then.\nOne way is to use git reflog, it will list all the HEADs you've had.\nI find that git reflog --relative-date is very useful as it shows how long ago each change happened.\nOnce you find that commit just do a git reset --hard <commit id> and your branch will be as it was before.\nIf you have SourceTree, you can look up the <commit id> there if git reflog is too overwhelming." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to change my Git username in terminal?\nI was pushing and pulling from git in Terminal then I changed my username on github.com. I went to push some changes and it couldn't push because it was still recognizing my old username.. How do I change/update my username on git in terminal?" }, { "role": "assistant", "content": "In your terminal, navigate to the repo you want to make the changes in.\nExecute git config --list to check current username & email in your local repo.\nChange username & email as desired. Make it a global change or specific to the local repo: \ngit config --global user.name \"Full Name\"\ngit config --global user.email \"[email protected]\"\nPer repo basis you could also edit .git/config manually instead.\nDone!\n\nWhen performing step 2 if you see credential.helper=manager you need to open the credential manager of your computer (Win or Mac) and update the credentials there\nHere is how it look on windows\n\nTroubleshooting? Learn more" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "gitlab initial root password\n\nIm trying to do an automated deployment of gitlab that has everything pre-configured. I need to specify an initial root password so first-time logins are not prompted with the password reset screen. I see the omnibus config option in the template: https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/files/gitlab-config-template/gitlab.rb.template#L509\n506 #### Change the initial default admin password and shared runner registration tokens.\n507 ####! **Only applicable on initial setup, changing these settings after database\n508 ####! is created and seeded won't yield any change.**\n509 # gitlab_rails['initial_root_password'] = \"password\"\n\nHowever, as the documentation says, this option will not take affect after installation. So, using gitlab-ctl reconfigure does not deploy these changes, as I have tested.\nWhen I try the solution from this this post:\n$ sudo gitlab-rake gitlab:setup RAILS_ENV=production GITLAB_ROOT_PASSWORD=\"Pa$$w0rd!\" GITLAB_ROOT_EMAIL=\"[email protected]\" DISABLE_DATABASE_ENVIRONMENT_CHECK=1\nThis will create the necessary database tables and seed the database.\nYou will lose any previous data stored in the database.\nDo you want to continue (yes/no)? yes\n\nPG::ObjectInUse: ERROR: database \"gitlabhq_production\" is being accessed by other users\nDETAIL: There are 10 other sessions using the database.\n: DROP DATABASE IF EXISTS \"gitlabhq_production\"\nCouldn't drop database 'gitlabhq_production'\nrake aborted!\nActiveRecord::StatementInvalid: PG::ObjectInUse: ERROR: database \"gitlabhq_production\" is being accessed by other users\nDETAIL: There are 10 other sessions using the database.\n: DROP DATABASE IF EXISTS \"gitlabhq_production\"\n/opt/gitlab/embedded/service/gitlab-rails/lib/tasks/gitlab/setup.rake:33:in `setup_db'\n/opt/gitlab/embedded/service/gitlab-rails/lib/tasks/gitlab/setup.rake:5:in `block (2 levels) in <top (required)>'\n/opt/gitlab/embedded/bin/bundle:23:in `load'\n/opt/gitlab/embedded/bin/bundle:23:in `<main>'\n\nCaused by:\nPG::ObjectInUse: ERROR: database \"gitlabhq_production\" is being accessed by other users\nDETAIL: There are 10 other sessions using the database.\n/opt/gitlab/embedded/service/gitlab-rails/lib/tasks/gitlab/setup.rake:33:in `setup_db'\n/opt/gitlab/embedded/service/gitlab-rails/lib/tasks/gitlab/setup.rake:5:in `block (2 levels) in <top (required)>'\n/opt/gitlab/embedded/bin/bundle:23:in `load'\n/opt/gitlab/embedded/bin/bundle:23:in `<main>'\nTasks: TOP => db:drop:_unsafe\n(See full trace by running task with --trace)\n\nWhen I try to stop gitlab so no users are accessing it with gitlab-ctl stop, it fails with the following error:\n$ sudo gitlab-rake gitlab:setup RAILS_ENV=production GITLAB_ROOT_PASSWORD=\"Pa$$w0rd!\" GITLAB_ROOT_EMAIL=\"[email protected]\" DISABLE_DATABASE_ENVIRONMENT_CHECK=1\nrake aborted!\nPG::ConnectionBad: could not connect to server: No such file or directory\n Is the server running locally and accepting\n connections on Unix domain socket \"/var/opt/gitlab/postgresql/.s.PGSQL.5432\"?\n/opt/gitlab/embedded/service/gitlab-rails/ee/app/models/license.rb:261:in `load_license'\n/opt/gitlab/embedded/service/gitlab-rails/ee/app/models/license.rb:250:in `current'\n/opt/gitlab/embedded/service/gitlab-rails/ee/app/models/license.rb:254:in `feature_available?'\n/opt/gitlab/embedded/service/gitlab-rails/ee/lib/ee/gitlab/auth/ldap/config.rb:19:in `_available_servers'\n/opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/auth/ldap/config.rb:39:in `available_servers'\n/opt/gitlab/embedded/service/gitlab-rails/config/initializers/omniauth.rb:3:in `<module:Strategies>'\n/opt/gitlab/embedded/service/gitlab-rails/config/initializers/omniauth.rb:2:in `<top (required)>'\n/opt/gitlab/embedded/service/gitlab-rails/config/environment.rb:6:in `<top (required)>'\n/opt/gitlab/embedded/bin/bundle:23:in `load'\n/opt/gitlab/embedded/bin/bundle:23:in `<main>'\nTasks: TOP => gitlab:setup => gitlab_environment => environment\n(See full trace by running task with --trace)\n\n\nHow do I set an initial root password for gitlab with the omnibus install?" }, { "role": "assistant", "content": "I had a similar problem. Even if I set the environment variable, it seems that my gitlab ce still can't login. So I reset the password with the \"root\" user.\n# dir: /etc/gitlab\ngitlab-rake \"gitlab:password:reset[root]\"\n\nWait 10 minutes.\nAnd result\nEnter password:\nConfirm password:\nPassword successfully updated for user with username root.\n\nThen all works as usual." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Automatically closing issue from pull request in GitHub\n\nHow do I close an issue using a pull request on GitHub? I know about closing multiple issues with a commit message, but it's a different case.\nI would like to close the issues not from a commit, but from the description of the pull request. More like \nPull request:\nName: bla bla\nDescription ... , _fixes_ #123\n\nAnd when merging the pull request, the #123 to automatically close. Is this possible?" }, { "role": "assistant", "content": "As you mention in the comments, the merge from the pull request will result in a commit.\nIt is on that commit message you can add a \"close #xx\" in order to trigger the closing of an issue.\nHowever, as mentioned in \"Closing multiple issues in Github with a commit message\", in GitHub blog post \"Closing Issues via Commit Messages\" (January 2013), and in the current GitHub docs.\n\nNow when you enter \"Fixes #33\" in a commit message, issue 33 will only be closed once the commit is merged into your default branch (usually master).\nThis is super useful because it means the issue's open / closed status will map to your default branch.\nIf the bug isn't fixed in your default branch, the issue will remain open.\nOnce the commit with the fix is merged into your default branch the issue will be automatically closed.\nWhen you do make a commit in a non-default branch with the \"Fixes #33\" syntax, the issue will be referenced with a tooltip:\n\nYou can use any of these keywords to close an issue via commit message:\nclose, closes, closed, fix, fixes, fixed, resolve, resolves, resolved\n\n\n\nAs mentioned below by cosmolev (upvoted), the blog post from May 14th 2013 \"Closing Issues via Pull Requests\" adds pull requests as a way to close an issue:\n\nsome issues take more work than a single commit to close.\nThat's why you can now close an issue from a Pull Request.\nAll you have to do is include the special keyword syntax (eg. \"fixes #5\") in the body of your Pull Request.\n\nthe referenced issue will automatically be closed when the PR is merged into the default branch.\nIt even works across repositories.\n\nAs John Eikenberry points out in the comments, the help page \"Closing issues using keywords\" does mention:\n\nTo close multiple issues, preface each issue reference with one of the above keywords.\nYou must use the keyword before each issue you reference for the keyword to work.\n\nFor example, This closes #34, closes #23, and closes example_user/example_repo#42 would close issues #34 and #23 in the same repository, and issue #42 in the \"example_user/example_repo\" repository." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Force git to update .gitignore\nI have a .gitignore file, and it's ignoring some files. I have updated the .gitignore file (removed some filenames and added some filenames). This is not reflected in git status. How can I force git to update these changes, so that track files which are not tracked before and vice versa. \nI have tried this question, still all of my files are not tracked (according to my updated .gitignore). (In simple, how can I force git to retract files once .gitignore is updated or deleted)." }, { "role": "assistant", "content": "You will have to clear the existing git cache first.\nRemove the cache of all the files\n\ngit rm -r --cached .\n\nRemove the cache of specific file\n\ngit rm -r --cached <file_name.ext>\n\nOnce you clear the existing cache, add/stage file/files in the current directory and commit\n\ngit add . // To add all the files\ngit add <file_name.ext> // To add specific file\ngit commit -m \"Suitable Message\"\n\nAs pointed out by Scott Biggs in comment that \"This works for both adding a file that was once ignored as well as ignoring a file that was once tracked\"" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-submodule - Initialize, update or inspect submodules set-url [--] <path> <newurl>" }, { "role": "assistant", "content": "Sets the URL of the specified submodule to <newurl>. Then, it will\nautomatically synchronize the submodule’s new remote URL\nconfiguration." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-config - Get and set repository or global options diff.orderFile" }, { "role": "assistant", "content": "File indicating how to order files within a diff.\nSee the -O option to git-diff for details.\nIf diff.orderFile is a relative pathname, it is treated as\nrelative to the top of the working tree." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "What exactly is a Release in GitHub?\nWhat is it exactly?\nFor what is it used? \nHow widespread is the usage? \nHow is it usually used?" }, { "role": "assistant", "content": "From Official GitHub:\nReleases are GitHub's way of packaging and providing software to your users. You can think of it as a replacement to using downloads to provide software.\nWith Releases, you can provide links to binary files, as well as release notes describing your changes.\nAt their core, Releases are based on Git tags. Tags mark a specific point in the history of your project, so they're a great way to indicate a Release. Releases are ordered by a tag's date in the following way:\n\nIf it's an annotated tag, the tag object's date is used.\nIf it's a lightweight tag, then the commit object's date is used.\n\nFor more information about viewing your existing tags, see Working With Tags." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Git checkout does not change anything\nI really like git. At least, I like the idea of git. Being able to checkout my master project as a separate branch where I can change whatever I want without risk of screwing everything else up is awesome. But it's not working.\nBasically, my workflow is like this:\n\nCheckout stable version to a new branch to experiment with new code \nMake a bunch of changes - I have no intent on keeping any of this, I'm just experimenting.\nLook at all the stuff I changed\nAdd all the changes to be tracked\nCommit the branch and push branch to origin (if it worked, otherwise skip this step)\nDecide to try another method, go back to master\nObserve artifacts from the experimental branch I was working in, even though I'm in the master branch.\n\nEvery time I checkout a branch to another branch, make changes to the one branch, and then checkout the original branch, I still have all the files and changes that happened in the other branch. This is getting extremely frustrating. I've read that this can happen when you have files open in the IDE while doing this, but I've been pretty careful about that and both closed the files in the IDE, closed the IDE, and shut down my rails server before switching branches, and this still happens. Also, running 'git clean -f' either deletes everything that happened after some arbitrary commit (and randomly, at that), or, as in the latest case, didn't change anything back to its original state. \nI thought I was using git correctly, but at this point, I'm at my wit's end here. I'm trying to work with a bunch of experimental code using a stable version of my project, but I keep having to manually track down and fix all the changes I made. Any ideas or suggestions?\ngit checkout -b photo_tagging\ngit branch # to make sure it's right\n# make a bunch of changes, creations, etc\ngit status # see what's changed since before\ngit add . # approve of the changes, I guess, since if I do git commit after this, it says no changes\ngit commit -m 'these are changes I made'\n\ngit checkout master\ngit branch #=> *master\n\n# look at files, tags_controller is still there, added in photo_tagging\n# and code added in photo_tagging branch are still there in *master\n\nThis seems to happen whether I do a commit or not on the branch." }, { "role": "assistant", "content": "I had this issue when I tried to switch temp to another branch from the master branch and when I would change something on that temp page and without committing the changes I would checkout the master branch again, it actually merged all the changes from the TEMP branch into MASTER.\nANSWER: \nWhenever you checkout to a TEMP branch, COMMIT your changes. That way if you commit them on the TEMP branch and checkout MASTER again, it will work as supposed." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-update-index - Register file contents in the working tree to the index" }, { "role": "assistant", "content": "NOTES Users often try to use the assume-unchanged and skip-worktree bits\nto tell Git to ignore changes to files that are tracked. This does not\nwork as expected, since Git may still check working tree files against\nthe index when performing certain operations. In general, Git does not\nprovide a way to ignore changes to tracked files, so alternate solutions\nare recommended. For example, if the file you want to change is some sort of config file,\nthe repository can include a sample config file that can then be copied\ninto the ignored name and modified. The repository can even include a\nscript to treat the sample file as a template, modifying and copying it\nautomatically." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Opening PDF in a browser with Github Pages [closed]\n\nClosed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.\n \n \n\n\n\n\n\n\n\n\n\n\n\n This question does not appear to be about programming within the scope defined in the help center.\n\n\nClosed 2 years ago.\n\n\nThe community reviewed whether to reopen this question 17 days ago and left it closed:\n\nOriginal close reason(s) were not resolved\n\n\n\n\n\n\n Improve this question\n \n\n\n\nI am using GitHub Pages to host my website. I have a PDF file that I want visitors to be able to open directly in a browser. But when I upload the PDF file to GitHub Pages and link to it it opens in GitHub's viewer. Is there any way to open the PDF in a browser? I do not want to upload the document to dropbox or Google Drive as these services are not available in certain countries.\nUsing a raw URL would lead to download. But I would like to have the file open in the browser." }, { "role": "assistant", "content": "Suppose your personal website is hosted in a Github page as follows:\nhttps://username.github.io\n\nThe repository should be name as username.github.io. If you have a pdf file named document.pdf and you place it in the directory folder then you should be able to open it directly in the browser through the following link:\nhttps://username.github.io/folder/document.pdf\n\nTo allow the user to open the pdf in a new window in the browser, you may use the following HTML, where \"PDF\" points to the link:\n<a href=\"username.github.io/folder/document.pdf\" target=\"_blank\">PDF.</a>" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Warning: Permanently added the RSA host key for IP address\nWhen I do pull from Github, I am getting this warning message. \n MYPC:/Rails$ git pull origin master\n Warning: Permanently added the RSA host key for IP address '#{Some IP address}' to the list of known hosts.\n From github.com:Example/Demo\n * branch master -> FETCH_HEAD\n Already up-to-date.\n\nI just want to know which IP address it is adding to the known hosts." }, { "role": "assistant", "content": "If you are accessing your repositories over the SSH protocol, you will receive a warning message each time your client connects to a new IP address for github.com. As long as the IP address from the warning is in the range of IP addresses , you shouldn't be concerned. Specifically, the new addresses that are being added this time are in the range from 192.30.252.0 to 192.30.255.255. The warning message looks like this:\nWarning: Permanently added the RSA host key for IP address '$IP' to the list of \n\n\nhttps://github.com/blog/1606-ip-address-changes" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to show full-file Git blame in Visual Studio Code\nAt one point I found a way to show line-by-line Git blame within Visual Studio Code. I now cannot recall or find the means with which to do that. I have the Git Blame extension, but that only shows blame on a single selected line." }, { "role": "assistant", "content": "Use the Gitlens extension. It supports various options. Once installed, you can use Alt+B to show the full file blame information." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-show - Show various types of objects ignore-space-change" }, { "role": "assistant", "content": "Ignore changes in amount of whitespace. This ignores whitespace\nat line end, and considers all other sequences of one or\nmore whitespace characters to be equivalent." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to replace local branch with remote branch entirely in Git?\nI have two branches:\n\nlocal branch (the one which I work with)\nremote branch (public, only well-tested commits go there)\n\nRecently I seriously messed up my local branch.\nHow would I replace the local branch entirely with the remote one, so I can continue my work from where the remote branch is now?\nI have already searched SO and checking out to the remote branch locally does not have any effect." }, { "role": "assistant", "content": "Make sure you've checked out the branch you're replacing (from Zoltán's comment).\nAssuming that master is the local branch you're replacing, and that \"origin/master\" is the remote branch you want to reset to:\ngit reset --hard origin/master\n\n\nThis updates your local HEAD branch to be the same revision as origin/master, and --hard will sync this change into the index and workspace as well." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-rm - Remove files from the working tree and from the index --cached" }, { "role": "assistant", "content": "Use this option to unstage and remove paths only from the index.\nWorking tree files, whether modified or not, will be\nleft alone." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Is there a command line utility for rendering GitHub flavored Markdown?\n\nI'm wondering if there is a command line utility for taking a GitHub flavored Markdown file and rendering it to HTML.\nI'm using a GitHub wiki to create website content. I've cloned the repository on my server and would then like to process it into regular HTML. It's important to me that what appears on GitHub is exactly how it should look for my website. I'd also really like to use the fenced blocks with ~~~, so I'd rather not use standard Markdown syntax only.\nI've looked a bit into the JavaScript live preview thinking I could hook it into Node.js, but they say it is deprecated. I've looked at the redcarpet repository, but it doesn't look like it has a command line interface.\nI rolled my own solution, however, since no solution here is clearly better than the others, I'll leave the question without a selected answer." }, { "role": "assistant", "content": "I wrote a small CLI in Python and added GFM support. It's called Grip (Github Readme Instant Preview).\nInstall it with:\n$ pip install grip\n\nAnd to use it, simply:\n$ grip\n\nThen visit localhost:5000 to view the readme.md file at that location.\nYou can also specify your own file:\n$ grip CHANGES.md\n\nAnd change port:\n$ grip 8080\n\nAnd of course, specifically render GitHub-Flavored Markdown, optionally with repository context:\n$ grip --gfm --context=username/repo issue.md\n\nNotable features:\n\nRenders pages to appear exactly like on GitHub\nFenced blocks\nPython API\nNavigate between linked files (thanks, vladwing!) added in 2.0\nExport to a single file (thanks, iliggio!) added in 2.0\nNew: Read from stdin and export to stdout added in 3.0\n\nCheck it out." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to pull remote branch from somebody else's repo\nI've got a project hosted on GitHub which somebody has forked. On their fork, they've created a new branch \"foo\" and made some changes. How do I pull their \"foo\" into a new branch also named \"foo\" in my repo?\nI understand they could submit a pull request to me, but I'd like to initiate this process myself.\nAssume the following:\n\nBecause they forked my project, both our repos share the same 'history'\nAlthough GitHub shows their project was forked from mine, my local repository doesn't have any references to this person's project. Do I need to add theirs as a remote?\nI don't have a branch called \"foo\" yet - I don't know if I need to manually create this first.\nI definitely want this pulled into a separate branch and not my master." }, { "role": "assistant", "content": "git remote add coworker git://path/to/coworkers/repo.git\ngit fetch coworker\ngit checkout --track coworker/foo\n\nThis will setup a local branch foo, tracking the remote branch coworker/foo. So when your co-worker has made some changes, you can easily pull them:\ngit checkout foo\ngit pull\n\n\nResponse to comments:\n\nCool :) And if I'd like to make my own\n changes to that branch, should I\n create a second local branch \"bar\"\n from \"foo\" and work there instead of\n directly on my \"foo\"?\n\nYou don't need to create a new branch, even though I recommend it. You might as well commit directly to foo and have your co-worker pull your branch. But that branch already exists and your branch foo need to be setup as an upstream branch to it:\ngit branch --set-upstream foo colin/foo\n\nassuming colin is your repository (a remote to your co-workers repository) defined in similar way:\ngit remote add colin git://path/to/colins/repo.git" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-rev-list - Lists commit objects in reverse chronological order --merge" }, { "role": "assistant", "content": "Show commits touching conflicted paths in the range HEAD...<other> ,\nwhere <other> is the first existing pseudoref in MERGE_HEAD , CHERRY_PICK_HEAD , REVERT_HEAD or REBASE_HEAD . Only works\nwhen the index has unmerged entries. This option can be used to show\nrelevant commits when resolving conflicts from a 3-way merge." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Git - push current branch shortcut\nIs there a shortcut to tell Git to push the current tracking branch to origin?\nNote: I know that I can change the default push behavior, but I am looking for an ad-hoc solution that does not change the default behavior.\nFor example, suppose I am on branch feature/123-sandbox-tests I would be using\ngit push origin feature/123-sandbox-tests\n\nwhich is tedious. I am looking for a shortcut, something like\ngit push origin current # <- example, not working\n\nwhere git knows that current is feature/123-sandbox-tests.\n\nEdit: Starting from version 2.0, git's default behavior has changed to a more intuitive behavior, which is what I wanted to achieve. See This SO question for details.\nEdit 2: ceztko's answer is the best answer as it allows to push the current branch, regardless of the settings." }, { "role": "assistant", "content": "According to git push documentation:\ngit push origin HEAD\n A handy way to push the current branch to the same name on the remote.\n\nSo I think what you need is git push origin HEAD. Also it can be useful git push -u origin HEAD to set upstream tracking information in the local branch, if you haven't already pushed to the origin." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-svn - Bidirectional operation between a Subversion repository and Git --no-metadata" }, { "role": "assistant", "content": "Set the noMetadata option in the [svn-remote] config.\nThis option is not recommended, please read the svn.noMetadata section of this manpage before using this option." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "When does Git refresh the list of remote branches?\nUsing git branch --all shows all remote and local branches. When does Git refresh this list?\nOn pull/push? And how do I refresh it using Git Bash?" }, { "role": "assistant", "content": "To update the local list of remote branches:\ngit remote update origin --prune\n\nTo show all local and remote branches that (local) Git knows about:\ngit branch -a" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "There is nothing changed, but eclipse egit marks the file as changed\nI'm using eclipse egit with github. I found something strange that I didn't change anything, but egit marked the file as \"changed\". See the images:\n\nthe file \"run.bat\" is marked as \"changed\"\n\n\nCompare with \"file in Git index\", you can see nothing is different\n\n\nCompare with \"file in HEAD\", you can see nothing is different neither\n\n\n\nMy friend uses mac and I use windows, but we all configured git as \"commit unix lineend\".. I also checked the lineend of my source and the HEAD, they are the same(I configured git to convert them to \"\\r\\n\" when pulling)\nWhere is wrong? Is it a bug of Egit?" }, { "role": "assistant", "content": "Eclipse Preferences / Team / Git / Configuration / User Settings\n(\"core\" section)\nkey: autocrlf\nvalue: false\n\nThe key should already exist, so just need to edit the value.\nIf creating a new key then use core.autocrlf." } ]