messages
listlengths
3
3
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How do I pull from another computer's repository in Git?\nFor example, I have cloned the origin repository on two computers. Then, I go ahead and make some changes and commit to the local repository of computer A. How do I now pull these changes to computer B? Both computer A and B are connected to a network. \nWhat I am looking for will be the equivalent of someone manually creating a patch and sending it to me, which I can apply to my working copy/local repo." }, { "role": "assistant", "content": "If the machine you want to pull from is accessible via ssh, you can add the repository on it as a remote via ssh, and then pull from it like you would any remote:\n$ git remote add repo_b username@host:path/to/repository.git\n$ git pull repo_b master\n\n(You can skip the step of adding a remote and just specify the full URL in the git pull command instead of a remote name, but if you're going to be pulling from the repository on a regular basis, adding it as a remote will save you lots of typing.)" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Editing a git submodule\nIs this possible? Imagine I have projects Parent & Child. Both are git respositories. Child is a submodule of Parent.\nCan I make edits to the version of Child that is inside Parent & commit & push them just like a regular repository?\nOr do I need a separate clone of Child somewhere that I make changes to?\nThanks." }, { "role": "assistant", "content": "You don't need a seperate clone. The sub-module folder is a world of its own. Just edit, commit, branch, and push to your heart's delight.\nGit is great that way. :-)\nBTW, the parent repository will even detect when changes happen inside the sub-module folder and offer you to commit the current state of the sub-module as the new official reference point for clones of the parent repo.\nImportant note:\nMake sure you do git checkout master (or some other branch) inside the sub-module folder before your start hacking.\nThen also make sure when you commit the updated state of the sub-module, that you either push those commits to a public repo, or at least that you don't rebase or otherwise change the history inside the sub-module afterwards - as that would corrupt the parent's reference to the sub-module's history.\nTread with care. (Hat tip to @pjmorse for the reminder.)\nBottomline:\nYes. Developing within a submodule folder is possible and often convenient but not without its risks. Choose your development model wisely" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Git Remove unwanted commits from a Pull Request\n\nI have started working on a project and I made some unwanted commits which I pushed to origin master. Now, when I try to do a pull request, Github wants to commit all of the previous commits. \nMy question is, how do I remove the unwanted commits and commit the changes that I want to commit so that I am up to date with master?" }, { "role": "assistant", "content": "I assume your origin is your own fork of some project that you want to do a pull request too?\nSince you will be changing history (by resetting the head) you will need to push with --force flag. Locate the hash of your last good commit using git log.\nNow run\ngit reset SHA\n\nThis will change your head to that sha and preserve the changes in the files since that last good commit, your index will also be reset.\nNow you can change your code and do the commits you want. But you have to do git push --force since you changed the history of the repository. This means that anyone who forked your repository won't be able to pull changes from you anymore. But you will be able to do a pull request to your upstream." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-config - Get and set repository or global options submoduleAlternateErrorStrategyDie" }, { "role": "assistant", "content": "Shown when a submodule.alternateErrorStrategy option\nconfigured to \"die\" causes a fatal error." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Bitbucket fails to authenticate on git pull\nI use BitBucket and had to change my password because it was compromised.\ngit pull\n\n\nremote: Invalid username or password. If you log in via a third party service you must ensure you have an account password set in your account profile.\n fatal: Authentication failed for 'https://bitbucket.org/myusername/myproject.git/'\n\nHow can I change my password using command line?" }, { "role": "assistant", "content": "You need to reset the password as shown below.\nOn macOS:\ngit config --global credential.helper osxkeychain\n\nOn Windows 10/11:\ngit config --global credential.helper store\n\nAfter executing this, it prompts you for the user name and password for your repo." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "add #*# glob to .gitignore?\nI want to add emacs autosave files to my .gitignore with the glob #*# but of course, lines starting with a hash are comment lines.\nHow can I get this into my .gitignore without it being treated as a comment?" }, { "role": "assistant", "content": "Did you try\n\\#*#\n\nOr:\n\\#*\\#\n\nSince 1.6.2, \\ should be supported in .gitignore (see this patch)\nTo be precise, 1.6.2.1 (March 2009)\n\n.gitignore learned to handle backslash as a quoting mechanism for comment introduction character \"#\"." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-rev-list - Lists commit objects in reverse chronological order --no-merges" }, { "role": "assistant", "content": "Do not print commits with more than one parent. This is\nexactly the same as --max-parents=1 ." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Is it possible to deploy GItLab Pages without CI/CD?\n\nWe have a locally deployed instance of Gitlab, where at the time we cannot afford to have a GitLab Runner to run CI/CD pipelines.\nIs it possible to use GitLab Pages without CI/CD? E.g. is it possible to manually prepare the HTML-content, put it in the public folder in the root and make it accessible?" }, { "role": "assistant", "content": "I assume you don't want to use GitLab shared runner which costs you and CI minutes limits.\nPublic folder\nRefer to this gitlab-ci.yaml for making HTML content available https://gitlab.com/pages/plain-html/-/blob/master/.gitlab-ci.yml\nRunning locally without registration\nHere is the known limitations: https://docs.gitlab.com/runner/commands/#limitations-of-gitlab-runner-exec\nPages are directly managed by Gitlab so running locally won't affect the page's state.\nUse your own runner and register with gitlab (Possible)\nInstall GitLab runner on your machine and register as a runner, instructions can be found at Settings->CI/CD->Runners->Specific runner Enable it for your project or group.\nI use my personal machine gitlab-runner to execute CI jobs that aren't counted towards CI minutes." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-diff - Show changes between commits, commit and working tree, etc git diff HEAD" }, { "role": "assistant", "content": "compares a (c)ommit and the (w)ork tree;" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git, filter-branch on all branches\nI'm using the following sources to expunge some large files and directories from my repository:\nhttp://dound.com/2009/04/git-forever-remove-files-or-folders-from-history/\nWhy is my git repository so big?\ngit filter-branch only seems to work on the current branch - is there a way to apply it to all branches at once?" }, { "role": "assistant", "content": "The solution is simple:\ngit filter-branch [options] -- --all\nNote the four dashes (two sets of double dashes with a space in between) in -- --all.\nIf you look at the docs for git-filter-branch, it says this:\ngit filter-branch [--env-filter <command>] [--tree-filter <command>]\n [--index-filter <command>] [--parent-filter <command>]\n [--msg-filter <command>] [--commit-filter <command>]\n [--tag-name-filter <command>] [--subdirectory-filter <directory>]\n [--prune-empty]\n [--original <namespace>] [-d <directory>] [-f | --force]\n [--] [<rev-list options>…]\n\nReading on, the beginning of the docs say: \"Lets you rewrite git revision history by rewriting the branches mentioned in the <rev-list options>, applying custom filters on each revision.\"\nSo checking the docs for rev-list gives:\n\n< rev-list options >… Arguments for git rev-list. All positive refs\n included by these options are rewritten. You may also specify options\n such as --all, but you must use -- to separate them from the git\n filter-branch options.\n\nAnd the docs for git-rev-list say:\n--all\nPretend as if all the refs in refs/ are listed on the command line as <commit>." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "gitglossary - A Git Glossary remote-tracking branch" }, { "role": "assistant", "content": "A ref that is used to follow changes from another repository . It typically looks like refs/remotes/foo/bar (indicating that it tracks a branch named bar in a remote named foo ), and matches the right-hand-side of\na configured fetch refspec . A remote-tracking\nbranch should not contain direct modifications or have local\ncommits made to it." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-diff - Show changes between commits, commit and working tree, etc git diff [<options>] --no-index [--] <path> <path>" }, { "role": "assistant", "content": "This form is to compare the given two paths on the\nfilesystem. You can omit the --no-index option when\nrunning the command in a working tree controlled by Git and\nat least one of the paths points outside the working tree,\nor when running the command outside a working tree\ncontrolled by Git. This form implies --exit-code ." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Cloning git repository from svn repository, results in file-less, remote-branch-less git repo\nWorking SVN repo\nI'm starting a git repo to interact with a svn repo. The svn repository is set and working fine, with a single commit of a basic README file in it.\nChecking it out works fine:\ntchalvak:~/test/svn-test$ \nsvn checkout --username=myUsernameHere http://www.url.to/project/here/charityweb/\nA charityweb/README\nChecked out revision 1.\n\nFailed git-svn clone of svn repo\nWhen I try to clone the repository in git, the first step shows no errors...\ntchalvak:~/test$ \ngit svn clone -s --username=myUserNameHere http://www.url.to/project/here/charityweb/\nInitialized empty Git repository in /home/tchalvak/test/charityweb/.git/\nAuthentication realm: <http://www.url.to/project/here:80> Charity Web\nPassword for 'myUserNameHere': \n\n...but results in a useless folder, containing no files, no branches, and no commits:\ntchalvak:~/test$ ls\ncharityweb\ntchalvak:~/test$ cd charityweb/\ntchalvak:~/test/charityweb$ ls\ntchalvak:~/test/charityweb$ ls -al\ntotal 12\ndrwxr-xr-x 3 tchalvak tchalvak 4096 2010-04-02 13:46 .\ndrwxr-xr-x 4 tchalvak tchalvak 4096 2010-04-02 13:46 ..\ndrwxr-xr-x 8 tchalvak tchalvak 4096 2010-04-02 13:47 .git\ntchalvak:~/test/charityweb$ git branch -av\ntchalvak:~/test/charityweb$ git status\n# On branch master\n#\n# Initial commit\n#\nnothing to commit (create/copy files and use \"git add\" to track)\ntchalvak:~/test/charityweb$ git fetch\nfatal: Where do you want to fetch from today?\ntchalvak:~/test/charityweb$ git rebase origin/master\nfatal: bad revision 'HEAD'\nfatal: Needed a single revision\ninvalid upstream origin/master\ntchalvak:~/test/charityweb$ git log\nfatal: bad default revision 'HEAD'\n\nHow do I get something I can commit back to? I expect I'm doing something wrong in this process, but what?" }, { "role": "assistant", "content": "You used the -s option to git svn clone, but from your example, it doesn't appear that your Subversion repository is using the standard layout (i.e., trunk, branches, and tags directories at the repository root).\nIf that's the case, clone without -s." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to upload an attachment to GitHub wiki? [closed]\n\nClosed. This question is off-topic. 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's on-topic for Stack Overflow.\n\n\nClosed 12 years ago.\n\n\n\n\n\n\n\n Improve this question\n \n\n\n\nI know how to reference it from wikis but where in GitHub site do I upload the attachment? Thanks a lot!" }, { "role": "assistant", "content": "As of Feburary 14th, 2022 GitHub allows uploading images to Wiki pages by dragging files into the web editor.\nCaveat: Files will be uploaded to their githubusercontent bucket, not added to the git repository for the wiki.\n\nOriginal post:\nJust to answer it shortly: You can't. You have to upload your images somewhere else (like in a repository or on an image hoster) and link it\nBut I agree with @jstephenson" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "What is the special gitlab-ci-token user?\n\nThe docs for gitlab's container registry (https://gitlab.com/help/container_registry/README.md) provide a config example with this instruction:\n- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN registry.example.com\nand this explanation:\nYou have to use the credentials of the special gitlab-ci-token user with its password stored in $CI_BUILD_TOKEN in order to push to the Registry connected to your project. This allows you to automated building and deployment of your Docker images.\nI cannot find any documentation about this special gitlab-ci-token user, nor about the $CI_BUILD_TOKEN var.\nWhat is this special user? Is it automatically available? Does it have to be defined somewhere? What value should be given to the $CI_BUILD_TOKEN var?" }, { "role": "assistant", "content": "Gitlab acts as an authentication provider for the registry.\ngitlab-ci-token is a user automatically created for you.\nCI_BUILD_TOKEN is set automatically for each build by Gitlab-CI" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Understanding the basics of Git and GitHub [closed]\nClosed. This question needs to be more focused. 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 focuses on one problem only 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\nI don't fully understand the purpose of using Git or Github; I know it helps to keep track of your changes and it's helpful for people collaborating with other people, but I don't collaborate with anybody so I don't know if this would be helpful for me.\nI usually work as a web designer/developer but I never have to collaborate. I know in Git you have create, push, commit, create branches etc for every repository but...\n\nWhat is the difference between Git and GitHub?\nIs git saving every repository locally (in the user's machine) and in GitHub?\nCan you use Git without GitHub? If yes, what would be the benefit for using GitHub?\nHow does Git compare to a backup system such as Time Machine?\nIs this a manual process, in other words if you don't commit you wont have a new version of the changes made?\nIf are not collaborating and you are already using a backup system why would you use Git?" }, { "role": "assistant", "content": "What is the difference between Git and GitHub?\n\nGit is a version control system; think of it as a series of snapshots (commits) of your code. You see a path of these snapshots, in which order they where created. You can make branches to experiment and come back to snapshots you took.\nGitHub, is a web-page on which you can publish your Git repositories and collaborate with other people.\n\nIs Git saving every repository locally (in the user's machine) and in GitHub?\n\nNo, it's only local. You can decide to push (publish) some branches on GitHub.\n\nCan you use Git without GitHub? If yes, what would be the benefit for using GitHub?\n\nYes, Git runs local if you don't use GitHub. An alternative to using GitHub could be running Git on files hosted on Dropbox, but GitHub is a more streamlined service as it was made especially for Git.\n\nHow does Git compare to a backup system such as Time Machine?\n\nIt's a different thing, Git lets you track changes and your development process. If you use Git with GitHub, it becomes effectively a backup. However usually you would not push all the time to GitHub, at which point you do not have a full backup if things go wrong. \nI use git in a folder that is synchronized with Dropbox.\n\nIs this a manual process, in other words if you don't commit you won't have a new version of the changes made?\n\nYes, committing and pushing are both manual.\n\nIf are not collaborating and you are already using a backup system why would you use Git?\n\n\nIf you encounter an error between commits you can use the command git diff to see the differences between the current code and the last working commit, helping you to locate your error.\nYou can also just go back to the last working commit.\nIf you want to try a change, but are not sure that it will work. You create a branch to test you code change. If it works fine, you merge it to the main branch. If it does not you just throw the branch away and go back to the main branch.\nYou did some debugging. Before you commit you always look at the changes from the last commit. You see your debug print statement that you forgot to delete.\n\n\nMake sure you check gitimmersion.com." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Multiple commits before pushing\nI'm completely new to GIT, so excuse the naivety. If I'm working on a project offline, and I do multiple commits then push the changes once I'm back online, will all the commits show up in my repository, or just the last one I did before going back online?" }, { "role": "assistant", "content": "Git is a distributed version control system. Your repository is entirely your own, and it contains absolutely everything you need. Committing takes place only within your repository; it has nothing to do with whether or not you're online.\nThe things that you need to be online for are pushing (publishing your commits to another repository) and pulling (fetching and merging commits from another repository). When you push, it will push exactly what you told it to - all of the commits on that branch. It doesn't matter when you made them or if your network cable was plugged in at the time." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to create releases in GitLab?\nI had created a private repository which I then changed to public repository. However, I could not find any way to release. Is it possible to create releases in GitLab? If so, how are they done?" }, { "role": "assistant", "content": "To create a release on the GitLab website:\n\nGo to your repository\nIn the menu choose Repository > Tags\nAdd a tag for the version of your app. For example, v1.3.1.\nAdd a message (title) about the release. For example, Release 1.3.1.\nAdd a note that describes the details of the release. (Not optional. Adding a note to a tag is what makes it a release.)\nClick Create tag.\n\n\nThe release will now show up under Project > Releases. Read more at the GitLab documentation. GitLab recommends that you use the Release API now, but their documentation is hard to follow. It would be the preferred method for automating everything with CI/CD, though." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to import existing Git repository into another?\nI have a Git repository in a folder called XXX, and I have second Git repository called YYY.\nI want to import the XXX repository into the YYY repository as a subdirectory named ZZZ and add all XXX's change history to YYY.\nFolder structure before:\n├── XXX\n│ ├── .git\n│ └── (project files)\n└── YYY\n ├── .git\n └── (project files)\n\nFolder structure after:\nYYY\n├── .git <-- This now contains the change history from XXX\n├── ZZZ <-- This was originally XXX\n│ └── (project files)\n└── (project files)\n\nCan this be done, or must I resort to using sub-modules?" }, { "role": "assistant", "content": "Probably the simplest way would be to pull the XXX stuff into a branch in YYY and then merge it into master:\nIn YYY:\ngit remote add other /path/to/XXX\ngit fetch other\ngit checkout -b ZZZ other/master\nmkdir ZZZ\ngit mv stuff ZZZ/stuff # repeat as necessary for each file/dir\ngit commit -m \"Moved stuff to ZZZ\"\ngit checkout master \ngit merge ZZZ --allow-unrelated-histories # should add ZZZ/ to master\ngit commit\ngit remote rm other\ngit branch -d ZZZ # to get rid of the extra branch before pushing\ngit push # if you have a remote, that is\n\nI actually just tried this with a couple of my repos and it works. Unlike Jörg's answer it won't let you continue to use the other repo, but I don't think you specified that anyway.\nNote: Since this was originally written in 2009, git has added the subtree merge mentioned in the answer below. I would probably use that method today, although of course this method does still work." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-diff - Show changes between commits, commit and working tree, etc --check" }, { "role": "assistant", "content": "Warn if changes introduce conflict markers or whitespace errors.\nWhat are considered whitespace errors is controlled by core.whitespace configuration. By default, trailing whitespaces (including\nlines that consist solely of whitespaces) and a space character\nthat is immediately followed by a tab character inside the\ninitial indent of the line are considered whitespace errors.\nExits with non-zero status if problems are found. Not compatible\nwith --exit-code." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Branch descriptions in Git\nIs there a way in Git to have a 'description' for branches?\nWhile I try to use descriptive names, working for a while on a single branch sometimes dampens my memory of why I made some of the other topic branches. I try to use descriptive names for the branches, but I think a 'description' (short note about the purpose of the branch) would be nice." }, { "role": "assistant", "content": "Git 1.7.9 supports this. From the 1.7.9 release notes:\n\n * \"git branch --edit-description\" can be used to add descriptive text\n to explain what a topic branch is about.\n\nYou can see that feature introduced back in September 2011, with commits 6f9a332, 739453a3, b7200e8:\nstruct branch_desc_cb {\n const char *config_name;\n const char *value;\n};\n\n--edit-description::\n\n\nOpen an editor and edit the text to explain what the branch is for, to be used by various other commands (e.g. request-pull).\n\nNote that it won't work for a detached HEAD branch.\nThat description is used by the script request-pull: see commit c016814783, but also git merge --log. \n\nrequest-pull is a script used to summarizes the changes between two commits to the standard output, and includes the given URL in the generated summary.\n\n[From @AchalDave] Unfortunately, you can't push descriptions since they're stored in your config, making it useless for the sake of documenting branches in a team." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How can I delete group in gitlab?\n\nIn our organisation we recently moving to git, I have created a group accidentally I would be appreciate if there is a way to delete this group." }, { "role": "assistant", "content": "In the most recent version (Mar. 2019):\n\nAt top bar, click on Groups.\nType part of the name of the desired group or click on Explore Groups. Click on the desired group.\nGo to Settings > General\nExpand Path, transfer, remove\nAt the bottom of page you find Remove group. Click on the button and type the name of the group to activate Confirm button. Then click on Confirm to delete the group." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Unmerge a git branch, keeping post-merge commits\nSay there are two branches master and branchA. \nI work on master, a friend on branchA. \nOnce things are finalized, we merge branchA with master. \nAfter several commits on the merged master, the client wants the \nwork done on branchA removed, but NOT the commits done after the merge. \nHow can we do it?" }, { "role": "assistant", "content": "Read through Pro Git - Undoing Merges.\nBasically, you git revert the merge commit:\ngit revert -m 1 hash_of_merge_commit\n\nYou may end up with some conflicts that you'll have to manually unmerge, just like when merging normally.\nAdditional links:\n\nGit SCM - Undoing Merges\nGit Ready - Rolling back changes with revert" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-show - Show various types of objects <limit>" }, { "role": "assistant", "content": "An integer parameter specifies a cut-off percent (3% by default).\nDirectories contributing less than this percentage of the changes\nare not shown in the output." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Go, go get, go install, local packages, and version control\nI am having trouble understanding the workflow for creating a go project that has local packages.\nSay I create a new project, using git for version control, which has a main.go file and a tools.go file which will be in package utils. So I have a directory structure such as this:\n/myproject/\n main.go\n utils/\n tools.go\n\nmain.go looks like this:\npackage main\nimport \"./utils\"\nfunc main() {\n utils.DoSomthing()\n}\n\nand tools.go looks like this:\npackage utils;\nfunc DoSomething() {\n}\n\nEverything works just fine locally, using go build and go run. But this is being hosted on github, and I'd like to be able to have others use the go get command to install it. So the local package import must be changed to use the format \"github.com/user/project/utils\", which works, except now I have two copies of the source code, and the real problem is that the copy with the git history has an import that makes use of the downloaded copy. So if I'm working on the copy with the git history, any changes made to tools.go will go unnoticed, because it will be using the downloaded copy.\nSo I'm wondering if someone can explain the right way of using go get, version control, and package imports within the same project." }, { "role": "assistant", "content": "I've just written a short step-by-step guide on how I am using the new go tool and github.com. You might find it useful:\n1. Setup your GOPATH\nYou can set the environment variable GOPATH to any directory you like. If you have larger projects, it's probably a good idea to create a different GOPATH for each of them. I would recommend this approach especially for the deployment, so that updating a library for project A doesn't break project B which might require an earlier version of the very same library.\nAlso note that you can set your GOPATH to a list of directories, delimited by colons. So you might have a GOPATH containing all commonly used packages, and separate GOPATHS for each project with additonal packages or different versions of existing packages.\nBut unless your are working on a lot of different Go projects simultaneously, its probably enough to have just a single GOPATH locally. So, let's create one:\nmkdir $HOME/gopath\n\nThen you need to set two environment variables to tell the go tool where it can find existing Go packages and where it should install new ones. It's probably best to add the following two lines to your ~/.bashrc or ~/.profile (and do not forget to reload your .bashrc afterwards).\nexport GOPATH=\"$HOME/gopath\"\nexport PATH=\"$GOPATH/bin:$PATH\"\n\n2. Create a new project\nIf you want to create a new Go project which should be hosted at github.com later, you should create this project under $GOPATH/src/github.com/myname/myproject. It's important that the path matches the URL of the github.com repo, because the go tool will follow the same convention. So, let's create the project root and initialize a new git repository there:\nmkdir -p $GOPATH/src/github.com/myname/myproject\ncd $GOPATH/src/github.com/myname/myproject\ngit init\n\nBecause I do not like to type such long paths, I normally create symbolic links for the projects I am currently working on in my home folder:\nln -s $GOPATH/src/github.com/myname/myproject ~/myproject\n\n3. Write your application\nStart coding and don't forget to git add and git commit your files. Also, do not use relative imports like import \"./utils\" for sub-packages. They are currently undocumented and shouldn't be used at all, because they won't work with the go tool. Use imports like github.com/myname/myproject/utils instead.\n4. Publish your project\nCreate a new repository at github.com, upload your SSH public key if you haven't done that before and push your changes to the remote repository:\ngit remote add origin [email protected]:myname/myproject.git\ngit push origin master\n\n5. Continue working on your project\nIf you have set the GOPATH in your .bashrc and if you have created a symlink to your project in your home folder, you can just type cd myproject/ and edit some files there. Afterwards, you can commit the changes using git commit -a and send them to github.com by doing a git push." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to ignore whitespace in github when comparing?\n\nI have committed a file after prettifying it in sublime. Now when I am comparing the differences in GitHub web UI it's showing a lot of changes, so it is very difficult to see the actual changes. Can I compare files in there and ignore the whitespace?" }, { "role": "assistant", "content": "On github, you simply append the w=1 parameter to the URL for it to ignore whitespace. \nThat would look something like:\nhttps://github.com/account_name/repo/pull/14/files?w=1" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Is it possible to make git svn dcommit result in a single svn commit?\nAccording to the manual, git dcommit “will create a revision in SVN for each commit in git.” But is there a way to avoid multiple Subversion revisions? That is, to have git merge all changes prior to performing the svn commit?" }, { "role": "assistant", "content": "If you work on a branch in git, you can git-merge --squash, which does that within git. You could then push that one squashed commit to SVN.\nOf course, lots of small commits are good, so why would you want to squash them?" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How can I choose to overwrite remote repository with local commits?\nBasically, due to events beyond my control, my remote repo was moved - I did a lot of work on my local copy in the meantime and now I really just want to overwrite everything in the remote repo with my local files.\nHowever, I don't seem to be able to do this. The closest I can get is to pull and merge, but then it wants to walk me through some convoluted process for merging. I don't want to merge. I want to overwrite. I don't need a new branch - basically, I just want a fresh start.\nThe remote repo is on unfuddle." }, { "role": "assistant", "content": "You can remove the branch and recreate it, let's say the branch that you want to overwrite is dev:\nRemove the branch in your remote host(github)\ngit push origin :dev \n\nThen just push your dev again: \ngit push origin dev\n\nI use Github for hosting, not familiar with unfuddle, but I think it'll works for the unfuddle, too. :)\n\nJust as @melee mentioned, you can also use \ngit push origin dev -f\n\n(not sure whether the -f is valid, but --force is OK)\ngit push origin dev --force\n\nto force overwrite the branch. I remember I did it before. Thanks @melee. :)" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to use gitlab search criteria\n\nIn gitlab's doc, there is list projects API,\nhowever I wonder how to use the search field.\nI've tried with http://GITLAB_API/projects?search=QUERY&private_token=xxx, and it successfully returned projects those contain QUERY in their names, but I want to know if there is advanced search criteria available? For example, I want to get projects under certain namespace, is it possible to filter those projects through this api? Or any api else?\nThank you!" }, { "role": "assistant", "content": "It appears to search for projects that have a name, path, namespace, or description that match your query string. Sadly, it doesn't appear to be anything fancier.\nTracing the source code of 8.3 stable: lib/api/projects.rb calls a filter_projects helper in lib/api/helpers.rb which calls search in app/models/project.rb." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-update-index - Register file contents in the working tree to the index <file>" }, { "role": "assistant", "content": "Files to act on.\nNote that files beginning with . are discarded. This includes ./file and dir/./file . If you don’t want this, then use\ncleaner names.\nThe same applies to directories ending / and paths with //" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-config - Get and set repository or global options grep.fallbackToNoIndex" }, { "role": "assistant", "content": "If set to true, fall back to git grep --no-index if git grep is executed outside of a git repository. Defaults to false." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-stash - Stash the changes in a dirty working directory away store" }, { "role": "assistant", "content": "Store a given stash created via git stash create (which is a\ndangling merge commit) in the stash ref, updating the stash\nreflog. This is intended to be useful for scripts. It is\nprobably not the command you want to use; see \"push\" above." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Gitlab CI ignores script exit code other than 1\n\nI'm trying to set up a GitLab pipeline, so that certain exit_codes are okay for a script I'm executing.\nI have tried both shell and a ruby script, but both seem to have the same behaviour.\ntest_job:\n stage: build\n image: ruby:3.0\n script:\n - chmod +x ci/wrap.sh\n - ./ci/wrap.sh\n allow_failure:\n exit_codes:\n - 64\n\nAs you can see, I am just executing the script and nothing more, my expectation would be, that the last script executed is used a the exit status for the job.\nIn the script I'm only calling exit 64, which should be a \"allowed failure\" in that case, the pipeline log however says that the job failed because of exit code 1:\n\nHow do I get GitLab to accept the exit code of this (or a ruby) script as the job exit code?" }, { "role": "assistant", "content": "I found a way to fix this problem. Apparently Gitlab Runner uses the -e flag, which means that any non-zero exit code will cancel the job. This can be updated by using set +e, but then you still need to capture the actual exit code for the job.\nUsing $? in two different lines of the configuration does not work, because Gitlab does echo calls in-between them.\nSo the exit code needs to be captured directly, example:\nscript:\n - set +e\n - ruby \"ci/example.rb\" || EXIT_CODE=$?\n - exit $EXIT_CODE" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git push fails: RPC failed; result=22, HTTP code = 411\nI have only one branch. For a few months I have been using\ngit push origin master\n\nto commit to my local repository. Last night after I made some minor changes to my local repository and tried to push using the same command, I got this error:\nerror: RPC failed; result=22, HTTP code = 411\nfatal: The remote end hung up unexpectedly\nfatal: The remote end hung up unexpectedly\nEverything up-to-date\n\nI googled and found questions such as this one and this one, but none of the answers to these questions solves my problem.\nMost of the answers suggest the problem of detached head. Yet I don't think my head is detached. Nor do I think I am on the wrong branch (as I only have one branch...)\nI did a few experiments to figure out what's wrong, and here are the results I got:\n(1) First comes my git status output\n\n# On branch master\n# Untracked files:\n# (use \"git add <file>...\" to include in what will be committed)\n#\n# egal.aux\n# egal.blg\n# egal.out\n# egal.pdf\n# egalcar.aux\n# egalcar.blg\n# egalcar.pdf\nnothing added to commit but untracked files present (use \"git add\" to track)\n\n\n(2) When I type git reflog, I can see all my local commits, but the remote repository just won't get updated.\n(3) When I type git branch -a, I get\n\n* master\n remotes/origin/master\n\n\n(4) When I type git remote show origin, I get\n\n* remote origin\n Fetch URL: http://github.com/CherryQu921/egaldoc_en\n Push URL: http://github.com/CherryQu921/egaldoc_en\n HEAD branch: master\n Remote branch:\n master tracked\n Local ref configured for 'git push':\n master pushes to master (fast-forwardable)\n\n\nI think the last line of output (the \"fast-forwardable\") is weird, but I am not sure what is wrong..." }, { "role": "assistant", "content": "If you attempt to push a large set of changes to a Git repository with HTTP or HTTPS, you may get an error message such as error: RPC failed; result=22, HTTP code = 411. This is caused by a Git configuration default which limits certain HTTP operations to 1 megabyte.\nTo change this limit run within your local repository\ngit config http.postBuffer *bytes*\n\nwhere bytes is the maximum number of bytes permitted. For example:\ngit config http.postBuffer 524288000\n\nFor 500MB (thanks @Hengjie)" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git - the stupid content tracker git-sh-i18n" }, { "role": "assistant", "content": "Git’s i18n setup code for shell scripts" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-diff - Show changes between commits, commit and working tree, etc <limit>" }, { "role": "assistant", "content": "An integer parameter specifies a cut-off percent (3% by default).\nDirectories contributing less than this percentage of the changes\nare not shown in the output." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Git reset to previous commit\nI have three commits I made which I attempted to clean up some code. Anyways I managed to completely destroy what I was working on. And I want to delete the past three commits and return to a specific commit SHA1.\nHow can I restore to that previous commit and delete the history of those 3 commits? (The history deleting part is not a big deal). These commits are pushed already, so I am a little lost.\nThanks!" }, { "role": "assistant", "content": "Find the commit you want to reset to: \ngit log\n\nOnce you have the hash:\ngit reset --hard <hash>\n\nAnd to push onto the remote:\ngit push -f <remote> <branch>" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to do \"go get\" on a specific tag of a github repository\nI am trying to compile the InfluxDB database (version v0.8.8) using go get github.com/influxdb/influxdb\nBut this pulls the master branch, and I need the v0.8.8 tag.\nI have tried to do: go get github.com/influxdb/influxdb/releases/tag/v0.8.8 but this fails saying unable to find.\nI also tried to do a regular go get of the master branch, and then manually checking out the tag using git in GOPATH/src/github... in order to set the corret version.\nThe problem using the last approach is that when I try to pull the dependencies with go get -u -f ./... it tries to find them in the master branch, and some of them do not exist on the master branch...\nTL;DR: perform go get on a specific github tag, and pull the correct dependencies." }, { "role": "assistant", "content": "It is not possible using the go get tool. Instead you need to use a third party go package management tool or create your own forks for the packages that you wish to manage more fine grained.\nSpoke to a guy that works at Google and he acknowledged this problem/requirement, he said that vendoring which his team used was bulky and they will probably solve it with the official tools soon.\nRead more:\n\nReference of third party package management tools\nBlog post by golang team discussing the approach for implementing vendoring\n\nVendoring in Go 1.6\nVendoring has been released from experimental in go 1.6 (after this post was initially written) that makes the process of using specific tags / versions of packages using third party tools easier. go get does still not have the functionality to fetch specific tags or versions.\nMore about how vendoring works: Understanding and using the vendor folder\nModules in Go 1.11\nGo 1.11 has released an experimental features called modules to improve dependency management, they hope to release it as stable in Go 1.12: Information about modules in Go 1.11" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-config - Get and set repository or global options pack.indexVersion" }, { "role": "assistant", "content": "Specify the default pack index version. Valid values are 1 for\nlegacy pack index used by Git versions prior to 1.5.2, and 2 for\nthe new pack index with capabilities for packs larger than 4 GB\nas well as proper protection against the repacking of corrupted\npacks. Version 2 is the default. Note that version 2 is enforced\nand this config option is ignored whenever the corresponding pack is\nlarger than 2 GB. If you have an old Git that does not understand the version 2 *.idx file,\ncloning or fetching over a non-native protocol (e.g. \"http\")\nthat will copy both *.pack file and corresponding *.idx file from the\nother side may give you a repository that cannot be accessed with your\nolder version of Git. If the *.pack file is smaller than 2 GB, however,\nyou can use git-index-pack on the *.pack file to regenerate\nthe *.idx file." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-diff - Show changes between commits, commit and working tree, etc diff.wordRegex" }, { "role": "assistant", "content": "A POSIX Extended Regular Expression used to determine what is a \"word\"\nwhen performing word-by-word difference calculations. Character\nsequences that match the regular expression are \"words\", all other\ncharacters are ignorable whitespace." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Git fast-forward VS no fast-forward merge\nGit merge allows us to perform fast-forward and no fast-forward branch merging. Any ideas when to use fast-forward merge and when to use no fast-forward merge?" }, { "role": "assistant", "content": "The --no-ff option is useful when you want to have a clear notion of your feature branch. So even if in the meantime no commits were made, FF is possible - you still want sometimes to have each commit in the mainline correspond to one feature. So you treat a feature branch with a bunch of commits as a single unit, and merge them as a single unit. It is clear from your history when you do feature branch merging with --no-ff.\nIf you do not care about such thing - you could probably get away with FF whenever it is possible. Thus you will have more svn-like feeling of workflow.\nFor example, the author of this article thinks that --no-ff option should be default and his reasoning is close to that I outlined above:\nConsider the situation where a series of minor commits on the \"feature\" branch collectively make up one new feature: If you just do \"git merge feature_branch\" without --no-ff, \"it is impossible to see from the Git history which of the commit objects together have implemented a feature—you would have to manually read all the log messages. Reverting a whole feature (i.e. a group of commits), is a true headache [if --no-ff is not used], whereas it is easily done if the --no-ff flag was used [because it's just one commit].\"" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Gitlab Push Failed error\n\nI keep getting this error when I try to push anything to my own gitlab server:\nPush failed\nFailed with error:\nfatal: The remote end hung up unexpectedly\nfatal: The remote end hung up unexpectedly\nerror: RPC failed;\ncurl 56 Recv failure: Connection was reset\n\nI have no idea why I keep getting this error. I kept trying to push and then out of nowhere it pushed it successfully. But everything I tried to push after that just gave me the same error.\nHere is a more detailed log:\n16:21:39.932: [gallery] git -c core.quotepath=false push --progress --porcelain origin refs/heads/master:master\nCounting objects: 12, done.\nDelta compression using up to 8 threads.\nCompressing objects: 100% (12/12), done.\nWriting objects: 100% (12/12), 1.88 MiB | 25.00 KiB/s, done.\nTotal 12 (delta 3), reused 0 (delta 0)\nfatal: The remote end hung up unexpectedly\nfatal: The remote end hung up unexpectedly\nDone\nerror: RPC failed; curl 56 Recv failure: Connection was reset" }, { "role": "assistant", "content": "Please try one of these methods below:\nMethod 1:\ngit config --global http.postBuffer 157286400\n\nMethod 2:\nIncrease \"client_max_body_size\" of your Nginx configuration in your Gitlab server.\nCheckout this link to get more information:\nhttps://confluence.atlassian.com/stashkb/git-push-fails-client-intended-to-send-too-large-chunked-body-590251250.html\nHope they will be useful! Good luck!!!" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How can I check out a GitHub pull request with git?\n\nI'd like to check out a previously created pull request (created via GitHub web interface). I searched and found different places where a refs/pull or refs/pull/pr\nBut when I add fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to the git config file and do a git fetch\nWhat I'm doing wrong? Should GitHub create automatically the pull/xyz stuff, or do I have to configure something?" }, { "role": "assistant", "content": "To fetch a remote PR into your local repo,\ngit fetch origin pull/$ID/head:$BRANCHNAME\n\nwhere $ID is the pull request id and $BRANCHNAME is the name of the new branch that you want to create. Once you have created the branch, then simply\ngit checkout $BRANCHNAME\n\nFor instance, let's imagine you want to checkout pull request #2 from the origin main branch:\ngit fetch origin pull/2/head:MASTER\n\nSee the official GitHub documentation for more." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-update-index - Register file contents in the working tree to the index --[no-]fsmonitor-valid" }, { "role": "assistant", "content": "When one of these flags is specified, the object names recorded\nfor the paths are not updated. Instead, these options\nset and unset the \"fsmonitor valid\" bit for the paths. See\nsection \"File System Monitor\" below for more information." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "gitglossary - A Git Glossary object" }, { "role": "assistant", "content": "The unit of storage in Git. It is uniquely identified by the SHA-1 of its contents. Consequently, an\nobject cannot be changed." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-fast-import - Backend for fast Git data importers import-marks import-marks-if-exists" }, { "role": "assistant", "content": "Like --import-marks except in two respects: first, only one\n\"feature import-marks\" or \"feature import-marks-if-exists\"\ncommand is allowed per stream; second, an --import-marks=\nor --import-marks-if-exists command-line option overrides\nany of these \"feature\" commands in the stream; third,\n\"feature import-marks-if-exists\" like a corresponding\ncommand-line option silently skips a nonexistent file." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Do you push every single commit? [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 5 years ago.\n\n\n\n\n\n\n\n Improve this question\n \n\n\n\nI would like, if someone could give me more detail in working with git and remote repositories. I haven't worked with remote repositories, yet.\nTo the local repository you commit smaller changes that may not be too world-shattering. What is pushed to the remote repository? Every local commit? Or the overall-work that was done, which is then merged with overall-works of others? I think the log of the remote repository must be confusing, if everyone pushes every commit." }, { "role": "assistant", "content": "Pushing and Pulling from the remote repository isn't quite as important as your local commits. Typically pushing and pulling a few times a day is sufficient. Like @earlonrails said, more frequent pushes means less likelihood of conflicting changes but typically it isn't that big a deal.\nThink of it this way, by committing to your local repository you are basically saying \"I trust this code. It is complete. It runs. I have tested it. I am ready for other people to see it.\" If you want to push to the remote repository after every commit, that's fine but as long as you do it on a regular basis it doesn't really matter.\nLocal repositories are about tracking your changes to protect the work you do. Remote repositories are for distributing the work to all your teammates and tracking everyone's changes. Your teammates need access to your code, but usually it isn't urgent and can wait until the end of the day or whenever you feel like pushing." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-show - Show various types of objects --submodule[=<format>]" }, { "role": "assistant", "content": "Specify how differences in submodules are shown. When specifying --submodule=short the short format is used. This format just\nshows the names of the commits at the beginning and end of the range.\nWhen --submodule or --submodule=log is specified, the log format is used. This format lists the commits in the range like git-submodule summary does. When --submodule=diff is specified, the diff format is used. This format shows an\ninline diff of the changes in the submodule contents between the\ncommit range. Defaults to diff.submodule or the short format\nif the config option is unset." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to merge two branches with different directory hierarchies in git?\nI started using Maven with a web application project so the directory hierarchy changed. I created a new branch for the Maven integration. Now I have two branches one with the old directory hierarchy and one with the maven directory hierarchy. Both branches have new commits (bugfixes and new features).\nI would like to get rid of the old branch and merge its changes to the Maven branch. Git merge gives countless conflicts that feels like impossible to resolve. I believe that this is because file paths have changed.\nWhat is the best way to approach this merge?" }, { "role": "assistant", "content": "Try setting merge.renameLimit to something high for this merge. git tries to detect renames, but only if the number of files is below this limit, since it requires O(n^2) processing time:\ngit config merge.renameLimit 999999\n\nthen when done:\ngit config --unset merge.renameLimit" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-config - Get and set repository or global options core.fileMode" }, { "role": "assistant", "content": "Tells Git if the executable bit of files in the working tree\nis to be honored. Some filesystems lose the executable bit when a file that is\nmarked as executable is checked out, or checks out a\nnon-executable file with executable bit on. git-clone or git-init probe the filesystem\nto see if it handles the executable bit correctly\nand this variable is automatically set as necessary. A repository, however, may be on a filesystem that handles\nthe filemode correctly, and this variable is set to true when created, but later may be made accessible from another\nenvironment that loses the filemode (e.g. exporting ext4 via\nCIFS mount, visiting a Cygwin created repository with\nGit for Windows or Eclipse).\nIn such a case it may be necessary to set this variable to false .\nSee git-update-index . The default is true (when core.filemode is not specified in the config file)." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git - the stupid content tracker" }, { "role": "assistant", "content": "Terminology Please see gitglossary ." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-config - Get and set repository or global options diff.<driver>.binary" }, { "role": "assistant", "content": "Set this option to true to make the diff driver treat files as\nbinary. See gitattributes for details." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Explain clones info in Github's Traffic tab\n\nIn a recent question I made, one of the answers pointed to another answer in another question where a way to explore the forks and clones of a public Github repo was shared.\nI went ahead and did that with my own public repo and came up with this information in the Git clones section under the Traffic tab in the Graphs section:\n\nI'm not really sure I understand what this information means. Are there 6 clones of the repo in total with 4 of them made on the 09/08? Did only 3 unique cloners cloned it?, in which case, does that mean they cloned it more than once? Do those numbers include myself and any clones I might have made in different systems (ie: home PC, work PC, laptop, etc)? Any help is much appreciated." }, { "role": "assistant", "content": "I believe part of the confusion is that the graph shows 4 cloners (blue line), and the label is saying 3 unique cloners. Other than that, it should be interpreted as:\n\n6 clones in the past 14 days, 4 made on 9/8 ... this may not indicate the \"total\" as you ask, as this graph only ever goes back 14 days\n3 unique cloners cloned it, some of them may have cloned it more than once...\n...For example, on 9/8, it could have been cloners:clones of 1:1 and 1:3 ... it doesn't give you that level of information\nIt should include every time the git clone command was executed against the repo, so all of your different devices, yes.\nYou would be identified as a unique user or not based on if it could determine \"unique GitHub users (or anonymous IP addresses)\" + confirmation from GitHub support" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "What is the difference between origin and upstream on GitHub?\n\nWhat is the difference between origin and upstream on GitHub?\nWhen a git branch -a command is executed, some branches it displays have a prefix of origin (remotes/origin/..) while others have a prefix of upstream (remotes/upstream/..)." }, { "role": "assistant", "content": "This should be understood in the context of GitHub forks (where you fork a GitHub repo on GitHub before cloning that fork locally).\n\nupstream generally refers to the original repo that you have forked\n(see also \"Definition of “downstream” and “upstream”\" for more on upstream term)\norigin is your fork: your own repo on GitHub, clone of the original repo of GitHub\n\nFrom the GitHub page:\n\nWhen a repo is cloned, it has a default remote called origin that points to your fork on GitHub, not the original repo it was forked from.\nTo keep track of the original repo, you need to add another remote named upstream\n\ngit remote add upstream https://github.com/<aUser>/<aRepo.git>\n\n(with aUser/aRepo the reference for the original creator and repository, that you have forked)\nNote: since Sept. 2021, the unauthenticated git protocol (git://...) on port 9418 is no longer supported on GitHub.\nYou will use upstream to fetch from the original repo (in order to keep your local copy in sync with the project you want to contribute to).\ngit fetch upstream\n\n(git fetch alone would fetch from origin by default, which is not what is needed here)\nYou will use origin to pull and push since you can contribute to your own repository.\ngit pull\ngit push\n\n(again, without parameters, 'origin' is used by default)\nYou will contribute back to the upstream repo by making a pull request." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-read-tree - Reads tree information into the index" }, { "role": "assistant", "content": "DESCRIPTION Reads the tree information given by <tree-ish> into the index,\nbut does not actually update any of the files it \"caches\". (see: git-checkout-index ) Optionally, it can merge a tree into the index, perform a\nfast-forward (i.e. 2-way) merge, or a 3-way merge, with the -m flag. When used with -m , the -u flag causes it to also update\nthe files in the work tree with the result of the merge. Only trivial merges are done by git read-tree itself. Only conflicting paths\nwill be in an unmerged state when git read-tree returns." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git - the stupid content tracker GIT_MERGE_VERBOSITY" }, { "role": "assistant", "content": "A number controlling the amount of output shown by\nthe recursive merge strategy. Overrides merge.verbosity.\nSee git-merge" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Git: Installing Git in PATH with GitHub client for Windows\n\nHow do I install Git in my PATH when using the GitHub client for Windows?\nI'm running into errors because apparently Git is not installed in PATH. For example, using Atom, trying to install the Linter plugin gives this error:\nnpm ERR! not found: git\nnpm ERR! \nnpm ERR! Failed using git.\nnpm ERR! This is most likely not a problem with npm itself.\nnpm ERR! Please check if you have git installed and in your PATH.\n\nDoes GitHub for Windows install Git when it installs? (It must, otherwise how does it use Git?) I don't want to double-install it... so how do I just add the Git that's already there to PATH?" }, { "role": "assistant", "content": "GitHub for Windows does indeed install its own version of Git, but it doesn't add it to the PATH variable, which is easy enough to do. Here's instructions on how to do it:\n\nGet the Git URL\nWe need to get the url of the Git \\cmd directory your computer. Git is located here: \nC:\\Users\\<user>\\AppData\\Local\\GitHub\\PortableGit_<guid>\\cmd\\git.exe\n\nSo on your computer, replace <user> with your user and find out what the <guid> is for your computer. (The guid may change each time GitHub updates PortableGit, but they're working on a solution to that.) \nCopy it and paste it into a command prompt (right-click > paste to paste in the terminal) to verify that it works. You should see the Git help response that lists common Git commands. If you see The system cannot find the path specified. Then the URL isn’t right. Once you have it right, create the link to the directory using this format: \n;C:\\Users\\<user>\\AppData\\Local\\GitHub\\PortableGit_<guid>\\cmd\n\n(Note: \\cmd at the end, not \\cmd\\git.exe anymore!)\nOn my system, it’s this, yours will be different:\n;C:\\Users\\brenton\\AppData\\Local\\GitHub\\PortableGit_7eaa494e16ae7b397b2422033as45d8ff6ac2010\\cmd\n\nEdit the PATH Variable\nNavigate to the Environmental Variables Editor (instructions) and find the Path variable in the “System Variables” section. Click Edit… and paste the URL of Git to the end of that string. Save! It might be easier to pull this into Notepad to do the edit, just make sure you put one semicolon before you paste in the URL. If it doesn't work it’s probably because this path got messed up either with a space in there somewhere (should be no spaces around the semicolon) or a semicolon at the end (semicolons should only separate URLs, no semicolon at beginning or end of string). \n\nIf it worked, you should be able to close & reopen a terminal and type git and it will give you that same git help file. Then installing the Linter should work. (Atom > File > Settings > Packages > Linter)" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Converting Mercurial folder to a Git repository\nI don't have a huge experience with Mercurial, I'm mostly a Git guy.\nI would love to mirror a specific Mercurial folder/file in a git Repository. What I'm actually trying to do is to export the history of a file from a Mercurial repository to Git and being able to keep this in sync with future commits.\nDo you have any suggestion on how to proceed? I believe that the way to go should be to get the history of the Mercurial patch, periodically export every single commit as a patch and apply the Mercurial patches to the Git repository." }, { "role": "assistant", "content": "On Linux or anything with bash/sh or similar, or python, try with fast export:\ncd\ngit clone git://repo.or.cz/fast-export.git\ngit init git_repo\ncd git_repo\n~/fast-export/hg-fast-export.sh -r /path/to/old/mercurial_repo\ngit checkout HEAD" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-notes - Add or inspect object notes GIT_NOTES_DISPLAY_REF" }, { "role": "assistant", "content": "Colon-delimited list of refs or globs indicating which refs,\nin addition to the default from core.notesRef or GIT_NOTES_REF , to read notes from when showing commit\nmessages.\nThis overrides the notes.displayRef setting. A warning will be issued for refs that do not exist, but a glob that\ndoes not match any refs is silently ignored." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git - the stupid content tracker GIT_INDEX_FILE" }, { "role": "assistant", "content": "This environment variable specifies an alternate\nindex file. If not specified, the default of $GIT_DIR/index is used." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-rebase - Reapply commits on top of another base tip" }, { "role": "assistant", "content": "NOTES You should understand the implications of using git rebase on a\nrepository that you share. See also RECOVERING FROM UPSTREAM REBASE\nbelow. When the rebase is run, it will first execute a pre-rebase hook if one\nexists. You can use this hook to do sanity checks and reject the rebase\nif it isn’t appropriate. Please see the template pre-rebase hook script\nfor an example. Upon completion, <branch> will be the current branch." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-diff - Show changes between commits, commit and working tree, etc patience" }, { "role": "assistant", "content": "Use \"patience diff\" algorithm when generating patches." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to specify where Git LFS files will be stored?\nI was just wondering if anyone could clear up some confusion I have about using Git Large File Storage.\nWhen creating your new repository, I know how to track certain files with git lfs track, but how do you specify where those files will be stored?\nFor example, in the project I am working on there are a number of png and wav files. These are being tracked using git lfs track. The Git LFS website says that they are stored on a remote server, but I cannot find out where that information is in our repository. \nIn addition, when a second user clones the repo, the project contains only pointers to the LFS objects. How can they find/use the url for the remote where the actual files are stored?\n(We are using Bitbucket and a local system git for our repo.)" }, { "role": "assistant", "content": "The Git-LFS storage server is specified by the lfs.url property, for example:\ngit config lfs.url https://github.com/foo/bar.git/info/lfs\n\nThe default (when lfs.url is unset) is to derive the Git-LFS server URL from the URL of the remote using some heuristics like: [email protected]:foo/bar.git -> https://github.com/foo/bar.git/info/lfs\nYou can view the current server for each remote with:\ngit lfs env | grep Endpoint\n\nNote: current git-lfs (2.13.3) supports only HTTP/HTTPS and file:// endpoint protocols, so you can't push LFS objects to a remote clone over SSH, for example. A workaround is to mount the remote repository over sshfs and use file://." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-instaweb - Instantly browse your working repository in gitweb -l --local" }, { "role": "assistant", "content": "Only bind the web server to the local IP (127.0.0.1)." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "GitHub OAuth2 Token: How to restrict access to read a single private repo\n\nUse-case:\n\nCommand-line application (which is deployed to a 3rd party machine) needs to be able to download a tarball copy of a private repo that belongs to an organization via the GitHub API (v3)\nApplication should only be able to access this one private repo and no other repos with read-only permission.\n\nI have been able to accomplish (1) by creating an authorization for the application after registering a client_id/secret on my github account. However, it does not seem that the tokens returned by the authorization allow read-only access to the repo nor are they restricted to one repo (e.g. one could potentially use the token to modify this repo along with others belonging to the organization).\nIs it possible to restrict access via the proper scope? I don't see anything relevant in the API docs (https://developer.github.com/v3/oauth/#scopes)." }, { "role": "assistant", "content": "I don't believe you can restrict github OAuth tokens in that way. The github docs for OAuth say that\n\nWhile Git over HTTP with OAuth reduces friction for some types of applications, keep in mind that unlike deploy keys, OAuth tokens work for any repository for which the user has access.\n\nSo while you can limit the scope of the token in terms of the types of activities, you can't limit it to a subset of repos.\nDeploy keys can be restricted to a single repo, but allow write access.\nThe obvious tactic (as mentioned by Thomas) is to create a dummy account that represents the application. Given the goals of OAuth, this might be a better workflow in any case -- it'll let you easily change the permissions the app has as if it were in fact a user.\nGithub even mentions/endorses this strategy explicitly, calling them machine users." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Github pull request shows wrong diff\nI am having two branches:\n- master and\n- develop.\nI am trying to merge branch develop into master branch.\nI have checked with Tower and Araxis merge, those two branches are identical. But when I do a pull request on Github, I am seeing that there are 381 files changed, like files are not on master at all.\nAny ideas why this behavior?\nUpdate: I am attaching screenshot of pull request." }, { "role": "assistant", "content": "Despite the misleading/broken github interface there's actually a way to get what you want. You need to drop one .\nInstead of:\n\nhttps://github.com/account/repo/compare/branchA...branchB\n\ndo\n\nhttps://github.com/account/repo/compare/branchA..branchB\n\nThis compares branch heads instead of simply using the base branch to find the merge base.\ngithub's reponse is what clued me in from @edwin-evans' response:\n\nThis is a result of the type of diff we use on GitHub. We use git’s three dot diff, which is the difference between the latest commit on the HEAD branch and the last common ancestor commit with the base branch." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-difftool - Show changes using common diff tools git-config" }, { "role": "assistant", "content": "Get and set repository or global options" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How can I delete all git branches which have been \"Squash and Merge\" via GitHub?\nEver since GitHub introduced Squash and Merge, all the cool kids at my workplace are using it when merging pull requests. Is there a way to cleanup \"Squash and Merge\" branches? \nThe following command from How can I delete all git branches which have been merged? does not work for \"Squash and Merge\":\ngit branch --merged | egrep -v \"(^\\*|master|dev)\" | xargs git branch -d" }, { "role": "assistant", "content": "Here's a script that will delete all local branches that have been squash merged into master:\ngit checkout -q master && git for-each-ref refs/heads/ \"--format=%(refname:short)\" | while read branch; do mergeBase=$(git merge-base master $branch) && [[ $(git cherry master $(git commit-tree $(git rev-parse \"$branch^{tree}\") -p $mergeBase -m _)) == \"-\"* ]] && git branch -D $branch; done\n\nIf you want to run a dry run, you can instead run this:\ngit checkout -q master && git for-each-ref refs/heads/ \"--format=%(refname:short)\" | while read branch; do mergeBase=$(git merge-base master $branch) && [[ $(git cherry master $(git commit-tree $(git rev-parse \"$branch^{tree}\") -p $mergeBase -m _)) == \"-\"* ]] && echo \"$branch is merged into master and can be deleted\"; done\n\nYou can then setup an alias like this:\nalias gprunesquashmerged='git checkout -q master && git for-each-ref refs/heads/ \"--format=%(refname:short)\" | while read branch; do mergeBase=$(git merge-base master $branch) && [[ $(git cherry master $(git commit-tree $(git rev-parse \"$branch^{tree}\") -p $mergeBase -m _)) == \"-\"* ]] && git branch -D $branch; done'\n\nSource:\nhttps://github.com/not-an-aardvark/git-delete-squashed" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How do I clone all remote branches?\nMy master and development branches are tracked remotely on GitHub. How do I clone both these branches?" }, { "role": "assistant", "content": "First, clone a remote Git repository and cd into it:\n$ git clone git://example.com/myproject\n$ cd myproject\n\nNext, look at the local branches in your repository:\n$ git branch\n* master\n\nBut there are other branches hiding in your repository! See these using the -a flag:\n$ git branch -a\n* master\n remotes/origin/HEAD\n remotes/origin/master\n remotes/origin/v1.0-stable\n remotes/origin/experimental\n\nTo take a quick peek at an upstream branch, check it out directly:\n$ git checkout origin/experimental\n\nTo work on that branch, create a local tracking branch, which is done automatically by:\n$ git checkout experimental\n\nBranch experimental set up to track remote branch experimental from origin.\nSwitched to a new branch 'experimental'\n\nHere, \"new branch\" simply means that the branch is taken from the index and created locally for you. As the previous line tells you, the branch is being set up to track the remote branch, which usually means the origin/branch_name branch.\nYour local branches should now show:\n$ git branch\n* experimental\n master\n\nYou can track more than one remote repository using git remote:\n$ git remote add win32 git://example.com/users/joe/myproject-win32-port\n$ git branch -a\n* master\n remotes/origin/HEAD\n remotes/origin/master\n remotes/origin/v1.0-stable\n remotes/origin/experimental\n remotes/win32/master\n remotes/win32/new-widgets\n\nAt this point, things are getting pretty crazy, so run gitk to see what's going on:\n$ gitk --all &" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git - the stupid content tracker GIT_OBJECT_DIRECTORY" }, { "role": "assistant", "content": "If the object storage directory is specified via this\nenvironment variable then the sha1 directories are created\nunderneath - otherwise the default $GIT_DIR/objects directory is used." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Undo changes made in a specific folder in Git\nHow I can undo changes made in a specific folder?\nI've modified files from multiple folders like\napp/code/core/\napp/code/local/\napp/design/frontend/\n\nI want to undo all the changes made in files present in app/code/core/, while keeping the changes modified in files present in app/code/local/ and app/design/frontend/." }, { "role": "assistant", "content": "If you want to undo the changes, do git checkout app/code/core/" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-show - Show various types of objects %<|( <M> )" }, { "role": "assistant", "content": "make the next placeholder take at least until Mth\ndisplay column, padding spaces on the right if necessary.\nUse negative M values for column positions measured\nfrom the right hand edge of the terminal window." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "View rendered output of a gist?\nI'm sure I'm being dim, but is it possible to view the rendered output of a gist?\nThis is the gist I'm interested in: https://gist.github.com/844752/420cc52eb4910fe8fa2bec9e13daab18b6230503\nWhere can I see how it actually renders?" }, { "role": "assistant", "content": "rawgit.com provides this service. To use rawgit.com, simply replace the domain of the raw view of the gist or github file you want to view with rawgit.com. For example:\nhttps://gist.githubusercontent.com/mbostock/844752/raw/index.html\n\nto\nhttps://rawgit.com/mbostock/844752/raw/index.html\n\nor\nhttps://raw.githubusercontent.com/caffinatedmonkey/Hello-World-PSP/master/main.cpp\n\nto\nhttps://rawgit.com/caffinatedmonkey/Hello-World-PSP/master/main.cpp" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-config - Get and set repository or global options color.remote" }, { "role": "assistant", "content": "If set, keywords at the start of the line are highlighted. The\nkeywords are \"error\", \"warning\", \"hint\" and \"success\", and are\nmatched case-insensitively. May be set to always , false (or never ) or auto (or true ). If unset, then the value of color.ui is used ( auto by default)." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How can I make a pull request for a wiki page on GitHub?\nI saw a wiki page on GitHub that isn't open for editing. Then I forked the project, edited it on \"my end\" and tried to do a pull request. It turns out, the wiki isn't in the project, and there isn't a way to commit changes to it.\nOther than e-mailing, is there a way to proceed if I want to suggest a change on the wiki in this case?\nAt this point I found out what seems like an alternative under \"Questions with similar titles\", but I couldn't do the pull request with it yet, and so I'm not sure submodules is a good way for this purpose. I now see I could probably branch it somehow... So is this the way to go?" }, { "role": "assistant", "content": "GitHub doesn't support pull requests for the wiki repository, only the main repository (this is a bit of a shame, IMO, but I can understand it).\nHere's an interesting way one project manages community updates to their wiki, while still keeping tight control, as for source code:\n\nMy proposed workflow is this:\n\nManually create a fork of the Taffy wiki on your Github account:\n \n \nCreate a new repository on your github account. Let's call it \"Taffy-Wiki\".\nClone the Taffy wiki repo to your local machine somewhere: git clone [email protected]:atuttle/Taffy.wiki.git\nRemove the original \"origin\" remote and add your github repo as new \"origin\" git remote rm origin and git remote add origin [email protected]:<YOUR_USERNAME>/Taffy-Wiki.git\n\nMake your proposed changes locally, then push them to your github account: git push -u origin master ('-u origin master' only required the first time; afterwards just do git push)\nSubmit a ticket to the official Taffy issue tracker requesting me to review your changes and merge them in. Please be sure to include a link to your repo and describe what you've changed.\nGoto #2\n\n\n(From How you can contribute to Taffy documentation.)\nIf it were me, I'd create an issue in the main repository (that is, the one you forked) suggesting an update to the wiki. If issues aren't enabled, then email's about the only other option I can think of." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-update-index - Register file contents in the working tree to the index --ignore-missing" }, { "role": "assistant", "content": "Ignores missing files during a --refresh" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-shortlog - Summarize git log output" }, { "role": "assistant", "content": "NAME git-shortlog - Summarize git log output" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Create a patch including specific files in git\nLet's say that I am 7 commits ahead of the origin/master repo. I would like to create a patch that includes in the patch specific files that were changed, not all the files. Or equivalent exclude specific files from the patch that were changed. How can I achieve that?" }, { "role": "assistant", "content": "You can create a patch file by restricting the output of git diff by listing paths at the end of the command (after a -- to avoid any potential clashes between path names and branch names).\nFor example, you could do the following:\ngit diff origin/master HEAD -- app/models/region.rb doc/ > changes.patch\n\nAbove commands generate a patch that shows only the differences for a particular file: region.rb and a particular directory : doc when compared to origin/master\nThen you can apply the patch using\npatch -p1 < changes.patch\n\nThe -p1 tells patch to strip the a/ and b/ in the paths in the patch" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Git alias with positional parameters\nBasically I'm trying to alias:\ngit files 9fa3\n\n...to execute the command:\ngit diff --name-status 9fa3^ 9fa3\n\nbut git doesn't appear to pass positional parameters to the alias command. I have tried:\n[alias]\n files = \"!git diff --name-status $1^ $1\"\n files = \"!git diff --name-status {1}^ {1}\"\n\n...and a few others but those didn't work.\nThe degenerate case would be:\n$ git echo_reverse_these_params a b c d e\ne d c b a\n\n...how can I make this work?" }, { "role": "assistant", "content": "A shell function could help on this:\n[alias]\n files = \"!f() { git diff --name-status \\\"$1^\\\" \\\"$1\\\"; }; f\"\n\nAn alias without ! is treated as a Git command; e.g. commit-all = commit -a.\nWith the !, it's run as its own command in the shell, letting you use stronger magic like this.\nUPD\nBecause commands are executed at the root of repository you may use ${GIT_PREFIX} variable when referring to the file names in commands" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-diff - Show changes between commits, commit and working tree, etc git diff [<options>] <commit> <commit>…​ <commit> [--] [<path>…​]" }, { "role": "assistant", "content": "This form is to view the results of a merge commit. The first\nlisted <commit> must be the merge itself; the remaining two or\nmore commits should be its parents. Convenient ways to produce\nthe desired set of revisions are to use the suffixes ^@ and ^! . If A is a merge commit, then git diff A A^@ , git diff A^! and git show A all give the same combined diff." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-diff - Show changes between commits, commit and working tree, etc --no-indent-heuristic" }, { "role": "assistant", "content": "Disable the indent heuristic." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git push rejected\nI give up!\nWhenever I try to push I get a stupid: \n! [rejected] master -> master (non-fast forward)\nerror: failed to push some refs to '[email protected]:companyX/projectX.git'\n\nOur team has a new git setup. Instead of making private branches I now Forked our main repository (on github) to create my own copy.\nAt some point what I did was:\n$ git fetch upstream master:upstreammaster\n\nSo here is my current setup::\n$ git branch\nmaster\n* upstreammaster\n\n$ git remote -v\norigin [email protected]:userX/projectX.git\nupstream [email protected]:companyX/projectX.git\n\nwhere userX is my private repository.\nSo I go and make some changes to my upstreammaster branch, and the PULL from \"upstream master\".\nEverything merges and stuff:\n$ git pull upstream master\nremote: Counting objects: 95, done.\nremote: Compressing objects: 100% (60/60), done.\nremote: Total 60 (delta 54), reused 0 (delta 0)\nUnpacking objects: 100% (60/60), done.\nFrom [email protected]:companyX/projectX\n * branch master -> FETCH_HEAD\nMerge made by recursive.\nstuff | 165 ++++++++++++--------\nstuff | 35 ++--\nstuff | 107 ++++++++++---\nstuff | 105 ++++++++++---\nstuff | 24 ++--\nstuff | 9 +-\nstuff | 53 +++----\nstuff | 44 +++---\nstuff | 52 +++----\nstuff | 32 +----\nstuff | 4 +-\n stuff | 138 ++++++++---------\nstuff | 58 ++++----\nstuff | 115 ++++++++------\nstuff | 5 +-\nstuff | 39 ++---\nstuff | 28 ++--\n 17 files changed, 560 insertions(+), 453 deletions(-)\n\nbut then when I try to do:\n$ git push upstream master\nTo [email protected]:companyX/projectX.git\n ! [rejected] master -> master (non-fast forward)\nerror: failed to push some refs to '[email protected]:companyX/projectX.git'\n\nAny help would be greately appreciated! If you need clarification please ask, I will reply!" }, { "role": "assistant", "content": "When doing a push, try specifying the refspec for the upstream master:\ngit push upstream upstreammaster:master" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git push fails: RPC failed; result=22, HTTP code = 411\n\nI have only one branch. For a few months I have been using\ngit push origin master\n\nto commit to my local repository. Last night after I made some minor changes to my local repository and tried to push using the same command, I got this error:\nerror: RPC failed; result=22, HTTP code = 411\nfatal: The remote end hung up unexpectedly\nfatal: The remote end hung up unexpectedly\nEverything up-to-date\n\nI googled and found questions such as this one and this one, but none of the answers to these questions solves my problem.\nMost of the answers suggest the problem of detached head. Yet I don't think my head is detached. Nor do I think I am on the wrong branch (as I only have one branch...)\nI did a few experiments to figure out what's wrong, and here are the results I got:\n(1) First comes my git status output\n\n# On branch master\n# Untracked files:\n# (use \"git add <file>...\" to include in what will be committed)\n#\n# egal.aux\n# egal.blg\n# egal.out\n# egal.pdf\n# egalcar.aux\n# egalcar.blg\n# egalcar.pdf\nnothing added to commit but untracked files present (use \"git add\" to track)\n\n\n(2) When I type git reflog, I can see all my local commits, but the remote repository just won't get updated.\n(3) When I type git branch -a, I get\n\n* master\n remotes/origin/master\n\n\n(4) When I type git remote show origin, I get\n\n* remote origin\n Fetch URL: http://github.com/CherryQu921/egaldoc_en\n Push URL: http://github.com/CherryQu921/egaldoc_en\n HEAD branch: master\n Remote branch:\n master tracked\n Local ref configured for 'git push':\n master pushes to master (fast-forwardable)\n\n\nI think the last line of output (the \"fast-forwardable\") is weird, but I am not sure what is wrong..." }, { "role": "assistant", "content": "If you attempt to push a large set of changes to a Git repository with HTTP or HTTPS, you may get an error message such as error: RPC failed; result=22, HTTP code = 411. This is caused by a Git configuration default which limits certain HTTP operations to 1 megabyte.\nTo change this limit run within your local repository\ngit config http.postBuffer *bytes*\n\nwhere bytes is the maximum number of bytes permitted. For example:\ngit config http.postBuffer 524288000\n\nFor 500MB (thanks @Hengjie)" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Git cherry-pick syntax and merge branches\nSo I have done countless cherry picks before and it seems that I must fail at life with this right now, I am trying to cherry pick from one branch to another which should be easy, how ever I get an error about it being a merge but not -m was given?\n$ git cherry-pick a8c5ad438f6173dc34f6ec45bddcef2ab23285e0\nerror: Commit a8c5ad438f6173dc34f6ec45bddcef2ab23285e0 is a merge but no -m option was given.\nfatal: cherry-pick failed\n\nThat looks wrong.......it should be:\n$ git cherry-pick a8c5ad438f6173dc34f6ec45bddcef2ab23285e0\n\nSince when do I have to supply a -m function?" }, { "role": "assistant", "content": "You have to supply -m if the commit is a merge commit, i.e. a commit with more than one parent.\nNormally, what git cherry-pick REV does can be described as:\n\nTake the changes between rev and its parent.\nApply these changes to the current HEAD and commit the result with rev's commit message.\n\nA merge commit joins two lines of development. For example, one line implements widget, and the other line removes clutter. The merge gives you the code with the widget, sans the clutter.\nNow consider step #1 of the cherry-pick process: git can't guess whether you want to remove the clutter or to implement the widget. Nor can you do both, because the information on how to do both is not contained inside a single merge commit, only the content of the resultant merged tree is.\nThe -m option allows you to tell git how to proceed. For example, if clutter removal happened on master and the merge commit was created using git merge WIDGET, then git cherry-pick -m 1 merged-commit will cherry-pick the new widget because diff between the merged tree and parent 1 (the last of clutter-removing commits) will have been exactly the widget addition. On the other hand, git cherry-pick -m 2 merge-commit will delete the clutter, because the difference between parent 2 (the last of the widget-adding commits) and merge-commit is exactly the clutter-removal missing from the widget branch." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How do you get git bisect to ignore merged branches?\nI'm aware that git bisect is branch-aware by design, so that if between good commit, G, and bad commit, B, you merged in a branch, it needs to take those changes into consideration as well, as the bug may be contained in the branch.\nIn my case I have a dependency as a side branch and I merge in changes to my main project from time to time. The dependency can be considered a library that has a different way of running, different build-system etc. from my main project, but I still want recent changes from it via merges to the main branch.\nThe problem is then that while bisecting in this scenario, you end up on non-compilable commits in the commits from the dependency.\nI would really just want to consider each branch merge as a single commit while doing the bisection.\nA workaround I've found so far is making a list of valid commits G..B with git log --first-parent, and then while bisecting, do git bisect skip if the current commit isn't in that list. That takes a lot of time though (lots of files to checkout/change for each skip).\nSo the question is: Is there any way of doing --first-parent with git bisect or providing a list of commits i feel are valid to be able to avoid checking out branches I know already are not compilable? How do we only check the commits marked o in the diagram?\n\nG---o---o---o---o---o---o---B main project branch\n / / / \n x---x---x---x---x dependency\n \\ /\n x' dependency project taskbranch\n\nEdit: added diagram for clarity" }, { "role": "assistant", "content": "Is there any way of doing --first-parent with git bisect\n\nYes: with Git 2.29 (Q4 2020), \"git bisect\"(man) learns the \"--first-parent\" option to find the first breakage along the first-parent chain.\nSee commit ad464a4, commit e8861ff, commit be5fe20, commit 0fe305a, commit 15a4802 (07 Aug 2020) by Aaron Lipman (alipman88).\n(Merged by Junio C Hamano -- gitster -- in commit 47f0f94, 17 Aug 2020)\n\nbisect: introduce first-parent flag\nSigned-off-by: Aaron Lipman\n\n\nUpon seeing a merge commit when bisecting, this option may be used to follow only the first parent.\nIn detecting regressions introduced through the merging of a branch, the merge commit will be identified as introduction of the bug and its ancestors will be ignored.\nThis option is particularly useful in avoiding false positives when a merged branch contained broken or non-buildable commits, but the merge itself was OK.\ngit bisect [--no-checkout] [--first-parent] [<bad> [<good>...]] [--] [<paths>...]\n\n\ngit bisect now includes in its man page:\n\n--first-parent\nFollow only the first parent commit upon seeing a merge commit.\nIn detecting regressions introduced through the merging of a branch, the merge\ncommit will be identified as introduction of the bug and its ancestors will be\nignored.\nThis option is particularly useful in avoiding false positives when a merged\nbranch contained broken or non-buildable commits, but the merge itself was OK." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-worktree - Manage multiple working trees --[no-]track" }, { "role": "assistant", "content": "When creating a new branch, if <commit-ish> is a branch,\nmark it as \"upstream\" from the new branch. This is the\ndefault if <commit-ish> is a remote-tracking branch. See --track in git-branch for details." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-log - Show commit logs %gD" }, { "role": "assistant", "content": "reflog selector, e.g., refs/stash@{1} or refs/stash@{2\nminutes ago} ; the format follows the rules described for the -g option. The portion before the @ is the refname as\ngiven on the command line (so git log -g refs/heads/master would yield refs/heads/master@{0} )." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-config - Get and set repository or global options http.cookieFile" }, { "role": "assistant", "content": "The pathname of a file containing previously stored cookie lines,\nwhich should be used\nin the Git http session, if they match the server. The file format\nof the file to read cookies from should be plain HTTP headers or\nthe Netscape/Mozilla cookie file format (see curl(1) ).\nNOTE that the file specified with http.cookieFile is used only as\ninput unless http.saveCookies is set." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-diff-index - Compare a tree to the working tree or index --find-copies-harder" }, { "role": "assistant", "content": "For performance reasons, by default, -C option finds copies only\nif the original file of the copy was modified in the same\nchangeset. This flag makes the command\ninspect unmodified files as candidates for the source of\ncopy. This is a very expensive operation for large\nprojects, so use it with caution. Giving more than one -C option has the same effect." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "LaTeX math in github wikis\n\nIs it possible to include LaTeX-style math in any way with github repo wikis? Googling implies github no longer allows things like MathJax, but most references are years old. What (if any) alternatives are there to including LaTeX-formatted math in github wikis?" }, { "role": "assistant", "content": "You can use chart.apis.google.com to render LaTeX formulas as PNG.\nIt work nicely with Githhub's markdown:\nExample (Markdown):\nThe ratio of the momentum to the velocity is\nthe relativistic mass, m.\n\n![f1]\n\nAnd the relativistic mass and the relativistic\nkinetic energy are related by the formula:\n\n![f2]\n\nEinstein wanted to omit the unnatural second term\non the right-hand side, whose only purpose is\nto make the energy at rest zero, and to declare\nthat the particle has a total energy, which obeys:\n![f3] which is a sum of the rest energy ![f4]\nand the kinetic energy.\n\n[f1]: http://chart.apis.google.com/chart?cht=tx&chl=m=\\frac{m_0}{\\sqrt{1-{\\frac{v^2}{c^2}}}}\n[f2]: http://chart.apis.google.com/chart?cht=tx&chl=E_k=mc^2-m_0c^2\n[f3]: http://chart.apis.google.com/chart?cht=tx&chl=E=mc^2\n[f4]: http://chart.apis.google.com/chart?cht=tx&chl=m_0c^2\n\nhttps\nSome installations of Github Enterprise reject http and work only if you use https\nRendered:" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-log - Show commit logs --no-merges" }, { "role": "assistant", "content": "Do not print commits with more than one parent. This is\nexactly the same as --max-parents=1 ." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Show full Git commit message in console\nI'm trying to output the full commit message in the console and I am able get the message, however in order to see the full message I have to keep resizing the console window in order to reveal more. I am on Windows using Cygwin.\nThe command I'm using is git log --pretty=full." }, { "role": "assistant", "content": "pagers to the rescue \ngit log | less\n\nMake sure you don't have -S on an alias for less\nAlso, it is generally considered good practice to limit the width for commit messages. I believe a common standard is 78 chars (IIRC), and most texteditors do a good job of ensuring such style rules (auto formatting your message).\nUpdate: As a reference data point, git-config lists:\n\ngui.commitmsgwidth\n Defines how wide the commit message window is in the git-gui(1). \"75\" \n is the default." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-svn: how do I create a new svn branch via git?\nI have a git repository which tracks an svn repository. I cloned it using --stdlayout.\nI created a new local branch via git checkout -b foobar\nNow I want this branch to end up in …/branches/foobar in the svn repository.\nHow do I go about that?\n(snipped lots of investigative text. see question history if you care)" }, { "role": "assistant", "content": "I know this question has been answered a while ago, but after reading it, I it might help adding examples of the specific git svn branch command and relate it to a typical workflow.\nLike kch answered, use git svn branch. Here is a full example, (note the -n for dry-run to test):\ngit svn branch -n -m \"Branch for authentication bug\" auth_bug\n\nIf this goes well, server replies with answer like this:\n\nCopying https://scm-server.com/svn/portal/trunk at r8914 to https://scm-server.com/svn/portal/branches/auth_bug...\n\nAnd without the -n switch the server probably adds something like:\n\nFound possible branch point: https://scm-server.com/svn/portal/trunk => https://scm-server.com/portal/branches/auth_bug, 8914\nFound branch parent:\n (refs/remotes/auth_bug)\nd731b1fa028d30d685fe260f5bb912cbf59e1971\nFollowing parent with do_switch\nSuccessfully followed parent r8915 = 6ed10c57afcec62e9077fbeed74a326eaa4863b8\n(refs/remotes/auth_bug)\n\nThe best part of it, now you can create a local branch based on your remote branch like so:\ngit checkout -b local/auth_bug auth_bug\n\nWhich means \"check out and create local branch named auth_bug and make it follow the remote branch (last parameter) auth_bug\nTest that your local branch works on that remote branch by using dcommit with --dry-run (-n):\ngit svn dcommit -n\n\nAnd SVN server should reply with the new branch name:\n\nCommitting to https://scm-server.com/svn/portal/branches/auth_bug ..." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "What is a \"merge bubble\"?\nI've heard of \"merge bubbles\" with regards to Git. I'm fairly well-versed in Git, but would not consider myself an expert. I've heard some negative things about merge bubbles; what is a \"merge bubble\" in Git, what's wrong with it, and how can I avoid it?" }, { "role": "assistant", "content": "A merge bubble is a \"trivial merge\" in Git that did not require any conflicts to be resolved. The bubble occurs in the log where the merge is displayed when you use the --graph option. for example, if you ran git log --graph you might see something like this:\n| |\n* | commit d79f3c4e129356b055c659ee5be28081c1f38aa1\n|\\ \\ Merge: 09bf1ed 4ef9a23\n| | | Author: Peter <[email protected]>\n| | | Date: Wed Sep 17 17:21:07 2014 -0400\n| | |\n| | | Merge branch 'master' of http://fictitiousrepo.visualstudio.com/DefaultCollection/_git/fictitiousproject\n| | |\n| * | commit 4ef9a2387f0d4db39a6cab8ff8f531815935c305\n| | | Author: Andrew <andrew@example>\n| | | Date: Tue Sep 16 11:54:14 2014 -0500\n| | |\n| | | updated changelog\n| | |\n* | | commit 09bf1ed0125d77c26b5760939c125998bb046e9a\n|/ / Author: Peter <[email protected]>\n| | Date: Wed Sep 17 17:20:30 2014 -0400\n| | \n| | fixed some bugs\n\nwhere the lines \"bulge\" out is the \"merge bubble\". This may seem innocuous; but many consider it much less readable than what could have happened, which would be like this:\n|\n* commit 09bf1ed0125d77c26b5760939c125998bb046e9a\n| Author: Peter <[email protected]>\n| Date: Wed Sep 17 17:20:30 2014 -0400\n|\n| fixed some bugs\n|\n* commit 4ef9a2387f0d4db39a6cab8ff8f531815935c305\n| Author: Andrew <andrew@example>\n| Date: Tue Sep 16 11:54:14 2014 -0500\n|\n| updated changelog\n|\n\n...because no merge was really required.\nThis generally happens when accepting a pull request by automatically merging it. Sometimes this was due to the how the \"Merge Pull Request\" button used to work on Github.\nTo avoid merge bubbles with pull requests, one strategy is to manually merge. For example:\ngit checkout master\ngit remote add remoteorigin git://remotegithost.com/remotegitrepo/remotegitproject\ngit fetch remoteorigin \ngit merge remoteorigin/remoteprojectbranch\ngit push origin master\n\nTo remove a recently committed merge bubble from a pull request (when you haven't pushed), one strategy is to first stash your current changes, reset your head to the commit before the bubble, pull with rebase, then push. For example:\ngit stash save\ngit reset --hard HEAD~1\ngit pull --rebase\ngit push origin HEAD\n\nReference:\n http://adammonsen.com/post/1172" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-diff - Show changes between commits, commit and working tree, etc -a --text" }, { "role": "assistant", "content": "Treat all files as text." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-symbolic-ref - Read, modify and delete symbolic refs -q --quiet" }, { "role": "assistant", "content": "Do not issue an error message if the <name> is not a\nsymbolic ref but a detached HEAD; instead exit with\nnon-zero status silently." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-rev-list - Lists commit objects in reverse chronological order --stdin" }, { "role": "assistant", "content": "In addition to getting arguments from the command line, read\nthem from standard input as well. This accepts commits and\npseudo-options like --all and --glob= . When a -- separator\nis seen, the following input is treated as paths and used to\nlimit the result. Flags like --not which are read via standard input\nare only respected for arguments passed in the same way and will not\ninfluence any subsequent command line arguments." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to send GitLab only schedule pipeline fail email?\n\nI wanted to send an email when schedule pipeline is failed. I have configure Project -> Settings -> Integrations -> Pipelines emails but these are sending emails for all the pipelines. \nI want to apply Pipeline Emails only for schedule ones. \nCould you please suggest any solution." }, { "role": "assistant", "content": "Looks like this isn't possible in GitLab. There is an issue about it here: https://gitlab.com/gitlab-org/gitlab/-/issues/220059\nYou probably have to turn off the automated GitLab emails entirely and then set up something manually in the schedule pipelines to email you, which is quite a drag but I guess should work." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-config - Get and set repository or global options --remove-section" }, { "role": "assistant", "content": "Remove the given section from the configuration file." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Mirroring from GitLab to GitHub\n\nI have been using a private GitLab instance to hold all my code. But since most of the staff that work with me now have a GitHub account, i would really like to get moving and mirror my Gitlab repo to Github.\nMy situation:\n\na server running Gitlab (Omnibus)\na Github account for which I'll create an organization for where me and my staff can be organized together.\n\nI know that there is the --mirror switch in git, but I am not really sure how this is ment to work. Documentation I found online was very wonky... So it would be nice if someone could help me out. :)" }, { "role": "assistant", "content": "GitLab has now an option to do this from the UI, go to the Settings->Repository of your repo:\nhttps://gitlab.com/yourUserNameInGitLab/yourRepoName/settings/repository\nThen find the option \"Mirror a repository\" and click on expand. What you want to do is choose the \"Push\" mirror direction and fill this URL:\nhttps://[email protected]/yourUserNameInGitHub/yourRepoName.git\nIn the password field, you have to use a Personal Access Token (as GitHub has deprecated password access now), which you can generate here: https://github.com/settings/tokens (don't forget to enable the \"repo\" and \"workflow\" permissions when generating it)" } ]