messages
listlengths 3
3
|
---|
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How do I change the URI (URL) for a remote Git repository?\nI have a repo (origin) on a USB key that I cloned on my hard drive (local). I moved \"origin\" to a NAS and successfully tested cloning it from here.\nI would like to know if I can change the URI of \"origin\" in the settings of \"local\" so it will now pull from the NAS, and not from the USB key.\nFor now, I can see two solutions:\n\npush everything to the USB origin, and copy it to the NAS again (implies a lot of work due to new commits to NAS origin);\n\nadd a new remote to \"local\" and delete the old one (I fear I'll break my history)."
},
{
"role": "assistant",
"content": "You can\ngit remote set-url origin new.git.url/here\n\nSee git help remote. You also can edit .git/config and change the URLs there.\nYou're not in any danger of losing history unless you do something very silly (and if you're worried, just make a copy of your repo, since your repo is your history.)"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to link folder from a git repo to another repo?\n\nI want to create a public repo to put some sample files from my main repo (private). Is there any way to soft link few folders from a git repo to another git repo?"
},
{
"role": "assistant",
"content": "Then you should use submodules for this task.\nSubmodule are different git repositories under the same root.\nThis way you can manage 2 different project at folder level inside the root repository\n\nSubmodules allow foreign repositories to be embedded within a dedicated subdirectory of the source tree, always pointed at a particular commit.\n\n\ngit submodule\nBreak your big project to sub projects as you did so far.\nNow add each sub project to you main project using :\ngit submodule add <url>\n\nOnce the project is added to your repo, you have to init and update it.\ngit submodule init\ngit submodule update\n\nAs of Git 1.8.2 new option --remote was added\ngit submodule update --remote --merge\n\nwill fetch the latest changes from upstream in each submodule, merge them in, and check out the latest revision of the submodule.\nAs the docs describe it:\n\n--remote\nThis option is only valid for the update command. Instead of using the superproject’s recorded SHA-1 to update the submodule, use the status of the submodule’s remote-tracking branch.\n\nThis is equivalent to running git pull in each submodule.\n\n\nHowever, how would I push a commit in the scenario of bug fix in C which affects the code shared with the parent layers?\n\nAgain: using submodule will place your code inside your main project as part of its content. The difference between having it locally inside the folder or having it as part of a submodule is that in submodule the content is managed (commited) to a different standalone repository.\n\nThis is an illustration of submodule - project inside another project in which each project is a standalone project.\n\n\ngit subtree\nGit subtree allows you to insert any repository as a sub-directory of another one\nVery similar to submodule but the main difference is where your code is managed. In submodules the content is placed inside a separate repo and is managed there which allow you to clone it to many other repos as well.\nsubtree is managing the content as part of the root project and not in a separate project.\nInstead of writing down how to set it up and to understand how to use it you can simply read this excellent post which will explain it all.\nhttps://developer.atlassian.com/blog/2015/05/the-power-of-git-subtree/"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to \"pull\" from a local branch into another one?\nThis sounds so simple, but I just can't figure it out. I made an experimental branch a while ago, and now I'd like to pull in all the changes that happened on master since I made it. This is all local. I want to pull from local master into local my_branch, but I can't do it. This doesn't seem to work, telling me that master isn't a git repository:\ngit pull master"
},
{
"role": "assistant",
"content": "You have to tell Git from where to pull, in this case from the current directory/repository (.):\ngit pull . master\n\nBut when working locally, you can simply use merge (pull internally calls merge):\ngit merge master\n\nWhat is meant by \"pull internally calls merge\"? With default configuration, git pull . master is the same as git fetch . master && git merge FETCH_HEAD"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to ignore the same name directory __pycache__ in a project?\nThe __pycache__ directory is annoying when working with git updates. Whenever I use git status, a lot of .pyc files show up. How can I conveniently list the __pycache__ folder in my .gitignore file so that they won't show up when using git status?\nFor example:\ncore/__pycache__/utils.cpython-36.pyc\ncore/__pycache__/version.cpython-36.pyc\ncore/actions/__pycache__/__init__.cpython-36.pyc\ncore/actions/__pycache__/action.cpython-36.pyc\n\nDo I have to list all the individual __pycache__files into the gitignore file?"
},
{
"role": "assistant",
"content": "Use **/__pycache__/ this to ignore all pycache folder across the repo"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "gitmodules - Defining submodule properties dirty"
},
{
"role": "assistant",
"content": "All changes to the submodule’s work tree will be ignored, only\ncommitted differences between the HEAD of the submodule and its\nrecorded state in the superproject are taken into account."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How do I force Git to use LF instead of CR+LF under Windows?\nI want to force Git to check out files under Windows using just LF not CR+LF.\nI checked the two configuration options, but was not able to find the right combination of settings.\nI want to convert all files to have LF line breaks and keep the LF in the files.\nRemark: I used autocrlf = input but this just repairs the files when you commit them.\nI want to force it to get them using LF.\nProbably I wasn't so clear:\nthe repository is already using LF but the files checked out using\nGit for Windows are using CR+LF\nand I want to force Git to get them with LF:\nforcing Unix line endings.\n$ git config --list | grep crlf\ncore.autocrlf=input"
},
{
"role": "assistant",
"content": "The proper way to get LF endings in Windows is to first set core.autocrlf to false:\ngit config --global core.autocrlf false\n\nYou need to do this if you are using msysgit, because it sets it to true in its system settings.\nNow git won’t do any line ending normalization. If you want files you check in to be normalized, do this: Set text=auto in your .gitattributes for all files:\n* text=auto\n\nAnd set core.eol to lf:\ngit config --global core.eol lf\n\nNow you can also switch single repos to crlf (in the working directory!) by running\ngit config core.eol crlf\n\nAfter you have done the configuration, you might want git to normalize all the files in the repo:\ngit add --update --renormalize\n\nIf you now want git to also normalize the files in your working directory, run these commands:\ngit ls-files -z | xargs -0 rm\ngit checkout ."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-config - Get and set repository or global options $XDG_CONFIG_HOME/git/config ~/.gitconfig"
},
{
"role": "assistant",
"content": "User-specific configuration files. When the XDG_CONFIG_HOME environment\nvariable is not set or empty, $HOME/.config/ is used as\n$XDG_CONFIG_HOME. These are also called \"global\" configuration files. If both files exist, both\nfiles are read in the order given above."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-ls-tree - List the contents of a tree object -d"
},
{
"role": "assistant",
"content": "Show only the named tree entry itself, not its children."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Git: How to reuse/retain commit messages after 'git reset'?\nAs Git user I regular come across the situation, that I need to rework one or more commits in a way which do not fit into --amend or rebase -iwith fixup commits. Typically I would do something like\ngit reset HEAD~1\n# hack, fix, hack\ngit commit -a\n# argh .. do I need to retype my message?\n\nI take sensible composed commit messages quite serious. They typically contain larger text with references & justifications for the change. Until now, I'm quite annoyed on the lengthy process to recover my old commit message via an unsorted git reflog, git logand copy & paste process.\nIs there a better to tackle this? And how would it, if my comprises more than one commit?\nEdit: After a bit thinking about this I think what I'm looking for is some git stash-like functionality for commit messages where fixup/amend commits are not appropriate."
},
{
"role": "assistant",
"content": "After a git reset, this one-liner can do it:\ngit commit --reuse-message=HEAD@{1}\n\nor even shorter:\ngit commit -C HEAD@{1}\n\nPerhaps more clear:\ngit commit --reuse-message=ORIG_HEAD\n\nYou can use the other options given by @user2718704."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Cannot see new files added to my git working directory\ngit version 1.7.4.1\nI am using git on Ubuntu.\nI have copied some files from another directory to my git working directory. Normally would appear under Untracked files. However, they do not appear. So I cannot add them.\nWhen I do a git status the new files are not shown.\nI tried to add them by doing git add source.c then tried git status. The file was not show.\nSo I opened the file and did a save as as the same name. git status still failed to see the file.\nI have done a git ls-files and the new files are shown ok.\nI have checked the file permissions and they are the same as all the current files in my git directory.\nI have never had this problem before.\nMany thanks for any suggestions,"
},
{
"role": "assistant",
"content": "If git ls-files shows source.c, then it must already be in the index. This means that it is already tracked, and possibly already committed. If source.c isn't showing up in git status at all, then the file must have been committed.\nTry modifying the file to see if it shows up as modified in git status. To really convince yourself that the file is checked in, run git cat-file -p HEAD:source.c to see the contents of the checked-in file (see git help revisions for documentation about the HEAD:source.c syntax).\nIn addition, one or more of the following may be true:\n\nThe file has been modified, but the 'assume unchanged' bit is set in the index. Take a look at the output of git ls-files -v source.c. If the first column is a lower-case letter, then the 'assume unchanged' bit is set. This will prevent any changes from showing up in git status. You can turn off the 'assume unchanged' bit by running git update-index --no-assume-unchanged source.c.\nThe file has been modified, but the 'skip-worktree' bit is set in the index. If the first column of the output of git ls-files -v source.c is s or S then the 'skip-worktree' bit is set. You can turn off the 'skip-worktree' bit by running git update-index --no-skip-worktree source.c.\nYour index is corrupt. Try deleting .git/index (Git will recreate it as necessary).\nFilesystem issues are preventing stat() from working properly. Try running git update-index --really-refresh. If your working directory is on a network drive (NFS, sshfs, etc.) try moving your repository to a local drive."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to link files directly from Github (raw.github.com)\n\nAre we allowed to link files directly from Github ?\n<link rel=\"stylesheet\" href=\"https://raw.github.com/username/project/master/style.css\"/>\n<script src=\"https://raw.github.com/username/project/master/script.js\"></script>\n\nI know this is allowed on Google Code. This way I don't have to worry about updating a local file."
},
{
"role": "assistant",
"content": "The great service RawGit was already mentioned, but I'll throw another into the ring: GitCDN.link\nBenefits:\n\nLets you link to specific commits, as well as auto-get the latest (aka master)\nIncurs no damage from high traffic volumes; RawGit asks that it's dev.rawgit.com links be only used during development, where as GitCDN give you access to the latest version, without the danger of the servers exploding\nGive you the option of auto minifying your HTML, CSS and JavaScript, or serving it as written (https://min.gitcdn.link).\nAdds compression (GZip)\nAdds all the correct headers (Content-Type, cache-control, e-tag, etc)\n\nFull disclosure, I'm a project maintainer at GitCDN.link\nThis service has been shuttered due to Heroku's policy change to remove all free tiers."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git - the stupid content tracker git-fetch"
},
{
"role": "assistant",
"content": "Download objects and refs from another repository"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-log - Show commit logs --color[=<when>]"
},
{
"role": "assistant",
"content": "Show colored diff. --color (i.e. without =<when> ) is the same as --color=always . <when> can be one of always , never , or auto ."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-rev-parse - Pick out and massage parameters --show-cdup"
},
{
"role": "assistant",
"content": "When the command is invoked from a subdirectory, show the\npath of the top-level directory relative to the current\ndirectory (typically a sequence of \"../\", or an empty string)."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-diff-index - Compare a tree to the working tree or index git-diff-index --cached <tree-ish>"
},
{
"role": "assistant",
"content": "compares the <tree-ish> and the index."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Delete commit on gitlab\nHow can I delete a commit that I made on GitLab? This commit that I made is not the HEAD now. \nIf I can't delete it, can I edit? \nWhen it was the HEAD, I tried:\ngit reset --soft HEAD\n\ngit reset --soft HEAD^1\n\ngit revert HEAD\n\ngit rebase -i HEAD\n\ngit rebase -i HEAD~1\n\ngit reset --hard HEAD\n\ngit reset --hard Id-Code\n\nI already tried to rebase it, but it still stays on the branch. Now I just removed it from the HEAD, but it is still there.\nThere is another command?"
},
{
"role": "assistant",
"content": "git reset --hard CommitId\ngit push -f origin master\n\n1st command will rest your head to commitid and 2nd command will delete all commit after that commit id on master branch.\n\nNote: Don't forget to add -f in push otherwise it will be rejected."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-show - Show various types of objects --patience"
},
{
"role": "assistant",
"content": "Generate a diff using the \"patience diff\" algorithm."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Windows git \"warning: LF will be replaced by CRLF\", is that warning tail backward?\nenv:\n\nWindows 7 \nmsysgit \n\nWheng I git commit, it says: \nwarning: LF will be replaced by CRLF. \n\nIs this warning tail backward?\nI edit file in Windows, the end of line is CRLF, just like this pic:\n\nAnd git changes it to LF for committing to repo.\nSo I think the correct warning is: \nwarning: CRLF will be replaced by LF."
},
{
"role": "assistant",
"content": "warning: LF will be replaced by CRLF.\n\nDepending on the editor you are using, a text file with LF wouldn't necessary be saved with CRLF: recent editors can preserve eol style. But that git config setting insists on changing those...\nSimply make sure that (as I recommend here):\ngit config --global core.autocrlf false\n\nThat way, you avoid any automatic transformation, and can still specify them through a .gitattributes file and core.eol directives.\n\n\nwindows git \"LF will be replaced by CRLF\"\n\nNote: the warning message has changed with Git 2.37 (Q3 2022)\n\nIs this warning tail backward?\n\nNo: you are on Windows, and the git config help page does mention\n\nUse this setting if you want to have CRLF line endings in your working directory even though the repository does not have normalized line endings.\n\nAs described in \"git replacing LF with CRLF\", it should only occur on checkout (not commit), with core.autocrlf=true.\n repo\n / \\ \ncrlf->lf lf->crlf \n / \\ \n\nAs mentioned in XiaoPeng's answer, that warning is the same as:\n\nwarning: (If you check it out/or clone to another folder with your current core.autocrlf configuration,) LF will be replaced by CRLF\nThe file will have its original line endings in your (current) working directory.\n\nAs mentioned in git-for-windows/git issue 1242:\n\nI still feel this message is confusing, the message could be extended to include a better explanation of the issue, for example: \"LF will be replaced by CRLF in file.json after removing the file and checking it out again\".\n\nNote: Git 2.19 (Sept 2018), when using core.autocrlf, the bogus \"LF\nwill be replaced by CRLF\" warning is now suppressed.\n\nAs quaylar rightly comments, if there is a conversion on commit, it is to LF only.\nThat specific warning \"LF will be replaced by CRLF\" comes from convert.c#check_safe_crlf():\nif (checksafe == SAFE_CRLF_WARN)\n warning(\"LF will be replaced by CRLF in %s.\n The file will have its original line endings \n in your working directory.\", path);\nelse /* i.e. SAFE_CRLF_FAIL */\n die(\"LF would be replaced by CRLF in %s\", path);\n\nIt is called by convert.c#crlf_to_git(), itself called by convert.c#convert_to_git(), itself called by convert.c#renormalize_buffer().\nAnd that last renormalize_buffer() is only called by merge-recursive.c#blob_unchanged().\nSo I suspect this conversion happens on a git commit only if said commit is part of a merge process.\n\nNote: with Git 2.17 (Q2 2018), a code cleanup adds some explanation.\nSee commit 8462ff4 (13 Jan 2018) by Torsten Bögershausen (tboegi).\n(Merged by Junio C Hamano -- gitster -- in commit 9bc89b1, 13 Feb 2018)\n\nconvert_to_git(): safe_crlf/checksafe becomes int conv_flags\n\n\nWhen calling convert_to_git(), the checksafe parameter defined what\nshould happen if the EOL conversion (CRLF --> LF --> CRLF) does not\nroundtrip cleanly.\nIn addition, it also defined if line endings should be renormalized (CRLF --> LF) or kept as they are.\n\n\nchecksafe was an safe_crlf enum with these values:\n\nSAFE_CRLF_FALSE: do nothing in case of EOL roundtrip errors\nSAFE_CRLF_FAIL: die in case of EOL roundtrip errors\nSAFE_CRLF_WARN: print a warning in case of EOL roundtrip errors\nSAFE_CRLF_RENORMALIZE: change CRLF to LF\nSAFE_CRLF_KEEP_CRLF: keep all line endings as they are\n\n\nNote that a regression introduced in 8462ff4 (\"convert_to_git():\nsafe_crlf/checksafe becomes int conv_flags\", 2018-01-13, Git 2.17.0) back in Git 2.17 cycle caused autocrlf rewrites to produce a warning message\ndespite setting safecrlf=false.\nSee commit 6cb0912 (04 Jun 2018) by Anthony Sottile (asottile).\n(Merged by Junio C Hamano -- gitster -- in commit 8063ff9, 28 Jun 2018)"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Git pull command from different user\n\nI am working with my friend on a project the code of which is on Git. If I need to pull the changes from my friend's machine, can I pull it from my username/password using the following command without any issue?\ngit pull https://[email protected]/abc/theproject.git"
},
{
"role": "assistant",
"content": "This command will help to pull from the repository as the different user:\ngit pull https://[email protected]/projectfolder/projectname.git master\n\nIt is a workaround, when you are using same machine that someone else used before you, and had saved credentials"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How can I completely delete a file that was uploaded to Gitlab in an issue comment?\n\nSomeone uploaded (attached) a file in a Gitlab issue comment. They did not mean to share that file publicly. I can delete the comment, but the file is still available via the original direct url. The file is at:\nhttps://gitlab.com/<username>/<repo>/uploads/<hash>/<filename>\n\nIs there any way to completely remove files from this uploads directory?"
},
{
"role": "assistant",
"content": "I raised a case with GitLab support and they were able to provide a solution for this. Using GraphQL, you can delete any uploaded files you have access to.\nNavigate to GitLab's GraphQL explorer: https://gitlab.com/-/graphql-explorer\nUse this query to delete your file:\nmutation{\n uploadDelete(input: { projectPath: \"YOUR_PROJECT_PATH\", secret: \"YOUR_SECRET_HASH_KEY\" , filename: \"FILE_NAME\" }) { \n upload {\n id\n size\n path \n }\n errors\n }\n}\n\nExample:\nIf your uploaded file path is https://gitlab.com/s_shaik/ci256986/uploads/abefe4f256e91ffc212c40605ae91ab3/ci.yml\nThen\nprojectPath: \"s_shaik/ci256986\"\nsecret: \"abefe4f256e91ffc212c40605ae91ab3\"\nfilename: \"ci.yml\"\nOn success you will receive a response like this:\n{\n \"data\": {\n \"uploadDelete\": {\n \"upload\": {\n \"id\": \"gid://gitlab/Upload/<id>\",\n \"size\": <file_size>,\n \"path\": \"@hashed/some/path/to/file\"\n },\n \"errors\": []\n }\n }\n}"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-show - Show various types of objects git show master:Makefile master:t/Makefile"
},
{
"role": "assistant",
"content": "Concatenates the contents of said Makefiles in the head\nof the branch master ."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "GitHub API V3 : what is the difference between pushed_at and updated_at?\n\nLooking to V3 API Repos (GET /repos/:owner/:repo) we have 3 datetime :\n \"pushed_at\": \"2011-01-26T19:06:43Z\",\n \"created_at\": \"2011-01-26T19:01:12Z\",\n \"updated_at\": \"2011-01-26T19:14:43Z\",\n\nto have a fast example just link this https://api.github.com/repos/twitter/bootstrap \nWhat is the difference between pushed_at and updated_at ?"
},
{
"role": "assistant",
"content": "UPDATE: the behavior described below wasn't intended. pushed_at will be updated any time a commit is pushed to any of the repository's branches. updated_at will be updated any time the repository object is updated, e.g. when the description or the primary language of the repository is updated. It's not necessary that a push will update the updated_at attribute -- that will only happen if a push triggers an update to the repository object. For example, if the primary language of the repository was Python, and then you pushed lots of JavaScript code -- that might change the primary language to JavaScript, which updates the repository object's language attribute and in turn updates the updated_at attribute. Previously, the primary language was getting updated after every push, even if it didn't change (which wasn't intended), so it triggered an update to updated_at.\n\nThe difference is that pushed_at represents the date and time of the last commit, whereas the updated_at represents the date and time of the last change the the repository. A change to the repository might be a commit, but it may also be other things, such as changing the description of the repo, creating wiki pages, etc. In other words, commits are a subset of updates, and the pushed_at timestamp will therefore either be the same as the updated_at timestamp, or it will be an earlier timestamp."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "GitKraken won't let me open my Private Repository on GitLab\n\nSo, in addition to GitKraken won't let me clone from a private repo on GitHub\nI get this screen when opening my GitLab Repo:\n\nAnyone got a solution of how to make my Repo 'non-private' or how to make GitKraken let me open this without the Pro Plan?\nAlready tried:\n\nGenerating new SSH Key in GitKraken\nRemoving Repo, Generate new GitLab connection, Clone Repo\nChecked GitLab: GitKraken is an Authorized applications\nGit Pull via command line gives no trouble, so no permission issue\n..."
},
{
"role": "assistant",
"content": "6.5.1 is the last version to support private repo. You can see the release details at this link https://blog.axosoft.com/gitkraken-v6-0/#pricing-changes OR https://support.gitkraken.com/release-notes/6x/\nAnd you can also download it (Mac version) from Axosoft https://release.axocdn.com/darwin/GitKraken-v6.5.1.zip OR https://release.gitkraken.com/darwin/GitKraken-v6.5.1.zip\nI not sure how to turn off the automatic update function, so if you turn off GitKraken completely and reopen it, it will update to the latest version.\n=======\nUpdated\nBlock IP Address for updating\nFor MacOS\necho \"127.0.0.1 release.gitkraken.com\" >> /private/etc/hosts\n\n\nWindows 10 – “C:\\Windows\\System32\\drivers\\etc\\hosts”\nLinux – “/etc/hosts”\nMac OS X – “/private/etc/hosts”"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-config - Get and set repository or global options rebase.missingCommitsCheck"
},
{
"role": "assistant",
"content": "If set to \"warn\", git rebase -i will print a warning if some\ncommits are removed (e.g. a line was deleted), however the\nrebase will still proceed. If set to \"error\", it will print\nthe previous warning and stop the rebase, git rebase\n--edit-todo can then be used to correct the error. If set to\n\"ignore\", no checking is done.\nTo drop a commit without warning or error, use the drop command in the todo list.\nDefaults to \"ignore\"."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Untracked files between branches in Git\nI've been searching around here for to look for an answer and it seems I may just be making incorrect assumptions on how git branches are supposed to work.\nI have my master branch and I've created a feature branch called profiles where I'm doing some specific work to profiles. While working on profiles I've changed 5 or 6 files and added another 5 or 6 new files. I needed to switch back to the master branch to fix a quick bug and noticed all the new files and modified files where in there as well. I guess this makes sense since git isnt going to remove untracked files from the master branch and bring them back for my profiles branch since they are, in fact, untracked. But what about the changes to existing files. Why are they showing up in the master branch.\nWhats the best practice here. I'm not ready to commit the changes locally yet. Should I just be stashing all these changes, switch to master, make the small fix, switch back to profiles then reapply the stash?\nAny help is appreciated. Thanks"
},
{
"role": "assistant",
"content": "\"I'm not ready to commit the changes locally yet.\"\n\nCommits in git are local things that can be undone, redone and re-re-done at will. It's only when you push the commit somewhere that you need to pay attention.\nPlus, commits are visible to local tools like gitk, and can have diffs taken of them and can be rebased onto other commits, etc. It's a very powerful tool. Learn to use it.\nI frequently do:\ngit add .; git commit -a -m 'WIP'\n\njust to stash away everything in the current work tree if I think I might be interrupted. If I make a few more changes, I use:\ngit add .; git commit --amend\n\nto update my \"WIP\" commit in-place. When I'm finally ready for the real commit, I just:\ngit reset --soft HEAD~; git reset\n\nand now I can carefully control what the final commit will be."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Gitlab and HTML documentation\n\nMy development environment consists of Git repository, GitLab repository manager and Jenkins. During build process a documentation is generated with Doxygen in HTML format.\nIs it possible to store that documentation on GitLab project's wiki? I know that HTML is not supported in Gollum, which is the Gitlab's wiki engine. Converting HTML to Markdown is not satisfactory because of internal links in HTML files that point to other HTML files.\nShould I store documentation in a separate wiki instead and only commit a link to GitLab project wiki?"
},
{
"role": "assistant",
"content": "I guess the answer depends on what you use your HTML documentation for and how much you distribute it.\nFirst of all, which version of Gitlab are you using ?\n\nIf it is only for your developers to get access to (aka these are private documents), then on Gitlab >= 8.1.2 there is a service called External Wiki that allows you to substitute the Wiki link of the project by any URL of your choice. Just set up a web server serving your html documentation, have your build server upload the newest version after each build and call it a day.\nIf your documentation is a code that you want to version control and distribute, then do so.\n\nWhether you go for 1. or 2., it is still a good idea to have a the whole documentation in a separate git repository, because you get compression for free and using git pull is much better than using any rsync to synchronise any local or remote directories. Then is just a matter of setting up shell script or git hooks to automatically do all of it for you; either at commit or build time.\nHope this helps !"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-notes - Add or inspect object notes core.notesRef"
},
{
"role": "assistant",
"content": "Notes ref to read and manipulate instead of refs/notes/commits . Must be an unabbreviated ref name.\nThis setting can be overridden through the environment and\ncommand line."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to reference a file in a GitHub issue? [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 11 years ago.\n\n\n\n\n\n\n\n Improve this question\n \n\n\n\nIn GitHub issues, can I reference a file in the repository directly in the issue and have it auto-link?"
},
{
"role": "assistant",
"content": "You cannot auto-link to a file, only commits and issues.\nSide note, it is better to use a hash when linking to make it “future proof”.\nExample:\nhttps://github.com/antirez/redis/blob/3244d8b/MANIFESTO"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "I cannot add the parent directory to *safe.directory* in Git\nAfter updating Git to v2.35.2.windows.1 I'm getting the following error:\n\nfatal: unsafe repository ('F:/GitHub/my-project' is owned by someone else) \nTo add an exception for this directory, call: \n\ngit config --global --add safe.directory F:/GitHub/my-project\n\nI've tried adding the parent directory of my projects to .gitconfig, but it doesn't work.\n[safe]\n directory = F:/GitHub/\n directory = F:/Private/\n\n\nIs there a workaround for this?\nWhat does it actually mean by \"'x' is owned by someone else\"?\n\nI don't want to add every single project I'm working on to the .gitconfig file."
},
{
"role": "assistant",
"content": "Starting in Git v2.35.3, safe directory checks can be disabled, which will end all the \"unsafe repository\" errors (this will also work in the latest patch versions of 2.30-34).\nThis can be done by running:\ngit config --global --add safe.directory '*'1\nIt will add the following setting to your global .gitconfig file:\n[safe]\n directory = *\n\nBefore disabling, make sure you understand this security measure, and why it exists. You should not do this if your repositories are stored on a shared drive.\nHowever, if you are the sole user of your machine 100% of the time, and your repositories are stored locally, then disabling this check should, theoretically, pose no increased risk.\nAlso note that you can't currently combine this with a file path, as the command doesn't interpret the wildcard * as an operator per say– it just takes the \"*\" argument to mean \"disable safe repository checks/ consider all repositories as safe\".\n\n1 - If this fails in your particular terminal program in Windows, try surrounding the wildcard with double quotes instead of single (Via this GitHub issue):\ngit config --global --add safe.directory \"*\""
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How do I clone a specific Git branch? [duplicate]\nThis question already has answers here:\n \n \n\n\n\n\nHow do I clone a single branch in Git?\n\n (27 answers)\n \n\nClosed 10 years ago.\nThe community reviewed whether to reopen this question 2 months ago and left it closed:\n\nOriginal close reason(s) were not resolved\n\n\n\n\nGit clone will clone remote branch into local.\nIs there any way to clone a specific branch by myself without switching branches on the remote repository?"
},
{
"role": "assistant",
"content": "git clone -b <branch> <remote_repo>\n\nExample:\ngit clone -b my-branch [email protected]:user/myproject.git\n\nWith Git 1.7.10 and later, add --single-branch to prevent fetching of all branches. Example, with OpenCV 2.4 branch:\ngit clone -b opencv-2.4 --single-branch https://github.com/Itseez/opencv.git"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Git completion not working in zsh on OS X Yosemite with Homebrew\nI cannot get git completion to work on my freshly installed OS X Yosemite in the zsh shell. I've installed both git and zsh using homebrew:\nbrew install zsh git\n\nWhen installing git via homebrew, it should setup tab-completion for you, but when I git <tab>, it just tries to tab-complete the directories, and not the git-commands. I.e. it's not giving any errors - it's just not working - like it's not set up.\nThis is what I know so far\nApparently zsh will look for ways to autocomplete by looking for _* files in one of the directories in $fpath. This is mine:\n% echo $fpath\n/usr/local/share/zsh/site-functions /usr/local/Cellar/zsh/5.0.6/share/zsh/functions\n\nLooking at the first path we see:\n% ls -l /usr/local/share/zsh/site-functions\nlrwxr-xr-x 1 watson admin 55 Oct 20 12:08 _git -> ../../../Cellar/git/2.1.2/share/zsh/site-functions/_git\nlrwxr-xr-x 1 watson admin 70 Oct 20 12:08 git-completion.bash -> ../../../Cellar/git/2.1.2/share/zsh/site-functions/git-completion.bash\n\nSo it seems to be setup to work out of the box - but it doesn't.\nThis is what I've also tried\ngit-completion.bash\n\nDownloading git-completion.bash\nRunning it using source git-completion.bash\n\nThis one kind of works (i.e. it enables auto-completion), but it prints a warning:\nWARNING: this script is deprecated, please see git-completion.zsh\n\ngit-completion.zsh\nSo because of the above warning, I obviously also tried to download git-completion.zsh and followed the guide in the top of the file, but it basically tells you to source the .bash file first, which is of cause still giving an error.\nSearch StackOverflow and Google\nI've tried just about everything I could find by searching here and on Google, but nothing seems to work for me."
},
{
"role": "assistant",
"content": "I just stumbled upon the answer!\nIn my case I was missing a few important pieces in my .zshrc file. But first a little background:\nWhat I'm trying to do is setup the \"zsh Completion System\". It comes with a lot of commands all named something with comp*. I tried to run these a few times but in many cases zsh would just tell me it didn't know them. So aparently you have to autoload them, among other things.\nThis is what I did:\nI added the following lines to my .zshrc file:\nautoload -U compinit && compinit\nzmodload -i zsh/complist\n\nThen I opened a new terminal and ran:\nrm -f ~/.zcompdump; compinit\n\nThen I opened a new terminal and now git <tab> worked as expected :)\nIf you are setting up a custom $fpath in your .zshrc file I would recommend adding these lines after you've modified the $fpath (though I don't know if it makes a difference)."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-rev-list - Lists commit objects in reverse chronological order %cE"
},
{
"role": "assistant",
"content": "committer email (respecting .mailmap, see git-shortlog or git-blame )"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Create Helm chart extending an existing chart\n\nI am using https://gitlab.com/charts/gitlab to deploy certain components included in the chart on an Openshift cluster. For now I just want to deploy the included Prometheus chart. I accomplished this, having an specific values.yaml configuration.\nI want to extend the Gitlab helm chart, to do so I am adding it as a requirement of my own chart. The problem comes whenever I add the previous values.yaml as subpart of my values.\nDeploying upstream Gitlab chart works with:\nglobal:\n registry:\n enabled: false\n # Disabling minio still requires to disable gitlab.minio or it will complain about \"A valid backups.objectStorage.config.secret is needed\"\n minio:\n enabled: false\n ingress:\n enabled: false\n configureCertmanager: false\n\nnginx-ingress:\n enabled: false\nregistry:\n enabled: false\ncertmanager:\n install: false\n rbac:\n create: false\n...\n\nDeploying my chart including configuration as a subchart does not work:\nglobal:\n registry:\n enabled: false\n # Disabling minio still requires to disable gitlab.minio or it will complain about \"A valid backups.objectStorage.config.secret is needed\"\n minio:\n enabled: false\n ingress:\n enabled: false\n configureCertmanager: false\n\n\ntest:\n nginx-ingress:\n enabled: false\n\n registry:\n enabled: false\n certmanager:\n install: false\n rbac:\n create: false\n ...\n\nI added the Gitlab upstream chart as a requirement:\ndependencies:\n- name: gitlab\n # Upgrade manually. Check https://gitlab.com/charts/gitlab/blob/master/requirements.yaml for the new Prometheus chart version.\n version: 1.7.1\n repository: https://charts.gitlab.io/\n alias: test\n\nIt seems that it is not fully checking my configuration, so this creates objects that the serviceAccount does not have permissions to, failing in the process. It still tries to create objects related to certmanager even if it is disabled and was correctly disabled when deploying Gitlab chart directly."
},
{
"role": "assistant",
"content": "Found it. Requirements conditions for a subchart have to be specified on the first level of values.yaml.\nIf A has B as a subchart requirement, in order to specify the B requirement conditions, you have to set them at A level:\nglobal:\n registry:\n enabled: false\n # Disabling minio still requires to disable gitlab.minio or it will complain about \"A valid backups.objectStorage.config.secret is needed\"\n minio:\n enabled: false\n ingress:\n enabled: false\n configureCertmanager: false\n\n\ntest:\n nginx-ingress:\n enabled: false\n\n registry:\n enabled: false\n ...\n\ncertmanager:\n install: false\n rbac:\n create: false\n ..."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to get GitHub Clone stats?\n\nThere used to be a \"Clones\" sub-tab in the \"Stats & Graphs\" tab of GitHub (for example https://github.com/TeamMentor/TeamMentor-Documentation/graphs/impact) but that is gone.\nIs there another way to get these stats?\nIt would be great if we could get Gauges to show up Git clone, pushes, pulls, GitHub page views, etc."
},
{
"role": "assistant",
"content": "At least regarding clone, you now (August, 12th 2014) have a dedicated graph.\n(In 2019: Insights / Traffic)\nSee \"Clone Graphs\"\n\nOur traffic graphs tab shows you a lot of information about who's visiting your repository on the web.\nWe've added a new graph to this tab, showing git clone activity.\n\nYou can use it to find out:\n\nhow many times your repository's source code is actually cloned in a given day, as well as\nhow many unique GitHub users (or anonymous IP addresses) did the cloning.\n\nFor more information on traffic graphs, check out the documentation.\n\nNote you also see the Referring sites and Unique visitors\n\nUpdate Jan. 2021: Dr. Jan-Philip Gehrcke reports in the comments:\n\nFor periodically collecting traffic/access data (such as clones, views), I've built a GitHub Action: jgehrcke/github-repo-stats:\nit automatically:\n\npersists the data snapshots in a git repository,\naggregates them, and\ngenerates a report with charts that then can span the entire data collection period!\n\nDemo report in the README."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git - the stupid content tracker git-upload-pack"
},
{
"role": "assistant",
"content": "Send objects packed back to git-fetch-pack"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-diff-index - Compare a tree to the working tree or index -s --no-patch"
},
{
"role": "assistant",
"content": "Suppress all output from the diff machinery. Useful for\ncommands like git show that show the patch by default to\nsquelch their output, or to cancel the effect of options like --patch , --stat earlier on the command line in an alias."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to set a dynamic gitlab job tag with a variable?\n\nI am trying to create a dynamic job that can switch between two gitlab runners depending on which tag it is given. I would like to do this with an environmental variable, but it seems this cannot be used. The following job:\nrunner_test:\n image: alpine\n tags:\n - $MY_RUNNER\n stage: deploy_main\n script:\n - echo foobar\n retry: 2\n\nResults in a paused pipeline with the error: This job is stuck because you don't have any active runners online or available with any of these tags assigned to them: $MY_RUNNER"
},
{
"role": "assistant",
"content": "Dynamic job tags is achievable now (originally tested on 14.10, updated & tested on 16.2). Variable interpolation works for job tags, however, an un-documented limitation is that variable changes within the job's YAML won't apply (even though the rules: keywords are supposed to be interpreted before anything else.) This means that we need to set dynamic runner tags at the global level with the workflow:rules:variables key.\nThe following example would result in a default job tag of \"staging\" for most branches, and an override value of \"production\" for pipelines running against the project's default branch.\n# global pipeline variable for the default value\nvariables:\n RUNNER_TAG: \"staging\" # default CI variable value\n\n# global workflow:rules:variables can change variables outside of jobs\nworkflow:\n rules:\n # if the pipeline is on the default branch, then change the RUNNER_TAG variable\n - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH\n variables:\n RUNNER_TAG: \"production\"\n # ensure pipeline still runs if above conditions are not met\n - when: always \n\n# ci job using the dynamic runner tag\njob:\n tags:\n - $RUNNER_TAG\n script:\n - hello world from runner matching $RUNNER_TAG\n\nNOTE: workflow:rules:variables was added in version 13.11 via a feature flag, and made available without a feature flag in version 14.1"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Push to origin from GitHub action\n\nI'm trying to push to origin remote from GitHub action. The logic of my action is:\n\nhandle pull_request_review events and filter by comment message\ncheckout to master, merge PR branch, run some checks and push it to origin\n\nThe script is:\nif [[ \"${GITHUB_EVENT_NAME}\" != \"pull_request_review\" ]]; then\n echo \"unsupported event: ${GITHUB_EVENT_NAME}\"\n exit 1\nfi\n\nuser=$(jq -r .review.user.login ${GITHUB_EVENT_PATH})\ncmd=$(jq -r .review.body ${GITHUB_EVENT_PATH})\necho \"reviewer is ${user}, command is ${cmd}\"\n\nif [[ \"${cmd}\" == \"merge\" ]]; then\n head=$(jq -r .pull_request.head.ref ${GITHUB_EVENT_PATH})\n git config user.email [email protected]\n git config user.name test\n git checkout -B _tmp origin/${head}\n git checkout -B master origin/master\n git merge --no-ff _tmp\n git push origin master\nfi\n\nI'm running this script from alpine:3.10 Docker container:\nFROM alpine:3.10\n\nLABEL \"com.github.actions.name\"=\"Hello world action\"\nLABEL \"com.github.actions.icon\"=\"shield\"\nLABEL \"com.github.actions.color\"=\"green\"\n\nWORKDIR /app\nCOPY action.sh action.sh\nRUN apk --update add bash git jq\nCMD [\"bash\", \"/app/action.sh\"]\n\nFirst steps are working fine (checkout and merge), but action failed to push the merge to origin because of the error:\n\n+ git push origin master\n fatal: could not read Username for 'https://github.com': No such device or address\n\nIt looks like GitHub-action Docker container is not configured to push to GitHub. How can I configure it? Is it possible to use some of the env variables provided by GitHub or maybe some mounted files (like in /github/* path)?"
},
{
"role": "assistant",
"content": "actions/checkout@v2 onwards\nFrom version 2 of checkout, the detached HEAD state issue is resolved and simplifies pushing to origin.\nname: Push commit\non: push\npermissions:\n contents: write\njobs:\n report:\n runs-on: ubuntu-latest\n steps:\n - uses: actions/checkout@v3\n - name: Create report file\n run: date +%s > report.txt\n - name: Commit report\n run: |\n git config --global user.name 'Your Name'\n git config --global user.email '[email protected]'\n git commit -am \"Automated report\"\n git push\n\nIf you need the push event to trigger other workflows, use a repo scoped Personal Access Token.\n - uses: actions/checkout@v3\n with:\n token: ${{ secrets.PAT }}\n\nactions/checkout@v1 (original answer)\nTo add some further detail to the excellent answer by @rmunn. The problem is that the actions/checkout@v1 action leaves the git repository in a detached HEAD state. See this issue about it for more detailed information: https://github.com/actions/checkout/issues/6\nHere is a complete example to demonstrate how to get the checked out repository to a usable state and push to the remote.\nname: Push commit\non: push\njobs:\n report:\n runs-on: ubuntu-latest\n steps:\n - uses: actions/checkout@v1\n - name: Create report file\n run: date +%s > report.txt\n - name: Commit report\n run: |\n git config --global user.name 'Your Name'\n git config --global user.email '[email protected]'\n git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY\n git checkout \"${GITHUB_REF:11}\"\n git commit -am \"Automated report\"\n git push\n\nTo include untracked (new) files change the workflow to use the following.\n git add -A\n git commit -m \"Automated report\"\n\nThe above workflow should work for the majority of events. For on: pull_request workflows the merging branch (GITHUB_HEAD_REF) should be checked out to replace the default merge commit.\nImportant: If you have other pull request checks besides the following workflow then you must use a Personal Access Token instead of the default GITHUB_TOKEN.\nThis is due to a deliberate limitation imposed by GitHub Actions that events raised by a workflow (such as push) cannot trigger further workflow runs.\nThis is to prevent accidental \"infinite loop\" situations, and as an anti-abuse measure.\nUsing a repo scoped Personal Access Token is an approved workaround. See this GitHub issue for further detail on the workaround.\nname: Push commit on pull request\non: pull_request\njobs:\n report:\n runs-on: ubuntu-latest\n steps:\n - uses: actions/checkout@v1\n with:\n ref: ${{ github.head_ref }}\n - name: Create report file\n run: date +%s > report.txt\n - name: Commit report\n run: |\n git config --global user.name 'Your Name'\n git config --global user.email '[email protected]'\n git remote set-url origin https://x-access-token:${{ secrets.PAT }}@github.com/${{ github.repository }}\n git commit -am \"Automated report\"\n git push\n\nFor further examples of push to origin during an on: pull_request workflow see this blog post, GitHub Actions: How to Automate Code Formatting in Pull Requests."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git - the stupid content tracker GIT_REDIRECT_STDIN GIT_REDIRECT_STDOUT GIT_REDIRECT_STDERR"
},
{
"role": "assistant",
"content": "Windows-only: allow redirecting the standard input/output/error\nhandles to paths specified by the environment variables. This is\nparticularly useful in multi-threaded applications where the\ncanonical way to pass standard handles via CreateProcess() is\nnot an option because it would require the handles to be marked\ninheritable (and consequently every spawned process would\ninherit them, possibly blocking regular Git operations). The\nprimary intended use case is to use named pipes for communication\n(e.g. \\\\.\\pipe\\my-git-stdin-123 ). Two special values are supported: off will simply close the\ncorresponding standard handle, and if GIT_REDIRECT_STDERR is 2>&1 , standard error will be redirected to the same handle as\nstandard output."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to remove commits from a pull request\nI did a pull request but after that I made some commits to the project locally which ended polluting my pull request, I tried to remove it but without any luck.\nI found some similar questions on StackOverflow but I can't apply what's in there.\nIt's my first pull request on GitHub so it's kinda strange to me how all of this works.\nThe highlighted commit is the one I need to keep and remove all the other stuff.\nIt becomes the fourth commit in the history because I make some merge stuff.\n\nmy git log\n\nCan someone please explain what's going on and how to fix this problem?"
},
{
"role": "assistant",
"content": "People wouldn't like to see a wrong commit and a revert commit to undo changes of the wrong commit. This pollutes commit history.\nHere is a simple way for removing the wrong commit instead of undoing changes with a revert commit.\n\ngit checkout my-pull-request-branch\n\ngit rebase -i HEAD~n // where n is the number of last commits you want to include in interactive\nrebase.\n\nReplace pick with drop for commits you want to discard.\n\nSave and exit.\n\ngit push --force-with-lease (safer force push, pointed out by @George)"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-show - Show various types of objects --color-moved-ws=<modes>"
},
{
"role": "assistant",
"content": "This configures how whitespace is ignored when performing the\nmove detection for --color-moved .\nThese modes can be given as a comma separated list: no Do not ignore whitespace when performing move detection. ignore-space-at-eol Ignore changes in whitespace at EOL. ignore-space-change Ignore changes in amount of whitespace. This ignores whitespace\nat line end, and considers all other sequences of one or\nmore whitespace characters to be equivalent. ignore-all-space Ignore whitespace when comparing lines. This ignores differences\neven if one line has whitespace where the other line has none. allow-indentation-change Initially ignore any whitespace in the move detection, then\ngroup the moved code blocks only into a block if the change in\nwhitespace is the same per line. This is incompatible with the\nother modes."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-format-patch - Prepare patches for e-mail submission --creation-factor=<percent>"
},
{
"role": "assistant",
"content": "Used with --range-diff , tweak the heuristic which matches up commits\nbetween the previous and current series of patches by adjusting the\ncreation/deletion cost fudge factor. See git-range-diff )\nfor details."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to check if the commit exists in a Git repository by its SHA-1\nIn a similar topic Validate if commit exists they recommend:\ngit rev-list HEAD..$sha\n\nIf it exits without error code than the commit exists.\nBut is it efficient enough just for validation?\nI was thinking about this option:\ngit cat-file commit $sha\n\nIs it correct for my task and are there any other ideas?"
},
{
"role": "assistant",
"content": "You can just run git cat-file -t $sha and check it returns \"commit\". You are right, you don't need to actually print the actual object for that...\nI'm not 100% sure that what goes on behind the scene is more efficient, though.\ntest $(git cat-file -t $sha) == commit"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Cannot push on Github suddenly\n\nWell, it is very weird. I'm using Github protection rules to enforce to make pull requests and to trigger TravisCI for every push. However, because of continuous translation, I need a user who should be able to push without making a pull request and avoiding TravisCI status check (for that I use [ci skip]). This user is included in the white list that Github provides in branch protection rules. It worked perfect since last week, suddenly when I try to push with this user I receive this:\nremote: Resolving deltas: 100% (5/5), completed with 5 local objects.\nremote: error: GH006: Protected branch update failed for refs/heads/master.\nremote: error: Required status check \"Travis CI - Pull Request\" is expected. At least 1 approving review is required by reviewers with write access.\nTo https://github.com/*****\n ! [remote rejected] master -> master (protected branch hook declined)\nerror: failed to push some refs to 'https://*****'\n\nIt is very weird since it always worked till now. And, the user has permissions to push without making a pull request and it is skipping Travis with through the commit message so I do not understand why Github is asking me about status check and approvals."
},
{
"role": "assistant",
"content": "The latest issue I had :\nremote: error: GH006: Protected branch update failed for refs/heads/master.\nremote: error: Cannot force-push to this protected branch\nTo https://github.com/org/project.git\n ! [remote rejected] master -> master (protected branch hook declined)\nerror: failed to push some refs to 'https://github.com/org/project.git \n\nBecause I'm admin/owner I was able to go and do the following and that helped me to resolve the push problem.\nSteps :\n--> Settings \n -->Branches\n --> Tick Allow force pushes\n Permit force pushes for all users with push access.\nThat will do the work."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-tag - Create, list, delete or verify a tag object signed with GPG $GIT_DIR/TAG_EDITMSG"
},
{
"role": "assistant",
"content": "This file contains the message of an in-progress annotated\ntag. If git tag exits due to an error before creating an\nannotated tag then the tag message that has been provided by the\nuser in an editor session will be available in this file, but\nmay be overwritten by the next invocation of git tag ."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-daemon - A really simple server for Git repositories --verbose"
},
{
"role": "assistant",
"content": "Log details about the incoming connections and requested files."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git rebase --editor=/something/other/than/vim? (for easier squashing)\nI happily use vim as my default editor for commits, and do not wish to change it. However, when it comes to rebasing, I find myself squashing dozens and dozens of commits which I find much easier with an interactive editor like Textwrangler (substituting \"pick\" with \"squash\" in all but the top commit).\nIs there any way to specify an alternate editor for a one-off rebase command? \nI know in vim I can do:\n:%s/pick/squash/\n\nbut that has its own minor annoyances.\nEDIT - as stated in the comments, you can squash all but the top commit very efficiently by going to the 2nd line and executing\n:,$s/pick/squash/\n\n(note the comma and dollar are different to the original)"
},
{
"role": "assistant",
"content": "Try adding the GIT_EDITOR environment variable before your command, like so:\nGIT_EDITOR=<editor of choice> git rebase <...>\n\nFor example, to use nano I would type:\nGIT_EDITOR=nano git rebase -i abcdef1234"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-diff - Show changes between commits, commit and working tree, etc diff.interHunkContext"
},
{
"role": "assistant",
"content": "Show the context between diff hunks, up to the specified number\nof lines, thereby fusing the hunks that are close to each other.\nThis value serves as the default for the --inter-hunk-context command line option."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "\"GitLab is not responding.\" 502 on Ubuntu 14.04 after starting server\n\nI have just installed GitLab on a fresh Ubuntu 14.04 64 bit server. I did so using the Omnibus package as indicated in the download page. There were no error messages during the install and all the remarks from the script were displayed in green.\nWhen I access the server through port 80 I get the following:\n\nFollowing the Trouble Shooting Guide I tried to query the status, but the result is also an error:\nsudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production\nsudo: bundle: command not found\n\nI tried to access the logs but the unicorn.stderr.log file is nowhere to be found in the system.\nThere is a similar question with the same error on Ubuntu 12.04, to which the solution is to increase the unicorn timeout. I have tried to do so but the error message remains."
},
{
"role": "assistant",
"content": "There is a lag of some 5 minutes from the moment gitlab is started/restarted to the point when it is actually able to process requests. Here is an example from the log:\n2015-01-08_09:00:57.37719 [13326] 08 Jan 10:00:57.377 * The server is now ready to accept connections on port 0\n2015-01-08_09:00:57.37722 [13326] 08 Jan 10:00:57.377 * The server is now ready to accept connections at /var/opt/gitlab/redis/redis.socket\n\n[...]\n\n==> /var/log/gitlab/unicorn/unicorn_stderr.log <==\nI, [2015-01-08T10:04:48.676879 #13351] INFO -- : listening on addr=127.0.0.1:8080 fd=11\nI, [2015-01-08T10:04:48.677663 #13351] INFO -- : unlinking existing socket=/var/opt/gitlab/gitlab-rails/sockets/gitlab.socket\nI, [2015-01-08T10:04:48.690283 #13351] INFO -- : listening on addr=/var/opt/gitlab/gitlab-rails/sockets/gitlab.socket fd=12\nI, [2015-01-08T10:04:48.716769 #13413] INFO -- : worker=0 spawned pid=13413\nI, [2015-01-08T10:04:48.735878 #13351] INFO -- : master process ready\nI, [2015-01-08T10:04:48.846635 #13416] INFO -- : worker=1 spawned pid=13416\nI, [2015-01-08T10:04:48.837438 #13413] INFO -- : worker=0 ready\nI, [2015-01-08T10:04:48.863110 #13416] INFO -- : worker=1 ready\n\nBefore Unicorn reports that it is up and running on port 8080, the \"GitLab is not responding\" message will be displayed. So all one has to do is wait."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-config - Get and set repository or global options gc.pruneExpire"
},
{
"role": "assistant",
"content": "When git gc is run, it will call prune --expire 2.weeks.ago (and repack --cruft --cruft-expiration 2.weeks.ago if using\ncruft packs via gc.cruftPacks or --cruft ). Override the\ngrace period with this config variable. The value \"now\" may be\nused to disable this grace period and always prune unreachable\nobjects immediately, or \"never\" may be used to suppress pruning.\nThis feature helps prevent corruption when git gc runs\nconcurrently with another process writing to the repository; see\nthe \"NOTES\" section of git-gc ."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "GIT: How to protect the branch from being removed by other developers?\n\nAfter the first release of our product, we will be switching to a different branches for the main development and feature development. Is there a way to create a branch in such a way, so that we can protect it from being removed (accidentally or on purpose) unless you're a specific user (based on role or username)? \nI tried to create a sample git repository in our local gitlab machine, then protected one of the branches from the option on the website, but then I was able to remove it with git push origin :branch_name. Thanks in advance!\nWill the solution work on github.com?"
},
{
"role": "assistant",
"content": "There are many ways to tackle this: \n\nMake another repo that's a sand box, and give readonly access to the master one. If they delete by accident they can get the branch from the master repo. This assumes you are only using github for your repos aside the local dev repos.\nSetup hooks in the repository that don't allow branches to be deleted unless you are a specific user. You can't do that on github as they won't allow arbitrary code to be executed on their servers. If you get a local repo instead, you can do this.\nSetup a local gitolite install to manage branches with permissions."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "gittutorial - A tutorial introduction to Git"
},
{
"role": "assistant",
"content": "Viewing project history At any point you can view the history of your changes using $ git log If you also want to see complete diffs at each step, use $ git log -p Often the overview of the change is useful to get a feel of\neach step $ git log --stat --summary"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git command for making one branch like another\nI'm trying to take a branch with changes and bring it back to be identical to the upstream it diverged from. The changes are both local and have been pushed to github, so neither git reset or git rebase are really viable, since they change history, which is a bad thing with a branch that's already been pushed.\nI've also tried git merge with various strategies but none of them undo the local changes, i.e. if I'd added a file, a merge might bring other files back in line, but I'll still have that file that the upstream doesn't have.\nI could just create a new branch off the upstream, but i'd really like a merge that in terms of revision history applies all the changes to take my branch and make it identical to the upstream again, so that I can safely push that change without clobbering history. Is there such a command or series of commands?"
},
{
"role": "assistant",
"content": "You could merge your upstream branch to your dev branch, with a custom merge driver, \"keepTheirs\":\nSee \"“git merge -s theirs” needed — but I know it doesn't exist\".\nIn your case, only one .gitattributes would be required, and a keepTheirs script like:\nmv -f $3 $2\nexit 0\n\n\ngit merge --strategy=theirs Simulation #1\nShows as a merge, with upstream as the first parent.\nJefromi mentions (in the comments) the merge -s ours, by merging your work on the upstream (or on a temp branch starting from upstream), and then fast-forwarding your branch to the result of that merge:\ngit checkout -b tmp origin/upstream\ngit merge -s ours downstream # ignoring all changes from downstream\ngit checkout downstream\ngit merge tmp # fast-forward to tmp HEAD\ngit branch -D tmp # deleting tmp\n\n\nThis has the benefit of recording the upstream ancestor as the first parent, so that the merge means \"absorb this out-of-date topic branch\" rather than \"destroy this topic branch and replace it with upstream\".\n\nUpdate 2023: for instance, if you want main to reflect exactly what dev is:\ngit switch -c tmp dev\ngit merge -s ours main # ignoring all changes from main\ngit switch main\ngit merge tmp # fast-forward to tmp HEAD, which is dev\ngit branch -D tmp # deleting tmp\n\n\n(Edit 2011):\nThis workflow has been reported in this blog post by the OP:\n\nWhy do I want this again?\nAs long as my repo had nothing to do with the public version, this was all fine, but since now I'd want the ability to collorate on WIP with other team members and outside contributors, I want to make sure that my public branches are reliable for others to branch off and pull from, i.e. no more rebase and reset on things I've pushed to the remote backup, since it's now on GitHub and public.\nSo that leaves me with how I should proceed.\n99% of the time, my copy will go into the upstream master, so I want to work my master and push into upstream most of the time.\nBut every once in a while, what I have in wip will get invalidated by what goes into upstream, and I will abandon some part of my wip.\nAt that point, I want to bring my master back in sync with upstream, but not destroy any commit points on my publicly pushed master. I.e. I want a merge with upstream that ends up with the changeset that make my copy identical to upstream.\nAnd that's what git merge --strategy=theirs should do.\n\n\ngit merge --strategy=theirs Simulation #2\nShows as a merge, with ours as the first parent.\n(proposed by jcwenger)\ngit checkout -b tmp upstream\ngit merge -s ours thebranch # ignoring all changes from downstream\ngit checkout downstream\ngit merge --squash tmp # apply changes from tmp, but not as merge.\ngit rev-parse upstream > .git/MERGE_HEAD #record upstream 2nd merge head\ngit commit -m \"rebaselined thebranch from upstream\" # make the commit.\ngit branch -D tmp # deleting tmp\n\n\ngit merge --strategy=theirs Simulation #3\nThis blog post mentions:\ngit merge -s ours ref-to-be-merged\ngit diff --binary ref-to-be-merged | git apply -R --index\ngit commit -F .git/COMMIT_EDITMSG --amend\n\n\nsometimes you do want to do this, and not because you have \"crap\" in your history, but perhaps because you want to change the baseline for development in a public repository where rebasing should be avoided.\n\n\ngit merge --strategy=theirs Simulation #4\n(same blog post)\n\nAlternatively, if you want to keep the local upstream branches fast-forwardable, a potential compromise is to work with the understanding that for sid/unstable, the upstream branch can from time to time be reset/rebased (based on events that are ultimately out of your control on the upstream project's side).\nThis isn't a big deal, and working with that assumption means that it's easy to keep the local upstream branch in a state where it only takes fast-forward updates.\n\ngit branch -m upstream-unstable upstream-unstable-save\ngit branch upstream-unstable upstream-remote/master\ngit merge -s ours upstream-unstable\ngit diff --binary ref-to-be-merged | git apply -R --index --exclude=\"debian/*\"\ngit commit -F .git/COMMIT_EDITMSG --amend\n\n\ngit merge --strategy=theirs Simulation #5\n(proposed by Barak A. Pearlmutter):\ngit checkout MINE\ngit merge --no-commit -s ours HERS\ngit rm -rf .\ngit checkout HERS -- .\ngit checkout MINE -- debian # or whatever, as appropriate\ngit gui # edit commit message & click commit button\n\n\ngit merge --strategy=theirs Simulation #6\n(proposed by the same Michael Gebetsroither):\n\nMichael Gebetsroither chimed in, claiming I was \"cheating\" ;) and gave another solution with lower-level plumbing commands:\n(it wouldn't be git if it wouldn't be possible with git only commands, everything in git with diff/patch/apply isn't a real solution ;).\n\n# get the contents of another branch\ngit read-tree -u --reset <ID>\n# selectivly merge subdirectories\n# e.g. superseed upstream source with that from another branch\ngit merge -s ours --no-commit other_upstream\ngit read-tree --reset -u other_upstream # or use --prefix=foo/\ngit checkout HEAD -- debian/\ngit checkout HEAD -- .gitignore\ngit commit -m 'superseed upstream source' -a\n\n\ngit merge --strategy=theirs Simulation #7\n\nThe necessary steps can be described as:\n\nReplace your worktree with upstream\nApply the changes to the index\nAdd upstream as the second parent\nCommit\n\nThe command git read-tree overwrites the index with a different tree, accomplishing the second step, and has flags to update the work tree, accomplishing the first step. When committing, git uses the SHA1 in .git/MERGE_HEAD as the second parent, so we can populate this to create a merge commit. Therefore, this can be accomplished with:\n\ngit read-tree -u --reset upstream # update files and stage changes\ngit rev-parse upstream > .git/MERGE_HEAD # setup merge commit\ngit commit -m \"Merge branch 'upstream' into mine\" # commit\n\n\nGit 2.44 (Q1 2024) also proposes a custom merge driver approach (that I illustrate in \"git merge -s theirs needed, but it does not exist\").\nCustom merge drivers need access to the names of the revisions they are working on, so that the merge conflict markers they introduce can refer to those revisions.\nThe conflict labels to be used for the common ancestor, local head and other head can be passed by using the placeholders '%S', '%X' and '%Y' respectively."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git - the stupid content tracker git-verify-commit"
},
{
"role": "assistant",
"content": "Check the GPG signature of commits"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Git push hangs when pushing to Github?\n\nGit push hangs everytime I try to push to github. I am using Cygwin and Windows 7. Git functions fine locally tracking branches, providing status, setting global user.name and user.email and allowing commits. \nI'm still new and learning.\nI enter git push , git push origin master or git push -u origin master and I get nothing but a blank line requiring me to ctl-c to get the prompt back. \nssh-keygen -t rsa -C \"[email protected]\" asks me for a file name and hangs\ngit push heroku master hangs\n$ git status returns On branch master nothing to commit, working directory clean\n$ git pull returns Already up to date\n$ git remote -v returns:\nheroku [email protected]:myherokusite.git (fetch)\n\nheroku [email protected]:myherokusite.git (push) origin \n\nhttps://github.com/gitusername/appname.git (fetch) origin \n\nhttps://github.com/gitusername/appname.git (push)\n\nor the correct ssh remote settings are returned when trying this with ssh\n\nUpdated: Using the SSH url [email protected]:gitusername/gitrepo.git also hangs\ngit remote set-url origin https://github.com/gitusername/appname.git is correct\nUpdated: I can see the git processes running in Windows Task Manager while it hangs.\nI've tried:\nUsing different internet connection locations\nswitching between https and ssh and it hangs\nUninstalled git. Reinstalled from: https://code.google.com/p/msysgit/downloads/list \nUninstalled git. Installed Cygwin's git\nUninstalled git. Installed Github for Windows GUI app and it I WAS able to push. But this app has limited functionality, forces me out of my Cygwin window into another app which then forces me into a Windows command prompt for complete functionality which I thought I had escaped by using Cygwin. \nSpent many, many hours trying to resolve this, it worked faultlessly before, thanks.\nUPDATE 4/2014: I rebuilt my entire machine Win 7, Cygwin etc and all is now working fine"
},
{
"role": "assistant",
"content": "Restart your ssh agent!\nkillall ssh-agent; eval `ssh-agent`"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to disable pre-commit code analysis for Git-backed projects using IntelliJ IDEA\nI have a project in IntelliJ IDEA, and I'm using Git/GitHub as source control. Each time I try to commit changes, IntelliJ IDEA runs a lengthy code analysis and searches for TODOs. When it finds \"problems,\" it prompts me whether or not I want to review or commit.\nI don't want the pre-commit code analysis to run, and I don't want IntelliJ IDEA to ask me about the results. I can't seem to find any setting in the regular IntelliJ IDEA project/IDE settings to disable this. How can I disable this?"
},
{
"role": "assistant",
"content": "As of 2022-3 there is a cog next to the 'Amend' checkbox that allows you to turn off checks."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-diff - Show changes between commits, commit and working tree, etc no"
},
{
"role": "assistant",
"content": "Moved lines are not highlighted."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-push - Update remote refs along with associated objects --[no-]verify"
},
{
"role": "assistant",
"content": "Toggle the pre-push hook (see githooks ). The\ndefault is --verify, giving the hook a chance to prevent the\npush. With --no-verify, the hook is bypassed completely."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Cross-referencing commits in github\nI'd like to reference commits in other repos (in this case submodules) in the github issues of my main repo. Is it possible to do so without typing the full hyperlink in a way similar to how github creates a shortened hyperlink from the commit number?"
},
{
"role": "assistant",
"content": "The answer, so us lazy people can find it without following the link to the Autolinked References and URLs section of the GitHub help:\nUser/Project@SHA\n\nFor example:\nmojombo/god@be6a8cc1c1ecfe9489fb51e4869af15a13fc2cd2\n\nShort SHAs work as well (as long as they are unique):\nmojombo/god@be6a8cc"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-fsck - Verifies the connectivity and validity of the objects in the database missingAuthor"
},
{
"role": "assistant",
"content": "(ERROR) Author is missing."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Gitlab CI how to ignore directory using rules syntax?\n\nI was able to ignore directory, file changes using the following syntax.\nbuild:\n script: npm run build\n except:\n changes:\n - \"*.md\"\n - \"src/**/*.ts\"\n\nWith this configuration build job is going to run except git changes include only *.md extension file or *.ts files in src directory. They're ignored.\nBut then they deprecated this only:changes, except:changes syntax and warned to use rules syntax instead. Unfortunately, I cannot seem to find how to ignore directory, file changes using this new syntax."
},
{
"role": "assistant",
"content": "Based on documents of rules: changes, it seems when: never must be used with rules: changes syntax. Like the following:\nbuild:\n script: npm run build\n rules:\n - changes:\n - \"*.md\"\n - \"src/**/*.ts\"\n when: never\n\n - when: always\n\nIf changed paths in the repository match above regular expressions then the job will not be added to any pipeline. In other cases the job always will be run by pipelines."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to resolve merge conflict in pull request in VSTS?\nI've created pull request I got into this:\n\n\"Approve\" button does nothing and complete is disabled.\nHow do I resolve this confligt in pull request?"
},
{
"role": "assistant",
"content": "Update\nMicrosoft just added browser based merges. This may get you out of a pickle for small conflicts. \nAnd offers improved visualizations of the different scenarios as of Sprint 150.\nFor more complex situations:\nYou have two options to resolve the conflict, reverse-integrate the changes from the target branch (which creates additional merge commits), or rebase on the target branch (which leaves your history nice and clean).\n\nMerge from target to current branch prior to completing the PR.\nYou need to clone the repo locally, perform a merge from the target branch to your branch and push those changes up to the repository. VSTS will detect the changes and update the pull request.\n -------o3 PR\n /\n---------o1-o2 target\n\nThus merge target (o2) to PR:\n -------o3-o4 PR\n / /\n---------o1----------o2 target\n\nThen complete the PR\n -------o3-o4 PR\n / / \\\n---------o1----------o2--o5 target\n\n\nRebase the PR branch to include the latest changes on target\nAlternatively, you can clone the repo locally, rebase the PR branch on the latest version of the target branch, solve all issues from the rebase and force-push the changes back to the PR branch. VSTS will detect the changes and update the pull request.\n -------o3 PR\n /\n---------o1-o2 target\n\nThus rebase o3 onto o2:\n -------o3 PR\n /\n---------o1-o2 target\n\nThen complete the PR (with Fast-forward merge in the case below):\n---------o1-o2-o3 target"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-log - Show commit logs %Cgreen"
},
{
"role": "assistant",
"content": "switch color to green"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-rebase - Reapply commits on top of another base tip merge backend"
},
{
"role": "assistant",
"content": "Treat lines with only whitespace changes as unchanged when merging.\nUnfortunately, this means that any patch hunks that were intended\nto modify whitespace and nothing else will be dropped, even if the\nother side had no changes that conflicted."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Does git log --branches work?\nI can't seem to get git log --branches to correctly filter its output. It seems as if Git ignores it.\nFor example, the head of git log --graph --all --decorate, prints:\n* commit 3ae0d17538f787bdde68f37f6644ffe9652d8dc1 (HEAD, feature/branch-ignore)\n| Author: Chris Lewis <[email protected]>\n| Date: Mon Mar 14 17:39:56 2011 -0700\n| \n| Ignore merge commits, as they're going to be duplicating events\n| \n* commit 770534e9d77acb03eaf842440c879aec1c5b5500\n| Author: Chris Lewis <[email protected]>\n| Date: Tue Mar 8 14:39:40 2011 -0800\n| \n| Removed another remote branch check\n| \n\nLet's say I want to filter by master, which should mean these commits are ignored. The head of git log --graph --all --decorate --branches=master, is also:\n* commit 3ae0d17538f787bdde68f37f6644ffe9652d8dc1 (HEAD, feature/branch-ignore)\n| Author: Chris Lewis <[email protected]>\n| Date: Mon Mar 14 17:39:56 2011 -0700\n| \n| Ignore merge commits, as they're going to be duplicating events\n| \n* commit 770534e9d77acb03eaf842440c879aec1c5b5500\n| Author: Chris Lewis <[email protected]>\n| Date: Tue Mar 8 14:39:40 2011 -0800\n| \n| Removed another remote branch check\n| \n\nGit doesn't seem to be filtering. It doesn't seem to make any difference whether --branches is passed with other arguments or not. My Git version is git version 1.7.4.1. Does anyone know how to use this command successfully?\nEDIT: All I want to be able to do is get the log of one branch or another, without having to do a checkout first."
},
{
"role": "assistant",
"content": "Firstly, (the other) Adam is right that it doesn't make sense to use --all for this: if you only want to see one branch like your question states, why ask for all branches?\nSecondly, as already stated in comments to other answers, you don't need --branches; just do git log mybranch.\nThirdly, I can explain why git log --branches=mybranch doesn't work. The git-log(1) man page says:\n--branches[=<pattern>]\n Pretend as if all the refs in refs/heads are listed on\n the command line as <commit>. If <pattern> is given, \n limit branches to ones matching given shell glob. If \n pattern lacks ?, *, or [, /* at the end is implied.\n\nThe last sentence is the crucial point here. If the <pattern> is just mybranch then there is no globbing character, so git-log interprets it as if you'd typed\ngit log --branches=mybranch/*\n\nwhich only matches references under $repo/.git/refs/heads/mybranch/*, i.e. branches which begin with mybranch/.\nThere is a dirty hack to prevent the /* from being assumed:\ngit log --branches=[m]ybranch\n\nbut I can't think of any good reason why you would want to do this rather than just typing\ngit log mybranch"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How do I handle images in a Git repo?\n\nI have inherited a medium sized iOS project - ~30,000 lines of code - that has an insane number of image assets. Of course we use Git/Github to scm. Currently the images are included in the directory tree and thus gets ingested into the repo, bloating the heck out of it and generally making development a big headache. \nWe have 4 devs on the project, some virtual. It occurs to me to move the images to Dropbox, refer to them from the iOS project and keep things ship shape.\nDoes anyone have a comment on this idea? What do you do do deal with image/video/audio files in a Git scm setup?"
},
{
"role": "assistant",
"content": "I'd be pretty nervous about that, actually; what if you want to update an image, then change your mind? Or what if you need to build a maintenance release with old images?\nIf this is really a problem -- and I've never seen this actually be a problem in practice, but I'll take your word for it -- why not just use one repo for the images, another for everything else? You can then just be lazy about syncing the image one."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-log - Show commit logs none"
},
{
"role": "assistant",
"content": "Disable word diff again."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-push - Update remote refs along with associated objects"
},
{
"role": "assistant",
"content": "SYNOPSIS git push [--all | --branches | --mirror | --tags] [--follow-tags] [--atomic] [-n | --dry-run] [--receive-pack=<git-receive-pack>]\n\t [--repo=<repository>] [-f | --force] [-d | --delete] [--prune] [-q | --quiet] [-v | --verbose]\n\t [-u | --set-upstream] [-o <string> | --push-option=<string>]\n\t [--[no-]signed|--signed=(true|false|if-asked)]\n\t [--force-with-lease[=<refname>[:<expect>]] [--force-if-includes]]\n\t [--no-verify] [<repository> [<refspec>…]]"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git commit best practices\nI am using git to manage a C++ project. When I am working on the projects, I find it hard to organize the changes into commits when changing things that are related to many places. \nFor example, I may change a class interface in a .h file, which will affect the corresponding .cpp file, and also other files using it. I am not sure whether it is reasonable to put all the stuff into one big commit.\nIntuitively, I think the commits should be modular, each one of them corresponds to a functional update/change, so that the collaborators could pick things accordingly. But seems that sometimes it is inevitable to include lots of files and changes to make a functional change actually work.\nSearching did not yield me any good suggestion or tips. Hence I wonder if anyone could give me some best practices when doing commits.\nPS. I've been using git for a while and I know how to interactively add/rebase/split/amend/... What I am asking is the PHILOSOPHY part.\nUpdate: Thanks for all the advices. Maybe this should be learned from practicing. I will keep the problem open for some time to see if there is more suggestions."
},
{
"role": "assistant",
"content": "I tend to commit as you propose: a commit is a logically connected change set. My commits can be anything from a one-liner to a change in all files (for example add/change a copyright notice in the source files). The reason for change need not be a full task that I am implementing, but it is usually a milestone in the task.\nIf I have modified something that is not related to my current commit, I tend to do an interactive add to separate out the unrelated changes, too - even when it is a whitespace tidy up.\nI have found that commits that simply dump the working state to repository makes them a lot less useful: I cannot backport a bugfix to an earlier version or include a utility functionality in another branch easily if the commits are all over the place.\nOne alternative to this approach is using a lot of tiny commits inside a feature branch, and once the whole feature is done, do heavy history rewriting to tidy up the commits into a logical structure. But I find this approach to be a time waster."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How do I fetch a branch on someone else's fork on GitHub? [duplicate]\n\nThis question already has answers here:\n \n \n\n\n\n\nHow to pull remote branch from somebody else's repo\n\n (8 answers)\n \n\nClosed 7 years ago.\n\n\n\nI've forked from a repo on GitHub. I want to get the code from a branch on another user's fork. \nMust I clone this user's whole repo to a separate local repo or can I do something like git checkout link_to_the_other_users_branch?"
},
{
"role": "assistant",
"content": "$ git remote add theirusername [email protected]:theirusername/reponame.git\n$ git fetch theirusername\n$ git checkout -b mynamefortheirbranch theirusername/theirbranch\n\nNote that there are multiple \"correct\" URIs you can use for the remote when you add it in the first step.\n\n[email protected]:theirusername/reponame.git is an SSH-based URI\nhttps://github.com/theirusername/reponame.git is an HTTPS URI\n\nWhich one you prefer to use will depend on your situation. GitHub has a help article explaining the difference and helping you choose: Choosing a URL for your remote repository"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-config - Get and set repository or global options -f <config-file> --file <config-file>"
},
{
"role": "assistant",
"content": "For writing options: write to the specified file rather than the\nrepository .git/config . For reading options: read only from the specified file rather than from all\navailable files. See also FILES ."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "GitLab CI Start job manually (deployment)\n\nIs it possible to mark gitlab ci jobs to start manually?\nI need it for deploying application but I want to decide if it's going to be deployed"
},
{
"role": "assistant",
"content": "This has changed since the first answer has been posted. Here's the link to the original Gitlab Issue. It is now supported to do something like\nproduction:\n stage: deploy\n script: run-deployment $OMNIBUS_GITLAB_PACKAGE\n environment: production\n when: manual\n\nNote the when: manual attribute. The UI updates itself to provide a way for users to trigger the job."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-push - Update remote refs along with associated objects git push origin :"
},
{
"role": "assistant",
"content": "Push \"matching\" branches to origin . See\n<refspec> in the OPTIONS section above for a\ndescription of \"matching\" branches."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-show - Show various types of objects %ge"
},
{
"role": "assistant",
"content": "reflog identity email"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-diff - Show changes between commits, commit and working tree, etc porcelain"
},
{
"role": "assistant",
"content": "Use a special line-based format intended for script\nconsumption. Added/removed/unchanged runs are printed in the\nusual unified diff format, starting with a + / - /` `\ncharacter at the beginning of the line and extending to the\nend of the line. Newlines in the input are represented by a\ntilde ~ on a line of its own."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "GitLab: How to disable automatic startup?\n\nI have not found a way to disable the automatic startup and it ends up using too much RAM when I'm not using.\nThe init files are not inside /etc/init or init.d.\nI try update-rc.d gitlab remove and no results.\nI am using GitLab 8.5.4 in Debian 8."
},
{
"role": "assistant",
"content": "Problem is solved!\nI contacted the GitLab by their official page on Facebook and here is the answer.\nI am using GitLab in a Desktop and it was using ~700MB.\nIf you too want turn off GitLab on startup, just execute in a terminal:\nsudo systemctl disable gitlab-runsvdir.service"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to add the Signed-off-by field in the git patch\nI'm generating a git patch. And then I want to send it to the project maintainer.\nI want to mark my Name and my email address as signed-off-by in the git patch\nHow to do it? in order that the project maintainer get the signed-off-by field with my name and email address."
},
{
"role": "assistant",
"content": "When you commit, just use:\ngit commit -s\n\nor\ngit commit --signoff\n\nOr you can just write at the end of the commit message, on a line by itself separated by a blank line from the body of the commit:\nSigned-off-by: Your Name <[email protected]>\n\nIf you already have the commit, use git commit -s --amend to add the above signoff line.\nOr, if you are going to be sending this as a patch or patch series, you can use git format-patch -s or --signoff to add the signoff to the patch itself, without modifying the commit."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "gitrevisions - Specifying revisions and ranges for Git <rev1>...<rev2>"
},
{
"role": "assistant",
"content": "Include commits that are reachable from either <rev1> or\n<rev2> but exclude those that are reachable from both. When\neither <rev1> or <rev2> is omitted, it defaults to HEAD ."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-rev-parse - Pick out and massage parameters --local-env-vars"
},
{
"role": "assistant",
"content": "List the GIT_* environment variables that are local to the\nrepository (e.g. GIT_DIR or GIT_WORK_TREE, but not GIT_EDITOR).\nOnly the names of the variables are listed, not their value,\neven if they are set."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-fast-import - Backend for fast Git data importers commit"
},
{
"role": "assistant",
"content": "Creates a new branch or updates an existing branch by\ncreating a new commit and updating the branch to point at\nthe newly created commit."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to remove unused objects from a git repository?\nI accidentally added, committed and pushed a huge binary file with my very latest commit to a Git repository.\nHow can I make Git remove the object(s) that was/were created for that commit so my .git directory shrinks to a sane size again?\nEdit: Thanks for your answers; I tried several solutions. None worked. For example the one from GitHub removed the files from the history, but the .git directory size hasn't decreased:\n$ BADFILES=$(find test_data -type f -exec echo -n \"'{}' \" \\;)\n\n$ git filter-branch --index-filter \"git rm -rf --cached --ignore-unmatch $BADFILES\" HEAD\nRewrite 14ed3f41474f0a2f624a440e5a106c2768edb67b (66/66)\nrm 'test_data/images/001.jpg'\n[...snip...]\nrm 'test_data/images/281.jpg'\nRef 'refs/heads/master' was rewritten\n\n$ git log -p # looks nice\n\n$ rm -rf .git/refs/original/\n$ git reflog expire --all\n$ git gc --aggressive --prune\nCounting objects: 625, done.\nDelta compression using up to 2 threads.\nCompressing objects: 100% (598/598), done.\nWriting objects: 100% (625/625), done.\nTotal 625 (delta 351), reused 0 (delta 0)\n\n$ du -hs .git\n174M .git\n$ # still 175 MB :-("
},
{
"role": "assistant",
"content": "I answered this elsewhere, and will copy here since I'm proud of it!\n... and without further ado, may I present to you this useful script, git-gc-all, guaranteed to remove all your git garbage until they might come up with extra config variables:\ngit -c gc.reflogExpire=0 -c gc.reflogExpireUnreachable=0 \\\n -c gc.rerereresolved=0 -c gc.rerereunresolved=0 \\\n -c gc.pruneExpire=now gc \"$@\"\n\nThe --aggressive option might be helpful.\nNOTE: this will remove ALL unreferenced thingies, so don't come crying to me if you decide later that you wanted to keep some of them!\nYou might also need to run something like these first, oh dear, git is complicated!!\ngit remote rm origin\nrm -rf .git/refs/original/ .git/refs/remotes/ .git/*_HEAD .git/logs/\ngit for-each-ref --format=\"%(refname)\" refs/original/ |\n xargs -n1 --no-run-if-empty git update-ref -d\n\nI put all this in a script, here:\nhttps://ucm.dev/t/bin.git/git-gc-all-ferocious"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git - getting ALL previous version of a specific file/folder\nI want to retrieve all previous version of a specific file in a git repository.\nI see it is possible to get one specific version with the checkout command, but I want them all. And the git clone command with the depth option doesn't seem to allow me to clone subfolder (\"not valid repository name\").\nDo you know if it is possible and how?\nThank you"
},
{
"role": "assistant",
"content": "OP wanted to retrieve all versions, but the answers would not deliver. Especially if the file has hundreds of revisions (all suggestions are too manual). The only half-working solution was proposed by @Tobias in the comments, but suggested bash loop would build files in random order as well as it generates hundreds of empty files when used against our repos. One of the reasons was that \"rev-list --all --objects\" would list different objects (trees included - but useless for our purpose).\nI started with Tobias's solution, added counters, clean up a bit and end up reinventing the wheel in form of the bash script listed below.\nThe script would:\n\nextract all file versions to /tmp/all_versions_exported\ntake 1 argument - relative path to the file inside git repo\ngive result filenames numeric prefix (sortable)\nmention inspected filename in result files (to tell apples apart from oranges:)\nmention commit date in the result filename (see output example below)\nnot create empty result files\n\ncat /usr/local/bin/git_export_all_file_versions\n#!/bin/bash\n\n# we'll write all git versions of the file to this folder:\nEXPORT_TO=/tmp/all_versions_exported\n\n# take relative path to the file to inspect\nGIT_PATH_TO_FILE=$1\n\n# ---------------- don't edit below this line --------------\n\nUSAGE=\"Please cd to the root of your git proj and specify path to file you with to inspect (example: $0 some/path/to/file)\"\n\n# check if got argument\nif [ \"${GIT_PATH_TO_FILE}\" == \"\" ]; then\n echo \"error: no arguments given. ${USAGE}\" >&2\n exit 1\nfi\n\n# check if file exist\nif [ ! -f ${GIT_PATH_TO_FILE} ]; then\n echo \"error: File '${GIT_PATH_TO_FILE}' does not exist. ${USAGE}\" >&2\n exit 1\nfi\n\n# extract just a filename from given relative path (will be used in result file names)\nGIT_SHORT_FILENAME=$(basename $GIT_PATH_TO_FILE)\n\n# create folder to store all revisions of the file\nif [ ! -d ${EXPORT_TO} ]; then\n echo \"creating folder: ${EXPORT_TO}\"\n mkdir ${EXPORT_TO}\nfi\n\n## uncomment next line to clear export folder each time you run script\n#rm ${EXPORT_TO}/*\n\n# reset coutner\nCOUNT=0\n\n# iterate all revisions\ngit rev-list --all --objects -- ${GIT_PATH_TO_FILE} | \\\n cut -d ' ' -f1 | \\\nwhile read h; do \\\n COUNT=$((COUNT + 1)); \\\n COUNT_PRETTY=$(printf \"%04d\" $COUNT); \\\n COMMIT_DATE=`git show $h | head -3 | grep 'Date:' | awk '{print $4\"-\"$3\"-\"$6}'`; \\\n if [ \"${COMMIT_DATE}\" != \"\" ]; then \\\n git cat-file -p ${h}:${GIT_PATH_TO_FILE} > ${EXPORT_TO}/${COUNT_PRETTY}.${COMMIT_DATE}.${h}.${GIT_SHORT_FILENAME};\\\n fi;\\\ndone \n\n# return success code\necho \"result stored to ${EXPORT_TO}\"\nexit 0\n\n\nUsage example:\ncd /home/myname/my-git-repo\n\ngit_export_all_file_versions docs/howto/readme.txt\n result stored to /tmp/all_versions_exported\n\nls /tmp/all_versions_exported\n 0001.17-Oct-2016.ee0a1880ab815fd8f67bc4299780fc0b34f27b30.readme.txt\n 0002.3-Oct-2016.d305158b94bedabb758ff1bb5e1ad74ed7ccd2c3.readme.txt\n 0003.29-Sep-2016.7414a3de62529bfdd3cb1dd20ebc1a977793102f.readme.txt\n 0004.28-Sep-2016.604cc0a34ec689606f7d3b2b5bbced1eece7483d.readme.txt\n 0005.28-Sep-2016.198043c219c81d776c6d8a20e4f36bd6d8a57825.readme.txt\n 0006.9-Sep-2016.5aea5191d4b86aec416b031cb84c2b78603a8b0f.readme.txt\n <and so on and on . . .>\n\nNote #1: if you see errors like this:\n\nfatal: Not a valid object name\n3e93eba38b31b8b81905ceaa95eb47bbaed46494:readme.txt\n\nit means you've started the script not from the root folder of your git project.\nNote #2: if you want to get all versions of the file that was deleted few commits ago you will have to switch to any of the old commits where that file was present (not yet deleted) by command:\ngit checkout OLD_HASH_WHERE_FILE_EXISTED\ngit_export_all_file_versions path/to/existing/file.ext\n\nOtherwise it will error out \"file does not exist\". You don't have to switch to the very last commit where the deleted file was last seen, instead it can be any old commit where the file was there and then \"git_export_all_file_versions\" will extract all versions (even from \"future\" commits relative to the old commit you switched to)."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-tag - Create, list, delete or verify a tag object signed with GPG -v --verify"
},
{
"role": "assistant",
"content": "Verify the GPG signature of the given tag names."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-config - Get and set repository or global options merge.ff"
},
{
"role": "assistant",
"content": "By default, Git does not create an extra merge commit when merging\na commit that is a descendant of the current commit. Instead, the\ntip of the current branch is fast-forwarded. When set to false ,\nthis variable tells Git to create an extra merge commit in such\na case (equivalent to giving the --no-ff option from the command\nline). When set to only , only such fast-forward merges are\nallowed (equivalent to giving the --ff-only option from the\ncommand line)."
}
] |
[
{
"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": "Jenkins returned status code 128 with github\n\nWith GitHub command I have:\nssh -T [email protected]\nHi (MyName)! You've successfully authenticated, but GitHub does not provide shell access.\n\nMy connection with GitHub is ok (no problem), but with Jenkins I have this error:\nERROR: Error cloning remote repo 'origin' : Could not clone [email protected]:Name-MysRepo/MyRepo.git\nhudson.plugins.git.GitException: Could not clone [email protected]:Name-MysRepo/MyRepo.git\n at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.clone(CliGitAPIImpl.java:219)\n at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:1001)\n at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:942)\n at hudson.FilePath.act(FilePath.java:904)\n at hudson.FilePath.act(FilePath.java:877)\n at hudson.plugins.git.GitSCM.determineRevisionToBuild(GitSCM.java:942)\n at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1101)\n at hudson.model.AbstractProject.checkout(AbstractProject.java:1369)\n at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:676)\n at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:88)\n at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:581)\n at hudson.model.Run.execute(Run.java:1575)\n at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:477)\n at hudson.model.ResourceController.execute(ResourceController.java:88)\n at hudson.model.Executor.run(Executor.java:241)\nCaused by: hudson.plugins.git.GitException: Command \"git clone --progress -o origin [email protected]:Name-MysRepo/MyRepo.git /root/.jenkins/jobs/TestKRGDAOV01/workspace\" returned status code 128:\nstdout: Cloning into '/root/.jenkins/jobs/TestKRGDAOV01/workspace'...\n\nstderr: Permission denied (publickey).\nfatal: The remote end hung up unexpectedly\n\nIs this problem with public key?\nI use Jenkins under Tomcat 7 / Ubuntu 12."
},
{
"role": "assistant",
"content": "This error:\n stderr: Permission denied (publickey). fatal: The remote end hung up unexpectedly\nindicates that Jenkins is trying to connect to github with the wrong ssh key.\nYou should:\n\nDetermine the user that jenkins runs as, eg. 'build' or 'jenkins'\nLogin on the jenkins host that is trying to do the clone - that is, do not login to the master if a node is actually doing the build.\nTry you ssh to github - if it fails, then you need to add the proper key to <jenkins user home>/.ssh"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Retaining file permissions with Git\nI want to version control my web server as described in Version control for my web server, by creating a git repo out of my /var/www directory. My hope was that I would then be able to push web content from our dev server to github, pull it to our production server, and spend the rest of the day at the pool. \nApparently a kink in my plan is that Git won't respect file permissions (I haven't tried it, only reading about it now.) I guess this makes sense in that different boxes are liable to have different user/group setups. But if I wanted to force permissions to propagate, knowing my servers are configured the same, do I have any options? Or is there an easier way to approach what I'm trying to do?"
},
{
"role": "assistant",
"content": "Git is Version Control System, created for software development, so from the whole set of modes and permissions it stores only executable bit (for ordinary files) and symlink bit. If you want to store full permissions, you need third party tool, like git-cache-meta (mentioned by VonC), or Metastore (used by etckeeper). Or you can use IsiSetup, which IIRC uses git as backend.\nSee Interfaces, frontends, and tools page on Git Wiki."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "how to change gitlab-ci runner build path\n\nHow to change the gitlab multi runner build path.\nin my server it have /home/gitlab-runner/builds.\nI want to change this path to my secondary HDD that is mounted in the same server."
},
{
"role": "assistant",
"content": "You can change your runners build path by adjusting the config.toml. In the [[runners]] section add or change the builds_dir directory.\nFor further reference on runner configuration you can check out the documentation here."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Connect to a locally built Jekyll Server using mobile devices in the LAN\n\nAfter using jekyll serve on one machine, a WEBrick server is set up and the site can be accessed from localhost:4000 on this particular PC.\nHowever, I'm wondering how to access this web server from other machines in the LAN, especially for mobile devices? I'm trying to test the jekyll site on mobile devices before pushing the code to Github."
},
{
"role": "assistant",
"content": "Try jekyll serve --host=0.0.0.0 when you invoke Jekyll on the command line.\nThat will make Jekyll's HTTP server bind to all available IPs, rather than just to localhost.\nYou can also add this to your _config.yml with host: 0.0.0.0. GitHub will simply ignore this when you push, so it's safe to use if you don't mind having your work openly accessible on your network.\n\nWithout --host=0.0.0.0 Jekyll will output something like this when you start up:\n$ jekyll serve\n[...]\nServer address: http://127.0.0.1:4000/\nServer running... press ctrl-c to stop.\n\nBut with --host=0.0.0.0 (or host: 0.0.0.0 in _config.yml) you'll notice that it's listening on all interfaces (represented by 0.0.0.0) rather than just listening on the loopback interface (represented by 127.0.0.1)\n$ jekyll serve --host=0.0.0.0\n[...]\nServer address: http://0.0.0.0:4000/\nServer running... press ctrl-c to stop. \n\nIf you still cannot access your server then there might be a firewall stopping it. Temporarily disable your firewall, or add a port forwarding rule for port 4000.\n\nOnce Jekyll is appropriately listening on all interfaces, you can access this from your mobile device using your LAN IP address (retrieved from something like ifconfig or ipconfig depending on your operating system)."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-send-email - Send a collection of patches as emails --bcc=<address>,…"
},
{
"role": "assistant",
"content": "Specify a \"Bcc:\" value for each email. Default is the value of sendemail.bcc . This option may be specified multiple times."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-config - Get and set repository or global options"
},
{
"role": "assistant",
"content": "CONFIGURATION pager.config is only respected when listing configuration, i.e., when\nusing --list or any of the --get-* which may return multiple results.\nThe default is to use a pager."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Git push error: RPC failed; result=56, HTTP code = 200 fatal: The remote end hung up unexpectedly fatal\n\nWhile doing git push, I receive this error:\nUsername for 'https://github.com': Newbie\nPassword for 'https://[email protected]':\nCounting objects: 11507, done.\nDelta compression using up to 4 threads.\nCompressing objects: 100% (8210/8210), done.\nWriting objects: 100% (11506/11506), 21.75 MiB | 0 bytes/s, done.\nTotal 11506 (delta 2213), reused 11504 (delta 2211)\nefrror: RPC failed; result=56, HTTP code = 200\natal: The remote end hung up unexpectedly\nfatal: The remote end hung up unexpectedly\nEverything up-to-date\n\nI also tried doing: git config http.postBuffer 524288000, but still error..\nAlso tried: git config --global http.postBuffer 2M by referring on git push error: RPC failed; result=56, HTTP code = 0\nPlease can anyone help me out with this?"
},
{
"role": "assistant",
"content": "Look here: https://flyingtomoon.com/2011/04/12/git-push-is-failed-due-to-rpc-failure-result56/\nThe problem is most likely because your git buffer is too low.\nYou will need to increase Git’s HTTP buffer by setting the git config var “http.postBuffer” to 524288000.\ngit config http.postBuffer 524288000"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git status not showing contents of newly added folder\nI just created a new git repo at / I created a new filetest.txt in the folder test_fold so that the path to the file is test_fold\\test.txt. I then run git status. This is the output, it finds the folder but not the file. Why is not showing me that there is a new file in test_fold?\n$ git status\nOn branch master\n\nInitial commit\n\nUntracked files:\n (use \"git add <file>...\" to include in what will be committed)\n\n .gitignore\n test_fold/\n\nnothing added to commit but untracked files present (use \"git add\" to track)\n\nThe .gitignore file is blank."
},
{
"role": "assistant",
"content": "Git will ignore the content of a folder if the folder doesn't already contain tracked paths. You know by the presence of test_fold/ that there are files in there (Git will never show you an empty directory as being untracked) and you know that those files are not tracked.\nOtherwise, unzipping a folder into your repository could potentially introduce huge amounts of output from git status. The default behavior of simply showing the top-level untracked path makes for much saner output.\nIf you want Git to show you the content of the folder, use\n$ git status -uall\n\nThis will show you test_fold/test.txt (and any other files) instead of just test_fold/."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-archive - Create an archive of files from a named tree -v --verbose"
},
{
"role": "assistant",
"content": "Report progress to stderr."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-revert - Revert some existing commits git revert HEAD~3"
},
{
"role": "assistant",
"content": "Revert the changes specified by the fourth last commit in HEAD\nand create a new commit with the reverted changes."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-config - Get and set repository or global options feature.experimental"
},
{
"role": "assistant",
"content": "Enable config options that are new to Git, and are being considered for\nfuture defaults. Config settings included here may be added or removed\nwith each release, including minor version updates. These settings may\nhave unintended interactions since they are so new. Please enable this\nsetting if you are interested in providing feedback on experimental\nfeatures. The new default values are: fetch.negotiationAlgorithm=skipping may improve fetch negotiation times by\nskipping more commits at a time, reducing the number of round trips. pack.useBitmapBoundaryTraversal=true may improve bitmap traversal times by\nwalking fewer objects. pack.allowPackReuse=multi may improve the time it takes to create a pack by\nreusing objects from multiple packs instead of just one."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Remove directory from remote repository after adding them to .gitignore\n\nI committed and pushed some directory to github. After that, I altered the .gitignore file adding a directory that should be ignored. Everything works fine, but the (now ignored) directory stays on github.\nHow do I delete that directory from github and the repository history?"
},
{
"role": "assistant",
"content": "The rules in your .gitignore file only apply to untracked files. Since the files under that directory were already committed in your repository, you have to unstage them, create a commit, and push that to GitHub:\ngit rm -r --cached some-directory\ngit commit -m 'Remove the now ignored directory \"some-directory\"'\ngit push origin master\n\nYou can't delete the file from your history without rewriting the history of your repository - you shouldn't do this if anyone else is working with your repository, or you're using it from multiple computers. If you still want to do that, you can use git filter-branch to rewrite the history - there is a helpful guide to that here.\nAdditionally, note the output from git rm -r --cached some-directory will be something like:\nrm 'some-directory/product/cache/1/small_image/130x130/small_image.jpg'\nrm 'some-directory/product/cache/1/small_image/135x/small_image.jpg'\nrm 'some-directory/.htaccess'\nrm 'some-directory/logo.jpg'\n\nThe rm is feedback from git about the repository; the files are still in the working directory."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-rm - Remove files from the working tree and from the index"
},
{
"role": "assistant",
"content": "BUGS Each time a superproject update removes a populated submodule\n(e.g. when switching between commits before and after the removal) a\nstale submodule checkout will remain in the old location. Removing the\nold directory is only safe when it uses a gitfile, as otherwise the\nhistory of the submodule will be deleted too. This step will be\nobsolete when recursive submodule update has been implemented."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-cat-file - Provide contents or details of repository objects --unordered"
},
{
"role": "assistant",
"content": "When --batch-all-objects is in use, visit objects in an\norder which may be more efficient for accessing the object\ncontents than hash order. The exact details of the order are\nunspecified, but if you do not require a specific order, this\nshould generally result in faster output, especially with --batch . Note that cat-file will still show each object\nonly once, even if it is stored multiple times in the\nrepository."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-diff - Show changes between commits, commit and working tree, etc -0"
},
{
"role": "assistant",
"content": "Omit diff output for unmerged entries and just show\n\"Unmerged\". Can be used only when comparing the working tree\nwith the index."
}
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.