messages listlengths 3 3 |
|---|
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Git (GitHub) commit at past date\n\nI am working on a git project (hosted on GitHub) and using GitHub for Windows. Yesterday, I got a lot accomplished but GitHub for Windows bailed on me (says it cannot make a commit) and I was not able to commit.\nI do not want to lose my GitHub commit streak, so I was wondering if there was any way to commit in a past date and sync with my GitHub (if this is possible).\nAlso: I have staged my commits in the git-bash but have not committed yet."
},
{
"role": "assistant",
"content": "While the question \"How do I make a Git commit in the past?\" explains how to amend the commit author date:\ngit commit --amend --no-edit --date=\"Fri Nov 6 20:00:00 2015 -0600\" \n\n\nRun that after a commit to amend the last commit with the timestamp noted.\nThe --no-edit will leave the message as-is.\n\nThe OP asks:\n\nThat question does not specify the GitHub result... would it work in the same way?\n\nYes: multiple projects exist allowing you to generate and push commits \"done in the past\", in order to update your contribution chart.\nSee for instance contribution.io, github-contribution, or gitgardener.\nAll you need to do, is to push those amended commit on the master branch of your GitHub repo, as I mention here."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git - the stupid content tracker GIT_TRACE_REFS"
},
{
"role": "assistant",
"content": "Enables trace messages for operations on the ref database.\nSee GIT_TRACE for available trace output options."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-shortlog - Summarize git log output --since-as-filter=<date>"
},
{
"role": "assistant",
"content": "Show all commits more recent than a specific date. This visits\nall commits in the range, rather than stopping at the first commit which\nis older than a specific date."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-diff - Show changes between commits, commit and working tree, etc --binary"
},
{
"role": "assistant",
"content": "In addition to --full-index , output a binary diff that\ncan be applied with git-apply .\nImplies --patch ."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Git Submodule update over https\nI am sitting on a proxy which only allows http/https traffic only, I am able to clone a repository from Github, but I have to fetch/push using the https URL and username/password. \nNow my issues is a repository with submodules, when I execute git submodule update it times out, and I can only assume this is because it's using an SSH connection which is blocked. (it doesn't even ask me for a password on private repos)"
},
{
"role": "assistant",
"content": "Edit your .gitmodules file to use the HTTPS URL.\nRun git submodule sync to reflect the change to your .git/config file.\nRun the update command again.\nCommit and push the changes in your .gitmodules file.\n\nExample .gitmodules file:\n[submodule \"vendor/engines/fat_free_crm\"]\n path = vendor/engines/fat_free_crm\n url = https://github.com/fatfreecrm/fat_free_crm.git\n\nCredits: https://stackoverflow.com/a/6632693/1273077"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-diff-index - Compare a tree to the working tree or index --patience"
},
{
"role": "assistant",
"content": "Generate a diff using the \"patience diff\" algorithm."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git - the stupid content tracker GIT_NO_REPLACE_OBJECTS"
},
{
"role": "assistant",
"content": "Setting and exporting this environment variable tells Git to\nignore replacement refs and do not replace Git objects."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How do I fetch all Git branches?\nI cloned a Git repository containing many branches. However, git branch only shows one:\n$ git branch\n* master\n\nHow would I pull all the branches locally so when I do git branch, it shows the following?\n$ git branch\n* master\n* staging\n* etc..."
},
{
"role": "assistant",
"content": "TL;DR answer\ngit branch -r | grep -v '\\->' | sed \"s,\\x1B\\[[0-9;]*[a-zA-Z],,g\" | while read remote; do git branch --track \"${remote#origin/}\" \"$remote\"; done\ngit fetch --all\ngit pull --all\n\n(It seems that pull fetches all branches from all remotes, but I always fetch first just to be sure.)\nRun the first command only if there are remote branches on the server that aren't tracked by your local branches.\nComplete answer\nYou can fetch all branches from all remotes like this:\ngit fetch --all\n\nIt's basically a power move.\nfetch updates local copies of remote branches so this is always safe for your local branches BUT:\n\nfetch will not update local branches (which track remote branches); if you want to update your local branches you still need to pull every branch.\n\nfetch will not create local branches (which track remote branches), you have to do this manually. If you want to list all remote branches:\ngit branch -a\n\n\nTo update local branches which track remote branches:\ngit pull --all\n\nHowever, this can be still insufficient. It will work only for your local branches which track remote branches. To track all remote branches execute this oneliner BEFORE git pull --all:\ngit branch -r | grep -v '\\->' | sed \"s,\\x1B\\[[0-9;]*[a-zA-Z],,g\" | while read remote; do git branch --track \"${remote#origin/}\" \"$remote\"; done\n\nP.S. AFAIK git fetch --all and git remote update are equivalent.\n\n\nKamil Szot's comment, which folks have found useful.\n\nI had to use:\nfor remote in `git branch -r`; do git branch --track ${remote#origin/} $remote; done\n\nbecause your code created local branches named origin/branchname and\nI was getting \"refname 'origin/branchname' is ambiguous whenever I\nreferred to it."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "setting up gitlab LDAP-authentication without special gitlab user\n\nI want to set up Gitlab with our company's LDAP as a demo. But unfortunately I have to put in an admin password in gitlab.yml to make gitlab access the LDAP service. The problem actually is the administration, as they don't want to setup another account just for Gitlab. Is there any way to circumvent this without filling in my own password? Is there a way to make Gitlab establish the LDAP connection with only the provided user credentials?\nAny ideas beside logging in as anonymous?\nAlready posted here."
},
{
"role": "assistant",
"content": "I haven't tried it yet, but from the things I've build so far authenticating against LDAP and the informations from the config-file this user-account seems only to be needed when your LDAP does not support anonymous binding and searching. \nSo I would leave the two entries bind_dn and password commented out and try whether it works or not.\nUPDATE\nI've implemented LDAP-Autehntication in Gitlab and it's fairly easy. \nIn the gitlab.yml-file there is a section called ldap.\nThere you have to provide the informations to connect to your LDAP. It seems that all fields have to be given, there seems to be no fallback default! If you want to use anonymous binding for retrieval of the users DN supply an empty string for bind_dn and password. Commenting them out seems not to work! At least I got a 501 Error message.\nMore information can be found at https://github.com/patthoyts/gitlabhq/wiki/Setting-up-ldap-auth and (more outdated but still helpful) https://github.com/intridea/omniauth-ldap"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git log show one commit id only\nI need some help. It is possible to only show one commit id? Since git log -3 show the log from 1 - 3, I just want to show only 3. What possible command will match for it?\nI use the command\ngit log -3 --pretty=format:\"%h\"\n\nthe result is\nffbef87\ncf0e073\n1c76c5d\n\nI only want to display the 1c76c5d only."
},
{
"role": "assistant",
"content": "You can use git show referencing the third parent from your current commit (i.e. the second ancestor from HEAD). Also, git show accepts the same format string as git log:\ngit show HEAD~2 --pretty=format:\"%h\" --no-patch\n\nUpdate (2016-12-01)\nAn even better way would be to use the rev-parse plumbing command with the --short option to output the abbreviated (7 characters) commit SHA-1:\ngit rev-parse --short HEAD~2\n\nOr you could also specify the exact length of the commit SHA-1:\ngit rev-parse --short=4 HEAD~2"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-rev-list - Lists commit objects in reverse chronological order %ge"
},
{
"role": "assistant",
"content": "reflog identity email"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-update-index - Register file contents in the working tree to the index"
},
{
"role": "assistant",
"content": "NAME git-update-index - Register file contents in the working tree to the index"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-diff - Show changes between commits, commit and working tree, etc --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": "Can we re-trigger the gitlab pipeline?\n\nAfter creating merge request in GitLab, merge request got failed and jenkins has deleted the failed job logs due to retention period defined under jenkins job. Now, i want to re-trigger that specific merge request only from gitlab so that it will trigger the merge request job in jenkins. Is it possible ? If yes, how can i do the same ?\nP.S. There is a pipeline defined from Gitlab to Jenkins. Whenever a merge request get creates in gitlab, it triggers the Jenkins Merge Request job which merge the specific changes to the git master branch."
},
{
"role": "assistant",
"content": "Go to the merge request page.\nIn the tabs section (next to Overview), Go to the Pipelines tab.\nClick on the button Run pipeline."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-status - Show the working tree status --long"
},
{
"role": "assistant",
"content": "Give the output in the long-format. This is the default."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "What does 'git remote add upstream' help achieve?\nI was reading on:\nhttps://wiki.diasporafoundation.org/Git_workflow#Rebase_your_development_branch_on_the_latest_upstream\nHere is an extract:\n\nYour Repository Up to Date\nIn order to get the latest updates from the development trunk do a\n one-time setup to establish the main GitHub repo as a remote by\n entering:\n$ git remote add upstream git://github.com/diaspora/diaspora.git\n\nRebase Your Development Branch on the Latest Upstream\nTo keep your development branch up to date, rebase your changes on top\n of the current state of the upstream master. See the What’s\n git-rebase? section below to learn more about rebasing.\nIf you’ve set up an upstream branch as detailed above, and a\n development branch called 100-retweet-bugfix, you’d update upstream,\n update your local master, and rebase your branch from it like so:\n$ git fetch upstream\n\n$ git checkout master\n\n$ git rebase upstream/master\n\n$ git checkout 100-retweet-bugfix\n\n[make sure all is committed as necessary in branch]\n$ git rebase master\n\n\nWhy is adding a 'remote upstream' needed in this case? Coudn't I have just done:\n$ git checkout master\n\n$ git pull origin master\n\n$ git checkout 100-retweet-bugfix\n\n[make sure all is committed as necessary in branch]\n$ git rebase master"
},
{
"role": "assistant",
"content": "The wiki is talking from a forked repo point of view. You have access to pull and push from origin, which will be your fork of the main diaspora repo. To pull in changes from this main repo, you add a remote, \"upstream\" in your local repo, pointing to this original and pull from it.\nSo \"origin\" is a clone of your fork repo, from which you push and pull. \"Upstream\" is a name for the main repo, from where you pull and keep a clone of your fork updated, but you don't have push access to it."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-config - Get and set repository or global options --bool --int --bool-or-int --path --expiry-date"
},
{
"role": "assistant",
"content": "Historical options for selecting a type specifier. Prefer instead --type (see above)."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Undoing a git rebase --skip - reapply a commit during a rebase\nI'm doing a long git rebase with a lot of commits. I accidentally --skipped a commit where there were some conflicts which I resolved. I should have done git rebase --continue.\nIs there are way to re-apply this previous commit during this rebase phase and then continue the rebase?\nOne way I see is to \n\nstop the rebase at this point by creating a branch on the last commit which was correctly applied\nrestart the rebase starting with the previously skipped commit.\n\nOr can I do a cherry-pick whilst being in a rebase-phase?"
},
{
"role": "assistant",
"content": "Git is great because it saves a log of basically everything you commit.\n\nFind your commit in \".git/logs/HEAD\" and open in a text editor\nFind your SHA in the HEAD file\n\n3c8c... 2260dc... Full Name {[email protected]} 1471276956 -0600 commit: Saving Trial 1,2,3\n\nType (note type enough of the sha so git knows which one to pull):\n\ngit checkout -b recovery 2260d...\n\n\nSee link for reference: http://blog.screensteps.com/recovering-from-a-disastrous-git-rebase-mistake"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-rebase - Reapply commits on top of another base tip -S[<keyid>] --gpg-sign[=<keyid>] --no-gpg-sign"
},
{
"role": "assistant",
"content": "GPG-sign commits. The keyid argument is optional and\ndefaults to the committer identity; if specified, it must be\nstuck to the option without a space. --no-gpg-sign is useful to\ncountermand both commit.gpgSign configuration variable, and\nearlier --gpg-sign ."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Gitlab pipeline should stop on pipeline failure\n\nI have a sample pipeline in gitlab. i want the the pipe to stop if any of the jobs fail. below is the code am using to replicate the scenario. the pipe does show failure as the status but the jobs continue to run even after a failed stage. example in the picture attached.\n stages:\n - unittest\n - coverage_test\n - static_code_analysis\n\nvariables:\n skip_integration:\n value: 'false'\n description: \"This variable for skipping integration tests\"\n skip_migration:\n value: 'false'\n\nunittest:\n stage: unittest\n script:\n - echo \"testing the code\"\n rules:\n - if: '$CI_COMMIT_BRANCH == \"master\"' \n when: always\n - if: '$skip_integration == \"true\"'\n when: never \n - if: '$skip_integration == \"false\"'\n when: always\n\n \nlint_test:\n stage: static_code_analysis\n allow_failure: false\n script:\n - echo \"this is a test\"\n rules:\n - if: '$CI_COMMIT_BRANCH == \"master\"' \n when: always\n - if: '$skip_integration == \"true\"'\n when: never \n - if: '$skip_integration == \"false\"'\n when: always\n - when: on_success\n\ncoverage_test:\n stage: coverage_test\n script:\n - echo00 \"this is test again\"\n rules:\n - if: '$CI_COMMIT_BRANCH == \"master\"' \n when: always\n - if: '$skip_integration == \"true\"'\n when: never \n - if: '$skip_integration == \"false\"'\n when: always\n - when: on_success\n\nbut the pipe does not stop on failure."
},
{
"role": "assistant",
"content": "when: always\n\n\nAs the name implies, runs the job always. If you want to run the job when the previous stage succeeded, run it on_success. Change all always to on_success.\nwhen: on_success"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-reset - Reset current HEAD to the specified state Undo add"
},
{
"role": "assistant",
"content": "$ edit (1) $ git add frotz.c filfre.c\n$ mailx (2) $ git reset (3) $ git pull git://info.example.com/ nitfol (4) You are happily working on something, and find the changes\nin these files are in good order. You do not want to see them\nwhen you run git diff , because you plan to work on other files\nand changes with these files are distracting. Somebody asks you to pull, and the changes sound worthy of merging. However, you already dirtied the index (i.e. your index does\nnot match the HEAD commit). But you know the pull you are going\nto make does not affect frotz.c or filfre.c , so you revert the\nindex changes for these two files. Your changes in working tree\nremain there. Then you can pull and merge, leaving frotz.c and filfre.c changes still in the working tree."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-cat-file - Provide contents or details of repository objects --textconv"
},
{
"role": "assistant",
"content": "Show the content as transformed by a textconv filter. In this case, <object> has to be of the form <tree-ish>:<path> , or :<path> in\norder to apply the filter to the content recorded in the index at <path> ."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Git-svn: create & push a new branch/tag?\nAfter cloning an SVN repository using git-svn with the -s option (git svn clone http://server/repo -s), how does one create a branch or tag and have pushed to the relevant branch/tag directory in the repository when dcommiting?\nFor instance; if I were to use git to create a foobar branch locally (git checkout -b foobar) how can I have git-svn create the branch on the server (http://server/repo/branches/foobar)?\nI'm using Git 1.5.5.6.\n\nPlease Note:\nThe accepted method below does not work with Git 1.5.5.6 as there is no git svn branch method. I'm still looking for a solution to this that doesn't involve resolving to working with svn directly."
},
{
"role": "assistant",
"content": "You can read all the nitty-gritty details in this tutorial, but the gist is basically the following:\n$ git svn branch -m \"Topic branch\" my_topic # Create SVN branch called \"my_topic\"\n$ git checkout --track -b my-topic remotes/my_topic # Create the Git branch for \"my_topic\"\n# Hack hack hack...\n$ git svn dcommit --dry-run # Make sure you're committing to the right SVN branch\n$ git svn dcommit # Commit changes to \"my_topic\" branch in SVN"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "gitglossary - A Git Glossary superproject"
},
{
"role": "assistant",
"content": "A repository that references repositories\nof other projects in its working tree as submodules .\nThe superproject knows about the names of (but does not hold\ncopies of) commit objects of the contained submodules."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How does one find out one's own Repo ID?\n\nWhile I definitely am not the owner of this private repo, I have been using it as part of a group for a school project, and the teacher is simply asking for the Repo's ID when sending him emails concerning anything. I'm sorry if this is blatantly obvious to a lot of people, but for the life of me I could not find any clear notes on this via github or google. I am not using a GUI for my git, strictly through a linux shell.\nHow do I find out the ID of the current Repo?"
},
{
"role": "assistant",
"content": "If, like me, you were after the GitHub repository ID (as in - the number identifying the repo - not its name), then I found an easy way to do this via the metadata element on the main page of the repository on GitHub:\n\nView the page source (Right Click > View Page Source in Chrome or Firefox for example) \nSearch the page source and look for octolytics-dimension-repository_id. You should find something that looks like:\n<meta content=\"123456789\" name=\"octolytics-dimension-repository_id\" />\n\nIn this example, the ID of the repository is 123456789."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-config - Get and set repository or global options maintenance.commit-graph.auto"
},
{
"role": "assistant",
"content": "This integer config option controls how often the commit-graph task\nshould be run as part of git maintenance run --auto . If zero, then\nthe commit-graph task will not run with the --auto option. A\nnegative value will force the task to run every time. Otherwise, a\npositive value implies the command should run when the number of\nreachable commits that are not in the commit-graph file is at least\nthe value of maintenance.commit-graph.auto . The default value is\n100."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Git: What's the best practice to \"git clone\" into an existing folder?\nI have a working copy of the project, without any source control meta data. Now, I'd like to do the equivalent of git-clone into this folder, and keep my local changes.\ngit-clone doesn't allow me to clone into an existing folder. What is the best practice here?"
},
{
"role": "assistant",
"content": "This can be done by cloning to a new directory, then moving the .git directory into your existing directory.\nIf your existing directory is named \"code\".\ngit clone https://myrepo.com/git.git temp\nmv temp/.git code/.git\nrm -rf temp\n\nThis can also be done without doing a checkout during the clone command; more information can be found here."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "running git clone against AWS CodeCommits gets me a 403 error\nMy local laptop is a Mac.\n\nThe ssh key is configured properly. This is the content of ~/.ssh/config\n\nHost barthea\nHostname git-codecommit.us-east-1.amazonaws.com\nUser AVVVVVVVVVVVVVVVVVQ\nIdentityFile ~/.ssh/aws-aws.pem\n\nRunning ssh barthea gets me\nYou have successfully authenticated over SSH. You can use Git to interact with AWS CodeCommit. Interactive shells are not supported.Connection to git-codecommit.us-east-1.amazonaws.com closed by remote host.\n\n\nI created an IAM user bruce666 complete with password and access keys, made this user part of the \"team\" group.Then I created a policy that includes \"AWSCodeCommitPowerUsers\" and assigned this policy to \"team\". And finally assigned bruce666 to \"team\". At this point, bruce666 can access any repo in CodeCommit through the management console.\n\nI ran aws config --profile bruce666, fed in his access and secret key, his region and specified the format at json. At this point, I was able to create the rekha repo in CodeCommmit by running aws codecommit get-repository --repository-name rekha --profile bruce666\n\nI can create a couple of dummy files, run git init, git add . , git commit -m \"1\", git add origin https://git-gitcode.amzonaws.com/repos/v1/rekha , git push -u origin master And that operation will be successful.\n\nHowever, when I run git clone ssh://git-gitcode.amazonaws.com/repos/v1/rekha , I get \"fatal: unable to access 'https://git-codecommit.us-east-1.amazonaws.com/v1/repos/barthia/': The requested URL returned error: 403\" What gives?"
},
{
"role": "assistant",
"content": "On MAC, if above-mentioned tricks don't work, do the following:\n\nOpen Keychain Access\nSearch for CodeCommit. You should find this:\n\n\n\nSelect 'git-codecommit....' and press delete\nConfirm the delete.\n\nNow try again. It should work. You may have to do it again next time as well when you face the error 403.\nOne of the possible reason for this issue is the keychain password different than login password on your MAC."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How do I push a new local branch to a remote Git repository and track it too?\nHow do I:\n\nCreate a local branch from another branch (via git branch or git checkout -b).\n\nPush the local branch\nto the remote repository (i.e. publish), but make it\ntrackable so that git pull and git push will work."
},
{
"role": "assistant",
"content": "In Git 1.7.0 and later, you can checkout a new branch:\ngit checkout -b <branch>\n\nEdit files, add and commit. Then push with the -u (short for --set-upstream) option:\ngit push -u origin <branch>\n\nGit will set up the tracking information during the push."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "pull using git including submodule\nIn one of my iOS project I have add a sub-module added, lets say a friend of my wants to pull it including the submodule, how can he do this? Whenever I tried to download the zip file from github it doesn't pull the submodule along with it"
},
{
"role": "assistant",
"content": "That's by design. Get the submodules as a second step.\ngit clone git://url...\ncd repo\ngit submodule update --init\n\nThen afterwards, add another step after the git pull.\ngit pull ...\ngit submodule update --recursive\n\nOf course, this only works if the submodules are set up correctly in the first place..."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "'git push heroku master' is still asking for authentication\nI have executed:\n$ heroku login\n\nBut when I try to push, I'm still asked for authentication:\n$ git push heroku master\nUsername for 'https://git.heroku.com': <email>\nPassword for 'https://<email>@git.heroku.com':\n\nThen I get a WARNING: Do not authenticate with username and password using Git.\nI ran heroku login again and authenticated successfully but I still get the same failure.\nI've checked the remote:\n$ git remote -v\nheroku https://[email protected]/appname.git (fetch)\nheroku https://[email protected]/appname.git (push)\n\nI've also generated a new public key, passed it to Heroku, and validated it: https://devcenter.heroku.com/articles/keys\nI am on Windows 8, with Git 1.9.5."
},
{
"role": "assistant",
"content": "I got around this by logging in with the following : \nusername : email used to register to heroku (Also been able to leave this field blank)\npassword : heroku auth token (API Key)\nwhere the auth token can be retrieved by $ heroku auth:token or via the Account Settings in Heroku"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-diff-index - Compare a tree to the working tree or index -B[<n>][/<m>] --break-rewrites[=[<n>][/<m>]]"
},
{
"role": "assistant",
"content": "Break complete rewrite changes into pairs of delete and\ncreate. This serves two purposes: It affects the way a change that amounts to a total rewrite of a file\nnot as a series of deletion and insertion mixed together with a very\nfew lines that happen to match textually as the context, but as a\nsingle deletion of everything old followed by a single insertion of\neverything new, and the number m controls this aspect of the -B\noption (defaults to 60%). -B/70% specifies that less than 30% of the\noriginal should remain in the result for Git to consider it a total\nrewrite (i.e. otherwise the resulting patch will be a series of\ndeletion and insertion mixed together with context lines). When used with -M, a totally-rewritten file is also considered as the\nsource of a rename (usually -M only considers a file that disappeared\nas the source of a rename), and the number n controls this aspect of\nthe -B option (defaults to 50%). -B20% specifies that a change with\naddition and deletion compared to 20% or more of the file’s size are\neligible for being picked up as a possible source of a rename to\nanother file."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Changing source branch for PR on Github\n\nI accidentally created a pull request from the master-branch of my fork of a repo.\nWhile trying to rebase it I noticed that all of these changes were pushed into that pull request — due to the fact that you can simply Add more commits by pushing to the master branch on username/repo\n\nCan you change the source branch of a pull request after the pull request has been submitted?\n\nI see you can edit the base branch, but that's obviously not what I'm after."
},
{
"role": "assistant",
"content": "AFAIK, you cannot change the source branch after creating a Pull Request. You have to create a new one instead.\nFor future reference, the established best practice is to create a new branch before making any commits. You should not commit directly to master, especially when contributing to team projects.\nSide note:\n\nyou can simply Add more commits by pushing to the master branch on username/repo\n\nMore correctly, any changes to the target branch of a PR are automatically included in the PR."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-format-patch - Prepare patches for e-mail submission --always"
},
{
"role": "assistant",
"content": "Include patches for commits that do not introduce any change,\nwhich are omitted by default."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Android Studio Update Project: Merge vs Rebase vs Branch Default\nApologies if this seems redundant as I know there are fair amount of questions regarding Merge vs Rebase, but there doesn't seem to be any that throw in 'Branch Default' as well. \nYou are given a case where you have multiple people working on something (i.e. an Android app in Android Studio) concurrently. What is the best option to update project/pull if someone pushes to the master branch and you want to pull in the new master such that it doesn't overwrite the work you are still working on and have yet to commit and push to master? Android Studio lists 'Merge' 'Rebase' and 'Branch Default' when clicking 'Update Project'. From what it sounds like, I would want to do 'Rebase' (followed by 'Merge'?), but I'm not entirely sure."
},
{
"role": "assistant",
"content": "Stashing\nThe key here is that you have uncommitted work that you want to save. Before trying to merge anything in, you should stash your changes to save your uncommitted changes and clean your working directory.\nRun git stash to stash your changes. You should then be able to pull the changes without any issues.\nAfter you have successfully pulled, you can do a git stash apply to re-apply the changes you had made prior to the pull.\nMerging and rebasing\nStashing your changes only works if you only have uncommitted changes. If at some point you committed but didn't push you will need to either rebase or merge.\nThis StackOverflow post has some great information on the differences.\nIn general, merging is easier, but some believe that it \"pollutes\" the git history with merge commits.\nRebasing requires additional work, but since you don't have a merge commit it will essentially make the merge invisible.\nAgain, in your case you shouldn't need to merge or rebase. Simply stash, pull, then apply the stash and it should all be good."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-log - Show commit logs --no-walk[=(sorted|unsorted)]"
},
{
"role": "assistant",
"content": "Only show the given commits, but do not traverse their ancestors.\nThis has no effect if a range is specified. If the argument unsorted is given, the commits are shown in the order they were\ngiven on the command line. Otherwise (if sorted or no argument\nwas given), the commits are shown in reverse chronological order\nby commit time.\nCannot be combined with --graph ."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git fsck: duplicateEntries: contains duplicate file entries - cannot push to gitlab\n\nWe have a big git repository, which I want to push to a self-hosted gitlab instance.\nThe problem is that the gitlab remote does not let me push my repo:\ngit push --mirror https://mygitlab/xy/myrepo.git\n\nThis will give me this error:\nEnumerating objects: 1383567, done.\nCounting objects: 100% (1383567/1383567), done.\nDelta compression using up to 8 threads\nCompressing objects: 100% (207614/207614), done.\nremote: error: object c05ac7f76dcd3e8fb3b7faf7aab9b7a855647867: \nduplicateEntries: contains duplicate file entries\nremote: fatal: fsck error in packed object \n\nSo I did a git fsck:\nerror in tree c05ac7f76dcd3e8fb3b7faf7aab9b7a855647867: duplicateEntries: contains duplicate file entries\nerror in tree 0d7286cedf43c65e1ce9f69b74baaf0ca2b73e2b: duplicateEntries: contains duplicate file entries\nerror in tree 7f14e6474400417d11dfd5eba89b8370c67aad3a: duplicateEntries: contains duplicate file entries\n\nNext thing I did was to check git ls-tree c05ac7f76dcd3e8fb3b7faf7aab9b7a855647867:\n100644 blob c233c88b192acfc20548d9d9f0c81c48c6a05a66 fileA.cs\n100644 blob 5d6096cb75d27780cdf6da8a3b4d357515f004e0 fileB.cs\n100644 blob 5d6096cb75d27780cdf6da8a3b4d357515f004e0 fileB.cs\n100644 blob d2a4248bcda39c0dc3827b495f7751b7cc06c816 fileC.xaml\n\nNotice that fileB.cs is displayed twice, with the same hash. I assume that this is the problem, because why would the file be two times in the same tree with the same file name and blob hash?\nNow I googled the problem but could not find a way how to fix this. \nOne seemingly good resource I found was this: Tree contains duplicate file entries\nHowever, it basically comes down to using git replace which does not really fix the problem, so git fsck will still print the error and prevent me from pushing to the remote.\nThen there is this one which seems to remove the file entirely (but I still need the file, but only once, not twice in the tree): https://stackoverflow.com/a/44672692/826244\nIs there any other way to fix this? I mean it really should be possible to fix so that git fsck does not throw any errors, right? I am aware that I will need to rewrite the entire history after the corrupted commits. I could not even find a way to get the commit that points to the specific trees, otherwise I might be able to use rebase and patching the corrupted commit or something. Any help would be greatly appreciated!\nUPDATE:\nPretty sure I know what to do, but not yet how to do it:\n\nCreating a new tree object from the old tree, but corrected with git mktree <- done\nCreate a new commit that is identical to the old one that references the bad tree but with the newly fixed tree <- difficult, I cannot easily get the commit to the tree, my current solution runs like an hour or more and I do not know how to create the modified commit then, once I have found it\nRun git filter-branch -- --all <- Should persist the replacements of the commits\n\nSadly I cannot just use git replace --edit on the bad tree and then run git filter-branch -- --all because filter-branch seems to only work on commits, but ignores tree-replaces..."
},
{
"role": "assistant",
"content": "You can try running git fast-export to export your repository into a data file, and then run git fast-import to re-import the data file into a new repository. Git will remove any duplicate entries during the fast-import process, which will solve your problem.\nBe aware that you may have to make a decision about how to handle signed tags and such when you export by passing appropriate arguments to git fast-export; since you're rewriting history, you probably want to pass --signed-tags=strip."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Not currently on any branch + git commit + checkout when not in any branch. Did I lose my changes?\nI was not currently on any branch when I commited my changes.\nI didn't really notice the message and checked out another branch.\nHow can I retrieve my changes?\nI can't merge or checkout, since there is no branch to merge from."
},
{
"role": "assistant",
"content": "You can use git reflog to get the commit hash of the commit that you did while in \"no branch\" ( a detached HEAD) and merge that in to the branch that you are currently in ( master maybe)\nSomething like git merge HEAD@{1}\nYou can also git rebase -i and \"pick\" the commit you want from the reflog."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "What to do with branch after merge\nI had two branches: master and branch1. I just merged branch1 back into master and I'm done with that branch. Should I delete it or just let it sit around? Will deleting it cause any loss of data?"
},
{
"role": "assistant",
"content": "After the merge, it's safe to delete the branch:\ngit branch -d branch1\n\nAdditionally, git will warn you (and refuse to delete the branch) if it thinks you didn't fully merge it yet. If you forcefully delete a branch (with git branch -D) which is not completely merged yet, you have to do some tricks to get the unmerged commits back though (see below).\nThere are some reasons to keep a branch around though. For example, if it's a feature branch, you may want to be able to do bugfixes on that feature still inside that branch.\nIf you also want to delete the branch on a remote host, you can do:\ngit push origin :branch1\n\nOr its equivalent:\ngit push -d origin branch1\n\nThis will forcefully delete the branch on the remote (this will not affect already checked-out repositiories though and won't prevent anyone with push access to re-push/create it).\n\ngit reflog shows the recently checked out revisions. Any branch you've had checked out in the recent repository history will also show up there. Aside from that, git fsck will be the tool of choice at any case of commit-loss in git."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-fsck - Verifies the connectivity and validity of the objects in the database gitmodulesLarge"
},
{
"role": "assistant",
"content": "(ERROR) The .gitmodules file is too large to parse."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-config - Get and set repository or global options remote.<name>.mirror"
},
{
"role": "assistant",
"content": "If true, pushing to this remote will automatically behave\nas if the --mirror option was given on the command line."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Github pages, HTTP headers\n\nI serve some of my files from my Github pages account. But when I check my \"js\" files' headers, I saw following:\nLast-Modified:Sun, 10 Feb 2013 14:00:46 GMT \nExpires:Sun, 10 Feb 2013 14:13:23 GMT\nCache-Control:max-age=600\n\nThis file was commited 14 days ago. But I don't plan these files so frequent. So I need to make much bigger max-age value and change Last-Modified value to last commited date.\nIs it possible to change headers of Github pages?"
},
{
"role": "assistant",
"content": "I asked this to Github admins, and they told me that \"it is not possible\" to change headers. They added this issue to wishlist."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-log - Show commit logs --ignore-space-at-eol"
},
{
"role": "assistant",
"content": "Ignore changes in whitespace at EOL."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git - the stupid content tracker git-check-attr"
},
{
"role": "assistant",
"content": "Display gitattributes information"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to solve git merge error \"Swap file .MERGE_MSG.swp already exists\"\n\nWhen I pull:\nE325: ATTENTION\nFound a swap file by the name \"~/Documents/Sites/recipegenerator/.git/.MERGE_MSG.swp\"\n owned by: username dated: Wed Dec 14 12:28:45 2016\n file name: ~username/Documents/Sites/recipegenerator/.git/MERGE_MSG\n modified: YES\n user name: username host name: Users-MacBook-Pro.local\n process ID: 33747\nWhile opening file \"/Users/larsvanurk/Documents/Sites/recipegenerator/.git/MERGE_MSG\"\n dated: Thu Dec 22 14:06:17 2016\n NEWER than swap file!\n\n(1) Another program may be editing the same file.\n If this is the case, be careful not to end up with two\n different instances of the same file when making changes.\n Quit, or continue with caution.\n\n(2) An edit session for this file crashed.\n If this is the case, use \":recover\" or \"vim -r /Users/username/Documents/Sites/recipegenerator/.git/MERGE_MSG\"\n to recover the changes (see \":help recovery\").\n If you did this already, delete the swap file \"/Users/username/Documents/Sites/recipegenerator/.git/.MERGE_MSG.swp\"\n to avoid this message.\n\nSwap file \"~/Documents/Sites/recipegenerator/.git/.MERGE_MSG.swp\" already exists!\n\nWhen I push:\nTo https://github.com/nickname/recipegenerator.git\n ! [rejected] master -> master (fetch first)\nerror: failed to push some refs to 'https://github.com/nickname/recipegenerator.git'\nhint: Updates were rejected because the remote contains work that you do\nhint: not have locally. This is usually caused by another repository pushing\nhint: to the same ref. You may want to first integrate the remote changes\nhint: (e.g., 'git pull ...') before pushing again.\nhint: See the 'Note about fast-forwards' in 'git push --help' for details.\n\nPlease help :C Idk what to do. I can't push or pull. I tried pretty much everything I could think of. I also tried: git merge --abort. The thing is when I do that, I can't seem to find my conflict that I should resolve."
},
{
"role": "assistant",
"content": "It's a message from VIM which apparently you are using as the text editor in git. Have you tried reading and following these two (1) (2) points? One of them will be probably true, and will let you solve this issue.\nFirst of all, check that MERGE_MSG file (not MERGE_MSG.swp), and see if it exists and what's inside. Most likely it's trash or a temporary file that can be safely deleted. Judging from the name, it's probably the file name used as a temporary text editing area for merge commit messages.\nThen, since you use VIM, when VIM starts, it tries to create a swap file for its own internal needs. The error message says it's ~/Documents/Sites/recipegenerator/.git/.MERGE_MSG.swp. Often, you can simply delete such swap files, especially if they are old or unexpected. However, if recently some merge-commit-message-editing session has crashed and if you had a lot of creative text you don't want to lose - then don't delete it and recover that swap instead, as described in (2) in the error message.\nHowever, since you don't know what is going on and you haven't said anything about losing some text you wrote, and since it's probably just a MERGE_MSG that was auto-generated anyways, I suppose you can:\ngit merge --abort\nrm ~/Documents/Sites/recipegenerator/.git/.MERGE_MSG.swp\n\nand try what you were doing once again.\nAlso, it's good to check the hint mentioned in (1) in error message. Check with ps or whatever else for any open VIM sessions that could be currently editing that MERGE_MSG. If you spot any, then, well, get to them and either finish editing, or make them quit (escape, :q!, enter) (vim will cleanup swaps on quitting), or terminate them (kill them, but then you need to remove swap files manually)."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Package management in Git for Windows (Git Bash)?\nI'm reading the github wiki for git-for-windows and it says that msys2 bundles pacman: https://github.com/git-for-windows/git/wiki/Package-management\nBut when I invoke it I get:\n$ pacman\nbash: pacman: command not found\n\nDoes anyone have an idea what is going on?\nWhich git version does this wiki refer to?\nIs there a way to install additional packages to msys2 inside Git for windows?"
},
{
"role": "assistant",
"content": "As mentioned in issue 397:\n\nThis is intended. We do not ship pacman with Git for Windows.\nIf you are interested in a fully fledged package manager maintained environment you have to give the Git for Windows SDK a try.\n\nThe bash that you see in the latest git for Windows (2.5.3), which is a more recent bash than the old msysgit one, is only there to execute git commands.\nIt is not a full-fledged linux environment to install any third-party package.\n\nWarning: dhj reports in the comments\n\nDo not link your existing git for windows with the msys2 main system by using a directory junction.\nIf you uninstall it will decide that linked directory belongs to it and DELETE YOUR ENTIRE HOME DIRECTORY including sub-directories like \"Downloads\".\nBeware dealing with msys2.\nI don't know if the same is true for the git for windows SDK, but BE CAREFUL trying to get pacman from other systems integrated with git for windows."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "strikethrough code in markdown on github\n\nI am talking about github markdown here, for files like README.md.\nQuestion:\nIs it possible to strikethrough a complete code block in markdown on github?\nI know how to mark text as a block of code\nthis is\nmultiline code\n\nand\nthis\n\nthis\nalso\nby indenting by 4 spaces or by using ``` or `...\nI also know how to strike through texts using\n\ndel tag\ns tag\n~~\n\nTemporary solution:\nIndependently they work fine, but together not as expected or desired. I tried several combinations of the above mentioned.\nFor now, I use this: \nstriked\nthrough\nby using ~~ and ` for every single line.\nRequirement:\nI would like to have a code formatted text striked through, where the code block is continuous:\nunfortunately, this is\nnot striked through\n\nor at least with only a small paragraph in between:\nunfortunately, also not\nstriked through\n\nIs this possible at all?\nI found some old posts and hints on using jekyll, but what I was searching for is a simple way, preferably in markdown."
},
{
"role": "assistant",
"content": "This would only be possible with raw HTML, which GitHub doesn't allow. But you may be able to use a diff instead.\nCode blocks are for \"pre-formatted\" text only. The only formatting you can get in a code block is the formatting that can be represented in plain text (indentation, capitalization, etc). There is no mechanism to mark up the content of a code block (as bold, italic, stricken, underlined, etc). This was an intentional design decision. Otherwise, how would you be able to show Markdown text in a code block? If you want formatted text, then you need to use something other than a code block.\nAs the rules state:\n\nHTML is a publishing format; Markdown is a writing format. Thus, Markdown’s formatting syntax only addresses issues that can be conveyed in plain text.\nFor any markup that is not covered by Markdown’s syntax, you simply use HTML itself.\n\nTherefore you would need to format your own custom HTML code block with the various bits marked up properly:\n<pre><code><del>some stricken code</del>\n<del>A second line of stricken code</del>\n</code></pre>\n\nHowever, for security reasons, GitHub will strip out any such raw HTML in your Markdown. So while this works where you have full control of the entire stack, on a hosted service it is most likely not possible.\nHowever, I'm assuming you want to show some changes made to a block of code. As it turns out, a specific format already exists for that, namely, a diff. Just use a fenced code block with diff as the language and GitHub will format it correctly:\n```diff\n Unchanged Line\n- Removed Line\n+ Added Line\n```\n\nYou can see how GitHub displays the above code block live (you can also see that in raw), but I've included a screenshot below for convenience.\n\nI realize that the formatting does not use strike-through, but it does use a commonly used and understood format. For more complex blocks, you should probably use the diff utility program to generate the diff for you."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Channel is not opened Errors in automatic merge on Teamcity (git)\nI am using TeamCity on ubuntu (TeamCity Professional 9.1.7 (build 37573)). And having some problems with automatic merges lately (git).\nI haven't changed anything in the configuration from when it used to work.\nI tried to remove the work directory. it only helped for a couple of merges.\nSymptoms:\nThe build log looks clean, and I am getting this on the build overview:\nFailed to merge sources in VCS root foo. Merge error 'git fetch' command failed.\nstderr: [email protected]:foo/foo.git: channel is not opened.\nexit code: 1.\n\nAlthough, in the agent running this i am getting a totally different error in teamcity-vcs.log:\n[2016-03-30 15:14:31,722] INFO - jetbrains.buildServer.VCS - [/home/ubuntu/BuildAgent/work/7676127c0a691f42]: /usr/bin/git show-ref refs/remotes/origin/foo \n[2016-03-30 15:14:31,775] INFO - jetbrains.buildServer.VCS - [/home/ubuntu/BuildAgent/work/7676127c0a691f42]: /usr/bin/git log -n1 --pretty=format:%H%x20%s 193f46d88205c5e419a8a7458e742ce9b598cca8 \n-- \n[2016-03-30 15:14:31,797] WARN - jetbrains.buildServer.VCS - '/usr/bin/git log -n1 --pretty=format:%H%x20%s 193f46d88205c5e419a8a7458e742ce9b598cca8 --' command failed.\nstderr: fatal: bad object 193f46d88205c5e419a8a7458e742ce9b598cca8 \n[2016-03-30 15:14:31,798] INFO - jetbrains.buildServer.VCS - [/home/ubuntu/BuildAgent/work/7676127c0a691f42]: /usr/bin/git fetch --progress origin +refs/heads/foo:refs/remotes/origin/foo \n[2016-03-30 15:14:35,832] WARN - jetbrains.buildServer.VCS - Error output produced by: /usr/bin/git fetch --progress origin +refs/heads/foo:refs/remotes/origin/foo \n[2016-03-30 15:14:35,832] WARN - jetbrains.buildServer.VCS - remote: Counting objects: 2, done.ESC[K\nremote: Compressing objects: 50% (1/2) ESC[K\nremote: Compressing objects: 100% (2/2) ESC[K\nremote: Compressing objects: 100% (2/2), done.ESC[K\nremote: Total 2 (delta 1), reused 0 (delta 0)ESC[K\nFrom bitbucket.org:bar/bar\n 62ba378..193f46d foo -> origin/foo \n\nAs if the log command failed..\nThanks.\n\nUpdate: I got an update that there is anecdotal evidence that this is due to changes specifically in BitBucket's git over SSH servers."
},
{
"role": "assistant",
"content": "Per https://youtrack.jetbrains.com/issue/TW-46052, the problem has been fixed. The fix will be shipped with the next release, either 9.1.8 or 10. If you don't want to wait for the release, you can manually update the git plugin by downloading it from here (logging in as a guest, or creating an account on JetBrains' build server) and replacing it in your installation.\n\nShut down TC\nPut the downloaded file jetbrains.git.zip in %TEAM_CITY%/webapps/ROOT/WEB-INF/plugins replacing the existing one\nRestart TC\n\nThis fixed the problem for me and others."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-log - Show commit logs %at"
},
{
"role": "assistant",
"content": "author date, UNIX timestamp"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "gitmodules - Defining submodule properties submodule.<name>.path"
},
{
"role": "assistant",
"content": "Defines the path, relative to the top-level directory of the Git\nworking tree, where the submodule is expected to be checked out.\nThe path name must not end with a / . All submodule paths must\nbe unique within the .gitmodules file."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Working on git repo without cd into directory\nHow would I run git commands on a repo when I have not cd'd into that directory?\nI.e. I want to run git branch /repos/myrepo.git"
},
{
"role": "assistant",
"content": "Starting with git 1.8.5, use the -C option.\ngit -C \"/Users/michael/Development/Projects/opensource/dvsc-backup\" status\n\nOtherwise, you have to specify --work-tree as well as --git-dir\ngit --work-tree=\"/Users/michael/Development/Projects/opensource/dvsc-backup\" --git-dir=\"/Users/michael/Development/Projects/opensource/dvsc-backup/.git\" status"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-config - Get and set repository or global options notes.displayRef"
},
{
"role": "assistant",
"content": "Which ref (or refs, if a glob or specified more than once), in\naddition to the default set by core.notesRef or GIT_NOTES_REF , to read notes from when showing commit\nmessages with the git log family of commands. This setting can be overridden with the GIT_NOTES_DISPLAY_REF environment variable, which must be a colon separated list of refs or\nglobs. A warning will be issued for refs that do not exist,\nbut a glob that does not match any refs is silently ignored. This setting can be disabled by the --no-notes option to the git\nlog family of commands, or by the --notes=<ref> option accepted by\nthose commands. The effective value of \"core.notesRef\" (possibly overridden by\nGIT_NOTES_REF) is also implicitly added to the list of refs to be\ndisplayed."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to uncommit my last commit in Git [duplicate]\nThis question already has answers here:\n \n \n\n\n\n\nHow do I undo the most recent local commits in Git?\n\n (109 answers)\n \n\nClosed 7 years ago.\n\n\n\nHow can I uncommit my last commit in git?\nIs it\ngit reset --hard HEAD\n\nor\ngit reset --hard HEAD^\n\n?"
},
{
"role": "assistant",
"content": "If you aren't totally sure what you mean by \"uncommit\" and don't know if you want to use git reset, please see \"Revert to a previous Git commit\".\nIf you're trying to understand git reset better, please see \"Can you explain what \"git reset\" does in plain English?\".\n\nIf you know you want to use git reset, it still depends what you mean by \"uncommit\". If all you want to do is undo the act of committing, leaving everything else intact, use:\ngit reset --soft HEAD^\n\nIf you want to undo the act of committing and everything you'd staged, but leave the work tree (your files) intact:\ngit reset HEAD^\n\nAnd if you actually want to completely undo it, throwing away all uncommitted changes, resetting everything to the previous commit (as the original question asked):\ngit reset --hard HEAD^\n\n\nThe original question also asked it's HEAD^ not HEAD. HEAD refers to the current commit - generally, the tip of the currently checked-out branch. The ^ is a notation which can be attached to any commit specifier, and means \"the commit before\". So, HEAD^ is the commit before the current one, just as master^ is the commit before the tip of the master branch.\nHere's the portion of the git-rev-parse documentation describing all of the ways to specify commits (^ is just a basic one among many)."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-gc - Cleanup unnecessary files and optimize the local repository --force"
},
{
"role": "assistant",
"content": "Force git gc to run even if there may be another git gc instance running on this repository."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-daemon - A really simple server for Git repositories --[no-]informative-errors"
},
{
"role": "assistant",
"content": "When informative errors are turned on, git-daemon will report\nmore verbose errors to the client, differentiating conditions\nlike \"no such repository\" from \"repository not exported\". This\nis more convenient for clients, but may leak information about\nthe existence of unexported repositories. When informative\nerrors are not enabled, all errors report \"access denied\" to the\nclient. The default is --no-informative-errors."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-rev-list - Lists commit objects in reverse chronological order --author-date-order"
},
{
"role": "assistant",
"content": "Show no parents before all of its children are shown, but\notherwise show commits in the author timestamp order."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Run pipeline on gitlab when branch is deleted\n\nIs it possible to run a pipeline thanks to Gitlab CI/CD after a branch is deleted.\nIn fact I want to edit file after that branch is removed.\nFor example, I have two repositories, R1 and R2.\nIn R1 I have 2 branches\n\nB1\nB2\n\nI want to edit a file from R2 when B1 (which is a R1's branch) is removed.\nI know how to access and edit the file but I don't know how can I set a trigger for removed branch."
},
{
"role": "assistant",
"content": "You can use environments. Look at Stopping an environment.\n\nGitLab will automatically trigger a stop action when the associated branch is deleted. The stop_review job must be in the same stage as the deploy_review job in order for the environment to automatically stop.\n\ndeploy_review:\n stage: deploy\n script:\n - echo \"Deploy a review app\"\n environment:\n name: review/$CI_COMMIT_REF_NAME\n url: https://$CI_ENVIRONMENT_SLUG.example.com\n on_stop: stop_review\n only:\n - branches\n except:\n - master\n\nstop_review:\n stage: deploy\n variables:\n GIT_STRATEGY: none\n script:\n - echo \"Implement editing files from R2 here\"\n when: manual\n environment:\n name: review/$CI_COMMIT_REF_NAME\n action: stop\n\nIt's not fully what you want, but maybe more useful for you."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-update-index - Register file contents in the working tree to the index --chmod=(+|-)x"
},
{
"role": "assistant",
"content": "Set the execute permissions on the updated files."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-push - Update remote refs along with associated objects (space)"
},
{
"role": "assistant",
"content": "for a successfully pushed fast-forward;"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "GitHub Actions CI Conditional Regex\n\nI'm trying to move my CI workflow from CircleCI to GitHub Actions. The last major struggle I'm facing is with deployment.\nCurrently my workflow is such that when I push a tag to my GitHub repo, it will run the tests, then run the deployment. Only thing is CircleCI filters tags to only run the job if the tag matches the regex: /v[0-9]+(\\.[0-9]+)*/.\nHow can I check to ensure the tag I pushed matches the regex pattern above before running the deployment?\nI currently have the following GitHub Actions yml file:\nname: CI\non: [create]\n\njobs:\n # ...\n\n deploy:\n runs-on: ubuntu-latest\n if: github.event.ref_type == 'tag' && github.event.ref == SOMETHING HERE\n steps:\n - uses: actions/checkout@v1\n # ...\n\nUnder the if block, I need to change github.event.ref == SOMETHING HERE to be something else. I have looked in the Contexts and expression syntax for GitHub Actions documentation page. But due to how flexible and powerful GitHub Actions is, it seems like there should be a method or way to do this, or at least some type of workaround.\nHow can I ensure the tag (github.event.ref) matches the regex pattern (/v[0-9]+(\\.[0-9]+)*/)?"
},
{
"role": "assistant",
"content": "Unfortunately, I don't think there is any way to do regex matching on if conditional expressions yet.\nOne option is to use filtering on push events.\non:\n push:\n tags:\n - 'v*.*.*'\n\nAnother option is to do the regex check in a separate step where it creates a step output. This can then be used in an if conditional.\n - name: Check Tag\n id: check-tag\n run: |\n if [[ ${{ github.event.ref }} =~ ^refs/tags/v[0-9]+\\.[0-9]+\\.[0-9]+$ ]]; then\n echo \"match=true\" >> $GITHUB_OUTPUT\n fi\n - name: Build\n if: steps.check-tag.outputs.match == 'true'\n run: |\n echo \"Tag is a match\""
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-diff - Show changes between commits, commit and working tree, etc files"
},
{
"role": "assistant",
"content": "Compute the dirstat numbers by counting the number of files changed.\nEach changed file counts equally in the dirstat analysis. This is\nthe computationally cheapest --dirstat behavior, since it does\nnot have to look at the file contents at all."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Loading Maven dependencies from GitHub [duplicate]\n\nThis question already has answers here:\n \n \n\n\n\n\nCan I use a GitHub project directly in Maven?\n\n (3 answers)\n \n\nClosed 4 years ago.\n\n\n\nHow do I add a Java library from its GitHub repo (the library uses Maven as a build system) as a dependency to my Maven project? Can I do that without downloading and compiling the library?"
},
{
"role": "assistant",
"content": "Now you can import a Java library from a GitHub repo using JitPack.\nIn your pom.xml:\n\nAdd repository:\n\n<repository>\n <id>jitpack.io</id>\n <url>https://jitpack.io</url>\n</repository>\n\n\nAdd dependency\n\n<dependency>\n <groupId>com.github.User</groupId>\n <artifactId>Repo name</artifactId>\n <version>Release tag</version>\n</dependency>\n\nIt works because JitPack will check out the code and build it. So you'll end up downloading the jar.\nIf the project doesn't have a GitHub release then its possible to use a commit id as the version."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "\"Can't push refs to remote. Try running 'Pull' first to integrate your changes.\"\n\nI keep getting this error when I try to push to Github from VScode.\nI've pushed before to that repository by following the exact same steps I am following now.\nWhat is the reason for this error?"
},
{
"role": "assistant",
"content": "You get this message whenever your local branch and your remote branch are not on the same point, before your changes.\nremote branch commits : A -> B -> C -> D\nlocal branch commits : A -> B -> C -> Local_Commits \n\nNow clearly, there's a change D that you don't have integrated locally. So you need to rebase, then push, which will lead to the following.\nremote branch commits : A -> B -> C -> D\nlocal branch commits : A -> B -> C -> D -> Local_Commits \n\nTo solve your issue, do the following\ngit pull --rebase origin branchname\ngit push origin branchname"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git - the stupid content tracker gitcli"
},
{
"role": "assistant",
"content": "Git command-line interface and conventions"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git - the stupid content tracker git-ls-tree"
},
{
"role": "assistant",
"content": "List the contents of a tree object"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to prevent git commit --no-verify command?\n\nI would like to setup a pre-commit hook for all git repos to validate syntax errors using jshint and phplint. But the issue is that the git has a feature which can skip pre-commit hook from happening by using --no-verify flag. But i don't need to use that option. Can i prevent that --no-verify flag for git Please suggest a way."
},
{
"role": "assistant",
"content": "First off: you can't definitively prevent someone from passing the --no-verify option. That said, it's a good practice to use pre-commit hooks for linting, and it's a good practice to avoid passing the --no-verify option without reason.\nIf, however, you want to make it more cumbersome to pass the --no-verify option, you could:\n\ngenerate a verification token and append it to the commit message in pre-commit;\nexit pre-receive with a non-zero exitcode if this token is missing or invalid. (Examples of things you can do in pre-receive hooks: https://github.com/github/platform-samples/tree/master/pre-receive-hooks)\n\nSomeone determined to avoid passing --no-verify could manually do step 1, which is why this isn't 100% effective. I wouldn't recommend setting this up in a professional context, but I'm all for people using the tools at their disposal to instill good habits for themselves, while learning more about git hooks."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-diff - Show changes between commits, commit and working tree, etc --ignore-cr-at-eol"
},
{
"role": "assistant",
"content": "Ignore carriage-return at the end of line when doing a comparison."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git - the stupid content tracker GIT_ATTR_SOURCE"
},
{
"role": "assistant",
"content": "Sets the treeish that gitattributes will be read from."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "What is the difference between Stop Tracking and Discard File in git SourceTree\nI wanted to know what the difference is between discarding a file and and stop tracking a file in git using source-tree. If I deleted a file in my updated code and I want that file deleted on the repository too should I mark it as stop tracking or should I discard it during the commit process"
},
{
"role": "assistant",
"content": "The one detail not covered by the first answer is that Stop Tracking does not delete the local file. It only removes it from source control.\n\nIf you want to keep the file locally (maybe it's a .suo file storing\nVisual Studio settings that you decide shouldn't have been in source\ncontrol) but remove it from the repository, you should use Stop Tracking. After this, if you see the file listed in Unstaged files, you can use right-click > Ignore... in SourceTree to update your .gitignore file to ignore the file in future.\nIf you want to delete your file both locally and in the repository,\nyou should use Remove. (to use the SourceTree term)\nFinally, if you only want to revert your local changes without\nchanging the repository at all, use Discard."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to change branch name in Azure DevOps\nIs there a way to change branch name in Azure DevOps. As shown in SS i have named my branch as Developer branch, now i want to change it to a specific request-id.\nIs this possible."
},
{
"role": "assistant",
"content": "Unfortunately, you are not able to rename a branch. However, you can create a new branch from the branch which you want to rename then you can delete that branch.\nAs per the design, the rename of azure repo branches is not implemented. You can see this existing similar thread\nMicrosoft's documentation page \"Rename old branches\" gives the following instructions:\n\nopen repo > Branches view.\nlocate the old branch.\nhover over the old branch > ...(More) icon > + New Branch.\nenter the new branch name > Create branch.\nhover over the old branch > trash icon (Delete branch)."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Git - What is \"Refspec\"\n\nI've been following this guide on configuring GitLab continuous integration with Jenkins.\nAs part of the process, it is necessary to set the refspec as follows: +refs/heads/*:refs/remotes/origin/* +refs/merge-requests/*/head:refs/remotes/origin/merge-requests/*\nWhy this is necessary is not explained in the post, so I began looking online for an explanation and looked at the official documentation as well as some related StackOverflow questions like this one.\nIn spite of this, I'm still confused:\nWhat exactly is refspec? And why is the above refspec necessary – what does it do?"
},
{
"role": "assistant",
"content": "A refspec tells git how to map references from a remote to the local repo.\nThe value you listed was +refs/heads/*:refs/remotes/origin/* +refs/merge-requests/*/head:refs/remotes/origin/merge-requests/*; so let's break that down.\nYou have two patterns with a space between them; this just means you're giving multiple rules. (The pro git book refers to this as two refspecs; which is probably technically more correct. However, you just about always have the ability to list multiple refspecs if you need to, so in day to day life it likely makes little difference.)\nThe first pattern, then, is +refs/heads/*:refs/remotes/origin/* which has three parts:\n\nThe + means to apply the rule without failure even if doing so would move a target ref in a non-fast-forward manner. I'll come back to that.\nThe part before the : (but after the + if there is one) is the \"source\" pattern. That's refs/heads/*, meaning this rule applies to any remote reference under refs/heads (meaning, branches).\nThe part after the : is the \"destination\" pattern. That's refs/remotes/origin/*.\n\nSo if the origin has a branch master, represented as refs/heads/master, this will create a remote branch reference origin/master represented as refs/remotes/origin/master. And so on for any branch name (*).\nSo back to that +... suppose the origin has\nA --- B <--(master)\n\nYou fetch and, applying that refspec you get\nA --- B <--(origin/master)\n\n(If you applied typical tracking rules and did a pull you also have master pointed at B.) \nA --- B <--(origin/master)(master)\n\nNow some things happen on the remote. Someone maybe did a reset that erased B, then committed C, then forced a push. So the remote says\nA --- C <--(master)\n\nWhen you fetch, you get\nA --- B\n \\\n C\n\nand git must decide whether to allow the move of origin/master from B to C. By default it wouldn't allow this because it's not a fast-forward (it would tell you it rejected the pull for that ref), but because the rule starts with + it will accept it. \nA --- B <--(master)\n \\\n C <--(origin/master)\n\n(A pull will in this case result in a merge commit.)\nThe second pattern is similar, but for merge-requests refs (which I assume is related to your server's implementation of PR's; I'm not familiar with it).\nMore about refspecs: https://git-scm.com/book/en/v2/Git-Internals-The-Refspec"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git - the stupid content tracker gitweb"
},
{
"role": "assistant",
"content": "Git web interface (web frontend to Git repositories)"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "CocoaPods: point to a branch in pod spec\nI'm trying to install code from a repository's branch on a pod spec, and based on the documentation, this should work:\ns.dependency 'repository_name',\n:git => 'https://github.com/account_name/repository_name.git',\n:branch => 'experimental_branch'\n\nBut I get an error with something like [!] Unsupported version requirements. Updating CocoaPods might fix the issue.\nIt works when installing from a pod file directly:\npod 'ObjectiveRecord', :git => 'https://github.com/supermarin/ObjectiveRecord.git', :branch => '2-0-experimental'\n\nDoes anyone know? Thanks!"
},
{
"role": "assistant",
"content": "You can't use a pod dependency like that, it only supports \"name\", \"version\". Source: guides.cocoapods.org. It is expected that the :git and :branch metadata will come from the podfile."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How do I get IntelliJ to see my remote git branches\nI'm using BitBucket and I created a branch on another machine with IntelliJ and pushed it in to my repo. I can see the branch on the BitBucket site, but when I try to access the remote branch using IntelliJ on another machine I can't see the new branch when I go to VCS -> git -> Remote Branches. I tried doing a pull, but that only brought down the head changes (which currently points to master), and didn't update the remote branches list. Is there something you have to do to see the remote branches (besides Head and Master) in IntelliJ?"
},
{
"role": "assistant",
"content": "In case anyone runs in to something similar I found that on my IntelliJ at least I had to run a fetch and then I could see the remote branches. It didn't appear that a pull was sufficient even though pull is supposed to fetch."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-diff - Show changes between commits, commit and working tree, etc git diff [<options>] <commit>..<commit> [--] [<path>…]"
},
{
"role": "assistant",
"content": "This is synonymous to the earlier form (without the .. ) for\nviewing the changes between two arbitrary <commit>. If <commit> on\none side is omitted, it will have the same effect as\nusing HEAD instead."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "\"refusing to merge unrelated histories\" failure while pulling to recovered repository\n\nI come up with a problem about Git push.\nIt worked successfully before, but it failed this time. In the beginning, I am in my master MINGW64 /d/javasoft/apache-tomcat-7.0.70/webapps/MyNote (master), and then,\n\nI use git remote add origin to relate my remote origin, but it alerts that fatal: remote origin already exists.\nthen, I use git remote rm origin (Someone told me to), and it's OK.\nthen, I use git remote add origin https://github.com/***/***.git again. It's OK.\nthen, I use git push -u origin master ( I tried git push origin master, but I lost my local whole .git for some reason before, so I guess it may be the first time to push, and I should add -u ). BUT, it alerts error: failed to push some refs to 'https://github.com/***/***.git'\nthen, someone told me that I should use git pull origin master before I use push, and I did as it. but, it alerted: fatal: refusing to merge unrelated histories.\nI found some answers in Git refusing to merge unrelated histories on rebase, but it seemed that it didn't work. In my issue, it alerted fatal: Couldn't find remote ref –allow-unrelated-histories\n\n\nHow can I do it? I just want to push..."
},
{
"role": "assistant",
"content": "This cannot be answered shortly.\nWarning: You should not use the --allow-unrelated-histories flag unless you know what unrelated history is and are sure you need it. The check was introduced just to prevent disasters when people merge unrelated projects by mistake.\nAs far as I understand, in your case the following has happened:\nYou have cloned a project at some point 1, and made some development to point 2. Meanwhile, project has evolved to some point 3.\n\nThen you for some reason lost your local .git subdirectory - which contained all your history from 1 to 2. You managed to restore the current state though.\n\nBut now it does not have any history - it looks like the whole project has appeared out of nowhere. If you ask Git to merge them it will not be able to say where your changes are, so it can add them to remote project, as far as I understand it will just report massive add/add conflicts.\nYou should now find back that commit 1 from the remote history where you have cloned the project (I assume you did not pull after that; if you did then you should instead look for the last commit you have pulled). Then you should modify your history so that is starts from that commit 1, and then Git will be able to merge correctly (with pull for example).\nSo, the steps (assuming you are now in your restored commit without history):\n\nestimate where is the commit 1 you have cloned from as some 1?, based on commit time for example\nrun git diff _1?_..HEAD, and read carefully. Make sure that the difference contains only edits which you have made. If it contains more then you should have picked a bit wrong 1? and need to adjust it and repeat this step\nafter you have found the commit 1. You should make it your parent; do git --reset --soft _1_, and then git commit.\n\n\nNow it looks like you have cloned from 1, then made one commit with all your changes. Your intermediate history is lost anyway with your older .git directory, but now you can run your git pull - it will merge correctly."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-tag - Create, list, delete or verify a tag object signed with GPG -e --edit"
},
{
"role": "assistant",
"content": "The message taken from file with -F and command line with -m are usually used as the tag message unmodified.\nThis option lets you further edit the message taken from these sources."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Clear git local cache\nI have a Webstorm project that I was about to commit, but before pressing the commit button in the Git Windows GUI, I remembered that I don't want to commit my .idea folder content. \nSo I used the website that auto generates .gitignores for certain IDEs and added it to my .gitignore file. \nAll .idea files that are explicitly ignored are still showing up to commit, despite me removing and re-added the files in question. \nI've also committed the gitignore file without any other files, and re-pasted my content, but it still is not ignoring the .idea files.\nHow do I tell Git to refresh or clear its cache?\nI tried /cd ing into the directory in question, and typing \ngit clean -n \nbut no files show up."
},
{
"role": "assistant",
"content": "All .idea files that are explicitly ignored are still showing up to commit\n\nyou have to remove them from the staging area\ngit rm --cached .idea\n\nnow you have to commit those changes and they will be ignored from this point on.\nOnce git start to track changes it will not \"stop\" tracking them even if they were added to the .gitignore file later on.\nYou must explicitly remove them and then commit your removal manually in order to fully ignore them."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-show - Show various types of objects %al"
},
{
"role": "assistant",
"content": "author email local-part (the part before the @ sign)"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git rebase using sourcetree\nI think I am confused on how to use SourceTree GUI to do git rebase. I have two branches \"master\" and \"dev\". As seen, the two branch diverged. I want to do a rebase on \"dev\" branch, using command line, this would be:\ngit checkout dev\ngit rebase master\n\n\nI would have expected to right click \"dev\", and choose \"Rebase current changes onto dev\". I assume current changes means \"new commits on master\". But picking this option seems have no effect whatsoever. What would be the correct steps?"
},
{
"role": "assistant",
"content": "But picking this option seems have no effect whatsoever. \n\nYes, because current changes are the one of the current branches, which is dev.\nRebasing dev on top of dev means an no-op.\ngit checkout dev\ngit rebase master\n\nThat means: current branch is dev: to be rebased on top of master.\nSo in SourceTree, you need to right-click on master (while dev is checked out), and select:\nRebase current changes onto master\n\nHowe adds in the comments:\n\nCurrent Naming of \"rebase current changes onto [branch]\" is misleading. Check out this improvement discussion SRCTREE-1578.\nAfter finding myself baffled attempting to bring a feature branch up to date with development and failing, I've come to realize that the left-pane context menu item labeled “rebase current changes onto $somebranch” actually does the opposite of what its name suggests:\n it rebases the current branch to the state of $somebranch;\n In other words it rebases $somebranch onto (or into) the current branch, not the other way around. (Right?)\nThe preposition “onto” in the current text is misleading; it implies that the object of the sentence ($somebranch in my example) will receive the changes.\n In fact, it is the opposite that will occur.\n The absence of the current branch's name adds to the confusion.\nA re-wording that improves the sentence structure and includes the name of the affected branch would afford a huge win for clarity.\n For example:\nrebase $currentbranch to head of $somebranch\nrebase $somebranch onto $currentbranch"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Difference between author and committer in Git?\nI am trying to make a commit like\ngit commit --author=\"John Doe <[email protected]>\" -m \"<the usual commit message>\"\n\nwhere John Doe is some user in whose name I want to make the commit.\nIt appears all right in git log. However, when I do a gitk, the author name is correct, but the committer name is picked from my global git config settings (and is thus set to my name/email).\nQuestions\n\nWhat is the difference between the two (committer vs author)?\nShould I be setting the committer as well to the other user?\nIf yes, how?"
},
{
"role": "assistant",
"content": "The original poster asks:\n\nWhat is the difference between the two (Committer vs author)?\n\nThe author is the person who originally wrote the code. The committer, on the other hand, is assumed to be the person who committed the code on behalf of the original author. This is important in Git because Git allows you to rewrite history, or apply patches on behalf of another person. The FREE online Pro Git book explains it like this:\n\nYou may be wondering what the difference is between author and committer. The author is the person who originally wrote the patch, whereas the committer is the person who last applied the patch. So, if you send in a patch to a project and one of the core members applies the patch, both of you get credit — you as the author and the core member as the committer.\n\nThe original poster asks:\n\nShould I be setting the committer as well to the other user?\n\nNo, if you want to be honest, you should not be setting the committer to the author, unless the author and the committer are indeed the same person."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Set a default reviewer\n\nI do pull requests in a repo where it's always the same person reviewing.\nI would like to set him as the default reviewer so that I don't always have to choose him at each pull request, it'd be automatic.\nHow to do that ?"
},
{
"role": "assistant",
"content": "GitHub has the ability to set the default reviewer using a CODEOWNERS file.\n\nCode owners are automatically requested for review when someone opens a pull request that modifies code that they own. When someone with admin permissions has enabled required reviews, they can optionally require approval from a code owner.\nTo use a CODEOWNERS file, create a new file called CODEOWNERS in the root, docs/, or .github/ directory of the repository, in the branch where you'd like to add the code owners."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git - the stupid content tracker scalar"
},
{
"role": "assistant",
"content": "A tool for managing large Git repositories"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-log - Show commit logs %ar"
},
{
"role": "assistant",
"content": "author date, relative"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git - the stupid content tracker git-restore"
},
{
"role": "assistant",
"content": "Restore working tree files"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git blame with commit details in emacs\nFrom emacs, how can I see the details (e.g. commit message) of the commit that last changed the line at point?\nI have magit installed."
},
{
"role": "assistant",
"content": "It is not necessary to use magit for this particular operation - vanilla emacs can do it.\n(Also, because this uses vc, this should work identically in any version control system that vc supports.)\nFirst, use the vc-annotate command, which is bound to the key sequence C-x v g.\nNow, the point should be at the commit id that you are interested in. (If not, you might need to use C-x 1 and/or v so that you can see which line is which, in order to navigate to the right one.) You might be able to see the diff for that file using = now - if you get an error beginning with \"cannot diff from any revision prior...\", that probably means that this revision created the file (and that's probably a bug in emacs).\nThe author and date are already visible in the Annotate buffer that vc-annotate produced.\nTo see the commit message, press l (the letter, not the number 1) in the Annotate buffer. To see what the file looked like at that revision, press f in either the Annotate buffer or the vc-change-log buffer."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to roll back Git repo to first commit and delete all history\nI'm learning how to use git these days and I had to do many hit-and-misses. Thus I needed to delete and create anew my remote and local repos. Is there a way to roll back to the first commit of the repo and delete all history after that? Basically a clean slate to experiment on."
},
{
"role": "assistant",
"content": "I don't know of any way to do exactly what you're asking (one can roll back to first commit, but not delete all history, since the history will at least contain that initial commit.)\nIf I were you I'd just delete the remote repo and the .git directory of the local repo, and start over with git init.\nThe closest that I can get to what you're asking for would be to rollback all but the first commit. To do that, you'd first find the SHA1 of the first commit, for example:\n% git rev-list --max-parents=0 --abbrev-commit HEAD\naa8119f\n\n...and then run either\n% git reset aa8119f\n\n...or\n% git reset --hard aa8119f\n\n...depending on whether you want to preserve or discard all the changes made since that initial commit. (The above assumes that you have only one branch. If not, you'll also have to delete any other branches you have with git branch -d <BRANCHNAME>.)\nFinally, you'd run\n% git push -f\n\n(I hope that you realize that git push -f is a no-no whenever you're pushing to a repo that is shared with others.)\nUnfortunately, as already explained, this approach does not delete all the history.\nIf this is something you'll want to do often, I'd recommend that, immediately after git init, you run something like\n% git commit --allow-empty --allow-empty-message -m ''\n% git tag -a -m '' ROOT\n\nThis will put an empty commit at the root of your history, and tag it with a tag named ROOT. Then you can do something like\n% git reset ROOT\n\nor\n% git reset --hard ROOT\n\nto bring you back to that first empty commit.\nTo get a good handle on what git reset does, I recommend reading this."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-send-email - Send a collection of patches as emails --envelope-sender=<address>"
},
{
"role": "assistant",
"content": "Specify the envelope sender used to send the emails.\nThis is useful if your default address is not the address that is\nsubscribed to a list. In order to use the From address, set the\nvalue to \"auto\". If you use the sendmail binary, you must have\nsuitable privileges for the -f parameter. Default is the value of the sendemail.envelopeSender configuration variable; if that is\nunspecified, choosing the envelope sender is left to your MTA."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-difftool - Show changes using common diff tools diff.tool"
},
{
"role": "assistant",
"content": "Controls which diff tool is used by git-difftool .\nThis variable overrides the value configured in merge.tool .\nThe list below shows the valid built-in values.\nAny other value is treated as a custom diff tool and requires\nthat a corresponding difftool.<tool>.cmd variable is defined."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Cloning git repo causes error - Host key verification failed. fatal: The remote end hung up unexpectedly\nI am using SSH to clone a git repo to my web server, but every time I get this error\n$git clone [email protected]:aleccunningham/marjoram.git\nCloning into marjoram...\nHost key verification failed.\n\nI have tried almost everything that has shown up in Google searches, and I am dumbfounded on why this will not work. Any ideas?\nAlso, I am not using anything like Jenkins."
},
{
"role": "assistant",
"content": "The issue could be that Github isn't present in your ~/.ssh/known_hosts file.\nAppend GitHub to the list of authorized hosts: \nssh-keyscan -H github.com >> ~/.ssh/known_hosts"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-diff - Show changes between commits, commit and working tree, etc --raw"
},
{
"role": "assistant",
"content": "Generate the diff in raw format."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Fully backup a git repo?\nIs there a simple way to backup an entire git repo including all branches and tags?"
},
{
"role": "assistant",
"content": "git bundle\n\nI like that method, as it results in only one file, easier to copy around.\nSee ProGit: little bundle of joy.\nSee also \"How can I email someone a git repository?\", where the command\ngit bundle create /tmp/foo-all --all\n\nis detailed:\n\ngit bundle will only package references that are shown by git show-ref: this includes heads, tags, and remote heads.\nIt is very important that the basis used be held by the destination.\nIt is okay to err on the side of caution, causing the bundle file to contain objects already in the destination, as these are ignored when unpacking at the destination.\n\n\nTo use that bundle, you can clone it, specifying a non-existent folder (outside any git repo):\ngit clone /tmp/foo-all newFolder\n\n\nAs noted by shayan in the comments, git bundle won't include stashed commits, even if git show-ref can technically show a stashed commit.\nAs explained in \"git bundle stashed code\", by torek:\n\nanything that is not an actual reference name falls afoul of this problem, including reflog references like stash@{1}.\n\n(You can try git show-ref stash@{1}: it returns nothing)"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Is there any git hook for pull?\nI need to perform some actions (prepare gettext *.mo message files) on my project everytime I run git pull. Is there any suitable git hook, which I could use for this purpose please?"
},
{
"role": "assistant",
"content": "The githooks man page is a complete list of hooks. If it's not on there, it doesn't exist.\nThat said, there is a post-merge hook, and all pulls include a merge, though not all merges are pulls. It's run after merges, and can't affect the outcome. It never gets executed if there were conflicts; you'd have to pick that up with the post-commit hook if it really matters, or invoke it manually."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-show - Show various types of objects %ah"
},
{
"role": "assistant",
"content": "author date, human style (like the --date=human option of git-rev-list )"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Gitlab can't clone repository even though ssh works\n\nAs the title states, I can't clone a repository from a Gitlab 6 server even though the ssh seems to work.\nWhen trying to clone, it looks like this:\ngit clone ssh://[email protected]:1337/project/repository.git\nCloning into 'repository'...\nAccess denied.\nfatal: Could not read from remote repository.\n\nPlease make sure you have the correct access rights\nand the repository exists.\n\nIn the project, I have the role of \"developer\" which should have the rights to clone a repository?\nI also checked if my SSH public key is working\nssh [email protected] -p 1337 -T\nWelcome to GitLab, Anonymous!\n\nMore irritating to me is that for a friend of mine seems everything to work fine.\nEdit:\nThe main indicator for the problem stated here is the greeting from the SSH Test. In an working enviroment it should be greeting you with your name instead Anonymous!"
},
{
"role": "assistant",
"content": "Try the scp-like syntax:\ngit clone ssh://[email protected]:1337:project/repository.git\n\nThat forces the use of ~/.ssh/config actually, which means the url can be simplified to gitlab:project/repositoriy.git. \nBut it turned out to be an ssh key issue in the gitlab server ~gitlab/.ssh/authorized_keys (a bit like in issue 4730).\nThe OP Gelix confirms in the comments:\n\nI removed my key from Gitlab, manually from authorized_keys, readded it on Gitlab. Everything fine now.\n Message with SSH Test is now also Welcome to GitLab, Felix *****!\n\n(instead of Welcome to GitLab, Anonymous!)"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git stuck on Unpacking Objects phase\n\nI'm trying to do a git pull from a remote repository in github into a local machine...\nbut git gets stuck on 70% into the \"Unpacking objects\" phase, with no sign of going anywhere.. (left it for several hours now with no change)\nAny suggestion on how to fix this issue?\nIs it possible to instruct git to only download the latest commit/version from the remote repository without all the Intermediate states?"
},
{
"role": "assistant",
"content": "I had the same problem when I git pull a repository on github.com. I found there were some large files and the connection to github was slow. So maybe you just have to wait patiently before git pulls the whole repository."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Git: can I suppress listing of 'modified content'/dirty submodule entries in status, diff, etc?\nSomewhen (around the 1.6.x releases, I think) git became aware of changes inside submodules. That only serves to annoy me:\n\n$ git status vendor | grep modified:\n# modified: vendor/rails (modified content)\n\n\n$ git diff vendor/\ndiff --git a/vendor/rails b/vendor/rails\n--- a/vendor/rails\n+++ b/vendor/rails\n@@ -1 +1 @@\n-Subproject commit 046c900df27994d454b7f906caa0e4226bb42b6f\n+Subproject commit 046c900df27994d454b7f906caa0e4226bb42b6f-dirty\n\nPlease make it stop?\nEdit:\nOk, so I have an answer. Now I have another question:\nCan I put this in ~/.gitconfig? From my initial it appears that I cannot, and I didn't see anything promising by skimming the patch. (I guess I can still make an alias.)"
},
{
"role": "assistant",
"content": "There is even a possibility to set the ignore mode for every added submodule within the .gitmodules file.\nJust today I encountered this problem and immediately wrote an article in my blog about it after finding a solution: How to ignore changes in git submodules\nThe gist of it:\n\nOnce you added a submodule there will be a file named .gitmodules in the root of your repository\n\nJust add one line to that .gitmodules file:\n[submodule \"bundle/fugitive\"]\n path = bundle/fugitive\n url = git://github.com/tpope/vim-fugitive.git\n ignore = dirty"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-rev-list - Lists commit objects in reverse chronological order --encoding=<encoding>"
},
{
"role": "assistant",
"content": "Commit objects record the character encoding used for the log message\nin their encoding header; this option can be used to tell the\ncommand to re-code the commit log message in the encoding\npreferred by the user. For non plumbing commands this\ndefaults to UTF-8. Note that if an object claims to be encoded\nin X and we are outputting in X , we will output the object\nverbatim; this means that invalid sequences in the original\ncommit may be copied to the output. Likewise, if iconv(3) fails\nto convert the commit, we will quietly output the original\nobject verbatim."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Unable to locate credentials - Gitlab Pipeline for S3\n\nI'm deploying the front-end of my website to amazon s3 via Gitlab pipelines. My previous deployments have worked successfully but the most recent deployments do not. Here's the error:\nCompleted 12.3 MiB/20.2 MiB (0 Bytes/s) with 1 file(s) remaining\nupload failed: dist/vendor.bundle.js.map to s3://<my-s3-bucket-name>/vendor.bundle.js.map Unable to locate credentials\n\nUnder my secret variables I have defined four. They are S3 credential variables (AWS_ACCESS_KEY_ID & AWS_SECRET_ACCESS_KEY) for two different buckets. One pair is for the testing branch and the other is for the production branch. \nNot - the production environment variables are protected and the other variables are not.\nHere's the deploy script that I run:\n#/bin/bash\n#upload files\naws s3 cp ./dist s3://my-url-$1 --recursive --acl public-read\n\nSo why am I getting this credential location error? Surely it should just pick up the environment variables automatically (the unprotected ones) and deploy them. Do I need to define the variables in the job and refer to them?"
},
{
"role": "assistant",
"content": "(I encountered this issue many times - Adding another answer for people that have the same error - from other reasons).\nA quick checklist.\nGo to Setting -> CI/CD -> Variables and check:\n\nIf both AWS_ACCESS_KEY_ID & AWS_SECRET_ACCESS_KEY environment variables exist.\nIf both names are spelled right.\nIf their state is defined as protected - they can only be ran against protected branches (like master).\n\nIf error still occurs:\n\nMake sure the access keys still exist and active on your account.\nDelete current environment variables and replace them with new generated access keys and make sure AWS_SECRET_ACCESS_KEY doesn't contain any special characters (can lead to strange errors)."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-config - Get and set repository or global options instaweb.httpd"
},
{
"role": "assistant",
"content": "The HTTP daemon command-line to start gitweb on your working\nrepository. See git-instaweb ."
}
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.