messages
listlengths 3
3
|
---|
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-config - Get and set repository or global options bundle.heuristic"
},
{
"role": "assistant",
"content": "If this string-valued key exists, then the bundle list is designed to\nwork well with incremental git fetch commands. The heuristic signals\nthat there are additional keys available for each bundle that help\ndetermine which subset of bundles the client should download. The\nonly value currently understood is creationToken ."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git - the stupid content tracker git-prune"
},
{
"role": "assistant",
"content": "Prune all unreachable objects from the object database"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Use Gitlab Pipeline to push data to ftpserver\n\nI want to deploy to a ftp server using a Gitlab pipeline. \nI tried this code:\ndeploy: // You can name your task however you like\n stage: deploy\n only:\n - master\n deploy:\n script:\n - apt-get update -qq && apt-get install -y -qq lftp\n\nBut I get a error message. What is the best way to do this? :)"
},
{
"role": "assistant",
"content": "Then add the following code in your .gitlab-ci.yml file.\nvariables:\n HOST: \"example.com\"\n USERNAME: \"yourUserNameHere\"\n PASSWORD: \"yourPasswordHere\"\n\ndeploy:\n script:\n - apt-get update -qq && apt-get install -y -qq lftp\n - lftp -c \"set ftp:ssl-allow no; open -u $USERNAME,$PASSWORD $HOST; mirror -Rnev ./public_html ./ --ignore-time --parallel=10 --exclude-glob .git* --exclude .git/\"\n only:\n - master\n\nThe above code will push all your recently modified files in your Gitlab repository into public_html folder in your FTP Server root.\nJust update the variables HOST, USERNAME and PASSWORD with your FTP Credentials and commit this file to your Gitlab Repository, you are good to go.\nNow whenever you make changes in your master branch, Gitlab will automatically push your changes to your remote FTP server."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Broken pipe when pushing to git repository\nI'm trying to push for the first time a code to my git repository but i get the following error:\n\nCounting objects: 222026, done. \nCompressing objects: 100% (208850/208850), done. \nWrite failed: Broken pipe222026) \nerror: pack-objects died of signal 13 \nfatal: The remote end hung up unexpectedly error: failed to push some refs to 'ssh://[email protected]/<...>'\n\n\nI tried to increase the http buffer size (git config http.postBuffer 524288000), I tried to git repack, but it did not work.\nI was able to push a very similar size code to another repository (it was not working like this one, but after the git repack it did work). I'm trying to push it to bitbucket.\nAny ideas?"
},
{
"role": "assistant",
"content": "Simple solution is to increase the HTTP post buffer size to allow for larger chunks to be pushed up to the remote repo. To do that, simply type:\ngit config http.postBuffer 52428800\n\nThe number is in bytes, so in this case I have set it to 50MB. The default is 1MB."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-log - Show commit logs %>( <N> ) , %>|( <M> )"
},
{
"role": "assistant",
"content": "similar to %<( <N> ) , %<|( <M> ) respectively,\nbut padding spaces on the left"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-switch - Switch branches -c <new-branch> --create <new-branch>"
},
{
"role": "assistant",
"content": "Create a new branch named <new-branch> starting at <start-point> before switching to the branch. This is the\ntransactional equivalent of $ git branch <new-branch>\n$ git switch <new-branch> that is to say, the branch is not reset/created unless \"git switch\" is\nsuccessful (e.g., when the branch is in use in another worktree, not\njust the current branch stays the same, but the branch is not reset to\nthe start-point, either)."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to use git with gnome-keyring integration\nGit 1.8.0 supports integration with gnome-keyring.\nhttp://www.h-online.com/open/news/item/Git-1-8-0-can-access-Windows-and-GNOME-keyrings-1733879.html\nAfter reading the docs about the git credentials helpers: http://git-scm.com/docs/gitcredentials.html\nI was not able to find a way to use this new feature. How can I integrate it?\nI'm using Archlinux with git installed from Archlinux's repository. (git 1.8.0)"
},
{
"role": "assistant",
"content": "@marcosdsanchez's answer is for Arch (which answers the original question) but I'm on Ubuntu. For git >= 2.11:\nsudo apt-get install libsecret-1-0 libsecret-1-dev\ncd /usr/share/doc/git/contrib/credential/libsecret\nsudo make\ngit config --global credential.helper /usr/share/doc/git/contrib/credential/libsecret/git-credential-libsecret\n\nFor git < 2.11:\nsudo apt-get install libgnome-keyring-dev\ncd /usr/share/doc/git/contrib/credential/gnome-keyring\nsudo make\ngit config --global credential.helper /usr/share/doc/git/contrib/credential/gnome-keyring/git-credential-gnome-keyring"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Unknown SSL protocol error in connection\nI want to push my commits to a Bitbucket repository but this error occurred:\nFatal: unable to access\n'https://[email protected]/myUsername/myRepository.git/':\nUnknown SSL protocol error in connection to bitbucket.org:443"
},
{
"role": "assistant",
"content": "You can get more information with \n# Windows\nset GIT_CURL_VERBOSE=1\nset GIT_TRACE_PACKET=2\n\n# Unix\nexport GIT_CURL_VERBOSE=1\nexport GIT_TRACE_PACKET=2\n\nAnd then try a git push.\nDouble-check your proxy settings if you have one.\nNote: git 2.8 (March 2016) adds more information on an error 35:\nSee commit 0054045 (14 Feb 2016) by Shawn Pearce (spearce).\n(Merged by Junio C Hamano -- gitster -- in commit 97c49af, 24 Feb 2016) \n\nremote-curl: include curl_errorstr on SSL setup failures\nFor curl error 35 (CURLE_SSL_CONNECT_ERROR) users need the additional text stored in CURLOPT_ERRORBUFFER to debug why the connection did not start.\n This is curl_errorstr inside of http.c, so include that in the message if it is non-empty.\n\n\nAlso check out the common causes for that message:\nIf it was working before, and not working today, it is possible the SSL private key has expired on the BitBucket side (see below, reason #3), but that doesn't seem to be the case here (the certificate is valid until 12/03/2014).\n\nThe Destination Site Does Not Like the Protocol\n\nFiring off a request like the following, results in the Unknown SSL Protocol error:\n\ncurl --sslv2 https://techstacks-tools.appspot.com/\n\n\nWhy? Well, in this case it is because the techstacks tools site does not support SSLv2, thus, generating the curl (35) error.\n\nThe Destination Site Does Not Like the Cipher\n\nYou could be trying to connect to the site using an ssl cipher that the site is configured to reject.\n For example, anonymous ciphers are typically disabled on ssl-encrypted sites that are customer-facing. (Many of us set a blanket rejection policy on any SSL-encrypted web site—regardless of it's purpose.)\n The following command string \"can\" also result in the curl (35) error:\n\ncurl --ciphers ADH-RC4-MD5 https://some_web_site.some_domain.com/\n\n\nUnfortunately, the type of error response you can get from curl depends largely upon the ssl server. On some sites, you'll receive the Unknown SSL Protocol error but on my techstacks-tools site, I get:\n\ncurl: (35) error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure\n\n\nKudos to Google because this particular error is a bit more descriptive than the one my websites at work generate because this at least tells you that a ssl socket was started but because of handshake failures, the socket was never able to complete.\nTry connecting to the site with a cipher that the site supports. Not sure which cipher to use? Well, let me introduce my cryptonark ssl cipher tester...\n\nThe SSL Private Key Has Expired\n\nI came across this one earlier today working with an old WebSeAL site.\n In IBM GSKit, you can specify how long the private key password is valid. After reaching a certain date, you will still be able to get webseal started and listening on port 443 (or whatever you set your https-port value to) but you will not be able to successfully negotiate an SSL session.\n In today's case, the old WebSEAL instance was using long-expired kdb file with a long expired private key password. Once replaced with the correct, more-up-to-date version, everything worked again.\n\nImproper redirection\n\nSome ISP's and DNS providers like to intercept your failed DNS queries in order to redirect you to a search engine results-style page offering you alternative URLs or \"Did you mean...?\" counter-query results.\n If you see an error like this: \n\n error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol, \n\n\nit could be due to you typing the hostname incorrectly or the hostname is not yet tabled in your DNS. You can verify that with a simple \"host\" or \"nslookup\".\n\n\nNote (August 2015): Git 2.6+ (Q3 2015) will allow to specify the SSL version explicitly:\n\nhttp: add support for specifying the SSL version\n\nSee commit 01861cb (14 Aug 2015) by Elia Pinto (devzero2000).\nHelped-by: Eric Sunshine (sunshineco).\n(Merged by Junio C Hamano -- gitster -- in commit ed070a4, 26 Aug 2015) \nhttp.sslVersion\n\n\nThe SSL version to use when negotiating an SSL connection, if you want to force the default.\n The available and default version depend on whether libcurl was built against NSS or OpenSSL and the particular configuration of the crypto library in use. Internally this sets the 'CURLOPT_SSL_VERSION' option; see the libcurl documentation for more details on the format of this option and for the ssl version supported.\n Actually the possible values of this option are:\n\nsslv2\nsslv3\ntlsv1\ntlsv1.0\ntlsv1.1\ntlsv1.2\n\nCan be overridden by the 'GIT_SSL_VERSION' environment variable.\n To force git to use libcurl's default ssl version and ignore any explicit http.sslversion option, set 'GIT_SSL_VERSION' to the empty string."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Cleaning up old remote git branches\nI work from two different computers (A and B) and store a common git remote in the dropbox directory.\nLet's say I have two branches, master and devel. Both are tracking their remote counterparts origin/master and origin/devel.\nNow while on computer A, I delete branch devel, on local and remote.\ngit push origin :heads/devel\ngit branch -d devel\n\nRunning git branch -a on computer A, I get the following list of branches.\n\nmaster\norigin/HEAD\norigin/master\n\nRunning git fetch on computer B, I can remove the local devel branch with git branch -d devel, but I can't remove the remote devel branch.\ngit push origin :heads/devel returns the following error messages.\n\nerror: unable to push to unqualified destination: heads/proxy3d\n The destination refspec neither matches an existing ref on the remote nor begins with refs/, and we are unable to guess a prefix based on the source ref.\n fatal: The remote end hung up unexpectedly\n\ngit branch -a still lists origin/devel in the remote branches.\nHow can I clean up the remote branches from computer B?"
},
{
"role": "assistant",
"content": "First, what is the result of git branch -a on machine B?\nSecond, you have already deleted heads/devel on origin, so that's why you can't delete it from machine B.\nTry\ngit branch -r -d origin/devel\n\nor\ngit remote prune origin\n\nor\ngit fetch origin --prune\n\nand feel free to add --dry-run to the end of your git statement to see the result of running it without actually running it.\nDocs for git remote prune and git branch."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-config - Get and set repository or global options mergeConflict"
},
{
"role": "assistant",
"content": "Shown when various commands stop because of conflicts."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Is git good with binary files? [closed]\nClosed. This question is seeking recommendations for software libraries, tutorials, tools, books, or other off-site resources. It does not meet Stack Overflow guidelines. It is not currently accepting answers.\n \n \n\n\n\n\n\n\n\n\n\n\n\n We don’t allow questions seeking recommendations for software libraries, tutorials, tools, books, or other off-site resources. You can edit the question so it can be answered with facts and citations.\n\n\nClosed 3 years ago.\n\n\n\n\n\n\n\n Improve this question\n \n\n\n\nIs git good with binary files?\nIf I have a lot of uncompressed files being modified, and many compressed files never (or almost never) modified, would git handle it well? For example, if I insert or remove the middle and insert data near the end it will notice it as it does with text?\nIf git isn't good with binary files, what tool might I consider?"
},
{
"role": "assistant",
"content": "Out of the box, git can easily add binary files to its index, and also store them in an efficient way unless you do frequent updates on large uncompressable files.\nThe problems begin when git needs to generate diffs and merges: git cannot generate meaningful diffs, or merge binary files in any way that could make sense. So all merges, rebases or cherrypicks involving a change to a binary file will involve you making a manual conflict resolution on that binary file.\nYou need to decide whether the binary file changes are rare enough that you can live with the extra manual work they cause in the normal git workflow involving merges, rebases, cherrypicks."
}
] |
[
{
"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>] <blob> <blob>"
},
{
"role": "assistant",
"content": "This form is to view the differences between the raw\ncontents of two blob objects."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-ls-files - Show information about files in the index and the working tree -f"
},
{
"role": "assistant",
"content": "Similar to -t , but use lowercase letters for files\nthat are marked as fsmonitor valid (see git-update-index )."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to show the size of each commit with \"git log\"?\nHow can I get commit size shown in the output of git log?\nYou may understand commit size as the diff between its parents and itself, or anything reasonable that tells you how big the commit is.\ngit log has a --log-size option but its the size of the log message, not the commit itself."
},
{
"role": "assistant",
"content": "The \"size\" of a commit can mean different things. If you mean how much disk storage it takes up... that's very tricky to tell in Git and probably unproductive. Whereas something like SVN stores commits as deltas, when you change a file in Git it stores a new copy of the file as an object in a graph database. One object can be shared in many commits. While this might sound inefficient, Git has many clever ways to use disk space shockingly efficiently.\nIf you mean how many lines did it change, that's easy. You can use various flags to get how many files and lines changed, most of them have the word \"stat\" in them. For example, git log --shortstat will tell you how many files changed, and how many lines were inserted and deleted. Here's an example.\ncommit e3d1909c875ea0c1a64246d735affa039ad11aa0 (origin/master, origin/HEAD)\nAuthor: Michael G. Schwern <[email protected]>\nDate: Thu Aug 11 13:04:24 2016 -0700\n\n Add default Travis and AppVeyor configs.\n\n The AppVeyor one is set up for Dist::Zilla, the hardest of the bunch.\n\n 2 files changed, 60 insertions(+)\n\nIf you want an idea of the disk storage that commit represents, you need to get the IDs of the new files (blob objects) the commit created, then check their size. You can see them in a git log -p.\ncommit 0f28d9a96bc92d802b57900ce4a06db71cbaef6d\nAuthor: Michael G. Schwern <[email protected]>\nDate: Wed Aug 10 09:13:40 2016 -0700\n\n Remove my name from the gitconfig.\n\n Now it can be used by anyone. Git will prompt for the user info.\n\ndiff --git a/.gitconfig b/.gitconfig\nindex 1d539bd..538440f 100644\n--- a/.gitconfig\n+++ b/.gitconfig\n@@ -1,18 +1,10 @@\n-# If you use this file, remember to change the [user] and [sendemail] sections.\n-\n...and so on...\n\nindex 1d539bd..538440f 100644 indicates this replaced blob object (file) 1d539bd with 538440f and uses permissions 0644. If you run git cat-file -s 538440f it tells me the object is 4356 bytes. That's it's uncompressed size. On disk it's just 1849 bytes.\n$ ls -l .git/objects/53/8440f84014584432fa5bf09d761926b3d70dbe \n-r--r--r-- 1 schwern staff 1849 Aug 10 09:14 .git/objects/53/8440f84014584432fa5bf09d761926b3d70dbe\n\nAfter I git gc even the object file is gone. Now everything is in a pack file using less than 10K.\n$ tree -h .git/objects/\n.git/objects/\n├── [ 102] info\n│ └── [ 54] packs\n└── [ 136] pack\n ├── [1.9K] pack-d5b7110001ed35cce1aa0a380db762f39505b1c0.idx\n └── [7.8K] pack-d5b7110001ed35cce1aa0a380db762f39505b1c0.pack\n\nThis answer shows how to get the blobs from a commit in a more automated fashion."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-apply - Apply a patch to files and/or to the index --whitespace=<action>"
},
{
"role": "assistant",
"content": "When applying a patch, detect a new or modified line that has\nwhitespace errors. What are considered whitespace errors is\ncontrolled by core.whitespace configuration. By default,\ntrailing whitespaces (including lines that solely consist of\nwhitespaces) and a space character that is immediately followed\nby a tab character inside the initial indent of the line are\nconsidered whitespace errors. By default, the command outputs warning messages but applies the patch.\nWhen git-apply is used for statistics and not applying a\npatch, it defaults to nowarn . You can use different <action> values to control this\nbehavior: nowarn turns off the trailing whitespace warning. warn outputs warnings for a few such errors, but applies the\npatch as-is (default). fix outputs warnings for a few such errors, and applies the\npatch after fixing them ( strip is a synonym — the tool\nused to consider only trailing whitespace characters as errors, and the\nfix involved stripping them, but modern Gits do more). error outputs warnings for a few such errors, and refuses\nto apply the patch. error-all is similar to error but shows all errors."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-worktree - Manage multiple working trees"
},
{
"role": "assistant",
"content": "REFS When using multiple worktrees, some refs are shared between all worktrees,\nbut others are specific to an individual worktree. One example is HEAD ,\nwhich is different for each worktree. This section is about the sharing\nrules and how to access refs of one worktree from another. In general, all pseudo refs are per-worktree and all refs starting with refs/ are shared. Pseudo refs are ones like HEAD which are directly\nunder $GIT_DIR instead of inside $GIT_DIR/refs . There are exceptions,\nhowever: refs inside refs/bisect , refs/worktree and refs/rewritten are\nnot shared. Refs that are per-worktree can still be accessed from another worktree via\ntwo special paths, main-worktree and worktrees . The former gives\naccess to per-worktree refs of the main worktree, while the latter to all\nlinked worktrees. For example, main-worktree/HEAD or main-worktree/refs/bisect/good resolve to the same value as the main worktree’s HEAD and refs/bisect/good respectively. Similarly, worktrees/foo/HEAD or worktrees/bar/refs/bisect/bad are the same as $GIT_COMMON_DIR/worktrees/foo/HEAD and $GIT_COMMON_DIR/worktrees/bar/refs/bisect/bad . To access refs, it’s best not to look inside $GIT_DIR directly. Instead\nuse commands such as git-rev-parse or git-update-ref which will handle refs correctly."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Git push failed with error: “GitLab: Author not member of team”\ngit push failed with the following message:\nremote: GitLab: Author '`[email protected]`' is not a member of team\n\nMy #git config user.name and #git config user.email are set as:\n#git config user.name\nSam Logan \n\n#git config user.email\n[email protected]\n\nMy hostname is logath-T460.\nI am not sure why git push uses my localhostname with the Author. Any clue how to resolve this issue?"
},
{
"role": "assistant",
"content": "It's not git push that's using your username + hostname, it's git commit.\nBy default, if you did not set user.name and user.email BEFORE making a commit, git will get it from your computer name and hostname. It would also have shown you a warning like this:\nCommitter: user1234 <[email protected]>\nYour name and email address were configured automatically based\non your username and hostname. Please check that they are accurate.\nYou can suppress this message by setting them explicitly:\n\n git config --global user.name \"Your Name\"\n git config --global user.email [email protected]\n\nAfter doing this, you may fix the identity used for this commit with:\n\n git commit --amend --reset-author\n\n 1 file changed, 0 insertions(+), 0 deletions(-)\n create mode 100644 file1.txt\n\nWhen you do git push, it would just use whatever was set as the commit author and push it to the remote repo.\nWhat I think happened, is that you already committed BEFORE you set the correct user.name and user.email settings. So those commits you're trying to push already has that invalid user details \"[email protected]\" saved as the commit author.\nWhat you need to do then is to update the author of the previous commits.\nFirst, make sure to properly set the user.name and user.email config (--global or --local to the repo), otherwise known as your Git identity.\ngit config --global user.name \"yourname\"\ngit config --global user.email \"[email protected]\"\n\nSet it now to the correct identity that matches the user account of your Gitlab repo.\nThen use --reset-author on those commits.\n\nTo modify the author of only the most recent commit:\ngit commit --amend --reset-author --no-edit\n\n\nTo modify the author of multiple past commits:\n(reference: How to amend several commits in Git to change author)\ngit rebase -i HEAD~N -x \"git commit --amend --reset-author --no-edit\"\n\nwhere N is the number of previous commits you need to update. The rebase -i will show a command line editor to show you the changes, and --reset-author will use your current user.* settings. Just save and quit to apply to changes.\n\nAfter that, git push should now work."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-log - Show commit logs %d"
},
{
"role": "assistant",
"content": "ref names, like the --decorate option of git-log"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Clean up a fork and restart it from the upstream\nI have forked a repository, then I made some changes and it looks like I've messed up everything. \nI wish to start it again from scratch, using the current upstream/master as the base for my work.\nShould I rebase my repository or delete it at all?"
},
{
"role": "assistant",
"content": "The simplest solution would be (using 'upstream' as the remote name referencing the original repo forked):\ngit remote add upstream /url/to/original/repo\ngit fetch upstream\ngit checkout master\ngit reset --hard upstream/master \ngit push origin master --force \n\n(Similar to this GitHub page, section \"What should I do if I’m in a bad situation?\")\nBe aware that you can lose changes done on the master branch (both locally, because of the reset --hard, and on the remote side, because of the push --force).\nAn alternative would be, if you want to preserve your commits on master, to replay those commits on top of the current upstream/master.\nReplace the reset part by a git rebase upstream/master. You will then still need to force push.\nSee also \"What should I do if I’m in a bad situation?\"\n\nA more complete solution, backing up your current work (just in case) is detailed in \"Cleanup git master branch and move some commit to new branch\".\nSee also \"Pull new updates from original GitHub repository into forked GitHub repository\" for illustrating what \"upstream\" is.\n\n\nNote: recent GitHub repos do protect the master branch against push --force.\nSo you will have to un-protect master first (see picture below), and then re-protect it after force-pushing).\n\n\nNote: on GitHub specifically, there is now (February 2019) a shortcut to delete forked repos for pull requests that have been merged upstream."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Should the mvnw files be added to the repository?\nWhen creating spring-boot projects by using start.spring.io, some maven wrapper files get included:\n\nmvnw\nmvnw.bat\n\nShould these files be ignored when committing to a git repo?"
},
{
"role": "assistant",
"content": "A mvnw Maven wrapper script allows you to run a Maven command without having Maven installed and present on your PATH. It does by looking for Maven on your PATH and, if not found, it downloads and installs Maven in a default location (your user home directory, IIRC).\nThey are a convenience but they are not necessarily part of your project, not in the same way as your project code and configuration is. In other words:\n\nAny given mnvw file could be used for multiple, unrelated projects\nA mnvw file will almost certainly not be different from one version of your project to another\n\nOn this basis you could make a case for not committing mvnw to your code repository.\nHowever, including a mvnw script in your repo does have these benefits:\n\nAllows anyone who clones / checks-out your repo to build your project without having to install Maven first. \nEnsures that the version of Maven in use is the version with which your project is compatible.\n\nOn this basis you could make a case for committing mvnw to your code repository.\nSo, there are pros and cons on both sides. Just choose the side which best fits the needs of those who will use your repo. Either:\n\nInclude something in your readme which makes clear that (a) Maven is a prerequisite and (b) which version of Maven is required.\n\n... or:\n\nInclude a mvnw script."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-clone - Clone a repository into a new directory init.defaultBranch"
},
{
"role": "assistant",
"content": "Allows overriding the default branch name e.g. when initializing\na new repository."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-config - Get and set repository or global options gpg.ssh.revocationFile"
},
{
"role": "assistant",
"content": "Either a SSH KRL or a list of revoked public keys (without the principal prefix).\nSee ssh-keygen(1) for details.\nIf a public key is found in this file then it will always be treated\nas having trust level \"never\" and signatures will show as invalid."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "gitglossary - A Git Glossary grafts"
},
{
"role": "assistant",
"content": "Grafts enable two otherwise different lines of development to be joined\ntogether by recording fake ancestry information for commits. This way\nyou can make Git pretend the set of parents a commit has\nis different from what was recorded when the commit was\ncreated. Configured via the .git/info/grafts file. Note that the grafts mechanism is outdated and can lead to problems\ntransferring objects between repositories; see git-replace for a more flexible and robust system to do the same thing."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-rm - Remove files from the working tree and from the index"
},
{
"role": "assistant",
"content": "NAME git-rm - Remove files from the working tree and from the index"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-rev-parse - Pick out and massage parameters CHERRY_PICK_HEAD"
},
{
"role": "assistant",
"content": "records the commit which you are cherry-picking when you run git\ncherry-pick ."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-diff - Show changes between commits, commit and working tree, etc diff.dirstat"
},
{
"role": "assistant",
"content": "A comma separated list of --dirstat parameters specifying the\ndefault behavior of the --dirstat option to git-diff and friends. The defaults can be overridden on the command line\n(using --dirstat=<param1,param2,...> ). The fallback defaults\n(when not changed by diff.dirstat ) are changes,noncumulative,3 .\nThe following parameters are available: changes Compute the dirstat numbers by counting the lines that have been\nremoved from the source, or added to the destination. This ignores\nthe amount of pure code movements within a file. In other words,\nrearranging lines in a file is not counted as much as other changes.\nThis is the default behavior when no parameter is given. lines Compute the dirstat numbers by doing the regular line-based diff\nanalysis, and summing the removed/added line counts. (For binary\nfiles, count 64-byte chunks instead, since binary files have no\nnatural concept of lines). This is a more expensive --dirstat behavior than the changes behavior, but it does count rearranged\nlines within a file as much as other changes. The resulting output\nis consistent with what you get from the other --*stat options. files 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. cumulative Count changes in a child directory for the parent directory as well.\nNote that when using cumulative , the sum of the percentages\nreported may exceed 100%. The default (non-cumulative) behavior can\nbe specified with the noncumulative parameter. <limit> An integer parameter specifies a cut-off percent (3% by default).\nDirectories contributing less than this percentage of the changes\nare not shown in the output. Example: The following will count changed files, while ignoring\ndirectories with less than 10% of the total amount of changed files,\nand accumulating child directory counts in the parent directories: files,10,cumulative ."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git - the stupid content tracker git-submodule"
},
{
"role": "assistant",
"content": "Initialize, update or inspect submodules"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to git reset --hard a subdirectory\nUPDATE²: With Git 2.23 (August 2019), there's a new command git restore that does this, see the accepted answer.\n\n\nUPDATE: This will work more intuitively as of Git 1.8.3, see my own answer.\n\nImagine the following use case: I want to get rid of all changes in a specific subdirectory of my Git working tree, leaving all other subdirectories intact.\n\nI can do git checkout . , but git checkout . adds directories excluded by sparse checkout\n\nThere is git reset --hard, but it won't let me do it for a subdirectory:\n> git reset --hard .\nfatal: Cannot do hard reset with paths.\n\nAgain: Why git can't do hard/soft resets by path?\n\nI can reverse-patch the current state using git diff subdir | patch -p1 -R, but this is a rather weird way of doing this.\n\n\nWhat is the proper Git command for this operation?\nThe script below illustrates the problem. Insert the proper command below the How to make files comment -- the current command will restore the file a/c/ac which is supposed to be excluded by the sparse checkout. Note that I do not want to explicitly restore a/a and a/b, I only \"know\" a and want to restore everything below. EDIT: And I also don't \"know\" b, or which other directories reside on the same level as a.\n#!/bin/sh\n\nrm -rf repo; git init repo; cd repo\nfor f in a b; do\n for g in a b c; do\n mkdir -p $f/$g\n touch $f/$g/$f$g\n git add $f/$g\n git commit -m \"added $f/$g\"\n done\ndone\ngit config core.sparsecheckout true\necho a/a > .git/info/sparse-checkout\necho a/b >> .git/info/sparse-checkout\necho b/a >> .git/info/sparse-checkout\ngit read-tree -m -u HEAD\necho \"After read-tree:\"\nfind * -type f\n\nrm a/a/aa\nrm a/b/ab\necho >> b/a/ba\necho \"After modifying:\"\nfind * -type f\ngit status\n\n# How to make files a/* reappear without changing b and without recreating a/c?\ngit checkout -- a\n\necho \"After checkout:\"\ngit status\nfind * -type f"
},
{
"role": "assistant",
"content": "With Git 2.23 (August 2019), you have the new command git restore (also presented here)\ngit restore --source=HEAD --staged --worktree -- aDirectory\n# or, shorter\ngit restore -s@ -SW -- aDirectory\n\nThat would replace both the index and working tree with HEAD content, like an reset --hard would, but for a specific path.\n\nOriginal answer (2013)\nNote (as commented by Dan Fabulich) that:\n\ngit checkout -- <path> doesn't do a hard reset: it replaces the working tree contents with the staged contents.\ngit checkout HEAD -- <path> does a hard reset for a path, replacing both the index and the working tree with the version from the HEAD commit.\n\nAs answered by Ajedi32, both checkout forms don't remove files which were deleted in the target revision.\nIf you have extra files in the working tree which don't exist in HEAD, a git checkout HEAD -- <path> won't remove them.\nNote: With git checkout --overlay HEAD -- <path> (Git 2.22, Q1 2019), files that appear in the index and working tree, but not in <tree-ish> are removed, to make them match <tree-ish> exactly.\nBut that checkout can respect a git update-index --skip-worktree (for those directories you want to ignore), as mentioned in \"Why do excluded files keep reappearing in my git sparse checkout?\"."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-request-pull - Generates a summary of pending changes <URL>"
},
{
"role": "assistant",
"content": "The repository URL to be pulled from."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "gitglossary - A Git Glossary icase"
},
{
"role": "assistant",
"content": "Case insensitive match."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Remove releases in GitLab\n\nI have a problem with my releases in GitLab.\nI created them in my project with tags. Now I want to remove them, so I deleted the associated tags but my releases are always displayed. I searched on Google and Stack Overflow but I can't find any solutions.\nHow can I remove these releases without their tags?"
},
{
"role": "assistant",
"content": "Go to Project Overview -> Releases\nClick the release you want to delete\nScroll to the bottom. Find the tag icon. Click on the tag.\nThere is a trash can button for the tag. Deleting the tag will delete the release as well."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git - the stupid content tracker gitignore"
},
{
"role": "assistant",
"content": "Specifies intentionally untracked files to ignore"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-config - Get and set repository or global options commit.cleanup"
},
{
"role": "assistant",
"content": "This setting overrides the default of the --cleanup option in git commit . See git-commit for details. Changing the\ndefault can be useful when you always want to keep lines that begin\nwith the comment character # in your log message, in which case you\nwould do git config commit.cleanup whitespace (note that you will\nhave to remove the help lines that begin with # in the commit log\ntemplate yourself, if you do this)."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Not able to execute GitLab Runner in Kubernetes cluster: cannot create resource \"secrets\" in API group \"\" in the namespace \"gitlab\"\n\nCurrently I'm facing the issue:\nERROR: Job failed (system failure): \nprepare environment: \nsetting up credentials: \nsecrets is forbidden: \nUser \"system:serviceaccount:default:gitlab-runner\" cannot create\nresource \"secrets\" in API group \"\" in the namespace \"gitlab\" \n\nafter following the official documentation on how to integrate the GitLab Runner.\nI'm using the following runner-chart-values.yaml:\n# The GitLab Server URL (with protocol) that want to register the runner against\n# ref: https://docs.gitlab.com/runner/commands/README.html#gitlab-runner-register\n#\ngitlabUrl: http://example.domain/\n\n# The Registration Token for adding new runners to the GitLab Server. This must\n# be retrieved from your GitLab instance.\n# ref: https://docs.gitlab.com/ce/ci/runners/README.html\n#\nrunnerRegistrationToken: \"<token>\"\n\n# For RBAC support:\nrbac:\n create: true\n rules:\n - apiGroups: [\"*\"]\n\n# Run all containers with the privileged flag enabled\n# This will allow the docker:dind image to run if you need to run Docker\n# commands. Please read the docs before turning this on:\n# ref: https://docs.gitlab.com/runner/executors/kubernetes.html#using-dockerdind\nrunners:\n privileged: true\n\nAny clues what's going on?\nMany thanks!"
},
{
"role": "assistant",
"content": "For me adding all necessary roles was the only solution that actually helped.\nHere the corresponding runner-chart-values.yaml file:\n## GitLab Runner Image\ngitlabUrl: http://example.domain/\nrunnerRegistrationToken: \"<token>\"\n\nrbac:\n create: true\n rules:\n - apiGroups: [\"\"]\n resources: [\"pods\"]\n verbs: [\"list\", \"get\", \"watch\", \"create\", \"delete\"]\n - apiGroups: [\"\"]\n resources: [\"pods/exec\"]\n verbs: [\"create\"]\n - apiGroups: [\"\"]\n resources: [\"pods/log\"]\n verbs: [\"get\"]\n - apiGroups: [\"\"]\n resources: [\"pods/attach\"]\n verbs: [\"list\", \"get\", \"create\", \"delete\", \"update\"]\n - apiGroups: [\"\"]\n resources: [\"secrets\"]\n verbs: [\"list\", \"get\", \"create\", \"delete\", \"update\"] \n - apiGroups: [\"\"]\n resources: [\"configmaps\"]\n verbs: [\"list\", \"get\", \"create\", \"delete\", \"update\"] \n\nrunners:\n privileged: true"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git: 'remote-https' is not a git command?\nWhenever I attempt to clone, push or pull I get:\nC:\\Users\\User\\Documents\\Project>git pull\n\ngit: 'remote-https' is not a git command. See 'git --help'.\nCommitting and adding still work fine."
},
{
"role": "assistant",
"content": "In my case, I was building Git from source in WSL Ubuntu.\nThe distribution didn't come with libcurl preinstalled. In this case, the git-remote-http executable was not being built. So I installed it:\nsudo apt install libcurl4-openssl-dev\n\nThen, I re-configured, re-maked and re-installed, and Git could clone."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Ignoring folder meta files on version control\nUnity creates and deletes meta files for folders inside the Asset folder.\nThat can create an annoying situation when using version control (that you can skip and go to the questions): someone creates a folder of files that will be ignored but forget to ignore the folder's meta file. Unity creates the meta file and this person adds the meta to version control. Another person gets the changesets and, since they don't have the folder, their Unity deletes the meta file and they remove the meta file from version control. Not everyone in the team understand this, so the process is perpetuated in a loop from hell.\nSurprisingly this happens all the time. So, two questions:\n\nIs it important to version folder meta files? \nIs there a way to automatically ignore folder meta files - particularly on git or mercurial?"
},
{
"role": "assistant",
"content": "The Unity docs say:\n\nWhen creating new assets, make sure both the asset itself and the associated .meta file is added to version control. \n\nFor me this is reason enough to put them under version control. I see two approaches to solve the problem:\n\nOrganisational: Set up a naming convention for local folders like starting with \"_\". But we all know that this won't work ;-)\nInstall a client side pre-commit hook on all machines. I haven't done this yet but it seems promising. \n\nI just played around with the different git commands, the following could be useful:\nThe git hook script shoud first check if .gitignore has changed by:\ngit diff-index --cached --name-only HEAD | grep \".gitignore\"\n\nPrint out directory names of all newly added lines in .gitignore if they are located under the Assets folder:\ngit diff --cached --word-diff=plain .gitignore | grep -o -e \"{+\\/.*\\/Assets\\/.*+}\" | cut -d + -f 2\n\n\nUpdate\nI just wrote such a pre-commit hook :-) See the GitHub repository git-pre-commit-hook-unity-assets for code and my blog posting about it for more details."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How do I remove a directory from a Git repository?\nHow can I delete a single directory containing files from a Git repository?"
},
{
"role": "assistant",
"content": "Remove directory from Git and local\nCheckout 'master' with both directories:\ngit rm -r one-of-the-directories // This deletes from filesystem\ngit commit . -m \"Remove duplicated directory\"\ngit push origin <your-git-branch> (typically 'master', but not always)\n\nRemove directory from Git but NOT local\nTo remove this directory from Git, but not delete it entirely from the filesystem (local):\ngit rm -r --cached myFolder"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git - the stupid content tracker gitcredentials"
},
{
"role": "assistant",
"content": "Providing usernames and passwords to Git"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Going back to a previous commit in Github Desktop\nI am trying to use GitHub Desktop (i.e. the GUI application - NOT command line) to go back to a previous commit (on the same branch). Something that I would have thought is a core feature, since it's the primary reason for using source control in the first place.\nI can see that it's possible to revert a commit, but this is not really what I want as it creates a new commit. I would just simply like to go back with the option of going forward again, in the same way that I can just hop to a different branch.\nIs this possible or is it a limitation of github desktop and I need to use the cmd line for that?"
},
{
"role": "assistant",
"content": "In general, you can go back to a commit in your history with git reset.\n\nThis is not possible with GitHub Desktop. GitHub Desktop is more of a tool to synchronize your repositories and not a full featured GUI client.\nBut that doesn't mean you have to use the command line, since there are alternatives. You can find a list here. To mention a few (that support git reset):\n\nTortoiseGit (Windows)\nSourceTree (Mac, Windows)\n\n\nHere is how you do it on command line. Most clients provide this in their UI using the same vocabulary (usually, you are able to select a commit and reset to it via context menu).\nYou will go back to the previous commit with\ngit reset HEAD^\n\nor some more commits (for example 3) by\ngit reset HEAD^3\n\nor to a specific commit by\ngit reset f7823ab\n\nHave in mind that, by default, the option --mixed is passed to git reset. So, all changes made, since that commit you reset to, will still be there.\nTo get the original state of the commit that you want to 'revert', you have to pass --hard. For example:\ngit reset f7823ab --hard"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to troubleshoot a url error with \"Port number ended with 'y'\"?\n\nWhile trying to clone an already existing repository from gitlab into my local drive. I used the format\n$ git clone https://github.com/libgit2/libgit2 mylibgit \n\nThe resulting folder e.g mylibgit was found somewhere outside the XAMPP web folder (i.e htdocs), I moved it there but it's not working as supposed. \nI moved it out to my desktop and got the error :\nfatal: unable to access 'https://[email protected]:xxxxx/yyyyyy/':Port number ended with 'y'"
},
{
"role": "assistant",
"content": "For gitlab, you don't need to specify the user.\nReplace it by an https url based on your GitLab account name.\ncd /path/to/your/repo\ngit remote set-url origin https://gitlab.com/<username>/<yourProjectName.git>\ngit push -u origin master\n\nNote:\n\ntrying to clone an already existing repository from gitla\n\nThis contradict \"git clone https://github.com/libgit2/libgit2\", since this is a GitHub url, not a GitLab one."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "No submodule mapping found in .gitmodules for path and missing .gitmodules file\nWhen I run git submodule init, I get the following error:\n\nNo submodule mapping found in .gitmodules for path 'xxx'\n\nI searched for a .gitmodules file and I cannot find it anywhere.\nI have read this most popular SO question on the same topic. \nBut unfortunately, I cannot solve the problem. Especially given that I no longer have .gitmodules.\nAccording to my GitHub private repo, I still have submodules for my repository. Just that I cannot find the .gitmodules file anywhere."
},
{
"role": "assistant",
"content": "Make sure that there are no submodule sections in .git/config. If there are, remove them.\nDo git rm --cached <path_to_submodule>."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-branch - List, create, or delete branches --no-abbrev"
},
{
"role": "assistant",
"content": "Display the full sha1s in the output listing rather than abbreviating them."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git - the stupid content tracker githooks"
},
{
"role": "assistant",
"content": "Hooks used by Git"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to avoid merge-commit hell on GitHub/BitBucket\n\nWe're ending up with a lot of commits like this in our repo:\nMerge branch 'master' of bitbucket.org:user/repo\n\nThis happens every time a developer syncs his/hers local fork to the top-level repo.\nIs there anyway to avoid this merge-commit hell from cluttering all the repo log? Can one avoid them when initiating the pull-requests in some way?\nI know I can do git rebase if this is done in my local VM only, is there any equivalence in the GitHub/BitBucket UI?\nHow do you guys do it?"
},
{
"role": "assistant",
"content": "Rebase Feature Branches Before Merging\nIf you want to avoid merge commits, you need to ensure all commits are fast-forwards. You do this by making sure your feature branch rebases cleanly onto your line of development before a merge like so:\ngit checkout master\ngit checkout -b feature/foo\n\n# make some commits\n\ngit rebase master\ngit checkout master\ngit merge --ff-only feature/foo\n\nRebase also has a lot of flags, including interactive rebasing with the -i flag, but you may not need that if you're keeping things as simple as possible and want to preserve all of your branch history on a merge.\nUse the --ff-only Flag\nAside from rebasing, the use of the --ff-only flag will ensure that only fast-forward commits are allowed. A commit will not be made if it would be a merge commit instead. The git-merge(1) manual page says:\n\n--ff-only \nRefuse to merge and exit with a non-zero status unless the current\n HEAD is already up-to-date or the merge can be resolved as a\n fast-forward."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "fatal: Not a git repository (or any of the parent directories): .git [duplicate]\nThis question already has answers here:\n \n \n\n\n\n\nfatal: Not a git repository (or any of the parent directories): .git\n\n (9 answers)\n \n\n\nReceiving \"fatal: Not a git repository\" when attempting to remote add a Git repo\n\n (39 answers)\n \n\nClosed 10 years ago.\n\n\n\nWhen I tried to push an existing repository on github.com, and it when I entered the command the website prompted me to put into the terminal, I got this error message fatal: \nNot a git repository (or any of the parent directories): .git\n\nIf anyone could help me with this, then that would be great, thanks."
},
{
"role": "assistant",
"content": "The command has to be entered in the directory of the repository. The error is complaining that your current directory isn't a git repo\n\nAre you in the right directory? Does typing ls show the right files?\nHave you initialized the repository yet? Typed git init? (git-init documentation)\n\nEither of those would cause your error."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-rev-parse - Pick out and massage parameters [<refname>]@{<date>} , e.g. master@{yesterday} , HEAD@{5 minutes ago}"
},
{
"role": "assistant",
"content": "A ref followed by the suffix @ with a date specification\nenclosed in a brace\npair (e.g. {yesterday} , {1 month 2 weeks 3 days 1 hour 1\nsecond ago} or {1979-02-26 18:30:00} ) specifies the value\nof the ref at a prior point in time. This suffix may only be\nused immediately following a ref name and the ref must have an\nexisting log ( $GIT_DIR/logs/<ref> ). Note that this looks up the state\nof your local ref at a given time; e.g., what was in your local master branch last week. If you want to look at commits made during\ncertain times, see --since and --until ."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How do I create a readable diff of two spreadsheets using git diff?\nWe have a lot of spreadsheets (xls) in our source code repository. These are usually edited with gnumeric or openoffice.org, and are mostly used to populate databases for unit testing with dbUnit. There are no easy ways of doing diffs on xls files that I know of, and this makes merging extremely tedious and error prone.\nI've tried to converting the spreadsheets to xml and doing a regular diff, but it really feels like it should be a last resort. \nI'd like to perform the diffing (and merging) with git as I do with text files. How would I do this, e.g. when issuing git diff?"
},
{
"role": "assistant",
"content": "We faced the exact same issue in our co. Our tests output excel workbooks. Binary diff was not an option. So we rolled out our own simple command line tool. Check out the ExcelCompare project. Infact this allows us to automate our tests quite nicely. Patches / Feature requests quite welcome!"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Changing source branch for PR on Github\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 partial merge, not whole branch\nI've read about some tricks with merge in Git: merging public and private branches while while keeping certain files intact in both branches and others and not found a solution.\nIn my case I'm feeling need to do opposite merge strategy. In parallel development I have to keep some files same across the arbitrary branches. From other side I do not want to do squash or no-commit merge, while difference are significant and could break current state of testing branch. \nWhat I want something like \ngit checkout testing\ngit merge config.xml -b development or git merge config\\*.xml -b development\nI guess this is like git merge-files ... command, but second file delivered from the branch, not from the filesystem.\nIs it possible? or may be there is a kind of workaround? submodules? attributes?\nThanks"
},
{
"role": "assistant",
"content": "There are a couple things you can do.\nOne, you can cherry-pick the changes you want, which applies only a single commit. For example, if there's a change that only touches config.xml, you can cherry-pick it with\n$ git cherry-pick $COMMIT_ID_YOU_WANT\n\nYou could also just grab config.xml from the development branch:\n$ git checkout testing\n$ git checkout development -- config.xml\n\nThat'll get you the same version of config.xml that exists in the development branch, but note that it won't pull in the history of changes to the file."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-diff - Show changes between commits, commit and working tree, etc diff.autoRefreshIndex"
},
{
"role": "assistant",
"content": "When using git diff to compare with work tree\nfiles, do not consider stat-only changes as changed.\nInstead, silently run git update-index --refresh to\nupdate the cached stat information for paths whose\ncontents in the work tree match the contents in the\nindex. This option defaults to true. Note that this\naffects only git diff Porcelain, and not lower level diff commands such as git diff-files ."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Git format-patch to be svn compatible?\nIs there any way to get a patch created with git format-patch to be svn compatible so that I can submit it to an svn repo?\nI'm working off an svn repo on github and want to submit my changes back to the main repo. I need to create a patch to do this, however the patch cannot be applied since git formats that patch differently then svn. Is there some secret I haven't discovered yet?\nUPDATE: Although currently there exists no script or native git way to do this, I did managed to find a post from earlier this year about how to manually accomplish this. I have followed the instructions and had success getting my git patches to work with svn.\nIf someone could take a stab at writing a script to accomplish this and contribute to the git project, I'm everyone would be much appreciated.\nhttp://kerneltrap.org/mailarchive/git/2008/1/15/570308/thread#mid-570308"
},
{
"role": "assistant",
"content": "I always have to Google this but the way I've found that works perfectly (for me) is:\n\nCreate the patch with git diff --no-prefix master..branch > somefile.diff, the master and branch part are optional, depends how you want to get your diffs.\nSend it wherever and apply with patch -p0 < somefile.diff. \n\nIt always seems to work fine for me and seems to be the simplest method that I've come across."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Find a commit on GitHub given the commit hash\n\nI am fairly new to Github and have come across an amateur-ish problem.\nI have been asked to do a code review and have been provided with a commit hash, however I have tried looking in Git if I can search using commit hashes but couldn't find anything.\nIs there a way I can find the changed code just by using the commit hash?"
},
{
"role": "assistant",
"content": "A URL of the form https://github.com/<owner>/<project>/commit/<hash> will show you the changes introduced in that commit. For example here's a recent bugfix I made to one of my projects on GitHub:\nhttps://github.com/jerith666/git-graph/commit/35e32b6a00dec02ae7d7c45c6b7106779a124685\nYou can also shorten the hash to any unique prefix, like so:\nhttps://github.com/jerith666/git-graph/commit/35e32b\n\nI know you just asked about GitHub, but for completeness: If you have the repository checked out, from the command line, you can achieve basically the same thing with either of these commands (unique prefixes work here too):\ngit show 35e32b6a00dec02ae7d7c45c6b7106779a124685\ngit log -p -1 35e32b6a00dec02ae7d7c45c6b7106779a124685\n\nNote: If you shorten the commit hash too far, the command line gives you a helpful disambiguation message, but GitHub will just return a 404."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to ignore Icon? in git\nWhile trying to setup a dropbox folder with git, I saw a \"Icon\\r\" file which is not created by me. I try to ignore it in the ~/.gitignore file. But adding Icon\\r Icon\\r\\r Icon? won't work at all."
},
{
"role": "assistant",
"content": "You can use vim as well.\n\nvim .gitignore\nin a new line write Icon, then\npress ctrl+v and then press Enter\nrepeat step 3\nsave and exit (shortcut: ZZ)\n\nNow you should have Icon^M^M and it's done :)\nFor a smarter use you could add it to your gitignore global config file in ~/.gitignore_global."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "how to reference branch in gitlab markdown?\n\nI would like to use gitlab markdown syntax to refer to a branch in README.md file.\nI tried @develop, but it doesn't work. Any ideas?"
},
{
"role": "assistant",
"content": "Not exactly what you were looking for but at least something - try this markdown construct.\n[myReference](../../tree/myBranch/myPath/myFile.cpp#L310-313)\n\nThis will navigate you away from the main branch towards the branch you want (myBranch in this example)\nHowever if the branchname changes then things will be broken. I really feel this functionality should be added to gitlab in near future"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Remove git mapping in Visual Studio 2015\nThis question has nothing to do with git itself; rather, it has to do with removing a binding/mapping to a git repository that Visual Studio 2015 (VS2015) has previously seen.\nHere's a screen shot of the problem:\n\nNotice that the remove button is grayed out (disabled). How can I remove this entry from the \"Local Git Repositories\" list?"
},
{
"role": "assistant",
"content": "The solution is much simpler than that. You simply need to remove three files from the project UNC Path.\nNavigate to your solution's UNC Path.\nExample: C:\\Users\\Your User Name\\Documents\\Visual Studio 2015\\Projects\\Your Project Folder\nThen permanently delete (\"SHIFT + DEL\") the .git* files and folder. There are two files and one folder, which may be hidden so ensure you have your folders and search options > View > show hidden files, folder, and drives (Radio Button) Selected.\nThe files to permanently delete are:\n\n.gitignore (file)\n.gitattributes (file)\n.git (folder)\n\nReopen Visual Studio and there is no more relationship to the Git Source Control. If you wanted to take it as far as removing it from the registry as mentioned above, you could, but that shouldn't be necessary aside from the \"house keeping\" of your machine."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-diff - Show changes between commits, commit and working tree, etc --anchored=<text>"
},
{
"role": "assistant",
"content": "Generate a diff using the \"anchored diff\" algorithm. This option may be specified more than once. If a line exists in both the source and destination, exists only once,\nand starts with this text, this algorithm attempts to prevent it from\nappearing as a deletion or addition in the output. It uses the \"patience\ndiff\" algorithm internally."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to Diff between local uncommitted changes and origin\nLet's say I cloned a repository and started modifying files. I know that if I have local uncommitted changes, I can do a diff as follows git diff test.txt and it will show me the difference between the current local HEAD and the modified, uncommitted changes in the file. If I commit those changes I can diff it against the original repository by using git diff master origin/master\nBut is there any way of diff'ing the local changes with the original repository on the server before committing locally? I tried various permutations of git diff --cached master origin/master with no luck."
},
{
"role": "assistant",
"content": "Given that the remote repository has been cached via git fetch it should be possible to compare against these commits. Try the following:\n$ git fetch origin\n$ git diff origin/master"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-request-pull - Generates a summary of pending changes <start>"
},
{
"role": "assistant",
"content": "Commit to start at. This names a commit that is already in\nthe upstream history."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-describe - Give an object a human readable name based on an available ref --tags"
},
{
"role": "assistant",
"content": "Instead of using only the annotated tags, use any tag\nfound in refs/tags namespace. This option enables matching\na lightweight (non-annotated) tag."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How does Git save space and is fast at the same time?\nI just saw the first Git tutorial at http://blip.tv/play/Aeu2CAI.\nHow does Git store all the versions of all the files, and how can it still be more economical in space than Subversion which saves only the latest version of the code?\nI know this can be done using compression, but that would be at the cost of speed, but this also says that Git is much faster (though where it gains the maximum is the fact that most of its operations are offline).\nSo, my guess is that\n\nGit compresses data extensively\nIt is still faster because uncompression + work is still faster than network_fetch + work\n\nAm I correct? Even close?"
},
{
"role": "assistant",
"content": "I assume you are asking how it is possible for a git clone (full repository + checkout) to be smaller than checked-out sources in Subversion. Or did you mean something else?\nThis question is answered in the comments\n\nRepository size\nFirst you should take into account that along checkout (working version) Subversion stores pristine copy (last version) in those .svn subdirectories. Pristine copy is stored uncompressed in Subversion.\nSecond, git uses the following techniques to make repository smaller:\n\neach version of a file is stored only once; this means that if you have only two different versions of some file in 10 revisions (10 commits), git stores only those two versions, not 10.\nobjects (and deltas, see below) are stored compressed; text files used in programming compress really well (around 60% of original size, or 40% reduction in size from compression)\nafter repacking, objects are stored in deltified form, as a difference from some other version; additionally git tries to order delta chains in such a way that the delta consists mainly of deletions (in the usual case of growing files it is in recency order); IIRC deltas are compressed as well.\n\nPerformance (speed of operations)\nFirst, any operation that involves network would be much slower than a local operation. Therefore for example comparing current state of working area with some other version, or getting a log (a history), which in Subversion involves network connection and network transfer, and in Git is a local operation, would of course be much slower in Subversion than in Git. BTW. this is the difference between centralized version control systems (using client-server workflow) and distributed version control systems (using peer-to-peer workflow), not only between Subversion and Git.\nSecond, if I understand it correctly, nowadays the limitation is not CPU but IO (disk access). Therefore it is possible that the gain from having to read less data from disk because of compression (and being able to mmap it in memory) overcomes the loss from having to decompress data.\nThird, Git was designed with performance in mind (see e.g. GitHistory page on Git Wiki):\n\nThe index stores stat information for files, and Git uses it to decide without examining files if the files were modified or not (see e.g. core.trustctime config variable).\nThe maximum delta depth is limited to pack.depth, which defaults to 50. Git has delta cache to speed up access. There is (generated) packfile index for fast access to objects in packfile.\nGit takes care to not touch files it doesn't have to. For example when switching branches, or rewinding to another version, Git updates only files that changed. The consequence of this philosophy is that Git does support only very minimal keyword expansion (at least out of the box).\nGit uses its own version of LibXDiff library, nowadays also for diff and merge, instead of calling external diff / external merge tool.\nGit tries to minimize latency, which means good perceived performance. For example it outputs first page of \"git log\" as fast as possible, and you see it almost immediately, even if generating full history would take more time; it doesn't wait for full history to be generated before displaying it.\nWhen fetching new changes, Git checks what objects you have in common with the server, and sends only (compressed) differences in the form of thin packfile. Admittedly Subversion can (or perhaps by default it does) also send only differences when updating.\n\nI am not a Git hacker, and I probably missed some techniques and tricks that Git uses for better performance. Note however that Git heavily uses POSIX (like memory mapped files) for that, so the gain might be not as large on MS Windows."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git - the stupid content tracker gitremote-helpers"
},
{
"role": "assistant",
"content": "Helper programs to interact with remote repositories"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-config - Get and set repository or global options transfer.credentialsInUrl"
},
{
"role": "assistant",
"content": "A configured URL can contain plaintext credentials in the form <protocol>://<user>:<password>@<domain>/<path> . You may want\nto warn or forbid the use of such configuration (in favor of\nusing git-credential ). This will be used on git-clone , git-fetch , git-push ,\nand any other direct use of the configured URL. Note that this is currently limited to detecting credentials in remote.<name>.url configuration; it won’t detect credentials in remote.<name>.pushurl configuration. You might want to enable this to prevent inadvertent credentials\nexposure, e.g. because: The OS or system where you’re running git may not provide a way or\notherwise allow you to configure the permissions of the\nconfiguration file where the username and/or password are stored. Even if it does, having such data stored \"at rest\" might expose you\nin other ways, e.g. a backup process might copy the data to another\nsystem. The git programs will pass the full URL to one another as arguments\non the command-line, meaning the credentials will be exposed to other\nunprivileged users on systems that allow them to see the full\nprocess list of other users. On linux the \"hidepid\" setting\ndocumented in procfs(5) allows for configuring this behavior. If such concerns don’t apply to you then you probably don’t need to be\nconcerned about credentials exposure due to storing sensitive\ndata in git’s configuration files. If you do want to use this, set transfer.credentialsInUrl to one of these values: allow (default): Git will proceed with its activity without warning. warn : Git will write a warning message to stderr when parsing a URL\nwith a plaintext credential. die : Git will write a failure message to stderr when parsing a URL\nwith a plaintext credential."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Stuck in a git rebase ... how to reset\nI am part way through a git rebase and I am stuck. I can't remember exactly what happened but I was using a UI and deleted a checked-out branch and things just seemed to go blank. I restarted and managed to do a bit of other work creating and committing to other branches etc but then I noticed a status saying I was still in the middle of a rebase \nIf I try \ngit rebase --skip\ngit rebase --continue\ngit rebase --abort\n\neach fail with\nerror: could not read '.git/rebase-merge/head-name': No such file or directory\n\nIs there a way I can get back to a stable state? I'm really not bothered about what the rebase related to so am not trying to get back to point where I am still in the middle of the rebase.\nEdit:\n$ git status\nOn branch fix/SJW-01225\nYour branch is up to date with 'core-v3/fix/SJW-01225'.\n\nYou are currently rebasing.\n(all conflicts fixed: run \"git rebase --continue\")\n\nUntracked files:\n(use \"git add <file>...\" to include in what will be committed)\n\n [long list of untracked files]\n\nnothing added to commit but untracked files present (use \"git add\" to track)\n\nEdit-1:\n$ touch .git/rebase-merge/head-name\n\n$ git rebase --abort\nerror: could not read '.git/rebase-merge/onto': No such file or directory\n\n$ touch .git/rebase-merge/onto\n\n$ git rebase --abort\nerror: could not get 'onto': ''\n\nThx"
},
{
"role": "assistant",
"content": "To escape from corrupted git rebase you can do the following\n\nReset to a known state. You can find out from which commit you started your rebase with git reflog.\n\nFor example, reflog will give you the following. The rebase starting point is the last rebase (start) or rebase -i (start) if you did an interactive rebase. Here it is HEAD@{1}:\n$ git reflog\nf10ccfed (HEAD) HEAD@{0}: rebase : fast-forward\n383aa038 (origin/master, origin/HEAD) HEAD@{1}: rebase (start): checkout HEAD~10\n0600cf7e (origin/Files, master, Files) HEAD@{4}: checkout: moving from master to Files\n0600cf7e (origin/Files, master, Files) HEAD@{5}: commit: fixes\nf10ccfed (HEAD) HEAD@{6}: commit: refactoring\n\nSo what you need is:\ngit checkout master # assuming you were on master\ngit reset --hard HEAD@{1}\n\n\nRemove the rebase-merge folder\n\nrm -rf .git/rebase-merge"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Error \"Fatal: Not possible to fast-forward, aborting\"\nWhy is Git not allowing me to fast forward merge anymore?\nIf I try to force it using --ff-only, I get the message\n\nfatal: Not possible to fast-forward, aborting.\n\nI realize that there are huge advantages to merge --no-ff, but I'm just puzzled why I can't --ff-only now?"
},
{
"role": "assistant",
"content": "Disclaimer: these commands will bring changes from the remote branch into yours.\ngit pull --rebase. Unlike the other solution, you don't need to know the name of your destination branch.\nIf your upstream branch is not set, try git pull origin <branch> --rebase (credit to @Rick in the comments)\nTo set this option globally, use git config --global pull.rebase true (credit to @Artur Mustafin below)"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-rev-parse - Pick out and massage parameters"
},
{
"role": "assistant",
"content": "NAME git-rev-parse - Pick out and massage parameters"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Python. How to solve \"setuptools must be installed to install from a source distribution\"\n\nI have a Continuous Integration that works with Gitlab. When I deploy, it installs everything in my requirements.txt file with pip. However, when it gets to installing a package named cffi, it throws the error:\n\nDownloading/unpacking cffi==1.10.0 (from -r requirements.txt (line\n 11)) Cleaning up... \nsetuptools must be installed to install from a\n source distribution\n\nI am lost here. Tried adding \"setuptools\" to requirements.txt and adding a line that explicitly installs it, but it doesn't work.\ngitlab.ci looks like this:\nscript:\n - \"cp tests/test_settings.py app/local_settings.py\"\n - \"source /home/ci/misuper-venv/bin/activate\"\n - pip install setuptools\n - \"pip install -r requirements.txt\"\n - \"python manage.py migrate --noinput\"\n\nI'm completely lost here. Please help."
},
{
"role": "assistant",
"content": "It's a known problem.\npip install -U setuptools\npip install -U pip\n\nJust helped me.\nNote: a reasonable person would never sudo pip install anything.\nOS's Python should be managed by the OS's package manager; strong-arming your system Python installation has been many times seen to break your OS in interesting ways. \nTo pip install anything, use virtualenv or an equivalent."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Is it possible to configure user.name and user.email per wildcard domains in .gitconfig?\n\nI have a work computer, and it's configured globally to use my work email and name when committing. This is good. However, I'd like to make some sort of rule that says, \"if the repo origin is github, use user X and email Y\"\nI realize you can make a config entry per repository, but I'd like it to be more automatic: if the clone is github, it should use github user details. If I clone from work, it should use work details.\nIs there any way to configure this globally based on the remote domain? Or another way?\nEDIT/UPDATE\nI have accepted the answer below, but modified the script just a bit:\n#!/usr/bin/env bash\n\n# \"Real\" git is the second one returned by 'which'\nREAL_GIT=$(which -a git | sed -n 2p)\n\n# Does the remote \"origin\" point to GitHub?\nif (\"$REAL_GIT\" remote -v 2>/dev/null | grep '^origin\\b.*github.com.*(push)$' >/dev/null 2>&1); then\n\n # Yes. Set username and email that you use on GitHub.\n export GIT_AUTHOR_NAME=$(\"$REAL_GIT\" config --global user.ghname)\n export GIT_AUTHOR_EMAIL=$(\"$REAL_GIT\" config --global user.ghemail)\n\nfi\n\n\"$REAL_GIT\" \"$@\"\n\nThe primary addition is the requirement for two git config values.\ngit config --global user.ghname \"Your Name\"\ngit config --global user.ghemail \"[email protected]\"\n\nThis avoids hard coding the values in the script, allowing it to be more portable. Maybe?"
},
{
"role": "assistant",
"content": "Git 2.13 adds support for conditional config includes. If you organize your checkouts into directories for each domain of work, then you can add custom settings based on where the checkouts are. In your global git config:\n[includeIf \"gitdir:code/work/\"]\n path = /Users/self/code/work/.gitconfig\n\nAnd then in ~/code/work/.gitconfig:\n[user]\n email = [email protected]\n\nAnd of course you can do that for as many domains of work as you like."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-config - Get and set repository or global options instaweb.local"
},
{
"role": "assistant",
"content": "If true the web server started by git-instaweb will\nbe bound to the local IP (127.0.0.1)."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Undo local changes interactive\nI often add some debug code while developing so I need to remove these changes later. \nCurrently, I check the git diff and remove the changes manually or just type git checkout -- myfilename if I would like to undo the entire file.\nI love the interactive patch function (git add -i). Is there a tool or a command in git which can undo changes interactive like git add -i?\nIn other words: I would like to interactively checkout files and hunks out of the index."
},
{
"role": "assistant",
"content": "The command you are looking for is\n$git checkout -p\n\nThe git checkout Manual Page says:\n\n-p\n--patch\nInteractively select hunks in the difference between the (or the index, if unspecified) and the working tree. The chosen hunks are then applied in reverse to the working tree (and if a was specified, the index).\nThis means that you can use git checkout -p to selectively discard edits from your current working tree. See the “Interactive Mode” section of git-add(1) to learn how to operate the --patch mode.\n\n\nIf you want to restore staged changes interactively, use git reset --patch or git reset -p.\nFrom the docs:\n\ngit reset (--patch | -p) [] [--] [...]\nInteractively select hunks in the difference between the index and (defaults to HEAD). The chosen hunks are applied in reverse to the index.\nThis means that git reset -p is the opposite of git add -p, i.e. you can use it to selectively reset hunks. See the “Interactive Mode” section of git-add(1) to learn how to operate the --patch mode.\n\nand about git add -p it says\n\n-p\nInteractively choose hunks of patch between the index and the work tree and add them to the index. This gives the user a chance to review the difference before adding modified contents to the index.\nThis effectively runs add --interactive, but bypasses the initial command menu and directly jumps to the patch subcommand. See “Interactive mode” for details.\n\nSo basically with git reset -p you can select what you reset."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-am - Apply a series of patches from a mailbox --allow-empty"
},
{
"role": "assistant",
"content": "After a patch failure on an input e-mail message lacking a patch,\ncreate an empty commit with the contents of the e-mail message\nas its log message."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-grep - Print lines matching a pattern --no-exclude-standard"
},
{
"role": "assistant",
"content": "Also search in ignored files by not honoring the .gitignore mechanism. Only useful with --untracked ."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-config - Get and set repository or global options completion.commands"
},
{
"role": "assistant",
"content": "This is only used by git-completion.bash to add or remove\ncommands from the list of completed commands. Normally only\nporcelain commands and a few select others are completed. You\ncan add more commands, separated by space, in this\nvariable. Prefixing the command with - will remove it from\nthe existing list."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git - the stupid content tracker GIT_DIFF_OPTS"
},
{
"role": "assistant",
"content": "Only valid setting is \"--unified=??\" or \"-u??\" to set the\nnumber of context lines shown when a unified diff is created.\nThis takes precedence over any \"-U\" or \"--unified\" option\nvalue passed on the Git diff command line."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-rev-list - Lists commit objects in reverse chronological order --objects-edge"
},
{
"role": "assistant",
"content": "Similar to --objects , but also print the IDs of excluded\ncommits prefixed with a “-” character. This is used by git-pack-objects to build a “thin” pack, which records\nobjects in deltified form based on objects contained in these\nexcluded commits to reduce network traffic."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Check if specific file in git repository has changed\nI am novice in dealing with git, but I have a repository that contains a file named 'test'. I want to check if that specific file has changed. Is there anyway to do that?\nFrom a big picture, I'm writing a batch file that will perform a git clone of the repository if anything has changed (which I have figured out using the dry run option) EXCEPT for the test file(meaning that even if the test file has changed, I don't want to perform a git clone)\nLet me know if you need any clarifications and thanks for your time"
},
{
"role": "assistant",
"content": "You can pass a file or directory name to git diff to see only changes to that file or directory.\nIf you're \"writing a batch file\" then the --exit-code switch to git diff may be particularly useful. eg.\ngit diff --exit-code test\nor:\ngit diff --exit-code path/to/source/dir\nWhich will return 1 if there are changes to the file named test (or any other specified file or directory) or 0 otherwise. (Allowing a script to branch on the result.)\nTo see the names of the changed files only (and not a complete diff) use --name-only xor you can use -s to get no output at all, but just the exit code."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "gitrevisions - Specifying revisions and ranges for Git ORIG_HEAD"
},
{
"role": "assistant",
"content": "is created by commands that move your HEAD in a drastic way ( git\nam , git merge , git rebase , git reset ), to record the position\nof the HEAD before their operation, so that you can easily change\nthe tip of the branch back to the state before you ran them."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git - the stupid content tracker git-diff"
},
{
"role": "assistant",
"content": "Show changes between commits, commit and working tree, etc"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-diff-index - Compare a tree to the working tree or index -S<string>"
},
{
"role": "assistant",
"content": "Look for differences that change the number of occurrences of\nthe specified string (i.e. addition/deletion) in a file.\nIntended for the scripter’s use. It is useful when you’re looking for an exact block of code (like a\nstruct), and want to know the history of that block since it first\ncame into being: use the feature iteratively to feed the interesting\nblock in the preimage back into -S , and keep going until you get the\nvery first version of the block. Binary files are searched as well."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Gitlab-ci: extend script section\n\nI have an unity ci-project.\n .gitlab-ci.yml contains base .build job with one script command. Also I have multiple specified jobs for build each platform which extended base .build. I want to execute some platform-specific commands for android, so I have created separated job generate-android-apk. But if it's failing the pipeline will be failed too.(I know about allow_failure). Is it possible to extend script section between jobs without copy-pasting?"
},
{
"role": "assistant",
"content": "UPDATE:\nsince gitlab 13.9 it is possible to use !reference tags from other jobs or \"templates\" (which are commented jobs - using dot as prefix)\nactual_job:\n script:\n - echo doing something\n\n.template_job:\n after_script:\n - echo done with something\n\njob_using_references_from_other_jobs:\n script:\n - !reference [actual_job, script]\n after_script:\n - !reference [.template_job, after_script]\n\nThanks to @amine-zaine for the update\n\nFIRST APPROACH:\nYou can achieve modular script sections by utilizing 'literal blocks' (using |) like so:\n.template1: &template1 |\n echo install\n\n.template2: &template2 |\n echo bundle\n\ntestJob:\n script:\n - *template1\n - *template2\n\nSee Source\n\nANOTHER SOLUTION:\nSince GitLab 11.3 it is possible to use extend which could also work for you.\n.template:\n script: echo test template\n stage: testStage\n only:\n refs:\n - branches\n\nrspec:\n extends: .template1\n after_script:\n - echo test job\n only:\n variables:\n - $TestVar\n\nSee Docs\nMore Examples"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Why does Git say my master branch is \"already up to date\" even though it is not?\n\nBasic Problem\nI just deleted ALL the code from a file in my project and committed the change to my local git (on purpose). I did \ngit pull upstream master\n\nto fetch and merge from upstream (so in theory that deleted code should be back).\nGit tells me everything is up to date.\nEverything is definitely NOT up to date -- all that deleted code is still deleted.\nOther Relevant Info\nI only have one branch called \"master\".\nI recently set up \"master\" to track upstream like so:\n\nBranch master set up to track remote branch master from upstream.\n\nThe command git branch -vv yields:\n* master 7cfcb29 [upstream/master: ahead 9] deletion test\n\nWhy why why is this happening? I'm on the verge of just e-mailing my project manager any changes I make to our code.\nUpdate\nI thought it was obvious, but anyways this is my goal:\nGet the most recent of the code on my system.\nExcuse my anger here, but why does such a simple task as that have to be so hard?"
},
{
"role": "assistant",
"content": "I think your basic issue here is that you're misinterpreting and/or misunderstanding what git does and why it does it.\nWhen you clone some other repository, git makes a copy of whatever is \"over there\". It also takes \"their\" branch labels, such as master, and makes a copy of that label whose \"full name\" in your git tree is (normally) remotes/origin/master (but in your case, remotes/upstream/master). Most of the time you get to omit the remotes/ part too, so you can refer to that original copy as upstream/master.\nIf you now make and commit some change(s) to some file(s), you're the only one with those changes. Meanwhile other people may use the original repository (from which you made your clone) to make other clones and change those clones. They are the only ones with their changes, of course. Eventually though, someone may have changes they send back to the original owner (via \"push\" or patches or whatever).\nThe git pull command is mostly just shorthand for git fetch followed by git merge. This is important because it means you need to understand what those two operations actually do.\nThe git fetch command says to go back to wherever you cloned from (or have otherwise set up as a place to fetch from) and find \"new stuff someone else added or changed or removed\". Those changes are copied over and applied to your copy of what you got from them earlier. They are not applied to your own work, only to theirs.\nThe git merge command is more complicated and is where you are going awry. What it does, oversimplified a bit, is compare \"what you changed in your copy\" to \"changes you fetched from someone-else and thus got added to your-copy-of-the-someone-else's-work\". If your changes and their changes don't seem to conflict, the merge operation mushes them together and gives you a \"merge commit\" that ties your development and their development together (though there is a very common \"easy\" case in which you have no changes and you get a \"fast forward\").\nThe situation you're encountering now is one in which you have made changes and committed them—nine times, in fact, hence the \"ahead 9\"—and they have made no changes. So, fetch dutifully fetches nothing, and then merge takes their lack-of-changes and also does nothing.\nWhat you want is to look at, or maybe even \"reset\" to, \"their\" version of the code.\nIf you merely want to look at it, you can simply check out that version:\ngit checkout upstream/master\n\nThat tells git that you want to move the current directory to the branch whose full name is actually remotes/upstream/master. You'll see their code as of the last time you ran git fetch and got their latest code.\nIf you want to abandon all your own changes, what you need to do is change git's idea of which revision your label, master, should name. Currently it names your most recent commit. If you get back onto that branch:\ngit checkout master\n\nthen the git reset command will allow you to \"move the label\", as it were. The only remaining problem (assuming you're really ready to abandon everything you've don) is finding where the label should point.\ngit log will let you find the numeric names—those things like 7cfcb29—which are permanent (never changing) names, and there are a ridiculous number of other ways to name them, but in this case you just want the name upstream/master.\nTo move the label, wiping out your own changes (any that you have committed are actually recoverable for quite a while but it's a lot harder after this so be very sure):\ngit reset --hard upstream/master\n\nThe --hard tells git to wipe out what you have been doing, move the current branch label, and then check out the given commit.\nIt's not super-common to really want to git reset --hard and wipe out a bunch of work. A safer method (making it a lot easier to recover that work if you decide some of it was worthwhile after all) is to rename your existing branch:\ngit branch -m master bunchofhacks\n\nand then make a new local branch named master that \"tracks\" (I don't really like this term as I think it confuses people but that's the git term :-) ) the origin (or upstream) master:\ngit branch -t master upstream/master\n\nwhich you can then get yourself on with:\ngit checkout master\n\nWhat the last three commands do (there's shortcuts to make it just two commands) is to change the name pasted on the existing label, then make a new label, then switch to it:\nbefore doing anything:\nC0 - \"remotes/upstream/master\"\n \\\n \\- C1 --- C2 --- C3 --- C4 --- C5 --- C6 --- C7 --- C8 --- C9 \"master\"\n\nafter git branch -m:\nC0 - \"remotes/upstream/master\"\n \\\n \\- C1 --- C2 --- C3 --- C4 --- C5 --- C6 --- C7 --- C8 --- C9 \"bunchofhacks\"\n\nafter git branch -t master upstream/master:\nC0 - \"remotes/upstream/master\", \"master\"\n \\\n \\- C1 --- C2 --- C3 --- C4 --- C5 --- C6 --- C7 --- C8 --- C9 \"bunchofhacks\"\n\nHere C0 is the latest commit (a complete source tree) that you got when you first did your git clone. C1 through C9 are your commits.\nNote that if you were to git checkout bunchofhacks and then git reset --hard HEAD^^, this would change the last picture to:\nC0 - \"remotes/upstream/master\", \"master\"\n \\\n \\- C1 --- C2 --- C3 --- C4 --- C5 --- C6 --- C7 - \"bunchofhacks\"\n \\\n \\- C8 --- C9\n\nThe reason is that HEAD^^ names the revision two up from the head of the current branch (which just before the reset would be bunchofhacks), and reset --hard then moves the label. Commits C8 and C9 are now mostly invisible (you can use things like the reflog and git fsck to find them but it's no longer trivial). Your labels are yours to move however you like. The fetch command takes care of the ones that start with remotes/. It's conventional to match \"yours\" with \"theirs\" (so if they have a remotes/origin/mauve you'd name yours mauve too), but you can type in \"theirs\" whenever you want to name/see commits you got \"from them\". (Remember that \"one commit\" is an entire source tree. You can pick out one specific file from one commit, with git show for instance, if and when you want that.)"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-rev-list - Lists commit objects in reverse chronological order %cs"
},
{
"role": "assistant",
"content": "committer date, short format ( YYYY-MM-DD )"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How can I kick off a container instance using the Azure api?\n\nI have a container building in gitlab and registering itself with the gitlab custom registry. Inside this container is a command that runs a very long time. I would like to somehow deploy this container to azure, and only kick off this long running process inside a new container instance on demand from an administrative api service. I don't want the container running all the time, only for the time it takes to run the command.\nI was thinking that this admin api could be a classic http rest api service hosted under Azure \"App Services\", or possibly using the new \"Function Apps\" feature of Azure.\nIn my research, I found that using the azure cli commands, I can start a container like so:\naz container create \\\n --resource-group myResourceGroup \\\n --name mycontainer2 \\\n --image microsoft/aci-wordcount:latest \\\n --restart-policy OnFailure \\\n --environment-variables NumWords=5 MinLength=8\n\nhttps://learn.microsoft.com/en-us/azure/container-instances/container-instances-environment-variables\nI would like to do this from the admin api, preferably using what looks to me like the official Azure npm package located here:\nhttps://www.npmjs.com/package/azure\nIdeally, it would be a single command to create and start the instance, being able to set the environment variables like this example at the launch of the container is important to me. I'm not interested in moving all my code over into Azure, I would like to continue using gitlab for the source code and container registry but if there is some reason I have to switch to using the Azure container registry, I need a way to somehow move the container registration over there using the gitlab ci yaml.\nIn all my searching, I couldn't find any way to do this but the closest documentation I found was here:\nhttps://learn.microsoft.com/en-us/javascript/api/azure-arm-containerservice/containerserviceclient?view=azure-node-latest"
},
{
"role": "assistant",
"content": "At the current time there is no way to officially do this from the api, maybe in the future there will be"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Why doesn't Git use more modern SHA?\nI read about that Git uses SHA-1 digest as an ID for a revision. Why does it not use a more modern version of SHA?"
},
{
"role": "assistant",
"content": "Why does it not use a more modern version of SHA?\n\nDec. 2017: It will. And Git 2.16 (Q1 2018) is the first release to illustrate and implement that intent.\nNote: see Git 2.19 below: it will be SHA-256.\nGit 2.16 will propose an infrastructure to define what hash function is used in Git, and will start an effort to plumb that throughout various codepaths.\nSee commit c250e02 (28 Nov 2017) by Ramsay Jones (``).\nSee commit eb0ccfd, commit 78a6766, commit f50e766, commit abade65 (12 Nov 2017) by brian m. carlson (bk2204).\n(Merged by Junio C Hamano -- gitster -- in commit 721cc43, 13 Dec 2017)\n\n\nAdd structure representing hash algorithm\n\n\nSince in the future we want to support an additional hash algorithm, add a structure that represents a hash algorithm and all the data that must go along with it.\nAdd a constant to allow easy enumeration of hash algorithms.\nImplement function typedefs to create an abstract API that can be used by any hash algorithm, and wrappers for the existing SHA1 functions that conform to this API.\nExpose a value for hex size as well as binary size.\nWhile one will always be twice the other, the two values are both used extremely\ncommonly throughout the codebase and providing both leads to improved readability.\nDon't include an entry in the hash algorithm structure for the null object ID.\nAs this value is all zeros, any suitably sized all-zero object ID can be used, and there's no need to store a given one on a per-hash basis.\nThe current hash function transition plan envisions a time when we will accept input from the user that might be in SHA-1 or in the NewHash format.\nSince we cannot know which the user has provided, add a constant representing the unknown algorithm to allow us to indicate that we must look the correct value up.\n\n\n\nIntegrate hash algorithm support with repo setup\n\n\nIn future versions of Git, we plan to support an additional hash\nalgorithm.\nIntegrate the enumeration of hash algorithms with repository setup, and store a pointer to the enumerated data in struct repository.\nOf course, we currently only support SHA-1, so hard-code this value in\nread_repository_format.\nIn the future, we'll enumerate this value from the configuration.\nAdd a constant, the_hash_algo, which points to the hash_algo structure pointer in the repository global.\nNote that this is the hash which is used to serialize data to disk, not the hash which is used to display items to the user.\nThe transition plan anticipates that these may be different.\nWe can add an additional element in the future (say, ui_hash_algo) to provide for this case.\n\n\nUpdate August 2018, for Git 2.19 (Q3 2018), Git seems to pick SHA-256 as NewHash.\nSee commit 0ed8d8d (04 Aug 2018) by Jonathan Nieder (artagnon).\nSee commit 13f5e09 (25 Jul 2018) by Ævar Arnfjörð Bjarmason (avar).\n(Merged by Junio C Hamano -- gitster -- in commit 34f2297, 20 Aug 2018)\n\ndoc hash-function-transition: pick SHA-256 as NewHash\n\n\nFrom a security perspective, it seems that SHA-256, BLAKE2, SHA3-256, K12, and so on are all believed to have similar security properties.\nAll are good options from a security point of view.\nSHA-256 has a number of advantages:\n\nIt has been around for a while, is widely used, and is supported by just about every single crypto library (OpenSSL, mbedTLS, CryptoNG, SecureTransport, etc).\n\nWhen you compare against SHA1DC, most vectorized SHA-256 implementations are indeed faster, even without acceleration.\n\nIf we're doing signatures with OpenPGP (or even, I suppose, CMS), we're going to be using SHA-2, so it doesn't make sense to have our security depend on two separate algorithms when either one of them alone could break the security when we could just depend on one.\n\n\nSo SHA-256 it is.\nUpdate the hash-function-transition design doc to say so.\nAfter this patch, there are no remaining instances of the string\n\"NewHash\", except for an unrelated use from 2008 as a variable name in t/t9700/test.pl.\n\n\nYou can see this transition to SHA 256 in progress with Git 2.20 (Q4 2018):\nSee commit 0d7c419, commit dda6346, commit eccb5a5, commit 93eb00f, commit d8a3a69, commit fbd0e37, commit f690b6b, commit 49d1660, commit 268babd, commit fa13080, commit 7b5e614, commit 58ce21b, commit 2f0c9e9, commit 825544a (15 Oct 2018) by brian m. carlson (bk2204).\nSee commit 6afedba (15 Oct 2018) by SZEDER Gábor (szeder).\n(Merged by Junio C Hamano -- gitster -- in commit d829d49, 30 Oct 2018)\n\nreplace hard-coded constants\n\n\nReplace several 40-based constants with references to GIT_MAX_HEXSZ or\nthe_hash_algo, as appropriate.\nConvert all uses of the GIT_SHA1_HEXSZ to use the_hash_algo so that they\nare appropriate for any given hash length.\nInstead of using a hard-coded constant for the size of a hex object ID,\nswitch to use the computed pointer from parse_oid_hex that points after\nthe parsed object ID.\n\nGIT_SHA1_HEXSZ is further remove/replaced with Git 2.22 (Q2 2019) and commit d4e568b.\n\nThat transition continues with Git 2.21 (Q1 2019), which adds sha-256 hash and plug it through the code to allow building Git with the \"NewHash\".\nSee commit 4b4e291, commit 27dc04c, commit 13eeedb, commit c166599, commit 37649b7, commit a2ce0a7, commit 50c817e, commit 9a3a0ff, commit 0dab712, commit 47edb64 (14 Nov 2018), and commit 2f90b9d, commit 1ccf07c (22 Oct 2018) by brian m. carlson (bk2204).\n(Merged by Junio C Hamano -- gitster -- in commit 33e4ae9, 29 Jan 2019)\n\nAdd a base implementation of SHA-256 support (Feb. 2019)\n\n\nSHA-1 is weak and we need to transition to a new hash function.\nFor some time, we have referred to this new function as NewHash.\nRecently, we decided to pick SHA-256 as NewHash.\nThe reasons behind the choice of SHA-256 are outlined in this thread and in the commit history for the hash function transition document.\nAdd a basic implementation of SHA-256 based off libtomcrypt, which is in\nthe public domain.\nOptimize it and restructure it to meet our coding standards.\nPull in the update and final functions from the SHA-1 block implementation, as we know these function correctly with all compilers. This implementation is slower than SHA-1, but more performant implementations will be introduced in future commits.\nWire up SHA-256 in the list of hash algorithms, and add a test that the\nalgorithm works correctly.\nNote that with this patch, it is still not possible to switch to using SHA-256 in Git.\nAdditional patches are needed to prepare the code to handle a larger hash algorithm and further test fixes are needed.\n\n\nhash: add an SHA-256 implementation using OpenSSL\n\n\nWe already have OpenSSL routines available for SHA-1, so add routines\nfor SHA-256 as well.\nOn a Core i7-6600U, this SHA-256 implementation compares favorably to\nthe SHA1DC SHA-1 implementation:\nSHA-1: 157 MiB/s (64 byte chunks); 337 MiB/s (16 KiB chunks)\nSHA-256: 165 MiB/s (64 byte chunks); 408 MiB/s (16 KiB chunks)\n\n\n\nsha256: add an SHA-256 implementation using libgcrypt\n\n\nGenerally, one gets better performance out of cryptographic routines written in assembly than C, and this is also true for SHA-256.\nIn addition, most Linux distributions cannot distribute Git linked against\nOpenSSL for licensing reasons.\nMost systems with GnuPG will also have libgcrypt, since it is a dependency of GnuPG.\nlibgcrypt is also faster than the SHA1DC implementation for messages of a few KiB and larger.\nFor comparison, on a Core i7-6600U, this implementation processes 16 KiB\nchunks at 355 MiB/s while SHA1DC processes equivalent chunks at 337\nMiB/s.\nIn addition, libgcrypt is licensed under the LGPL 2.1, which is\ncompatible with the GPL. Add an implementation of SHA-256 that uses\nlibgcrypt.\n\n\nThe upgrade effort goes on with Git 2.24 (Q4 2019)\nSee commit aaa95df, commit be8e172, commit 3f34d70, commit fc06be3, commit 69fa337, commit 3a4d7aa, commit e0cb7cd, commit 8d4d86b, commit f6ca67d, commit dd336a5, commit 894c0f6, commit 4439c7a, commit 95518fa, commit e84f357, commit fe9fec4, commit 976ff7e, commit 703d2d4, commit 9d958cc, commit 7962e04, commit fee4930 (18 Aug 2019) by brian m. carlson (bk2204).\n(Merged by Junio C Hamano -- gitster -- in commit 676278f, 11 Oct 2019)\n\nInstead of using GIT_SHA1_HEXSZ and hard-coded constants, switch to\nusing the_hash_algo.\n\n\nWith Git 2.26 (Q1 2020), the test scripts are ready for the day when the object names will use SHA-256.\nSee commit 277eb5a, commit 44b6c05, commit 7a868c5, commit 1b8f39f, commit a8c17e3, commit 8320722, commit 74ad99b, commit ba1be1a, commit cba472d, commit 82d5aeb, commit 3c5e65c, commit 235d3cd, commit 1d86c8f, commit 525a7f1, commit 7a1bcb2, commit cb78f4f, commit 717c939, commit 08a9dd8, commit 215b60b, commit 194264c (21 Dec 2019) by brian m. carlson (bk2204).\n(Merged by Junio C Hamano -- gitster -- in commit f52ab33, 05 Feb 2020)\nExample:\n\nt4204: make hash size independent\nSigned-off-by: brian m. carlson\n\n\nUse $OID_REGEX instead of a hard-coded regular expression.\n\nSo, instead of using:\ngrep \"^[a-f0-9]\\{40\\} $(git rev-parse HEAD)$\" output\n\nTests are using\ngrep \"^$OID_REGEX $(git rev-parse HEAD)$\" output\n\nAnd OID_REGEX comes from commit bdee9cd (13 May 2018) by brian m. carlson (bk2204).\n(Merged by Junio C Hamano -- gitster -- in commit 9472b13, 30 May 2018, Git v2.18.0-rc0)\n\nt/test-lib: introduce OID_REGEX\nSigned-off-by: brian m. carlson\n\n\nCurrently we have a variable, $_x40, which contains a regex that matches a full 40-character hex constant.\nHowever, with NewHash, we'll have object IDs that are longer than 40 characters.\nIn such a case, $_x40 will be a confusing name.\nCreate a $OID_REGEX variable which will always reflect a regex matching the appropriate object ID, regardless of the length of the current hash.\n\nAnd, still for tests:\nSee commit f303765, commit edf0424, commit 5db24dc, commit d341e08, commit 88ed241, commit 48c10cc, commit f7ae8e6, commit e70649b, commit a30f93b, commit a79eec2, commit 796d138, commit 417e45e, commit dfa5f53, commit f743e8f, commit 72f936b, commit 5df0f11, commit 07877f3, commit 6025e89, commit 7b1a182, commit 94db7e3, commit db12505 (07 Feb 2020) by brian m. carlson (bk2204).\n(Merged by Junio C Hamano -- gitster -- in commit 5af345a, 17 Feb 2020)\n\nt5703: make test work with SHA-256\nSigned-off-by: brian m. carlson\n\n\nThis test used an object ID which was 40 hex characters in length, causing the test not only not to pass, but to hang, when run with SHA-256 as the hash.\nChange this value to a fixed dummy object ID using test_oid_init and test_oid.\nFurthermore, ensure we extract an object ID of the appropriate length using cut with fields instead of a fixed length.\n\n\nSome codepaths were given a repository instance as a parameter to work in the repository, but passed the_repository instance to its callees, which has been cleaned up (somewhat) with Git 2.26 (Q1 2020).\nSee commit b98d188, commit 2dcde20, commit 7ad5c44, commit c8123e7, commit 5ec9b8a, commit a651946, commit eb999b3 (30 Jan 2020) by Matheus Tavares (matheustavares).\n(Merged by Junio C Hamano -- gitster -- in commit 78e67cd, 14 Feb 2020)\n\nsha1-file: allow check_object_signature() to handle any repo\nSigned-off-by: Matheus Tavares\n\n\nSome callers of check_object_signature() can work on arbitrary repositories, but the repo does not get passed to this function. Instead, the_repository is always used internally.\nTo fix possible inconsistencies, allow the function to receive a struct repository and make those callers pass on the repo being handled.\n\nBased on:\n\nsha1-file: pass git_hash_algo to hash_object_file()\nSigned-off-by: Matheus Tavares\n\n\nAllow hash_object_file() to work on arbitrary repos by introducing a git_hash_algo parameter. Change callers which have a struct repository pointer in their scope to pass on the git_hash_algo from the said repo.\nFor all other callers, pass on the_hash_algo, which was already being used internally at hash_object_file().\nThis functionality will be used in the following patch to make check_object_signature() be able to work on arbitrary repos (which, in turn, will be used to fix an inconsistency at object.c:parse_object()).\n\n\nGit 2.38 (Q3 2022) adds support for libnettle, as SHA256 implementation has been added.\nSee commit e555735 (10 Jul 2022) by brian m. carlson (bk2204).\n(Merged by Junio C Hamano -- gitster -- in commit 4af2138, 18 Jul 2022)\n\nsha256: add support for Nettle\nSigned-off-by: brian m. carlson\n\n\nFor SHA-256, we currently have support for OpenSSL and libgcrypt because these two libraries contain optimized implementations that can take advantage of native processor instructions.\nHowever:\n\nOpenSSL is not suitable for linking against for Linux distros due to licensing incompatibilities with the GPLv2, and\nlibgcrypt has been less favored by cryptographers due to some security-related implementation issues, which, while not affecting our use of hash algorithms, has affected its reputation.\n\nLet's add another option that's compatible with the GPLv2, which is Nettle.\nThis is an option which is generally better than libgcrypt because on many distros GnuTLS (which uses Nettle) is used for HTTPS and therefore as a practical matter it will be available on most systems.\nAs a result, prefer it over libgcrypt and our built-in implementation.\nNettle also has recently gained support for Intel's SHA-NI instructions, which compare very favorably to other implementations, as well as assembly implementations for when SHA-NI is not available.\nA git gc(man) on git.git sees a 12% performance improvement with Nettle over our block SHA-256 implementation due to general assembly improvements.\nWith SHA-NI, the performance of raw SHA-256 on a 2 GiB file goes from 7.296 seconds with block SHA-256 to 1.523 seconds with Nettle."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Get current date and time in GitHub workflows\n\nI have a GitHub workflow for releasing nightly snapshots of the repository. It uses the create-release action. This is how the workflow file looks right now:\nname: Release Nightly Snapshot\n\non:\n schedule:\n - cron: \"0 0 * * *\"\n\njobs:\n build:\n name: Release Nightly Snapshot\n runs-on: ubuntu-latest\n steps:\n - name: Checkout master Branch\n uses: actions/checkout@v2\n with:\n ref: 'master'\n - name: Create Release\n id: nightly-snapshot\n uses: actions/create-release@latest\n env:\n GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n with:\n tag_name: 'nightly snapshot'\n release_name: 'nightly snapshot'\n draft: false\n prerelease: false\n\nI want tag_name and release_name to use the current date and time, instead of hard-coded values. However, I couldn't find any documentation on it. How should I do it?"
},
{
"role": "assistant",
"content": "From this post you can create a step that set its output with the value $(date +'%Y-%m-%d')\nThen use this output using ${{ steps.date.outputs.date }}. The following show an example for environment variables and for inputs :\non: [push, pull_request]\nname: build\njobs:\n build:\n name: Example\n runs-on: ubuntu-latest\n steps:\n - name: Get current date\n id: date\n run: echo \"::set-output name=date::$(date +'%Y-%m-%d')\"\n - name: Test with environment variables\n run: echo $TAG_NAME - $RELEASE_NAME\n env:\n TAG_NAME: nightly-tag-${{ steps.date.outputs.date }}\n RELEASE_NAME: nightly-release-${{ steps.date.outputs.date }}\n - name: Test with input\n uses: actions/hello-world-docker-action@master\n with:\n who-to-greet: Mona-the-Octocat-${{ steps.date.outputs.date }}\n\nOutputs :\n* Test with environment variables\nnightly-tag-2020-03-31 - nightly-release-2020-03-31\n\n* Test with input\nHello Mona-the-Octocat-2020-03-31"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git describe fails with \"fatal: No names found, cannot describe anything.\"\nI'm using git 1.7.1 on Ubuntu 10.10 amd64, and I'm trying to extract the hash of my repository HEAD to use it in an automated version information that I compile into my project.\nIn the past, this always worked by using \ngit describe --tags\n\nhowever, git is now throwing \nfatal: No names found, cannot describe anything.\n\nat me. Does anyone have a clue what that means?\nGoogle showed only few hits and no solution."
},
{
"role": "assistant",
"content": "I have had this problem in a CI build environment where the CI tool was performing a shallow clone of the repository. This was frustrating, because in my development environment, the command\ngit describe --tags\n\nwould give me output like\n2.2.12-7-g8ec9d6c9\n\nwhereas in the build environment I would get the \"fatal no names found\" error. If I tried using the --always tag\ngit describe --tags --always\n\nthen I would simply get the hash of the latest commit, but not the most recent tag prior to that commit\n8ec9d6c9\n\nPerforming a git pull in the build environment wouldn't help, because once the repo has been cloned shallowly, future pulls will not update the tags.\nThe solution was to ensure that the initial clone of the repo in the build environment was not a shallow clone (i.e. the git clone command was not used with --depth, --shallow-since or --shallow-exclude parameters)."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-rev-list - Lists commit objects in reverse chronological order %p"
},
{
"role": "assistant",
"content": "abbreviated parent hashes"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-format-patch - Prepare patches for e-mail submission --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-read-tree - Reads tree information into the index -v"
},
{
"role": "assistant",
"content": "Show the progress of checking files out."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How do I view 'git diff' output with my preferred diff tool/ viewer?\nWhen I type git diff, I want to view the output with my visual diff tool of choice (SourceGear \"diffmerge\" on Windows). How do I configure git to do this?"
},
{
"role": "assistant",
"content": "Since Git1.6.3, you can use the git difftool script: see my answer below.\n\nMay be this article will help you. Here are the best parts:\nThere are two different ways to specify an external diff tool. \nThe first is the method you used, by setting the GIT_EXTERNAL_DIFF variable. However, the variable is supposed to point to the full path of the executable. Moreover, the executable specified by GIT_EXTERNAL_DIFF will be called with a fixed set of 7 arguments:\npath old-file old-hex old-mode new-file new-hex new-mode\n\nAs most diff tools will require a different order (and only some) of the arguments, you will most likely have to specify a wrapper script instead, which in turn calls the real diff tool.\nThe second method, which I prefer, is to configure the external diff tool via \"git\nconfig\". Here is what I did:\n1) Create a wrapper script \"git-diff-wrapper.sh\" which contains something like\n-->8-(snip)--\n#!/bin/sh\n\n# diff is called by git with 7 parameters:\n# path old-file old-hex old-mode new-file new-hex new-mode\n\n\"<path_to_diff_executable>\" \"$2\" \"$5\" | cat\n--8<-(snap)--\n\nAs you can see, only the second (\"old-file\") and fifth (\"new-file\") arguments will be\npassed to the diff tool.\n2) Type\n$ git config --global diff.external <path_to_wrapper_script>\n\nat the command prompt, replacing with the path to \"git-diff-wrapper.sh\", so your ~/.gitconfig contains\n-->8-(snip)--\n[diff]\n external = <path_to_wrapper_script>\n--8<-(snap)--\n\nBe sure to use the correct syntax to specify the paths to the wrapper script and diff\ntool, i.e. use forward slashed instead of backslashes. In my case, I have\n[diff]\n external = \\\"c:/Documents and Settings/sschuber/git-diff-wrapper.sh\\\"\n\nin .gitconfig and\n\"d:/Program Files/Beyond Compare 3/BCompare.exe\" \"$2\" \"$5\" | cat\n\nin the wrapper script. Mind the trailing \"cat\"!\n(I suppose the '| cat' is needed only for some programs which may not return a proper or consistent return status. You might want to try without the trailing cat if your diff tool has explicit return status)\n(Diomidis Spinellis adds in the comments: \n\nThe cat command is required, because diff(1), by default exits with an error code if the files differ.\n Git expects the external diff program to exit with an error code only if an actual error occurred, e.g. if it run out of memory.\n By piping the output of git to cat the non-zero error code is masked.\n More efficiently, the program could just run exit with and argument of 0.)\n\n\nThat (the article quoted above) is the theory for external tool defined through config file (not through environment variable).\nIn practice (still for config file definition of external tool), you can refer to:\n\nHow do I setup DiffMerge with msysgit / gitk? which illustrates the concrete settings of DiffMerge and WinMerge for MsysGit and gitk\nHow can I set up an editor to work with Git on Windows? for the definition of Notepad++ as an external editor."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-config - Get and set repository or global options gc.reflogExpire gc.<pattern>.reflogExpire"
},
{
"role": "assistant",
"content": "git reflog expire removes reflog entries older than\nthis time; defaults to 90 days. The value \"now\" expires all\nentries immediately, and \"never\" suppresses expiration\naltogether. With \"<pattern>\" (e.g.\n\"refs/stash\") in the middle the setting applies only to\nthe refs that match the <pattern>."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "gitsubmodules - Mounting one repository inside another"
},
{
"role": "assistant",
"content": "FORMS Submodules can take the following forms: The basic form described in DESCRIPTION with a Git directory,\na working directory, a gitlink , and a .gitmodules entry. \"Old-form\" submodule: A working directory with an embedded .git directory, and the tracking gitlink and .gitmodules entry in\nthe superproject. This is typically found in repositories generated\nusing older versions of Git. It is possible to construct these old form repositories manually. When deinitialized or deleted (see below), the submodule’s Git\ndirectory is automatically moved to $GIT_DIR/modules/<name>/ of the superproject. Deinitialized submodule: A gitlink , and a .gitmodules entry,\nbut no submodule working directory. The submodule’s Git directory\nmay be there as after deinitializing the Git directory is kept around.\nThe directory which is supposed to be the working directory is empty instead. A submodule can be deinitialized by running git submodule deinit .\nBesides emptying the working directory, this command only modifies\nthe superproject’s $GIT_DIR/config file, so the superproject’s history\nis not affected. This can be undone using git submodule init . Deleted submodule: A submodule can be deleted by running git rm <submodule-path> && git commit . This can be undone\nusing git revert . The deletion removes the superproject’s tracking data, which are\nboth the gitlink entry and the section in the .gitmodules file.\nThe submodule’s working directory is removed from the file\nsystem, but the Git directory is kept around as it to make it\npossible to checkout past commits without requiring fetching\nfrom another repository. To completely remove a submodule, manually delete $GIT_DIR/modules/<name>/ ."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How do I manage conflicts with git submodules?\nI have a git superproject that references several submodules and I am trying to lock down a workflow for the rest of the my project members to work within.\nFor this question, lets say my superproject is called supery and the submodule is called subby. (Then is a simplification of what I'm trying to do...I'm not actually using the branches for versions, but I thought it would be easiest to lay out as a question.)\nMy master branch of supery has the tag v1.0 of the git project subby referenced as a submodule. The branch of supery called one.one and changed the reference of the submodule to point to the tag v1.1 of subby.\nI can work within each of these branches without a hitch, but if I try to update the one.one branch with changes from the master branch I receive some conflicts and I don't how to resolve them.\nBasically after running a git pull . master while in the subby branch, it looks like it creates additional submodules.\nBefore the pull/merge, I get the desired response from git submodule from the one.one branch:\n$ git checkout master\n$ git submodule\nqw3rty...321e subby (v1.0)\n$ git checkout one.one\n$ git submodule\nasdfgh...456d subby (v1.1)\n\nBut after the pull, it adds additional submodules when I run git submodule:\n$ git pull . master\nAuto-merged schema\nCONFLICT (submodule): Merge conflict in subby - needs qu3rty...321e\nAutomatic merge failed; fix conflicts and then commit the results.\n\n$ git submodule\nqw3rty...321e subby (v1.0)\nasdfgh...456d subby (v1.1)\nzxcvbn...7890 subby (v1.1~1)\n\nHow do I delete/ignore the unwanted submodule references and commit my conflicts and changes? Or is there a parameter I can use with my original git pull that will ignore my submodules?"
},
{
"role": "assistant",
"content": "Well, its not technically managing conflicts with submodules (ie: keep this but not that), but I found a way to continue working...and all I had to do was pay attention to my git status output and reset the submodules:\ngit reset HEAD subby\ngit commit\n\nThat would reset the submodule to the pre-pull commit. Which in this case is exactly what I wanted. And in other cases where I need the changes applied to the submodule, I'll handle those with the standard submodule workflows (checkout master, pull down the desired tag, etc)."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-diff-index - Compare a tree to the working tree or index --abbrev[=<n>]"
},
{
"role": "assistant",
"content": "Instead of showing the full 40-byte hexadecimal object\nname in diff-raw format output and diff-tree header\nlines, show the shortest prefix that is at least <n> hexdigits long that uniquely refers the object.\nIn diff-patch output format, --full-index takes higher\nprecedence, i.e. if --full-index is specified, full blob\nnames will be shown regardless of --abbrev .\nNon default number of digits can be specified with --abbrev=<n> ."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git - the stupid content tracker gitdiffcore"
},
{
"role": "assistant",
"content": "Tweaking diff output"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Open two GIT branches in two separate IDE instances?\nWe are migrating from Mercurial to GIT. \nWith Mercurial we have separate repositories compared to one repo with separate branches in GIT. \nThus with Mercurial it's straightforward to open two separate repos in two separate instances of your IDE. How can you do this with GIT as there is (I believe) only one branch current at a time in a GIT repo?\nNote: this similar ticket refers to opening two branches in the same IDE. The difference with this question is we're happy to open them in two separate IDE instances. Though I'm guessing the answer is the same - you can't do it."
},
{
"role": "assistant",
"content": "You are correct: there is only one active branch at a time. The best you can do is to clone the repository twice on your local machine into two different directories, and then simply open up the appropriate directory in each IDE instance."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How can I grep Git commits for a certain word?\nIn a Git code repository I want to list all commits that contain a certain word. I tried this\ngit log -p | grep --context=4 \"word\"\n\nbut it does not necessarily give me back the filename (unless it's less that five lines away from the word I searched for. I also tried\ngit grep \"word\"\n\nbut it gives me only present files and not the history.\nHow do I search the entire history, so I can follow changes on a particular word? I intend to search my codebase for occurrences of word to track down changes (search in files history)."
},
{
"role": "assistant",
"content": "If you want to find all commits where the commit message contains a given word, use\ngit log --grep=word\n\nIf you want to find all commits where \"word\" was added or removed in the file contents (to be more exact: where the number of occurrences of \"word\" changed), i.e., search the commit contents, use a so-called 'pickaxe' search with\ngit log -Sword\n\nIn modern Git there is also\ngit log -Gword\n\nto look for differences whose added or removed line matches \"word\" (also commit contents).\nA few things to note:\n\n-G by default accepts a regex, while -S accepts a string, but it can be modified to accept regexes using the --pickaxe-regex.\n-S finds commits where the number of occurrences of \"word\" changed, while -G finds commits where \"word\" appears in the diff.\nThis means that -S<regex> --pickaxe-regex and -G<regex> do not do exactly the same thing.\n\nThe git diff documentation has a nice explanation of the difference:\n\nTo illustrate the difference between -S<regex> --pickaxe-regex and -G<regex>, consider a commit with the following diff in the same file:\n+ return frotz(nitfol, two->ptr, 1, 0);\n...\n- hit = frotz(nitfol, mf2.ptr, 1, 0);\n\nWhile git log -G\"frotz\\(nitfol\" will show this commit, git log -S\"frotz\\(nitfol\" --pickaxe-regex will not (because the number of occurrences of that string did not change).\n\nThis will show the commits containing the search terms, but if you want to see the actual changes in those commits instead you can use --patch:\ngit log -G\"searchTerm\" --patch\n\nThis can then be piped to grep to isolate the output just to display commit diff lines with that search term. A common use-case is to display diff lines with that search term in commits since and including a given commit - 3b5ab0f2a1 in this example - like so:\ngit log 3b5ab0f2a1^.. -G\"searchTerm\" --patch | grep searchTerm"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git - the stupid content tracker git-fmt-merge-msg"
},
{
"role": "assistant",
"content": "Produce a merge commit message"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git: 'send-email' is not a git command. See 'git --help'\nI'm trying to send patches with the git send-email But I get the following error:\ngit: 'send-email' is not a git command. See 'git --help'.\n\nHow to make git send-email works ?\nRelated links:\nhttp://www.kernel.org/pub/software/scm/git/docs/git-send-email.html"
},
{
"role": "assistant",
"content": "You need to install the git-email package for it to work. \nOn Ubuntu, the usual apt-get install git-email works fine. I can confirm the same for Fedora as well (yum install git-email). \ncebewee mentions the rationale in the comments:\n\nLinux distributions often like to split up packages to avoid\n dependencies needed only by optional functionality (like send-email).\n\nNote that you have to configure it before starting."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Gitlab to Jenkins webhook with parameters\n\nI'm trying to build a job on my jenkins using Gitlab webhook when pushing into a specific branch.\nThe only issue I have is that the jenkins job is parameterized. The parameter is the branch name.\nIs there an option to add the branch name (its a different branch every time) to the webhook so it will be inserted automatically into the parameter in the jenkins job parameter?\nThanks"
},
{
"role": "assistant",
"content": "GitLab invokes the webhook URL with a JSON payload in the request body that carries a lot of information about the GitLab event that led to the webhook invocation. The JSON payload for the GitLab push event does have branch name information in it -- see the \"ref\" field in the GitLab webhook push event payload: \n{\n \"object_kind\": \"push\",\n \"before\": \"95790bf891e76fee5e1747ab589903a6a1f80f22\",\n \"after\": \"da1560886d4f094c3e6c9ef40349f7d38b5d27d7\",\n \"ref\": \"refs/heads/master\",\n \"checkout_sha\": \"da1560886d4f094c3e6c9ef40349f7d38b5d27d7\",\n \"user_id\": 4,\n \"user_name\": \"John Smith\",\n \"user_username\": \"jsmith\",\n \"user_email\": \"[email protected]\",\n \"user_avatar\": \"https://s.gravatar.com/avatar/d4c74594d841139328695756648b6bd6?s=8://s.gravatar.com/avatar/d4c74594d841139328695756648b6bd6?s=80\",\n \"project_id\": 15,\n \"project\":{\n \"id\": 15,\n \"name\":\"Diaspora\",\n \"description\":\"\",\n \"web_url\":\"http://example.com/mike/diaspora\",\n \"avatar_url\":null,\n \"git_ssh_url\":\"[email protected]:mike/diaspora.git\",\n \"git_http_url\":\"http://example.com/mike/diaspora.git\",\n \"namespace\":\"Mike\",\n \"visibility_level\":0,\n \"path_with_namespace\":\"mike/diaspora\",\n \"default_branch\":\"master\",\n \"homepage\":\"http://example.com/mike/diaspora\",\n \"url\":\"[email protected]:mike/diaspora.git\",\n \"ssh_url\":\"[email protected]:mike/diaspora.git\",\n \"http_url\":\"http://example.com/mike/diaspora.git\"\n },\n \"repository\":{\n \"name\": \"Diaspora\",\n \"url\": \"[email protected]:mike/diaspora.git\",\n \"description\": \"\",\n \"homepage\": \"http://example.com/mike/diaspora\",\n \"git_http_url\":\"http://example.com/mike/diaspora.git\",\n \"git_ssh_url\":\"[email protected]:mike/diaspora.git\",\n \"visibility_level\":0\n },\n \"commits\": [\n {\n \"id\": \"b6568db1bc1dcd7f8b4d5a946b0b91f9dacd7327\",\n \"message\": \"Update Catalan translation to e38cb41.\",\n \"timestamp\": \"2011-12-12T14:27:31+02:00\",\n \"url\": \"http://example.com/mike/diaspora/commit/b6568db1bc1dcd7f8b4d5a946b0b91f9dacd7327\",\n \"author\": {\n \"name\": \"Jordi Mallach\",\n \"email\": \"[email protected]\"\n },\n \"added\": [\"CHANGELOG\"],\n \"modified\": [\"app/controller/application.rb\"],\n \"removed\": []\n },\n {\n \"id\": \"da1560886d4f094c3e6c9ef40349f7d38b5d27d7\",\n \"message\": \"fixed readme\",\n \"timestamp\": \"2012-01-03T23:36:29+02:00\",\n \"url\": \"http://example.com/mike/diaspora/commit/da1560886d4f094c3e6c9ef40349f7d38b5d27d7\",\n \"author\": {\n \"name\": \"GitLab dev user\",\n \"email\": \"gitlabdev@dv6700.(none)\"\n },\n \"added\": [\"CHANGELOG\"],\n \"modified\": [\"app/controller/application.rb\"],\n \"removed\": []\n }\n ],\n \"total_commits_count\": 4\n}\n\nYou may not bind any field in the webhook payload to a Jenkins job parameter automatically. However, there is still a way to access webhook payload information in the Jenkins job. The Jenkins GitLab plugin makes this webhook payload information available in the Jenkins Global Variable env. The available env variables are as follows and they do include branch information:\ngitlabBranch\ngitlabSourceBranch\ngitlabActionType\ngitlabUserName\ngitlabUserEmail\ngitlabSourceRepoHomepage\ngitlabSourceRepoName\ngitlabSourceNamespace\ngitlabSourceRepoURL\ngitlabSourceRepoSshUrl\ngitlabSourceRepoHttpUrl\ngitlabMergeRequestTitle\ngitlabMergeRequestDescription\ngitlabMergeRequestId\ngitlabMergeRequestIid\ngitlabMergeRequestState\ngitlabMergedByUser\ngitlabMergeRequestAssignee\ngitlabMergeRequestLastCommit\ngitlabMergeRequestTargetProjectId\ngitlabTargetBranch\ngitlabTargetRepoName\ngitlabTargetNamespace\ngitlabTargetRepoSshUrl\ngitlabTargetRepoHttpUrl\ngitlabBefore\ngitlabAfter\ngitlabTriggerPhrase\n\nJust as you would read Jenkins job parameters from Jenkins Global Variable params in your job pipeline script, you could read webhook payload fields from Jenkins Global Variable env:\nparams.MY_PARAM_NAME\nenv.gitlabBranch\n\nHope, the above information helps solve your problem."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "egit - not authorized\nI just connected to GIT from Eclipse Juno using EGit, and successfully cloned a certain remote repository. During the clone I entered my Github username and password, but chose not to save them.\nThen I tried to \"Fetch from Upstream\". I got this error:\nhttps://github.com/biunlp/nlp-lab.git: not authorized\nI had no chance of entering my username and password...\nThis is strange since I connected to this repository in order to clone..."
},
{
"role": "assistant",
"content": "Update 2022: In what follows, always use:\n\na App password, not your account password (see blog post).\nSo create your app password.\na BitBucket Cloud, since BitBucket server will be discontinued in Feb. 2024.\n\n\nA. To specify credentials individually for each remote\n\nOpen Git repositories view,\nopen \"Remotes > origin > <your push url>\"\nclick \"Change Credentials...\"\n\n\n(From User Guide - Resource Context Menu)\nB. To specify credentials per server\nIf you want to access multiple repositories on the same server without providing the same credentials multiple times, you may use .netrc. With this, eGit will use the configuration you provide.\n\nCreate a text file called .netrc (_netrc in Windows) in the user home directory.\nAdd content to the file in this form:\n\n\n machine my.server1.com\n login yourUserName\n password yourPassword\n\n machine my.server2.com\n login yourUserName\n password yourPassword\n\nThe Stash documentation contains more information about .netrc\nSecurity issue The problem with using .netrc this way is that the password is visible in plain text. Refer to this answer in Stackoverflow to solve that problem.\n\nMore secure option (2022): EGit (from issue 441198) can be made (with an extension) to recognize a native Git credential helper, using a secure encrypted cache:\n\ninstall a native Git\n\ninstall the GCM (Git Credential Manager), which is cross-platform, and already package with Git For Windows for instance.\n\ninstruct EGit to look for credentials in the GCM: gitflow-incremental-builder/gitflow-incremental-builder\n\nregister your password or token in said GCM\nprintf \"Host=my.server1.com\\nprotocol=https\\nusername=yourUsername1\\npassword=passwd1\" | \\\ngit credential-manager-core store \n# and: \nprintf \"Host=my.server1.com\\nprotocol=https\\nusername=yourUsername1\\npassword=passwd1\" | \\\ngit credential-manager-core store\n\n\n\nLook for executable git-credential-manager-core, and add its folder to your %PATH%/$PATH."
}
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.