messages listlengths 3 3 |
|---|
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-merge - Join two or more development histories together no-renames"
},
{
"role": "assistant",
"content": "Turn off rename detection. This overrides the merge.renames configuration variable.\nSee also git-diff --no-renames ."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How do I sign out of the desktop version of GitHub?\n\nThis seems like a very silly question but I can not find any way to log out of GitHub on the windows desktop application. Does anyone know how?"
},
{
"role": "assistant",
"content": "Press CTRL + , to get to the options menu from which you can click sign out."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to change a release on Github point to the latest commit?\nI recently released a new version of my project on Github by clicking the release button, on the right-hand side of the page. However, I found something error in my code, so, I just fixed and committed it.\nNow, I would like to change my latest release in order to include my latest commit. I tried to remove the release and recreate it once again using the same tag name, however, it still points to the previous commit. I have been googling but still no luck. Any help would be appreciated."
},
{
"role": "assistant",
"content": "You would need to update/move the tag locally first, and force push it (as in here):\n# assuming you are in the branch referencing currently the right new commit:\ngit tag -f <tagname>\n\n# push your new commit:\ngit push \n\n# force push your moved tag:\ngit push origin -f <tagname>\n\nThen you can go on GitHub and associate new binaries with the release for that tag (which should point to the right commit)."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "GitLab API to post inline comment to Merge Request\n\nUsing GitLab API it is possible to post a comment to a commit \"on a particular line of a particular file\" (see here).\nOn Merge Request in order to add comments it's required to use the notes resource (see here) but the note object does not seem to contain any parameter to comment on a particular line.\nHowever from the GitLab UI I'm able to add inline comments to a Merge Request in the Changes tab but when I call the API and look at the corresponding note object created from my inline comment there is nothing about the inline, it is only a regular note object without any line or line_type parameter...\nAnyone knows how to use the GitLab API to add inline comments to a Merge Request ?"
},
{
"role": "assistant",
"content": "Code\nfunctions.yml\n.commit_comment:\n script:\n - export GITLAB_TOKEN=\"PROJECT_ACCESS_TOKEN\"\n - |\n commit_comment() {\n curl --location --request POST \"https://gitlab.com/api/v4/projects/$CI_MERGE_REQUEST_PROJECT_ID/merge_requests/$CI_MERGE_REQUEST_IID/notes\" --header \"PRIVATE-TOKEN: $GITLAB_TOKEN\" --header \"Content-Type: application/json\" --data-raw \"{ \\\"body\\\": \\\"$1\\\" }\"\n }\n\nHow to Use?\n# ...\nscript:\n - !reference [.commit_comment, script]\n - commit_comment \"YOUR_MESSAGE\"\n# ...\n\n\nℹ️ Markdown is allowed for the message\n\nGenerating Token\n\nGo to Your Project > Settings > Access Tokens\nEnter a Token name\nChoose Reporter as role\nSelect the api scope. You can add more scopes but this is all we need here\nGenerate the token\n\n\nP.s. Here, I have created a function to use with multiple jobs but you also directly use the curl command anywhere directly by replacing $1 with your message.\nRef"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to create a new branch on both local and remote? GIT [duplicate]\n\nThis question already has answers here:\n \n \n\n\n\n\nHow do I create a remote Git branch?\n\n (26 answers)\n \n\nClosed 8 years ago.\n\n\n\nI create a new branch like this:\n\ngit branch dev-itt-9\n\nHowever, it only creates a new branch on local\n\ngit branch -a\n\n* dev-itt-9\n master\n testing\n\n remotes/origin/HEAD -> origin/master\n remotes/origin/development\n remotes/origin/master\n remotes/origin/testing\n\nWhat is the proper way to create a new branch on both local and remote?\nI am quite new to git. Sorry if my question is stupid."
},
{
"role": "assistant",
"content": "First, you create your branch locally:\ngit checkout -b <branch-name>\n\nThe remote branch is automatically created when you push it to the remote server. So when you feel ready for it, you can just do:\ngit push <remote-name> <branch-name>\n\nWhere <remote-name> is typically origin, the name which git gives to the remote you cloned from. Your colleagues would then just pull that branch, and it's automatically created locally.\n\nCredit: this answer is a copy of https://stackoverflow.com/a/1519032"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How To Upload Files on GitHub\n\nI have recently downloaded GitHub and created a repository on it. I am trying to upload an Objective C project in it. How do I go about doing this?"
},
{
"role": "assistant",
"content": "I didn't find the above answers sufficiently explicit, and it took me some time to figure it out for myself. The most useful page I found was:\nhttp://www.lockergnome.com/web/2011/12/13/how-to-use-github-to-contribute-to-open-source-projects/\nI'm on a Unix box, using the command line. I expect this will all work on a Mac command line. (Mac or Window GUI looks to be available at desktop.github.com but I haven't tested this, and don't know how transferable this will be to the GUI.)\nStep 1: Create a Github account\nStep 2: Create a new repository, typically with a README and LICENCE file created in the process.\nStep 3: Install \"git\" software. \n(Links in answers above and online help at github should suffice to do these steps, so I don't provide detailed instructions.)\nStep 4: Tell git who you are:\ngit config --global user.name \"<NAME>\"\ngit config --global user.email \"<email>\"\n\nI think the e-mail must be one of the addresses you have associated with the github account. I used the same name as I used in github, but I think (not sure) that this is not required. Optionally you can add caching of credentials, so you don't need to type in your github account name and password so often. https://help.github.com/articles/caching-your-github-password-in-git/\nCreate and navigate to some top level working directory:\nmkdir <working>\ncd <working>\n\nImport the nearly empty repository from github:\ngit clone https://github.com/<user>/<repository>\n\nThis might ask for credentials (if github repository is not 'public'.)\nMove to directory, and see what we've done:\ncd <repository>\nls -a\ngit remote -v\n\n(The 'ls' and 'git remote' commands are optional, they just show you stuff)\nCopy the 10000 files and millions of lines of code that you want to put in the repository:\ncp -R <path>/src .\ngit status -s\n\n(assuming everything you want is under a directory named \"src\".) (The second command again is optional and just shows you stuff)\nAdd all the files you just copied to git, and optionally admire the the results:\ngit add src\ngit status -s\n\nCommit all the changes:\ngit commit -m \"<commit comment>\"\n\nPush the changes\ngit push origin master\n\n\"Origin\" is an alias for your github repository which was automatically set up by the \"git clone\" command. \"master\" is the branch you are pushing to. Go look at github in your browser and you should see all the files have been added.\nOptionally remove the directory you did all this in, to reclaim disk space:\ncd ..\nrm -r <working>"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "List Git aliases\nHow do I print a list of my git aliases, i.e., something analogous to the bash alias command?"
},
{
"role": "assistant",
"content": "You can use --get-regexp with the regular expression ^alias, ie all configurations that start with alias\ngit config --get-regexp ^alias"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Access GitLab repo with project access token\n\nAccording to the documentation, it should be possible to access GitLab repos with project access tokens:\n\nThe username is set to project_{project_id}_bot, such as project_123_bot.\n\nNever mind that that's a lie -- the actual user is called project_4194_bot1 in my case; apparently they increment a number for subsequent tokens.\nEither way -- and I have tried both with and without the trailing 1 -- I would expect\ngit clone \"https://project_4194_bot1:[email protected]/my-group/my-project.git\"\n\nto succeed, same as with my.username:$PERSONAL_TOKEN (which works perfectly). However, I get\nremote: HTTP Basic: Access denied\nfatal: Authentication failed for '<snip>'\n\nWhat may be going on here? How can I access GitLab repositories using project access tokens?\n\nIt's not as if we'd get that far, but FWIW, the token seems to have sufficient permissions:"
},
{
"role": "assistant",
"content": "It seems that using the project name as username works. In your case replacing project_4194_bot1 with my-project should work:\ngit clone \"https://my-project:[email protected]/my-group/my-project.git\"\n\nEDIT: One can actually use any non-blank value as a username (see docs), as others correctly pointed out."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-log - Show commit logs --ws-error-highlight=<kind>"
},
{
"role": "assistant",
"content": "Highlight whitespace errors in the context , old or new lines of the diff. Multiple values are separated by comma, none resets previous values, default reset the list to new and all is a shorthand for old,new,context . When\nthis option is not given, and the configuration variable diff.wsErrorHighlight is not set, only whitespace errors in new lines are highlighted. The whitespace errors are colored\nwith color.diff.whitespace ."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-show - Show various types of objects --full-index"
},
{
"role": "assistant",
"content": "Instead of the first handful of characters, show the full\npre- and post-image blob object names on the \"index\"\nline when generating patch format output."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-config - Get and set repository or global options uploadpack.allowAnySHA1InWant"
},
{
"role": "assistant",
"content": "Allow upload-pack to accept a fetch request that asks for any\nobject at all.\nDefaults to false ."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-diff - Show changes between commits, commit and working tree, etc --full-index"
},
{
"role": "assistant",
"content": "Instead of the first handful of characters, show the full\npre- and post-image blob object names on the \"index\"\nline when generating patch format output."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git pull error \"The requested URL returned error: 503 while accessing\"\nI've been facing problems accessing my git repository lately. It worked perfectly fine earlier but now I cannot run any command on CLI. I can however, access the corresponding Web Page, Could someone help me how to resolve this issue?"
},
{
"role": "assistant",
"content": "Had the same error while using SourceTree connected to BitBucket repository.\nWhen navigating to repository url on bitbucket.org the warning message appeared:\n\nThis repository is in read-only mode. You caught us doing some quick maintenance.\n\nAfter around 2 hours repository was accessible again.\nYou can check status and uptime of bitbucket here:\nhttp://status.bitbucket.org/"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-archive - Create an archive of files from a named tree tar.<format>.command"
},
{
"role": "assistant",
"content": "This variable specifies a shell command through which the tar\noutput generated by git archive should be piped. The command\nis executed using the shell with the generated tar file on its\nstandard input, and should produce the final output on its\nstandard output. Any compression-level options will be passed\nto the command (e.g., -9 ). The tar.gz and tgz formats are defined automatically and use the\nmagic command git archive gzip by default, which invokes an internal\nimplementation of gzip."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Running a GitHub Actions step only if previous step has run\n\nI've set up a workflow in GitHub actions to run my tests and create an artifact of the test coverage. The stripped down version of my YAML file looks like this:\nname: Build\n\non: [pull_request]\n\njobs:\n build:\n runs-on: ubuntu-latest\n\n steps:\n # Other steps here\n\n - name: Build app\n - name: Run tests\n - name: Create artifact of test coverage\n\n # Other steps here\n\nThe problem is that the artifact does not get created when the tests fail.\nI figured out about if: always() condition the from the docs, but this will also cause this step to run when my Build app step fails. I don't want that to happen because there is nothing to archive in that case.\nHow can I only run this step if the previous step has run (either succeeded or failed)?"
},
{
"role": "assistant",
"content": "A possible better alternative is <step>.outcome or <step>.conclusion\nhttps://docs.github.com/en/actions/learn-github-actions/contexts#steps-context\n\nsteps.<step id>.conclusion. The result of a completed step after continue-on-error is applied. Possible values are success, failure, cancelled, or skipped. When a continue-on-error step fails, the outcome is failure, but the final conclusion is success.\n\n\nsteps.<step id>.outcome The result of a completed step before continue-on-error is applied. Possible values are success, failure, cancelled, or skipped. When a continue-on-error step fails, the outcome is failure, but the final conclusion is success.\n\n - name: Build app\n id: build\n run: |\n <build command>\n\n - name: Run tests\n\n - name: Create artifact of test coverage\n if: steps.build.outcome == 'success'"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-gc - Cleanup unnecessary files and optimize the local repository --no-prune"
},
{
"role": "assistant",
"content": "Do not prune any loose objects."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How do I create nested repositories in GitHub?\n\nI am able to create a repository via https://github.com/ (say repo) and have:\nhttps://github.com/username/repo.git\n\nHow do I create another repository (say sub_repo) placed under repo and expectedly have:\nhttps://github.com/username/repo/sub_repo.git"
},
{
"role": "assistant",
"content": "GitHub does not allow nested repositories (IIRC Git doesn't allow this for bare repositories).\nHowever, you can use submodules to nest repositories on the \"client side\" in the working tree.\nYou need to clone the parent directory.\nThen, add the sub-repository as a submodule:\ngit submodule add https://github.com/username/sub_repo.git\n\nThe sub_repo module will then be linked to the parent repo and can be found in the sub_repo directory.\nCommit (.gitmodules and sub_repo), push and you're done."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How can I have Github on my own server? [closed]\nClosed. This question is seeking recommendations for software libraries, tutorials, tools, books, or other off-site resources. It does not meet Stack Overflow guidelines. It is not currently accepting answers.\n \n \n\n\n\n\n\n\n\n\n\n\n\n We don’t allow questions seeking recommendations for software libraries, tutorials, tools, books, or other off-site resources. You can edit the question so it can be answered with facts and citations.\n\n\nClosed 9 months ago.\n\n\nThe community reviewed whether to reopen this question 9 months ago and left it closed:\n\nOriginal close reason(s) were not resolved\n\n\n\n\n\n\n Improve this question\n \n\n\n\nIs there anything out there like Github that is for your own local server? I am curious if there is like a PHP script or even a desktop client that mimics Github's functionality, I love Github but it would be nice to host on my own server.\nApologies if this isn't considered \"programming\" enough but generally only programmers use GIT and Github\n\nUpdate\nFirst of all thanks for all the great suggestions, it is great to see there are options out there. From what is posted here and from my googling I can say it looks like the best looking/most alike to Github solutions are coded in Ruby, which is great for some but I am a PHP kind of guy (for now).\nMost of the PHP GIT viewers either are outdated and abandoned projects or they just look like crap ( I realize I could fix them up to be more like Github) but I ran across something in PHP that looks promising so far. It is called Glip it is on Github here https://github.com/patrikf/glip and to me it is the most attractive and easy to use solution I have found for PHP so far. For the advanced Git user, it may not be enough but for me, I just wanted to be able to view a git repo and that provides that functionality.\nNow my search still continues for the perfect solution, will I ever find it? I hope so but, for now, this is we got. I am considering writing my own, one that is attractive like Github and has other features like an Issue tracker for bug and feature requests. All the ones I have seen so far are not so good"
},
{
"role": "assistant",
"content": "There is GitHub Enterprise (administration documentation) to satisfy your needs. And there is an open source \"clone\" of Github Enterprise.\nPS: Now Github provides unlimited private repositories, bitbucket does the same. you can give a try to both. There are several other solutions as well."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-notes - Add or inspect object notes"
},
{
"role": "assistant",
"content": "NOTES MERGE STRATEGIES The default notes merge strategy is \"manual\", which checks out\nconflicting notes in a special work tree for resolving notes conflicts\n( .git/NOTES_MERGE_WORKTREE ), and instructs the user to resolve the\nconflicts in that work tree.\nWhen done, the user can either finalize the merge with git notes merge --commit , or abort the merge with git notes merge --abort . Users may select an automated merge strategy from among the following using\neither -s/--strategy option or configuring notes.mergeStrategy accordingly: \"ours\" automatically resolves conflicting notes in favor of the local\nversion (i.e. the current notes ref). \"theirs\" automatically resolves notes conflicts in favor of the remote\nversion (i.e. the given notes ref being merged into the current notes\nref). \"union\" automatically resolves notes conflicts by concatenating the\nlocal and remote versions. \"cat_sort_uniq\" is similar to \"union\", but in addition to concatenating\nthe local and remote versions, this strategy also sorts the resulting\nlines, and removes duplicate lines from the result. This is equivalent\nto applying the \"cat | sort | uniq\" shell pipeline to the local and\nremote versions. This strategy is useful if the notes follow a line-based\nformat where one wants to avoid duplicated lines in the merge result.\nNote that if either the local or remote version contain duplicate lines\nprior to the merge, these will also be removed by this notes merge\nstrategy."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to compare a local Git branch with its remote branch\nHow can I see the diff between a local branch and a remote branch?"
},
{
"role": "assistant",
"content": "git diff <local branch> <remote>/<remote branch>\n\nFor example, git diff main origin/main, or git diff featureA origin/next\nOf course to have said remote-tracking branch you need to git fetch first; and you need it to have up-to-date information about branches in the remote repository."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-diff - Show changes between commits, commit and working tree, etc --no-color"
},
{
"role": "assistant",
"content": "Turn off colored diff.\nThis can be used to override configuration settings.\nIt is the same as --color=never ."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "File not shown in git diff after a git add. How do I know it will be committed?\nI had an untracked file which was not appearing in a git diff and when I added it to the 'changes to be committed' area, it still doesn't show up in the git diff. I shows up with a git status -v when I do a diff against HEAD.\nI'm still very new to git, so could anyone please tell me if the file will be committed even if it doesn't show up in a regular diff, as it has been added to the staging area?"
},
{
"role": "assistant",
"content": "If you'd like to see the staged changes in a diff, you can still use git diff, you just need to pass the --staged flag:\ndavid@pav:~/dummy_repo$ echo \"Hello, world\" > hello.txt\ndavid@pav:~/dummy_repo$ git status\n# On branch master\n#\n# Initial commit\n#\n# Untracked files:\n# hello.txt\nnothing added to commit but untracked files present\ndavid@pav:~/dummy_repo$ git add hello.txt\ndavid@pav:~/dummy_repo$ git diff\ndavid@pav:~/dummy_repo$ git diff --staged\ndiff --git a/hello.txt b/hello.txt\nnew file mode 100644\nindex 0000000..76d5293\n--- /dev/null\n+++ b/hello.txt\n@@ -0,0 +1 @@\n+Hello, world\n\nIf you only care about which files are staged, you can of course do a git status, but git diff --staged --name-only will give each staged filename on its own line."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Visual Studio Code: .git folder/file hidden\nI am trying Visual Studio Code at this moment. Everything about Visual Studio Code look really cool to me except one thing: .git folder/file is hidden in Visual Studio Code.\nI often change Git setting by modifying the .git configuration file. It is really annoying for me not able to see .git files.\nIs there a way to reveal .git files in Visual Studio Code?"
},
{
"role": "assistant",
"content": "By default Visual Studio Code excludes files in a folder using the following settings:\n\"files.exclude\": {\n \"**/.git\": true,\n \"**/.svn\": true,\n \"**/.hg\": true,\n \"**/.DS_Store\": true\n}\n\nYou can change your user settings or workspace settings to show the .git folder by adding these lines:\n\"files.exclude\": {\n \"**/.git\": false\n}\n\nThis setting can also be found in Text Editor -> Files -> Exclude if you are using the settings GUI.\n\nTo open the settings JSON for editing, do the following:\n\nOpen the command pallete:\nWindows: ctrl+shift+p\nor\nMac: ⌘ + Shift + P\n\nIn the command prompt that should open, type Preferences: Open Settings (JSON).\nThis should open the settings JSON file for you.\nNote: You will notice similar commands appear if you prefer to choose settings more specific to your user or workspace.\n\nFind files.exclude and you should see the relevant section to edit."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to delete remote branch (e.g. Github) from command line? [duplicate]\n\nThis question already has answers here:\n \n \n\n\n\n\nHow do I delete a Git branch locally and remotely?\n\n (41 answers)\n \n\nClosed 6 years ago.\n\n\n\nI have a git repository in my local machine:\nI add a new branch called test and add a few commits\nThen I checkout to master branch and add commits to it.\nSo I use git push --all github and continue working on master.\nAfter some time I decide to completely remove the test branch and use: git branch -d test and git branch -r -d github/test, but it only deletes the local branch used for tracking the actual test branch as git says:\nDeleted remote-tracking branch github/buggy (was acc5a58).\nI'm asking if there's a way to actually remove the test branch from github servers from command-line?"
},
{
"role": "assistant",
"content": "Local Branch\ngit branch -D local_branch\n\nRemote Branch\ngit push origin --delete remote_branch"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-svn - Bidirectional operation between a Subversion repository and Git --interactive"
},
{
"role": "assistant",
"content": "Ask the user to confirm that a patch set should actually be sent to SVN.\nFor each patch, one may answer \"yes\" (accept this patch), \"no\" (discard this\npatch), \"all\" (accept all patches), or \"quit\". git svn dcommit returns immediately if answer is \"no\" or \"quit\", without\ncommitting anything to SVN."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-diff - Show changes between commits, commit and working tree, etc Comparing with arbitrary commits"
},
{
"role": "assistant",
"content": "$ git diff test (1) $ git diff HEAD -- ./test (2) $ git diff HEAD^ HEAD (3) Instead of using the tip of the current branch, compare with the\ntip of \"test\" branch. Instead of comparing with the tip of \"test\" branch, compare with\nthe tip of the current branch, but limit the comparison to the\nfile \"test\". Compare the version before the last commit and the last commit."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git - the stupid content tracker git-daemon"
},
{
"role": "assistant",
"content": "A really simple server for Git repositories"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git: Apply changes introduced by commit in one repo to another repo\nI have a repo1 and repo2 on local machine. They are very similar, but the latter is some kind of other branch (repo1 is not maintained anymore).\n/path/to/repo1 $ git log HEAD~5..HEAD~4\n<some_sha> Add: Introduce feature X\n\nHow to apply changes made by commit <some_sha> in repo1 to repo2?\nDo I need to prepare some patch, or is it possible to do some cherry-pick between the repos?\nHow about doing the same but for range of commits?"
},
{
"role": "assistant",
"content": "You can to use git format-patch in your first repository and then git am to apply that patch in your second repository:\n/path/to/1 $ git format-patch sha1^..sha1\n/path/to/1 $ cd /path/to/2\n/path/to/2 $ git am -3 /path/to/1/0001-…-….patch\n\nOr, in one line:\n/path/to/2 $ git --git-dir=/path/to/1/.git format-patch --stdout sha1^..sha1 | git am -3"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "External URL must include a FQDN\n\nI set up a fresh CentOS 6.6 install and used the Omniubus installer for the CE of Gitlab.\nWhen running gitlab-ctl reconfigure I get the following errors:\n================================================================================\nRecipe Compile Error in /opt/gitlab/embedded/cookbooks/gitlab/recipes/default.rb\n================================================================================\n\n\nRuntimeError\n------------\nExternal URL must include a FQDN\n\n\nCookbook Trace:\n---------------\n /opt/gitlab/embedded/cookbooks/gitlab/libraries/gitlab.rb:95:in `parse_external_url'\n /opt/gitlab/embedded/cookbooks/gitlab/libraries/gitlab.rb:191:in `generate_config'\n /opt/gitlab/embedded/cookbooks/gitlab/recipes/default.rb:34:in `from_file'\n\n\nRelevant File Content:\n----------------------\n/opt/gitlab/embedded/cookbooks/gitlab/libraries/gitlab.rb:\n\n 88: \n 89: def parse_external_url\n 90: return unless external_url\n 91: \n 92: uri = URI(external_url.to_s)\n 93: \n 94: unless uri.host\n 95>> raise \"External URL must include a FQDN\"\n 96: end\n 97: Gitlab['user']['git_user_email'] ||= \"gitlab@#{uri.host}\"\n 98: Gitlab['gitlab_rails']['gitlab_host'] = uri.host\n 99: Gitlab['gitlab_rails']['gitlab_email_from'] ||= \"gitlab@#{uri.host}\"\n100: \n101: case uri.scheme\n102: when \"http\"\n103: Gitlab['gitlab_rails']['gitlab_https'] = false\n104: when \"https\"\n\nThe FQDN of the server is correctly set, I have an external IP. DNS is configured for the FQDN to point at my external IP.\nHere's the contents of my /etc/gitlab/gitlab.rb in case that is useful:\n# Check and change the external_url to the address your users will type in their browser\nexternal_url 'gitlab.thefallenphoenix.net'\ngitlab_rails['gitlab_email_from'] = '[email protected]'"
},
{
"role": "assistant",
"content": "EDIT: This is now fixed with adding http:// or https:// to the domain in the .rb file. Tested on Debian 9 with Gitlab EE.\n\nAdd a = sign to the gitlab.rb.\nIt should be:\nexternal_url = 'gitlab.thefallenphoenix.net'\ngitlab_rails['gitlab_email_from'] = '[email protected]'\n\nAfter that it should install fine. At least it worked for me on CentOS 6.6."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-rebase - Reapply commits on top of another base tip keep"
},
{
"role": "assistant",
"content": "The commit will be kept. This option is implied when --exec is\nspecified unless -i / --interactive is also specified."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Can Git and iCloud Drive be effectively used together?\n\nIn the same flavor as this question, are there any possible complications that can arise when using the two services together?"
},
{
"role": "assistant",
"content": "No, they shouldn’t be used together.\n\nApple says “You shouldn’t store app folders, libraries, or .tmp files in iCloud Drive.” .git is an app folder.\nThere is a list of filenames excluded by iCloud Drive that git doesn’t avoid. So, for example, if you name a tag “tmp”, that tag won’t be synced. There’s also nothing stopping git modifying its internal file structure, or iCloud Drive modifying its exclusion list, such that this sync failure always occurs.\niCloud Drive ignores symlinks, git doesn’t. So, git status may return different results on different computers that iCloud Drive is done syncing.\n\nMore broadly speaking, git and iCloud Drive are two different lossy implementations of “what are the contents of this directory”, one shouldn’t expect them to be equivalent."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-diff-index - Compare a tree to the working tree or index -I<regex> --ignore-matching-lines=<regex>"
},
{
"role": "assistant",
"content": "Ignore changes whose all lines match <regex>. This option may\nbe specified more than once."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Does git return specific return error codes?\nLike merging errors, or rebase errors. Does it have a unique error code?"
},
{
"role": "assistant",
"content": "I set-up a test to fail. This is what I got:\n$ git merge newbranch\nAuto-merging test.txt\nCONFLICT (content): Merge conflict in test.txt\nAutomatic merge failed; fix conflicts and then commit the result.\n\n$ echo $?\n1\n\nGit returns 0 when it merges correctly, as expected."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Getting docker error while using shell gitlab-runner ERRO[0000]\n\nHello I got this error at the installation,\nwhen I use the command \"gitlab-runner run\" or \"gitlab-runner start\":\nERRO[0000] Docker executor: prebuilt image helpers will be loaded from /var/lib/gitlab-runner\n\nThe strange thing about it is, I using a shell runner.\nI also tried on another server with no problems.\nEven I tried it with a docker build and without.\nI installed via\napt install gitlab-runner\n\nAlso I upgraded it and updated also. Rebuild the server (digitalocean droplet Ubuntu20.04)) and jep ... dont know what is going on.\nHere also some output og the gitlab-runner:\nroot@Server:~# gitlab-runner verify\nERRO[0000] Docker executor: prebuilt image helpers will be loaded from /var/lib/gitlab-runner.\nRunning in system-mode.\n\nVerifying runner... is alive runner=xVNzfox5\n\nroot@Server:~# gitlab-runner list\nERRO[0000] Docker executor: prebuilt image helpers will be loaded from /var/lib/gitlab-runner.\nListing configured runners ConfigFile=/etc/gitlab-runner/config.toml\ntest Executor=shell Token=JustAToken\nURL=https://gitlab.com/\n\nAll I found about this error was about docker runner, but like I said I use a shell runner.\nThanks if someone can help."
},
{
"role": "assistant",
"content": "Using this command apt-cache policy gitlab-runner, you will notice that only version 11.2.0 of gitlab-runner is available on the repositories, which is not supported by Gitlab.\nFollow the official documentation to install the latest version 14.2.0.\n$ sudo curl -L --output /usr/local/bin/gitlab-runner \"https://gitlab-runner-downloads.s3.amazonaws.com/latest/binaries/gitlab-runner-linux-amd64\"\n$ sudo chmod +x /usr/local/bin/gitlab-runner\n$ sudo useradd --comment 'GitLab Runner' --create-home gitlab-runner --shell /bin/bash\n$ # Optional sudo rm /etc/systemd/system/gitlab-runner.service\n$ sudo gitlab-runner install --user=gitlab-runner --working-directory=/home/gitlab-runner"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "gitglossary - A Git Glossary HEAD"
},
{
"role": "assistant",
"content": "The current branch . In more detail: Your working tree is normally derived from the state of the tree\nreferred to by HEAD. HEAD is a reference to one of the heads in your repository, except when using a detached HEAD , in which case it directly\nreferences an arbitrary commit."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-svn - Bidirectional operation between a Subversion repository and Git"
},
{
"role": "assistant",
"content": "CONFIGURATION git svn stores [svn-remote] configuration information in the\nrepository $GIT_DIR/config file. It is similar the core Git\n[remote] sections except fetch keys do not accept glob\narguments; but they are instead handled by the branches and tags keys. Since some SVN repositories are oddly\nconfigured with multiple projects glob expansions such those\nlisted below are allowed: [svn-remote \"project-a\"]\n\turl = http://server.org/svn\n\tfetch = trunk/project-a:refs/remotes/project-a/trunk\n\tbranches = branches/*/project-a:refs/remotes/project-a/branches/*\n\tbranches = branches/release_*:refs/remotes/project-a/branches/release_*\n\tbranches = branches/re*se:refs/remotes/project-a/branches/*\n\ttags = tags/*/project-a:refs/remotes/project-a/tags/* Keep in mind that the * (asterisk) wildcard of the local ref\n(right of the : ) must be the farthest right path component;\nhowever the remote wildcard may be anywhere as long as it’s an\nindependent path component (surrounded by / or EOL). This\ntype of configuration is not automatically created by init and\nshould be manually entered with a text-editor or using git config . Also note that only one asterisk is allowed per word. For example: branches = branches/re*se:refs/remotes/project-a/branches/* will match branches release , rese , re123se , however branches = branches/re*s*e:refs/remotes/project-a/branches/* will produce an error. It is also possible to fetch a subset of branches or tags by using a\ncomma-separated list of names within braces. For example: [svn-remote \"huge-project\"]\n\turl = http://server.org/svn\n\tfetch = trunk/src:refs/remotes/trunk\n\tbranches = branches/{red,green}/src:refs/remotes/project-a/branches/*\n\ttags = tags/{1.0,2.0}/src:refs/remotes/project-a/tags/* Multiple fetch, branches, and tags keys are supported: [svn-remote \"messy-repo\"]\n\turl = http://server.org/svn\n\tfetch = trunk/project-a:refs/remotes/project-a/trunk\n\tfetch = branches/demos/june-project-a-demo:refs/remotes/project-a/demos/june-demo\n\tbranches = branches/server/*:refs/remotes/project-a/branches/*\n\tbranches = branches/demos/2011/*:refs/remotes/project-a/2011-demos/*\n\ttags = tags/server/*:refs/remotes/project-a/tags/* Creating a branch in such a configuration requires disambiguating which\nlocation to use using the -d or --destination flag: $ git svn branch -d branches/server release-2-3-0 Note that git-svn keeps track of the highest revision in which a branch\nor tag has appeared. If the subset of branches or tags is changed after\nfetching, then $GIT_DIR/svn/.metadata must be manually edited to remove\n(or reset) branches-maxRev and/or tags-maxRev as appropriate."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to tell git to ignore all further edit to a single file without removing it from the repo\n\nI have forked a project on github and started messing around with it on my own machine, I want to commit the changes I have made back to my fork on github but without commiting the changes I have made to the .cfg file, since this contains things like db password etc"
},
{
"role": "assistant",
"content": "Use this:\ngit update-index --skip-worktree path/file.cfg\n\nAnd to restore:\ngit update-index --no-skip-worktree path/file.cfg\n\nLastly, if you want to list files that are marked with skip-worktree:\ngit ls-files -v | grep ^S | awk '{print $2}'\n\nTo simplify, you can make an alias for that in your $HOME/.gitconfig:\n[alias]\n ls-ignored-changes = !git ls-files -v | grep ^S | awk '{print $2}'\n\nThen you can type just git ls-ignored-changes. It even works with auto-completion if you have the git-completion in place (for bash, tcsh, zsh)."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git add all except ignoring files in .gitignore file\nI am adding source control to a project that had none. The problem is that there are a lot of files to initially add to git with a .gitignore file, but I can't figure out how to add all files without including the files matching something in the .gitignore file.\ngit add *\n\nThe above command will not add any files because it detects files which are ignored by the .gitignore.\ngit add -f *\n\nThe above command will add all files including the files I wish to ignore.\nSo, how do I add all files while still adhering to the .gitignore file?"
},
{
"role": "assistant",
"content": "I think you mean git add . which will add all of the files to the repo that AREN'T specified in the .gitignore - you can see these changes by typing git status\nThe . in bash usually means this directory and all other directories recursively, so if you do this from the bottom level of your repo, you should add all of the files.\nMy usual git flow is to create the .gitignore file and add the project files to the repo. I'll test the .gitignore file by typing git status after importing the files - if I see the files that I've added (for example only .php or .html, NOT .mp3 or .mov), then you can git add . to add all, and git commit -m \"initial commit\" to commit them and you should be set."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-log - Show commit logs notes.mergeStrategy"
},
{
"role": "assistant",
"content": "Which merge strategy to choose by default when resolving notes\nconflicts. Must be one of manual , ours , theirs , union , or cat_sort_uniq . Defaults to manual . See the \"NOTES MERGE STRATEGIES\"\nsection of git-notes for more information on each strategy. This setting can be overridden by passing the --strategy option to git-notes ."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-commit - Record changes to the repository"
},
{
"role": "assistant",
"content": "DESCRIPTION Create a new commit containing the current contents of the index and\nthe given log message describing the changes. The new commit is a\ndirect child of HEAD, usually the tip of the current branch, and the\nbranch is updated to point to it (unless no branch is associated with\nthe working tree, in which case HEAD is \"detached\" as described in git-checkout ). The content to be committed can be specified in several ways: by using git-add to incrementally \"add\" changes to the\nindex before using the commit command (Note: even modified files\nmust be \"added\"); by using git-rm to remove files from the working tree\nand the index, again before using the commit command; by listing files as arguments to the commit command\n(without --interactive or --patch switch), in which\ncase the commit will ignore changes staged in the index, and instead\nrecord the current content of the listed files (which must already\nbe known to Git); by using the -a switch with the commit command to automatically\n\"add\" changes from all known files (i.e. all files that are already\nlisted in the index) and to automatically \"rm\" files in the index\nthat have been removed from the working tree, and then perform the\nactual commit; by using the --interactive or --patch switches with the commit command\nto decide one by one which files or hunks should be part of the commit\nin addition to contents in the index,\nbefore finalizing the operation. See the “Interactive Mode” section of git-add to learn how to operate these modes. The --dry-run option can be used to obtain a\nsummary of what is included by any of the above for the next\ncommit by giving the same set of parameters (options and paths). If you make a commit and then find a mistake immediately after\nthat, you can recover from it with git reset ."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-config - Get and set repository or global options format.thread"
},
{
"role": "assistant",
"content": "The default threading style for git format-patch . Can be\na boolean value, or shallow or deep . shallow threading\nmakes every mail a reply to the head of the series,\nwhere the head is chosen from the cover letter, the --in-reply-to , and the first patch mail, in this order. deep threading makes every mail a reply to the previous one.\nA true boolean value is the same as shallow , and a false\nvalue disables threading."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-checkout - Switch branches or restore working tree files --pathspec-from-file=<file>"
},
{
"role": "assistant",
"content": "Pathspec is passed in <file> instead of commandline args. If <file> is exactly - then standard input is used. Pathspec\nelements are separated by LF or CR/LF. Pathspec elements can be\nquoted as explained for the configuration variable core.quotePath (see git-config ). See also --pathspec-file-nul and\nglobal --literal-pathspecs ."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to know which branch a \"git log\" commit belongs to?\nIf I do git log, is there any parameter I could specify to be able to tell from the output which branch every commit belongs to?\nEdit: to clarify, I understand that a commit may be part of two branches (for instance). What I want is to get the most recent branch that the commit in log belongs to. So, if I made a branch called foo from master. It would belong to both branches, but I want to get foo."
},
{
"role": "assistant",
"content": "I think that what you're looking for is the very useful command:\ngit branch -a --contains <SHA1sum-of-commit>\n\n... which will tell you every branch (both local and remote-tracking) that contains that commit.\nUnfortunately, I don't think there's a git log option that just outputs this for every commit. Using --all --source is close, but will only display one of the branches for each commit. However, if you click on a commit in gitk --all, you'll see that it lists every branch that that commit is on.\nThere's one part of your question that isn't very well defined, however - you ask:\n\nWhat I want is to get the most recent branch that the commit in log belongs to\n\nIt isn't clear to me what you mean by this - the \"most recent branch\" might be (a) the most recently created ref (b) the most recently modified ref (c) the branch with the most recent commit on it, etc. etc. There's probably a better way of defining what you want in terms of the commit graph."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Smudge error: Error downloading\n\nI'm not sure if this is the right forum to discuss git-lfs but as we have a tag for it I'll post my question. I have read the \"Troubleshoot Git LFS in Bitbucket\" page.\nI'm getting the following error when runing:\nssh-agent bash -c 'ssh-add /home/dan/.ssh/keyname; git clone [email protected]:[repo name removed].git' \n\n\n$ git-lfs smudge -- [Filename removed].zip Error downloading object:\n [Filename removed].zip ([code removed]): Smudge error: Error downloading\n [Filename removed].zip ([code removed]): [[code removed] Object does\n not exist on the server: [404] Object does not exist on the server\n[404] Object does not exist on the server\n github.com/git-lfs/git-lfs/errors.newWrappedError\n /tmp/docker_run/src/github.com/git-lfs/git-lfs/errors/types.go:170:\n [[code removed]] Object does not exist on the server\n github.com/git-lfs/git-lfs/errors.newWrappedError\n /tmp/docker_run/src/github.com/git-lfs/git-lfs/errors/types.go:170:\n Error downloading [Filename removed].zip ([code removed])\n github.com/git-lfs/git-lfs/errors.newWrappedError\n /tmp/docker_run/src/github.com/git-lfs/git-lfs/errors/types.go:170:\n Smudge error\n\nHas anyone got any advice?"
},
{
"role": "assistant",
"content": "I eventually found an answer by strich: on https://github.com/git-lfs/git-lfs/issues/911\n\nI've had similar issues in the past and I think there may be a\npotential bug in cloning with git lfs (Still to be determined). You\ncan try this method of fetching the repo, which is in fact faster too:\n\n// Skip smudge - We'll download binary files later in a faster batch\ngit lfs install --skip-smudge\n\n// Do git clone here\ngit clone ...\n\n// Fetch all the binary files in the new clone \ngit lfs pull\n\n// Reinstate smudge\ngit lfs install --force \n\n\nThis only needs to be done once to initialize the clone for the first\ntime.\nPlease do test it and let me know if it fixes it."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "In the context of git (and diff), what is a \"hunk\"\nI was looking for a definition of \"hunk\" while reading some git documentation. \nI know it means a description of the difference between two files and that it has a well defined format, but I couldn't call to mind a succinct definition. \nI tried searching with google, but there were a lot of somewhat spurious hits."
},
{
"role": "assistant",
"content": "And eventually I found this:\n\nWhen comparing two files, diff finds sequences of lines common to both files, interspersed with groups of differing lines called hunks.\n\nhere:\nhttp://www.gnu.org/software/diffutils/manual/html_node/Hunks.html\nWhich was exactly the kind of succinct definition I was looking for. Hopefully this helps someone else out!"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-diff-index - Compare a tree to the working tree or index --output-indicator-new=<char> --output-indicator-old=<char> --output-indicator-context=<char>"
},
{
"role": "assistant",
"content": "Specify the character used to indicate new, old or context\nlines in the generated patch. Normally they are + , - and\n' ' respectively."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-commit - Record changes to the repository --fixup=[(amend|reword):]<commit>"
},
{
"role": "assistant",
"content": "Create a new commit which \"fixes up\" <commit> when applied with git rebase --autosquash . Plain --fixup=<commit> creates a\n\"fixup!\" commit which changes the content of <commit> but leaves\nits log message untouched. --fixup=amend:<commit> is similar but\ncreates an \"amend!\" commit which also replaces the log message of <commit> with the log message of the \"amend!\" commit. --fixup=reword:<commit> creates an \"amend!\" commit which\nreplaces the log message of <commit> with its own log message\nbut makes no changes to the content of <commit> . The commit created by plain --fixup=<commit> has a subject\ncomposed of \"fixup!\" followed by the subject line from <commit>,\nand is recognized specially by git rebase --autosquash . The -m option may be used to supplement the log message of the created\ncommit, but the additional commentary will be thrown away once the\n\"fixup!\" commit is squashed into <commit> by git rebase --autosquash . The commit created by --fixup=amend:<commit> is similar but its\nsubject is instead prefixed with \"amend!\". The log message of\n<commit> is copied into the log message of the \"amend!\" commit and\nopened in an editor so it can be refined. When git rebase\n--autosquash squashes the \"amend!\" commit into <commit> , the\nlog message of <commit> is replaced by the refined log message\nfrom the \"amend!\" commit. It is an error for the \"amend!\" commit’s\nlog message to be empty unless --allow-empty-message is\nspecified. --fixup=reword:<commit> is shorthand for --fixup=amend:<commit>\n--only . It creates an \"amend!\" commit with only a log message\n(ignoring any changes staged in the index). When squashed by git\nrebase --autosquash , it replaces the log message of <commit> without making any other changes. Neither \"fixup!\" nor \"amend!\" commits change authorship of <commit> when applied by git rebase --autosquash .\nSee git-rebase for details."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-fetch - Download objects and refs from another repository --update-shallow"
},
{
"role": "assistant",
"content": "By default when fetching from a shallow repository, git fetch refuses refs that require updating\n.git/shallow. This option updates .git/shallow and accepts such\nrefs."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Remove specific commit\nI was working with a friend on a project, and he edited a bunch of files that shouldn't have been edited. Somehow I merged his work into mine, either when I pulled it, or when I tried to just pick the specific files out that I wanted. I've been looking and playing for a long time, trying to figure out how to remove the commits that contain the edits to those files, it seems to be a toss up between revert and rebase, and there are no straightforward examples, and the docs assume I know more than I do.\nSo here is a simplified version of the question:\nGiven the following scenario, how do I remove commit 2?\n$ mkdir git_revert_test && cd git_revert_test\n\n$ git init\nInitialized empty Git repository in /Users/josh/deleteme/git_revert_test/.git/\n\n$ echo \"line 1\" > myfile\n\n$ git add -A\n\n$ git commit -m \"commit 1\"\n[master (root-commit) 8230fa3] commit 1\n 1 files changed, 1 insertions(+), 0 deletions(-)\n create mode 100644 myfile\n\n$ echo \"line 2\" >> myfile\n\n$ git commit -am \"commit 2\"\n[master 342f9bb] commit 2\n 1 files changed, 1 insertions(+), 0 deletions(-)\n\n$ echo \"line 3\" >> myfile\n\n$ git commit -am \"commit 3\"\n[master 1bcb872] commit 3\n 1 files changed, 1 insertions(+), 0 deletions(-)\n\nThe expected result is\n$ cat myfile\nline 1\nline 3\n\nHere is an example of how I have been trying to revert\n$ git revert 342f9bb\nAutomatic revert failed. After resolving the conflicts,\nmark the corrected paths with 'git add <paths>' or 'git rm <paths>'\nand commit the result."
},
{
"role": "assistant",
"content": "There are four ways of doing so (replace \"commid-id\" with your commit's hash):\n\nClean way, reverting but keep in log the revert:\n git revert --strategy resolve commit-id\n\nNote: if the commit to remove is a merge commit, you will need to append -m 1 (thanks to @Powertoaster for the tip!).\n\nHarsh way, remove altogether only the last commit:\n git reset --soft \"HEAD^\"\n\nNote: Avoid git reset --hard as it will also discard all changes in files since the last commit. If --soft does not work, rather try --mixed or --keep.\n\nInteractive rebase (this will show the log of the last 5 commits and delete the lines you don't want, or reorder, or squash multiple commits in one, or do anything else you want, this is a very versatile tool):\n git rebase -i HEAD~5\n\nAnd if a mistake is made:\n git rebase --abort\n\n\nQuick rebase: remove only a specific commit using its id:\n git rebase --onto commit-id^ commit-id\n\n\nAlternative: you could also try:\n git cherry-pick commit-id\n\n\nYet another alternative:\n git revert --no-commit\n\n\nAs a last resort, if you need full freedom of history editing (eg, because git don't allow you to edit what you want to), you can use this very fast open source application: reposurgeon.\n\n\nNote: of course, all these changes are done locally, you should git push afterwards to apply the changes to the remote. And in case your repo doesn't want to remove the commit (\"no fast-forward allowed\", which happens when you want to remove a commit you already pushed), you can use git push --force to force push the changes.\nNote2: if working on a branch and you need to force push, you should absolutely avoid git push --force because this may overwrite other branches (if you have made changes in them, even if your current checkout is on another branch). To ensure to avoid that, always specify the remote branch when you force push: git push --force origin your_branch."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-mv - Move or rename a file, a directory, or a symlink -k"
},
{
"role": "assistant",
"content": "Skip move or rename actions which would lead to an error\ncondition. An error happens when a source is neither existing nor\ncontrolled by Git, or when it would overwrite an existing\nfile unless -f is given."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-diff-index - Compare a tree to the working tree or index --no-indent-heuristic"
},
{
"role": "assistant",
"content": "Disable the indent heuristic."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-pull - Fetch from and integrate with another repository or a local branch --commit --no-commit"
},
{
"role": "assistant",
"content": "Perform the merge and commit the result. This option can\nbe used to override --no-commit.\nOnly useful when merging. With --no-commit perform the merge and stop just before creating\na merge commit, to give the user a chance to inspect and further\ntweak the merge result before committing. Note that fast-forward updates do not create a merge commit and\ntherefore there is no way to stop those merges with --no-commit.\nThus, if you want to ensure your branch is not changed or updated\nby the merge command, use --no-ff with --no-commit."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "GitLab CI/CD: Run jobs only when files in a specific directory have changed\nI would like to run specific jobs on the .gitlab-ci.yaml if and only if files within specific directories of the repository have changed. Is there a way to do this with gilab's ci/cd tooling or would it be easier just to run a custom build script?"
},
{
"role": "assistant",
"content": "Changes policy introduced in GitLab 11.4.\nFor example:\ndocker build:\n script: docker build -t my-image:$CI_COMMIT_REF_SLUG .\n only:\n changes:\n - Dockerfile\n - docker/scripts/*\n - dockerfiles/**/*\n - more_scripts/*.{rb,py,sh}\n\nIn the scenario above, if you are pushing multiple commits to GitLab to an existing branch, GitLab creates and triggers the docker build job, provided that one of the commits contains changes to either:\n\nThe Dockerfile file.\nAny of the files inside docker/scripts/ directory.\nAny of the files and subdirectories inside the dockerfiles directory.\nAny of the files with rb, py, sh extensions inside the more_scripts directory.\n\nYou can read more in the documentation and with some more examples."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-fsck - Verifies the connectivity and validity of the objects in the database"
},
{
"role": "assistant",
"content": "SYNOPSIS git fsck [--tags] [--root] [--unreachable] [--cache] [--no-reflogs]\n\t [--[no-]full] [--strict] [--verbose] [--lost-found]\n\t [--[no-]dangling] [--[no-]progress] [--connectivity-only]\n\t [--[no-]name-objects] [<object>…]"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-log - Show commit logs cumulative"
},
{
"role": "assistant",
"content": "Count changes in a child directory for the parent directory as well.\nNote that when using cumulative , the sum of the percentages\nreported may exceed 100%. The default (non-cumulative) behavior can\nbe specified with the noncumulative parameter."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git - the stupid content tracker"
},
{
"role": "assistant",
"content": "File/Directory Structure Please see the gitrepository-layout document. Read githooks for more details about each hook. Higher level SCMs may provide and manage additional information in the $GIT_DIR ."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-log - Show commit logs [--] <path>…"
},
{
"role": "assistant",
"content": "Show only commits that are enough to explain how the files\nthat match the specified paths came to be. See History\nSimplification below for details and other simplification\nmodes. Paths may need to be prefixed with -- to separate them from\noptions or the revision range, when confusion arises."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to undo a git merge with conflicts\nI am on branch mybranch1. mybranch2 is forked from mybranch1 and changes were made in mybranch2.\nThen, while on mybranch1, I have done git merge --no-commit mybranch2\nIt shows there were conflicts while merging.\nNow I want to discard everything (the merge command) so that mybranch1 is back to what it was before.\nI have no idea how do I go about this."
},
{
"role": "assistant",
"content": "Latest Git:\ngit merge --abort\n\nThis attempts to reset your working copy to whatever state it was in before the merge. That means that it should restore any uncommitted changes from before the merge, although it cannot always do so reliably. Generally you shouldn't merge with uncommitted changes anyway.\nPrior to version 1.7.4:\ngit reset --merge\n\nThis is older syntax but does the same as the above.\nPrior to version 1.6.2:\ngit reset --hard\n\nwhich removes all uncommitted changes, including the uncommitted merge. Sometimes this behaviour is useful even in newer versions of Git that support the above commands."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-log - Show commit logs --line-prefix=<prefix>"
},
{
"role": "assistant",
"content": "Prepend an additional prefix to every line of output."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Error: before_script config should be an array of strings\n\nGitLab : \n\n.gitlab-ci.yml syntax error\n\ndocker exec -i XXX pip3 install -r ./requirements_os_specific.txt --target=./packages --platform=manylinux1_x86_64 --only-binary=:all:\n\nthis command giving a syntax error . \n\n\"Error: before_script config should be an array of strings\"\n\nThis work fine if I remove \"--only-binary=:all:\"\nvariables : IMAGE_NAME: xxx \n\nbefore_script:\n - whoami\n - echo $GitLabPassword\n - docker login -u Prasenjit.Chowdhury -p $GitLabPassword xxxxxxx\n - docker -v\n - docker exec -i abc python -V\n - docker exec -i abc aws --version\n - docker exec -i abc pip3 install -r ./requirements_os_specific.txt --target=./packages --platform=manylinux1_x86_64 --only-binary=:all:\n\n:\nThis script works fine if I remove the last line"
},
{
"role": "assistant",
"content": "You have to escape a colon : in yaml. This can be done by surrounding the whole entry with quotes \".\nReplace:\n- docker exec -i abc pip3 install -r ./requirements_os_specific.txt --target=./packages --platform=manylinux1_x86_64 --only-binary=:all:\n\nwith:\n- \"docker exec -i abc pip3 install -r ./requirements_os_specific.txt --target=./packages --platform=manylinux1_x86_64 --only-binary=:all:\""
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "gitattributes - Defining attributes per path Unset"
},
{
"role": "assistant",
"content": "Unsetting the text attribute on a path tells Git not to\nattempt any end-of-line conversion upon checkin or checkout."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-pull - Fetch from and integrate with another repository or a local branch --set-upstream"
},
{
"role": "assistant",
"content": "If the remote is fetched successfully, add upstream\n(tracking) reference, used by argument-less git-pull and other commands. For more information,\nsee branch.<name>.merge and branch.<name>.remote in git-config ."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How does git handle folder permission?\nI'm using git version 1.5.6.3, and it seems git doesn't notice a folder's mode changes\n#create a test repository with a folder with 777 mode\n:~$ mkdir -p test/folder\n:~$ touch test/folder/dummy.txt\n:~$ cd test\n:~/test$ chmod 777 folder/\n\n#init git repository\n:~/test$ git init\nInitialized empty Git repository in ~/test/.git/\n:~/test$ git add .\n:~/test$ git commit -m 'commit a directory'\nCreated initial commit 9b6b21a: commit a directory\n 0 files changed, 0 insertions(+), 0 deletions(-)\n create mode 100644 folder/dummy.txt\n\n#change folder permission to 744\n:~/test$ chmod 744 folder/\n:~/test$ git status \n# On branch master\nnothing to commit (working directory clean)\n\nWhat does 04000 stand for?\n:~/test$ git ls-tree HEAD folder\n040000 tree 726c1d5f0155771348ea2daee6239791f1cd7731 folder\n\nIs this normal behavior? \nHow can I track folder mode changes?"
},
{
"role": "assistant",
"content": "The only 'permissions' bit that git tracks is the executable bit for files, the rest of the mode bits describe what type of file system object the object in each git tree is. git supports files and symlinks (blobs), directories (trees) and the submodules (commits).\ngit is designed to help track source code across different machines. Permission bits depend on user and group mappings between machines. In distributed environments where these mappings don't exist, tracking permission bits usually ends up hindering things rather than helping anything.\nIf you need to track more file system attributes that what git tracks natively you could consider and extension tool such as etckeeper."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-show - Show various types of objects -C[<n>] --find-copies[=<n>]"
},
{
"role": "assistant",
"content": "Detect copies as well as renames. See also --find-copies-harder .\nIf n is specified, it has the same meaning as for -M<n> ."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Embed Github contributions graph in website\n\nIs there a way to embed the Github contributions graph in HTML5?"
},
{
"role": "assistant",
"content": "I wrote a JavaScript library to do that: github-calendar.\nHere is an example how to use it:\n<!-- Prepare a container for your calendar. -->\n<script\n src=\"https://cdn.rawgit.com/IonicaBizau/github-calendar/gh-pages/dist/github-calendar.min.js\"\n>\n</script>\n\n<!-- Optionally, include the theme (if you don't want to struggle to write the CSS) -->\n<link\n rel=\"stylesheet\"\n href=\"https://cdn.rawgit.com/IonicaBizau/github-calendar/gh-pages/dist/github-calendar.css\"\n/>\n\n<!-- Prepare a container for your calendar. -->\n<div class=\"calendar\">\n <!-- Loading stuff -->\n Loading the data just for you.\n</div>\n\n<script>\n new GitHubCalendar(\".calendar\", \"your-username\");\n</script>\n\nHere you can see it in action:\n\nBasically, since we need cross domain requests we need a proxy. It makes a request to GitHub profile page (github.com/<user>) and then brings back the needed stuff from there.\nFor more information, check out the documentation on GitHub."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "gitrevisions - Specifying revisions and ranges for Git The ... (three-dot) Symmetric Difference Notation"
},
{
"role": "assistant",
"content": "A similar notation r1...r2 is called symmetric difference\nof r1 and r2 and is defined as r1 r2 --not $(git merge-base --all r1 r2) .\nIt is the set of commits that are reachable from either one of r1 (left side) or r2 (right side) but not from both."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-rev-list - Lists commit objects in reverse chronological order --parents"
},
{
"role": "assistant",
"content": "Print also the parents of the commit (in the form \"commit parent…\").\nAlso enables parent rewriting, see History Simplification above."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Could not create work tree dir 'example.com'.: Permission denied\nI have got a virtual private server with nginx Virtual Hosts setup (Server Blocks).\nI've installed Git and got my ssh keys authenticated with GitHub.\nI have my website running in\n ~/var/www/example.com/public_html/\n\nI tried to run:\ngit clone [email protected]:example/example.co.uk.git\n\nto pull my files on GitHub to the /public_html/ directory but I get the error:\nfatal: could not create work tree dir 'example.com'.: Permission denied\n\nI've followed this tutorial including the same issue he has mentioned on the page, but it still won't work: http://machiine.com/2013/pulling-a-git-repo-from-github-to-your-ubuntu-server/\nI'm completely new to this, so your help would be much appreciated!"
},
{
"role": "assistant",
"content": "I think you don't have your permissions set up correctly for /var/www\nChange the ownership of the folder.\nsudo chown -R $USER /var/www"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-config - Get and set repository or global options pushAlreadyExists"
},
{
"role": "assistant",
"content": "Shown when git-push rejects an update that\ndoes not qualify for fast-forwarding (e.g., a tag.)"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-log - Show commit logs --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 checkout all the files\nHow can I get rid of all the changes in all the files of my repository?\nSay I am in a branch and I did some changes. git status returns a set of files in the \"Changes not staged for commit\" and I notice I would like to get rid of all of these changes in all the files. How can I do this with a single command?\nI know I can do the following to checkout just one file:\ngit checkout -- <file>\n\nI noticed that git checkout -- alone returns the list of all uncommited files. However, I cannot find a way to checkout all of them, something like git checkout --all.\nI checked man git checkout and could not find anything. Also I saw Git: Checkout all files except one and tried git checkout . and did not work either.\nWould I have to do it programmatically, by looping through the git checkout -- output?"
},
{
"role": "assistant",
"content": "If you are at the root of your working directory, you can do git checkout -- . to check-out all files in the current HEAD and replace your local files.\nYou can also do git reset --hard to reset your working directory and replace all changes (including the index)."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-cherry-pick - Apply the changes introduced by some existing commits --abort"
},
{
"role": "assistant",
"content": "Cancel the operation and return to the pre-sequence state."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Git says remote ref does not exist when I delete remote branch\nI ran git branch -a \n* master\n remotes/origin/test\n remotes/origin/master\n\nI want to delete my remote branch \nI've tried \ngit push origin --delete remotes/origin/test\n\nI got \n\nerror: unable to delete 'remotes/origin/test': remote ref does not\n exist\n\nHow is it not exist ? \nI did a git branch -a, and I saw it listed. \nDid I miss anything ?"
},
{
"role": "assistant",
"content": "The command git branch -a shows remote branches that exist in your local repository. This may sound a bit confusing but to understand it, you have to understand that there is a difference between a remote branch, and a branch that exists in a remote repository. Remote branches are local branches that map to branches of the remote repository. So the set of remote branches represent the state of the remote repository.\nThe usual way to update the list of remote branches is to use git fetch. This automatically gets an updated list of branches from the remote and sets up remote branches in the local repository, also fetching any commit objects you may be missing.\nHowever, by default, git fetch does not remove remote branches that no longer have a counterpart branch on the remote. In order to do that, you explicitly need to prune the list of remote branches:\ngit fetch --prune\n\nThis will automatically get rid of remote branches that no longer exist on the remote. Afterwards, git branch -r will show you an updated list of branches that really exist on the remote: And those you can delete using git push.\nThat being said, in order to use git push --delete, you need to specify the name of the branch on the remote repository; not the name of your remote branch. So to delete the branch test (represented by your remote branch origin/test), you would use git push origin --delete test."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-ls-tree - List the contents of a tree object path"
},
{
"role": "assistant",
"content": "The pathname of the object."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Gitlab Continuous Integration npm Background Process\n\nI have a setup of gitlab ci where I want to start a local npm server for testing in the background. My .gitlab-ci.yml is like:\nstages:\n - setup\n - build\n - test\n\ncache:\n paths:\n - venv/\n - node_modules/\n\nsetup_nvm:\n stage: setup\n script:\n - \"echo installing npm and phantomJS via nvm\"\n - \"git clone https://github.com/creationix/nvm.git ~/.nvm && cd ~/.nvm && git checkout `git describe --abbrev=0 --tags`\"\n - \". ~/.nvm/nvm.sh\"\n - \"nvm install 5.0\"\n - \"nvm use 5.0\"\n - \"npm install\"\n - \"nohup npm run dev &\" # HERE I TRY TO RUN THE SERVER IN THE BACKGROUND\n\nsetup_python:\n stage: setup\n script:\n - \"echo installing python dependencies in virtual environment\"\n - \"[ ! -d venv ] && virtualenv -p python3 venv\"\n - \"source venv/bin/activate\"\n - \"pip3 install -r requirements.txt\"\n\nbuild_multilang:\n stage: build\n script:\n - \"[ ! -d tu9onlinekurstest ] && make -f tools/makefiles/multilang\"\n\ndo_tests:\n stage: test\n script:\n - \"cd src/test\"\n - \"python -m unittest\"\n\nHowever the job halts and setup_python is never started and in status pending forever. I thought that jobs would be executed in parallel (according to gitlab runner docs). Do you have experience in running background tasks with gitlab runner?"
},
{
"role": "assistant",
"content": "According to Tomasz Maczukin on a related GitLab issue:\n\nI think the best solution would be to use some service manager\n (systemd, runit, upstart, sysv - whatever is present on this system).\nOn the server you should prepare configuration file to start the\n service. Then in CI job you would do e.g. systemctl start tomcat. This\n command is expected to exit just after calling and it's service\n manager (outside of Runner's scope) who starts the process.\nProcess started with Runner, even if you add nohup and & at the end, is marked with process group ID. When job is finished Runner is\n sending kill signal to whole process group. So any process started\n directly from CI job will be terminated at job end. Using service\n manager you're not starting the process in context of Runner's job.\n Your only notifying a manager to start a process using prepared\n configuration :)"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to push changes to github without pull\nI developed a project that was been developed by another developers. I sent my code to the previous developers to make changes in their code but they said that they have never worked with git, so they added changes to the project and it is now the actual version but not under version control.\nSo, I already have commits in github and I need to push this new version.\nWhat I did:\n\ngit init\ngit remote add origin\ngit add .\ngit push origin master\n\nBut there is an problem: I can't push new changes before updating the local repo. If I update my repo it will return all the files that the previous developers have deleted.\nHow do I push the current version without pulling data from git?"
},
{
"role": "assistant",
"content": "You can do a forced push.\ngit push -f origin branch_name\n\nThe forced push will erase all commit history of the remote repository's branch, and replace it to your branch.\nCheck the answers for doing forced pushes in \"How do I properly force a Git push?\". Forced push can have unintended consequences as mentioned in \"Git: How to ignore fast forward and revert origin [branch] to earlier commit?\", so check for the same.\nThe forced push will be an incorrect way to push stuff in your case, since you already have previous commits on GitHub, and this will erase the commit history for previous commits.\nHence, to preserve your commit history, you can do the following things:\nRemove all the files from the git repository, and then add the new files here, and then commit the updated files:\ngit rm -rf .\ncp -r path/to/updated/code/* .\ngit add .\n\nDoing a git status now will tell you which files the other developers modified, and a git diff will show what modifications are there. \nIf a file has remain unchanged, then git rm and git add will nullify the effect of each other.\nThe files which those developers deleted remain deleted since you ran the git rm for them but no git add.\nOnce you are satisfied that these indeed are the changes, you can commit using\ngit commit -m \"Merged new code\"\n\nPotential gotchas:\n\nOnly the file mode has changed (755 <=> 644) - depending on what code the other developers sent you.\nYou will lose your .gitignore file with git rm -rf . (and similarly .gitattributes and other such files). Reset HEAD for each such files using git reset HEAD .gitignore before the commit.\nDifferent line terminating characters (in case different development environments are being used), So check for them appropriately."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Deploy a project using Git push\nIs it possible to deploy a website using git push? I have a hunch it has something to do with using git hooks to perform a git reset --hard on the server side, but how would I go about accomplishing this?"
},
{
"role": "assistant",
"content": "I found this script on this site and it seems to work quite well.\n\nCopy over your .git directory to your web server\nOn your local copy, modify your .git/config file and add your web server as a remote:\n[remote \"production\"]\n url = username@webserver:/path/to/htdocs/.git\n\nOn the server, replace .git/hooks/post-update with this file (in the answer below)\nAdd execute access to the file (again, on the server):\nchmod +x .git/hooks/post-update\n\nNow, just locally push to your web server and it should automatically update the working copy:\ngit push production"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git diff: what is the difference between --cached and --staged\nTo compare the staged with the last commit:\ngit diff --cached\ngit diff --staged\n\nBoth commands generate the same results, right?"
},
{
"role": "assistant",
"content": "The documentation for git diff says \"--staged is a synonym of --cached\", so yes."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How can I search for a commit message on GitHub?\n\nNot in a Git repository, but rather in GitHub specifically - how do I search just the commit messages of a specific repository/branch?"
},
{
"role": "assistant",
"content": "You used to be able to do this, but GitHub removed this feature at some point mid-2013. To achieve this locally, you can do:\ngit log -g --grep=STRING\n\n(Use the -g flag if you want to search other branches and dangling commits.)\n-g, --walk-reflogs\n Instead of walking the commit ancestry chain, walk reflog entries from\n the most recent one to older ones."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-pull - Fetch from and integrate with another repository or a local branch -s <strategy> --strategy=<strategy>"
},
{
"role": "assistant",
"content": "Use the given merge strategy; can be supplied more than\nonce to specify them in the order they should be tried.\nIf there is no -s option, a built-in list of strategies\nis used instead ( ort when merging a single head, octopus otherwise)."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-format-patch - Prepare patches for e-mail submission -C[<n>] --find-copies[=<n>]"
},
{
"role": "assistant",
"content": "Detect copies as well as renames. See also --find-copies-harder .\nIf n is specified, it has the same meaning as for -M<n> ."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Git pull till a particular commit\n\nI want to do a git pull but only till a specific commit.\n A->B->C->D->E->F (Remote master HEAD)\n\nso suppose my local master HEAD points to B, and I want to pull till E. What should I do ?\nThis is not pulling a specific commit, this is pulling upto a specific commit."
},
{
"role": "assistant",
"content": "git pull is nothing but git fetch followed by git merge. So what you can do is\ngit fetch remote example_branch\ngit merge <commit_hash>"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "GitLab: How to include the previous job's artifacts as release assets?\n\nThe task create:release creates a new release. How do we add the artifact core.zip in task create:release?\nprepare:release:\n stage: prepare_release\n before_script:\n - echo \"Setting up packages for Build\"\n - apk --no-cache add zip\n script:\n - echo \"Preparing release\"\n - echo \"Build Core\"\n - yarn --cwd ./core/ install && yarn --cwd ./core/ build\n - echo \"Zip distribution folder for Core\"\n - zip -r core.zip ./core/dist ./core/node_modules ./core/package.json\n artifacts:\n paths:\n - core.zip\n expire_in: never\n\ncreate:release:\n stage: release\n image: registry.gitlab.com/gitlab-org/release-cli:latest\n needs:\n - job: prepare:release\n artifacts: true\n variables:\n TAG: '$CI_COMMIT_SHA'\n script:\n - echo \"Create Release $TAG\"\n release:\n name: 'Release $TAG'\n tag_name: '$TAG'\n ref: '$TAG'\n description: 'Release $TAG'"
},
{
"role": "assistant",
"content": "I have resolved this. In prepare:release job, save the job id in an environment file and this file should be in the artifacts.reports.env of this job. Later, in the create:release job, use the API \"https://gitlab.com/<namespace>/<project_name>/-/jobs/<job_id>/artifacts/download\" to refer to the artifact.\nUpdated pipeline:\nprepare:release:\n stage: prepare_release\n before_script:\n - echo \"Setting up packages for Build\"\n - apk --no-cache add zip\n script:\n - echo \"Preparing release\"\n - echo \"Build Core\"\n - yarn --cwd ./core/ install && yarn --cwd ./core/ build\n - echo \"Zip distribution folder for Core\"\n - zip -r core.zip ./core/dist ./core/node_modules ./core/package.json\n after_script:\n - echo \"JOB_ID=$CI_JOB_ID\" >> job.env\n artifacts:\n paths:\n - core.zip\n expire_in: never\n reports:\n dotenv: job.env\n\ncreate:release:\n stage: release\n image: registry.gitlab.com/gitlab-org/release-cli:latest\n needs:\n - job: prepare:release\n artifacts: true\n variables:\n TAG: '$CI_COMMIT_SHA'\n script:\n - echo \"Create Release $TAG\"\n - echo $JOB_ID \n release:\n name: 'Release $TAG'\n tag_name: '$TAG'\n ref: '$TAG'\n description: 'Release $TAG'\n assets:\n links:\n - name: \"core.zip\"\n url: \"https://gitlab.com/<namespace>/<project_name>/-/jobs/$JOB_ID/artifacts/download\""
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "What does \"T\" mean in \"git status\"? (it isn't in the man page)\nWhen I type git status I see:\nT /path/to/file...\nM /path/to/otherfile...\n\nWhat exactly does the T git status mean?\nI tried man git-status (I think it should be there, but isn't)."
},
{
"role": "assistant",
"content": "It means that the type of a file changed. For example, a symbolic link that became a regular file.\nAs far as I know, this only applies to symlinks, submodules and regular files\nEdit\nA source was requested for this information. While this is simply information that's in my head, I was able to find a few references to it on the internet. The most prominent one was a git changelog mentioning \"T\" as a type change and \"D\" as a deletion.\nEdit 2 (updating this because it's my highest rating answer so far)\nAs pointed out by @PhilipOakley, man git-diff-files actually does show this information.\n\nPossible status letters are:\n\nA: addition of a file\nC: copy of a file into a new one\nD: deletion of a file\nM: modification of the contents or mode of a file\nR: renaming of a file\nT: change in the type of the file\nU: file is unmerged (you must complete the merge before it can be committed)\nX: \"unknown\" change type (most probably a bug, please report it)\n\n\nAs pointed out by @Mat, it's also in diff.h, line 289:\n#define DIFF_STATUS_TYPE_CHANGED 'T'\n\nAnd in wt-status.c, line 282:\ncase DIFF_STATUS_TYPE_CHANGED:\n status_printf_more(s, c, _(\"typechange: %s\"), one);\n break;"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to get pull request number within GitHub Actions workflow\n\nI want to access the Pull Request number in a Github Actions workflow. I can access the GITHUB_REF environment variable that is available. Although on a Pull Request action it has the value: refs/pull/125/merge. I need to extract just the 125.\nI have found a similar post here that shows how to get the current branch using this variable. Although in this case, what I am parsing is different and I have been unable to isolate the Pull Request number.\n\nI have tried using {GITHUB_REF##\\*/} which resolves to merge\nI have also tried {GITHUB_REF#\\*/} which resolves to pull/125/merge\n\nI only need the Pull Request number (which in my example is 125)"
},
{
"role": "assistant",
"content": "Although it is already answered, the easiest way I found is using the github context. The following example shows how to set it to an environment variable.\nenv:\n PR_NUMBER: ${{ github.event.number }}"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-worktree - Manage multiple working trees list"
},
{
"role": "assistant",
"content": "List details of each worktree. The main worktree is listed first,\nfollowed by each of the linked worktrees. The output details include\nwhether the worktree is bare, the revision currently checked out, the\nbranch currently checked out (or \"detached HEAD\" if none), \"locked\" if\nthe worktree is locked, \"prunable\" if the worktree can be pruned by the prune command."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Change Default branch in gitlab\n\nI accidentally pushed my local master to a branch called origin on gitlab and now it is the default. Is there a way to rename this branch or set a new master branch to master?"
},
{
"role": "assistant",
"content": "Updated:\nPrerequisites:\n\nYou have the Owner or Maintainer role in the project.\n\nTo update the default branch for an individual project:\n\nOn the left sidebar, select Search or go to find your project.\nSelect Settings > Repository.\nExpand Branch defaults. For Default branch, select a new default branch.\nOptional. Select the Auto-close referenced issues on default branch checkbox to close issues when a merge request uses a closing pattern.\nSelect Save changes.\n\n\nTo change a default branch name for an instance or group:\n\nOn the left sidebar, at the bottom, select Admin Area.\nSelect Settings > Repository.\nExpand Default branch.\nFor Initial default branch name, select a new default branch.\nSelect Save changes."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to enable code coverage output in job list for PHP project on gitlab.com\n\nFor a project hosted at https://www.gitlab.com I would like to setup code coverage in the CI setup, so it can be displayed in the job list\n\nMy configuration looks like this: \n.gitlab-ci.yml\nimage: php:7.1.1\n\ncache:\n paths:\n - vendor/\n\nbefore_script:\n# Install git, the php image doesn't have installed\n- apt-get update -yqq\n- apt-get install git -yqq\n\n# Install composer\n- curl -sS https://getcomposer.org/installer | php\n\n# Install all project dependencies\n- php composer.phar install\n\n# Run our tests\ntest:\n only:\n - master\n - develop\n script:\n - vendor/bin/phpunit --configuration phpunit.xml --coverage-text --colors=never\n\nThe job succeeds, but shows the error message \nError: No code coverage driver is available\n\nI have updated the setting for Test coverage parsing and set the regex to \n^\\s*Lines:\\s*\\d+.\\d+\\%\n\nthe example for PHP/PHPUnit.\nWhen I run the command \nvendor/bin/phpunit --coverage-text --colors=never\n\nlocally, I get the following output:\nCode Coverage Report: \n 2017-06-21 14:52:55 \n\n Summary: \n Classes: 100.00% (4/4) \n Methods: 100.00% (14/14)\n Lines: 100.00% (43/43)\n\n\\Rodacker\\CartExample::Article\n Methods: 100.00% ( 6/ 6) Lines: 100.00% ( 11/ 11)\n\\Rodacker\\CartExample::ArticleLoader\n Methods: 100.00% ( 2/ 2) Lines: 100.00% ( 21/ 21)\n\\Rodacker\\CartExample::ArticleRepository\n Methods: 100.00% ( 3/ 3) Lines: 100.00% ( 6/ 6)\n\\Rodacker\\CartExample::Image\n Methods: 100.00% ( 3/ 3) Lines: 100.00% ( 5/ 5)"
},
{
"role": "assistant",
"content": "The problem was the missing Xdebug installation in the docker image. I could not install a proper version using apt-get, so I had to add a pecl install xdebug call in the before_script section:\nimage: php:7.1.1\n\ncache:\n paths:\n - vendor/\n\nbefore_script:\n# Install git, the php image doesn't have installed\n- apt-get update -yqq\n- apt-get install git -yqq\n\n# Install Xdebug\n- pecl install xdebug\n- docker-php-ext-enable xdebug\n\n# Install composer\n- curl -sS https://getcomposer.org/installer | php\n\n# Install all project dependencies\n- php composer.phar install\n\n# Run our tests\ntest:\n only:\n - master\n script:\n - vendor/bin/phpunit --configuration phpunit.xml --coverage-text --colors=never"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to force push a reset to remote repository?\nOur remote master branch somehow got messed up. Current development code is on the master branch along with the latest commits. Obviously, the development code is not ready for the master branch.\nSo on my local repository, I did a reset to the latest tag, git reset --hard (Tag). The master branch is now correct on my local repository. Now when I try to push the changes on to the remote repository, git push origin master, I get an error:\nTo (REMOTE GIT REPOSITORY LOCATION)\n ! [rejected] master -> master (non-fast-forward)\nerror: failed to push some refs to '(REMOTE GIT REPOSITORY LOCATION)'\nTo prevent you from losing history, non-fast-forward updates were rejected\nMerge the remote changes (e.g. 'git pull') before pushing again. See the\n'Note about fast-forwards' section of 'git push --help' for details.\n\nSo after looking around I found out the --force option. So I did a force push on to the remote repository, git push --force origin master, and I still got an error:\nTotal 0 (delta 0), reused 0 (delta 0)\nremote: error: denying non-fast-forward refs/heads/master (you should pull first)\nTo (REMOTE GIT REPOSITORY LOCATION)\n ! [remote rejected] master -> master (non-fast-forward)\nerror: failed to push some refs to '(REMOTE GIT REPOSITORY LOCATION)'\n\nI can't do a pull on master, because it contains development code which can't be on master."
},
{
"role": "assistant",
"content": "The message means that you're not allowed to do non-fast-forward push.\nYour remote repository has most likely denyNonFastforwards = true in its config. If you change that, git push --force should work.\nTo change the setting, you need access to the machine with the remote repository. From there, do git config receive.denynonfastforwards false."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-config - Get and set repository or global options tag.forceSignAnnotated"
},
{
"role": "assistant",
"content": "A boolean to specify whether annotated tags created should be GPG signed.\nIf --annotate is specified on the command line, it takes\nprecedence over this option."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Git pull is very slow... Why?\nNote I have studied the git-is-very-very-slow question, but in their case the reason was big binary files - while in my repository there is PHP/JS/HTML/CSS only code (no binaries) and the biggest file in the repository is around 800 KB.\nI've changed one file (a few lines), then git add . and git commit -m \"msg\", then git push origin master.\nOn some other machine, when I do git pull origin master it downloads a few MiB of data, and it takes more than 2 minutes to calculate the delta and apply changes. Something is terribly wrong here.\nI suspect some recent operations may cause this:\nrecently, I've accidentally added many vendor assets (bower_components assets)\nwhen I realized it, I've used git rm to remove them from repository (and ofcourse, git add, git commit and git push to upstream).\nThat was a few days ago and the problems I have right now started happeing around that time.\nI have two questions:\n\nWhy this is happeing?\nHow can I fix my repository?\n\nNote: I am the only one useing and pushing to this repo."
},
{
"role": "assistant",
"content": "I had the same issue. For me this was a IPv4/IPv6 issue. I fixed it forcing SSH to use IPv4.\nSet \"AddressFamily inet\" in /etc/ssh/ssh_config to force IPv4 connection. Then restart ssh client sudo service ssh restart\nMore info here."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Edit the root commit in Git?\nThere's ways to change the message from later commits:\ngit commit --amend # for the most recent commit\ngit rebase --interactive master~2 # but requires *parent*\n\nHow can you change the commit message of the very first commit (which has no parent)?"
},
{
"role": "assistant",
"content": "As of Git version 1.7.12, you may now use\ngit rebase -i --root\n\nDocumentation"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "What exactly does the \"u\" do? \"git push -u origin master\" vs \"git push origin master\"\nI'm apparently terrible at using git, despite my best attempts to understand it. \nFrom kernel.org for git push:\n\n-u\n--set-upstream\nFor every branch that is up to date or successfully pushed, add upstream (tracking) reference, used by argument-less git-pull(1) and other commands. For more information, see branch.<name>.merge in git-config(1).\n\nHere's branch.<name>.merge from git config:\n\nbranch.<name>.merge\nDefines, together with branch.<name>.remote, the upstream branch for the given branch. It tells git fetch/git pull which branch to merge and can also affect git push (see push.default). When in branch <name>, it tells git fetch the default refspec to be marked for merging in FETCH_HEAD. The value is handled like the remote part of a refspec, and must match a ref which is fetched from the remote given by \"branch.<name>.remote\". The merge information is used by git pull (which at first calls git fetch) to lookup the default branch for merging. Without this option, git pull defaults to merge the first refspec fetched. Specify multiple values to get an octopus merge. If you wish to setup git pull so that it merges into <name> from another branch in the local repository, you can point branch.<name>.merge to the desired branch, and use the special setting . (a period) for branch.<name>.remote.\n\nI successfully set up a remote repository with github, and I successfully pushed my first commit to it with:\ngit push -u origin master\n\nThen, I unwittingly successfully pushed my second commit to my remote repository using:\ngit commit -m '[...]'\n\nHowever, incorrectly thinking I would have to push again to origin from master, I ran:\n# note: no -u\ngit push origin master\n\nWhat did that do? It didn't seem to have any effect at all. Did I \"undo\" git push -u origin master?"
},
{
"role": "assistant",
"content": "The key is \"argument-less git-pull\". When you do a git pull from a branch, without specifying a source remote or branch, git looks at the branch.<name>.merge setting to know where to pull from. git push -u sets this information for the branch you're pushing.\nTo see the difference, let's use a new empty branch:\n$ git checkout -b test\n\nFirst, we push without -u:\n$ git push origin test\n$ git pull\nYou asked me to pull without telling me which branch you\nwant to merge with, and 'branch.test.merge' in\nyour configuration file does not tell me, either. Please\nspecify which branch you want to use on the command line and\ntry again (e.g. 'git pull <repository> <refspec>').\nSee git-pull(1) for details.\n\nIf you often merge with the same branch, you may want to\nuse something like the following in your configuration file:\n\n [branch \"test\"]\n remote = <nickname>\n merge = <remote-ref>\n\n [remote \"<nickname>\"]\n url = <url>\n fetch = <refspec>\n\nSee git-config(1) for details.\n\nNow if we add -u:\n$ git push -u origin test\nBranch test set up to track remote branch test from origin.\nEverything up-to-date\n$ git pull\nAlready up-to-date.\n\nNote that tracking information has been set up so that git pull works as expected without specifying the remote or branch.\nUpdate: Bonus tips:\n\nAs Mark mentions in a comment, in addition to git pull this setting also affects default behavior of git push. If you get in the habit of using -u to capture the remote branch you intend to track, I recommend setting your push.default config value to upstream.\ngit push -u <remote> HEAD will push the current branch to a branch of the same name on <remote> (and also set up tracking so you can do git push after that)."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Status from gitlab-ci not showing up anymore on gitlab merge request\n\nGitlab-CI works perfectly as far as I can tell. It runs and does everything as it should, but gitlab itself doesn't show the status.\nAll I keep seeing is \"Checking for CI status for x\" with the spinner standing still.\nThe only clue I get is from the gitlab production.log when I open the page:\nOpenSSL::SSL::SSLError (SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed):\n app/models/project_services/gitlab_ci_service.rb:39:in `commit_status'\n app/controllers/projects/merge_requests_controller.rb:165:in `ci_status'\n app/controllers/application_controller.rb:57:in `set_current_user_for_thread'\n\nThis is odd to say the least. Everything else works fine, so it doesn't seem systemic to gitlab as a whole.\nGitlab details:\nGitLab 6.6.4\nGitLab Shell 1.8.4\nGitLab API v3\nRuby 1.9.3p194\nRails 4.0.3\nGitLab CI 4.3.0 267edb0\n\nI searched around and did not find similar problems. It's puzzling since it stopped working after an upgrade from 6.something to 6.6.4 in gitlab. This is not a critical piece, but removes some of the easy use of the CI server."
},
{
"role": "assistant",
"content": "Maybe you're using self-signed certificates? I had to patch my Gitlab CI like this and then set config.verify_ssl = false.\nEdit: maybe I should make a pull request out of it? :)"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-log - Show commit logs patience"
},
{
"role": "assistant",
"content": "Use \"patience diff\" algorithm when generating patches."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Reverting to a previous commit in Git for visual studio 2012\nI am really new to git and source control.\nI am using visual studio tools for git with vs2012.\nI am on some commit and want to go back to some previous commit but i cannot seem to do it how. When i go to the commit details the revert button seems to have been grayed out.\nI have stuck on this problem for the last 2 hours. I have researched the internet but to no use. Please can somebody tell me how to revert to a previous commit.\nThanks."
},
{
"role": "assistant",
"content": "Visual Studio 2015 Update 2 adds support for GIT \"Reset\", which is what you probably want to do:\n\nopen history\nright click the commit you want to revert to\nreset -> reset and delete changes"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-show - Show various types of objects --no-ext-diff"
},
{
"role": "assistant",
"content": "Disallow external diff drivers."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Cannot connect to the Docker daemon at tcp://localhost:2375/. Is the docker daemon running. On GitLab\n\nI'm trying to build the CI pipeline in GitLab. I'd like to ask about making the docker work in GitLab CI.\nFrom this issue: https://gitlab.com/gitlab-org/gitlab-runner/issues/4501#note_195033385\nI'm follow the instruction for both ways. With TLS and not used TLS.\nBut It's still stuck. Which in same error\nCannot connect to the Docker daemon at tcp://localhost:2375/. Is the docker daemon running\n\nI've try to troubleshooting this problem. follow by below,\n\nenable TLS\n\nWhich used .gitlab-ci.yml and config.toml for enable TLS in Runner.\nThis my .gitlab-ci.yml:\nimage: docker:19.03\nvariables:\n DOCKER_HOST: tcp://localhost:2375/\n DOCKER_DRIVER: overlay2\n DOCKER_TLS_CERTDIR: \"/certs\"\n IMAGE_NAME: image_name\n\nservices:\n - docker:19.03-dind\n\nstages:\n - build\n\npublish:\n stage: build\n script:\n - docker build -t$IMAGE_NAME:$(echo $CI_COMMIT_SHA | cut -c1-10) .\n - docker push $IMAGE_NAME:$(echo $CI_COMMIT_SHA | cut -c1-10)\n only:\n - master \n\nAnd this my config.toml:\n[[runners]]\n name = MY_RUNNER\n url = MY_HOST\n token = MY_TOKEN_RUNNER\n executor = \"docker\"\n [runners.custom_build_dir]\n [runners.docker]\n tls_verify = false\n image = \"docker:stable\"\n privileged = true\n disable_entrypoint_overwrite = false\n oom_kill_disable = false\n disable_cache = false\n volumes = [\"/certs/client\", \"/cache\"] \n shm_size = 0\n\n\nDisable TLS\n\n.gitlab-ci.yml:\nimage: docker:18.09\nvariables:\n DOCKER_HOST: tcp://localhost:2375/\n DOCKER_DRIVER: overlay2\n DOCKER_TLS_CERTDIR: \"\"\n IMAGE_NAME: image_name\n\nservices:\n - docker:18.09-dind\n\nstages:\n - build\n\npublish:\n stage: build\n script:\n - docker build -t$IMAGE_NAME:$(echo $CI_COMMIT_SHA | cut -c1-10) .\n - docker push $IMAGE_NAME:$(echo $CI_COMMIT_SHA | cut -c1-10)\n only:\n - master \n\nAnd this my config.toml:\n[[runners]]\n environment = [\"DOCKER_TLS_CERTDIR=\"]\n\nAnyone have idea?\n\nSolution\nYou can see at the accepted answer. Moreover, In my case and\nanother one. Looks like the root cause it from the Linux server that\nGitLab hosted doesn't has permission to connect Docker. Let's check\nthe permission connectivity between GitLab and Docker on your server."
},
{
"role": "assistant",
"content": "You want to set DOCKER_HOST to tcp://docker:2375. It's a \"service\", i.e. running in a separate container, by default named after the image name, rather than localhost.\nHere's a .gitlab-ci.yml snippet that should work:\n# Build and push the Docker image off of merges to master; based off\n# of Gitlab CI support in https://pythonspeed.com/products/pythoncontainer/\ndocker-build:\n stage: build\n\n image:\n # An alpine-based image with the `docker` CLI installed.\n name: docker:stable\n\n # This will run a Docker daemon in a container (Docker-In-Docker), which will\n # be available at thedockerhost:2375. If you make e.g. port 5000 public in Docker\n # (`docker run -p 5000:5000 yourimage`) it will be exposed at thedockerhost:5000.\n services:\n - name: docker:dind\n alias: thedockerhost\n\n variables:\n # Tell docker CLI how to talk to Docker daemon; see\n # https://docs.gitlab.com/ee/ci/docker/using_docker_build.html#use-docker-in-docker-executor\n DOCKER_HOST: tcp://thedockerhost:2375/\n # Use the overlayfs driver for improved performance:\n DOCKER_DRIVER: overlay2\n DOCKER_TLS_CERTDIR: \"\"\n\n script:\n # Download bash:\n - apk add --no-cache bash python3\n # GitLab has a built-in Docker image registry, whose parameters are set automatically.\n # See https://docs.gitlab.com/ee/ci/docker/using_docker_build.html#using-the-gitlab-contai\n #\n # CHANGEME: You can use some other Docker registry though by changing the\n # login and image name.\n - docker login -u \"$CI_REGISTRY_USER\" -p \"$CI_REGISTRY_PASSWORD\" \"$CI_REGISTRY\"\n - docker build -t \"$CI_REGISTRY_IMAGE\" .\n - docker push \"$CI_REGISTRY_IMAGE\"\n\n # Only build off of master branch:\n only:\n - master"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "What does git sync do in VSCode\nWhat commands are actually run when you Synchronise Changes in Visual Studio Code?"
},
{
"role": "assistant",
"content": "From the VSCode online help:\n\nGiven that your repository is connected to some remote and that your checked out branch has an upstream link to a branch in that remote, VS Code offers you useful actions to push, pull and sync that branch (the latter will run a pull command followed by a push command).\n\nIt appears that if you run synchronize changes on a given branch, it will do the following:\ngit pull origin someBranch\ngit push origin someBranch\n\nPer the comment by @FelikZ one way to make pull --rebase the default behavior for git pull would be to configure your .gitconfig file by adding the following:\n[pull]\n rebase = true\n\nThen, when the VSCode plugin issues a git pull, it should use the rebase strategy by default. If you follow the above link and scroll to the section \"Git patch/diff mode,\" you will see a screen capture which actually shows configuring Git for pulling via rebase.\nUpdate: As of v1.28 there is now a git.rebaseWhenSync setting. From the release notes:\n\nThe git.rebaseWhenSync setting will let you configure the Sync command to always use rebase instead of merge when running."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "What is Git pruning?\nI've accidentally pruned some remote branches and I don't really know what the consequence of this is (I clicked the \"Prune remote branches\" button in Git Extensions, thinking it would delete a remote branch).\nThe official documentation says \"git-prune - Prune all unreachable objects from the object database \". I don't really understand what this means. I'm guessing this might have removed merged branches but I'm not really sure."
},
{
"role": "assistant",
"content": "\"Prune remote branches\" in Git Extensions executes git remote prune command, which removes your local remote tracking branches where the branch no longer exists on the remote.\nSee here: https://git-scm.com/docs/git-remote#Documentation/git-remote.txt-empruneem\n\nDeletes stale references associated with <name>. By default, stale remote-tracking branches under <name> are deleted, but depending on global configuration and the configuration of the remote we might even prune local tags that haven’t been pushed there. Equivalent to git fetch --prune <name>, except that no new references will be fetched.\nSee the PRUNING section of git-fetch for what it’ll prune depending on various configuration.\nWith --dry-run option, report what branches would be pruned, but do not actually prune them."
}
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.