messages listlengths 3 3 |
|---|
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Make Heroku run non-master Git branch\nI have a project hosted on Heroku and it's gotten to the point where I want to make an alternate test server (so I can test Heroku workers without messing up production).\nI have already set up my main Heroku remote running my trunk and a Heroku-dev remote on which I wish to run an alternate branch.\nMy problem is that since my alternate branch isn't master, Heroku won't build it.\n$ git push heroku-dev test\ncounting objects ...\n...\nPushed to non-master branch, skipping build.\nTo [email protected]:example-dev.git\n* [new branch] test -> test\n\nSwitching this build to master is not an option at the moment. Obviously one option is to create a whole new git repo that's a clone of my test branch, but that doesn't sound very ideal."
},
{
"role": "assistant",
"content": "You can push an alternative branch to Heroku using Git.\ngit push heroku-dev test:master\n\nThis pushes your local test branch to the remote's master branch (on Heroku).\n\nComment from @Brian Armstrong:\nWorth noting also, when you're ready to go back to master you need to do\ngit push -f heroku master:master"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git - the stupid content tracker git-sh-setup"
},
{
"role": "assistant",
"content": "Common Git shell script setup code"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to do a git diff on moved/renamed file?\nI moved a file using git mv. Now I would like to do a diff on the new file to compare it with the old file (with the old, now non-existent name). \nHow do I do this?"
},
{
"role": "assistant",
"content": "You need to use -M to let git autodetect the moved file when diffing. Using just git diff as knittl mentioned does not work for me.\nSo simply: git diff -M should do it.\nThe documentation for this switch is:\n-M[<n>], --find-renames[=<n>]\n Detect renames. If n is specified, it is a threshold on the similarity index \n (i.e. amount of addition/deletions compared to the file’s size). For example, \n -M90% means git should consider a delete/add pair to be a rename if more than\n 90% of the file hasn’t changed."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-rev-list - Lists commit objects in reverse chronological order %d"
},
{
"role": "assistant",
"content": "ref names, like the --decorate option of git-log"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "is it possible to ignore .gitignore rules in subdirectory?\nI want to ignore all of .gitignore rules in subdirectory except .gitignore rules in root.\nfor example:\nI already have .gitignore file in a directory structure /a.\nAnd also have .gitignore file in /a/b. Assume /a has a.txt and b.txt files.\n/a/b has .config file. .gitignore defines .config in /a/b.\n.config file will be ignored by .gitignore in /a/b.\nBut I really want to track .config file by ignoring rules of .gitignore in subdirectory.\nIs it possible?"
},
{
"role": "assistant",
"content": "Your question isn't too clear, but if there are some subdirectories where you want different gitignore rules, you can just create a new .gitignore in that directory.\nSay you have:\n\nproject/.gitignore\nproject/stuff/.gitignore\n\nThe .gitignore in stuff/ will override the .gitignore in the root directory.\ngit help gitignore or man gitignore has quite a bit more information about what's possible."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Methods for using Git with Google Colab\nAre there any recommended methods to integrate git with colab?\nFor example, is it possible to work off code from google source repositories or the likes?\nNeither google drive nor cloud storage can be used for git functionality.\nSo I was wondering if there is a way to still do it?"
},
{
"role": "assistant",
"content": "If you want to clone a private repository, the quickest way would be to create a personal access token and select only privileges that your application needs. Then clone command for GitHub would look like:\n!git clone https://[email protected]/username/repository.git"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How can I make git show a list of the files that are being tracked?\nUsing command line git, how can I make git show a list of the files that are being tracked in the repository?"
},
{
"role": "assistant",
"content": "To list all the files currently being tracked under the branch master, use ls-tree:\ngit ls-tree -r master --name-only\n\nTo list all files that have ever existed (i.e. including deleted files):\ngit log --pretty=format: --name-only --diff-filter=A | sort - | sed '/^$/d'"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git error - can't push to github - pack-objects died of signal 9\nI added some files to the repo, committed, and attempted to push to Github:\n$ git add . \n$ git commit -m 'bla' \n$ git push origin master\n\nI am getting an error when I try to push to Github. \nCounting objects: 84, done. \nDelta compression using up to 2 threads. \nerror: pack-objects died of signal 9 \nerror: failed to push some refs to '[email protected]:xxxxx/xxxxx.git'\n\nAll was working fine before I went on vacation 2 weeks ago. Nothing has changed in the interim as far as I know. The config file seems to be fine. And git push -f also generates the same errors as above."
},
{
"role": "assistant",
"content": "Try this:\ngit config --global pack.windowMemory \"32m\"\n\npack.windowMemory::\n The maximum size of memory that is consumed by each thread\n in linkgit:git-pack-objects[1] for pack window memory when\n no limit is given on the command line. The value can be\n suffixed with \"k\", \"m\", or \"g\". When left unconfigured (or\n set explicitly to 0), there will be no limit."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git:// protocol blocked by company, how can I get around that?\n\nAttempting something like git clone git://github.com/ry/node.git will not work, it results in:\nInitialized empty Git repository in /home/robert/node/.git/\ngithub.com[0: 207.97.227.239]: errno=Connection timed out\nfatal: unable to connect a socket (Connection timed out)\n\nHowever, cloning over HTTP works fine. So far I've gathered that it's a problem with the protocol, but I'm trying to install cloud9 which is requiring the command \ngit submodule update --init --recursive\nwhich is trying to use the git:// protocol and failing. Is there a way to change how that command will work or something?"
},
{
"role": "assistant",
"content": "If this is an issue with your firewall blocking the git: protocol port (9418), then you should make a more persistent change so you don't have to remember to issue commands suggested by other posts for every git repo.\nThe below solution also just works for submodules which might also be using the git: protocol.\nSince the git message doesn't really point immediately to the firewall blocking port 9418, lets try to diagnose this as the actual problem.\nDiagnosing the Problem\nReferences: https://superuser.com/q/621870/203918 and https://unix.stackexchange.com/q/11756/57414\nThere are several tools we can use to determine if the firewall causing our problem - use whichever is installed on your system.\n# Using nmap\n# A state of \"filtered\" against port 9418 (git) means\n# that traffic is being filtered by a firewall\n$ nmap github.com -p http,git\n\nStarting Nmap 5.21 ( http://nmap.org ) at 2015-01-21 10:55 ACDT\nNmap scan report for github.com (192.30.252.131)\nHost is up (0.24s latency).\nPORT STATE SERVICE\n80/tcp open http\n9418/tcp filtered git\n\n# Using Netcat:\n# Returns 0 if the git protocol port IS NOT blocked\n# Returns 1 if the git protocol port IS blocked\n$ nc github.com 9418 < /dev/null; echo $?\n1\n\n# Using CURL\n# Returns an exit code of (7) if the git protocol port IS blocked\n# Returns no output if the git protocol port IS NOT blocked\n$ curl http://github.com:9418\ncurl: (7) couldn't connect to host\n\nOK, so now we have determined it is our git port being blocked by a firewall, what can we do about it? Read on :)\nBasic URL Rewriting\nGit provides a way to rewrite URLs using git config. Simply issue the following command:\ngit config --global url.\"https://\".insteadOf git://\n\nNow, as if by magic, all git commands will perform a substitution of git:// to https://\nWhat Changes Did This Command Make?\nTake a look at your global configuration using:\ngit config --list\n\nYou'll see the following line in the output:\nurl.https://.insteadof=git://\n\nYou can see how this looks on file, by taking a peek at ~/.gitconfig where you should now see that the following two lines have been added:\n[url \"https://\"]\n insteadOf = git://\n\nWant More Control?\nSimply use a more complete/specific URL in the replacement. For example, to only have GitHub URLs use https:// instead of git://, you could use something like:\ngit config --global url.\"https://github\".insteadOf git://github\n\nYou can run this command multiple times using different replacements. However, in the event that a URL matches multiple replacements, the longest match \"wins\". Only a single replacement will be made per URL.\nSystem-Wide Changes for Sysadmins\nIf you're a Linux Sysadmin and you don't want your users to have to go through the above pains you can make a quick system-wide git configuration change.\nSimply edit or add the following contents to /etc/gitconfig and voila your users don't have to worry about any of the above:\n[url \"https://\"]\n insteadOf = git://"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-config - Get and set repository or global options filter.<driver>.smudge"
},
{
"role": "assistant",
"content": "The command which is used to convert the content of a blob\nobject to a worktree file upon checkout. See gitattributes for details."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-shortlog - Summarize git log output --skip=<number>"
},
{
"role": "assistant",
"content": "Skip number commits before starting to show the commit output."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Gitlab Cannot start runsv is not running\n\nI just upgraded my gitlab-ce version to the latest version using this command\nsudo yum install gitlab-ce-12.1.3-ce.0.el7.x86_64\n\nthe upgrade works well, but after restart the gitlab service won't start,\nwhen I run this command \nsudo gitlab-ctl start\n\nfail: alertmanager: runsv not running\nfail: gitaly: runsv not running\nfail: gitlab-monitor: runsv not running\nfail: gitlab-workhorse: runsv not running\nfail: grafana: runsv not running\nfail: logrotate: runsv not running\nfail: nginx: runsv not running\nfail: node-exporter: runsv not running\nfail: postgres-exporter: runsv not running\nfail: postgresql: runsv not running\nfail: prometheus: runsv not running\nfail: redis: runsv not running\nfail: redis-exporter: runsv not running\nfail: sidekiq: runsv not running\nfail: unicorn: runsv not running\n\nand then I try to start the gitlab-runsv by using this command \nsystemctl start gitlab-runsvdir.service\n\nBut it freezes and not doing anything!!, I must use the CTRL+C to quit\nand when I run the journal-ctl it don't showing anything.\njournalctl -u gitlab-runsvdir.service\n-- No entries --\n\nMy Environment is Centos 7."
},
{
"role": "assistant",
"content": "I faced the problem on my ubuntu-20. Previously i had disabled my gitlab-runsvdir.service. That was the reason for my problem. so what i did\nsudo systemctl enable gitlab-runsvdir.service\nsudo systemctl start gitlab-runsvdir.service"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Are git hooks pushed to the remote when I 'git push'?\nIf I create a new hook script in my local repository in repo/.git/hooks/post-commit and then I run \"git push\" are the hooks pushed to the remote? Then, when the other developers run \"git pull\" from the same origin will they get my new hooks?"
},
{
"role": "assistant",
"content": "No. Hooks are per-repository and are never pushed. Similarly, the repo config isn't pushed either, nor is anything in .git/info, or a number of other things.\nPushing and pulling only exchanges branches/tags and commit objects (and anything reachable from a commit, e.g. trees, blobs)."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git - the stupid content tracker --no-replace-objects"
},
{
"role": "assistant",
"content": "Do not use replacement refs to replace Git objects.\nThis is equivalent to exporting the GIT_NO_REPLACE_OBJECTS environment variable with any value.\nSee git-replace for more information."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to merge remote changes at GitHub?\nI'm getting following error, whn trying first Github push:\n[rejected] master -> master (non-fast forward)\nerror: failed to push some refs to '[email protected]:me/me.git'\nTo prevent you from losing history, non-fast-forward updates were rejected\nMerge the remote changes before pushing again. See the 'non-fast forward'\nsection of 'git push --help' for details.\n\nhow can I fix this and merge remote changes?"
},
{
"role": "assistant",
"content": "See the 'non-fast forward' section of 'git push --help' for details.\n\nYou can perform \"git pull\", resolve potential conflicts, and \"git push\" the result. A \"git pull\" will create a merge commit C between commits A and B.\nAlternatively, you can rebase your change between X and B on top of A, with \"git pull --rebase\", and push the result back. The rebase will create a new commit D that builds the change between X and B on top of A."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Could not open a connection to your authentication agent\nI am running into this error of: \n$ git push heroku master\nWarning: Permanently added the RSA host key for IP address '50.19.85.132' to the list of known hosts.\n! Your key with fingerprint b7:fd:15:25:02:8e:5f:06:4f:1c:af:f3:f0:c3:c2:65 is not authorized to access bitstarter.\n\nI tried to add the keys and I get this error below:\n$ ssh-add ~/.ssh/id_rsa.pub\nCould not open a connection to your authentication agent."
},
{
"role": "assistant",
"content": "Did You Start ssh-agent?\nYou might need to start ssh-agent before you run the ssh-add command:\neval `ssh-agent -s`\nssh-add\n\nNote that this will start the agent for msysgit Bash on Windows. If you're using a different shell or operating system, you might need to use a variant of the command, such as those listed in the other answers.\nSee the following answers:\n\nssh-add complains: Could not open a connection to your authentication agent\nGit push requires username and password (contains detailed instructions on how to use ssh-agent)\nHow to run (git/ssh) authentication agent?.\nCould not open a connection to your authentication agent\n\nTo automatically start ssh-agent and allow a single instance to work in multiple console windows, see Start ssh-agent on login.\nWhy do we need to use eval instead of just ssh-agent?\nSSH needs two things in order to use ssh-agent: an ssh-agent instance running in the background, and an environment variable set that tells SSH which socket it should use to connect to the agent (SSH_AUTH_SOCK IIRC). If you just run ssh-agent then the agent will start, but SSH will have no idea where to find it.\nfrom this comment.\nPublic vs Private Keys\nAlso, whenever I use ssh-add, I always add private keys to it. The file ~/.ssh/id_rsa.pub looks like a public key, I'm not sure if that will work. Do you have a ~/.ssh/id_rsa file? If you open it in a text editor, does it say it's a private key?"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Link another commit's reference in commit message gitlab\n\nI know we can mention issue in commit messages as'#issue_no', but is it possible to link it to another commit in gitlab?\neither mention commit SHA or complete commit URL in the commit message?"
},
{
"role": "assistant",
"content": "See the documentation: https://docs.gitlab.com/ce/user/markdown.html#special-gitlab-references\n\n\n\n\n\nreferences\ninput\ncross-project reference\nshortcut inside same namespace\n\n\n\n\nspecific commit\n9ba12248\nnamespace/project@9ba12248\nproject@9ba12248\n\n\n\n\nSo you can just use the commit hash within one project."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Gitlab - Too many authentication failures for git\n\nMy command line git is not working since last week, all I remember is that I init a local folder into git version controlled, and add a remote git ref to it. Then my git is unable to push or pull. It shows:\ngit clone [email protected]:xxx/myproj.git myproj\nCloning into 'myproj'...\nReceived disconnect from 192.168.xxx.xxx: 2: Too many authentication failures for git\nfatal: Could not read from remote repository.\n\nPlease make sure you have the correct access rights\nand the repository exists.\n\nWhat's weird is that my version control in JetBrain Idea works fine, it can still pull or push that project which can't be pull in command line.\nI've add the id_rsa.pub to gitlab before, and I re-add it again now, but it does not work.\nMy ssh debug info\nssh -v [email protected]\nOpenSSH_6.2p2, OSSLShim 0.9.8r 8 Dec 2011\ndebug1: Reading configuration data /etc/ssh_config\ndebug1: /etc/ssh_config line 20: Applying options for *\ndebug1: Connecting to gitlab.xxx.com [192.168.xxx.xxx] port 22.\ndebug1: Connection established.\ndebug1: identity file /Users/abc/.ssh/id_rsa type -1\ndebug1: identity file /Users/abc/.ssh/id_rsa-cert type -1\ndebug1: identity file /Users/abc/.ssh/id_dsa type -1\ndebug1: identity file /Users/abc/.ssh/id_dsa-cert type -1\ndebug1: Enabling compatibility mode for protocol 2.0\ndebug1: Local version string SSH-2.0-OpenSSH_6.2\ndebug1: Remote protocol version 2.0, remote software version OpenSSH_5.3\ndebug1: match: OpenSSH_5.3 pat OpenSSH_5*\ndebug1: SSH2_MSG_KEXINIT sent\ndebug1: SSH2_MSG_KEXINIT received\ndebug1: kex: server->client aes128-ctr hmac-md5 none\ndebug1: kex: client->server aes128-ctr hmac-md5 none\ndebug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent\ndebug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP\ndebug1: SSH2_MSG_KEX_DH_GEX_INIT sent\ndebug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY\ndebug1: Server host key: RSA d7:11:d8:62:a6:30:1d:4a:c7:f1:99:bd:ba:54:de:60\ndebug1: Host 'gitlab.corp.com' is known and matches the RSA host key.\ndebug1: Found key in /Users/abc/.ssh/known_hosts:127\ndebug1: ssh_rsa_verify: signature correct\ndebug1: SSH2_MSG_NEWKEYS sent\ndebug1: expecting SSH2_MSG_NEWKEYS\ndebug1: SSH2_MSG_NEWKEYS received\ndebug1: Roaming not allowed by server\ndebug1: SSH2_MSG_SERVICE_REQUEST sent\ndebug1: SSH2_MSG_SERVICE_ACCEPT received\ndebug1: Authentications that can continue: publickey,password,hostbased\ndebug1: Next authentication method: publickey\ndebug1: Offering RSA public key: /Users/abc/.ssh/id_rsa.cn0\ndebug1: Authentications that can continue: publickey,password,hostbased\ndebug1: Offering RSA public key: /Users/abc/.ssh/id_rsa.cn6\ndebug1: Authentications that can continue: publickey,password,hostbased\ndebug1: Offering RSA public key: /Users/abc/.ssh/id_rsa.cn1\ndebug1: Authentications that can continue: publickey,password,hostbased\ndebug1: Offering RSA public key: /Users/abc/.ssh/id_rsa.cn2\ndebug1: Authentications that can continue: publickey,password,hostbased\ndebug1: Offering RSA public key: /Users/abc/.ssh/id_rsa.cn5\ndebug1: Authentications that can continue: publickey,password,hostbased\ndebug1: Offering RSA public key: /Users/abc/.ssh/id_rsa.cn8\nReceived disconnect from 192.168.100.218: 2: Too many authentication failures for git\nabc@LiuzhMacbook:~/.ssh$\nabc@LiuzhMacbook:~/.ssh$ ls\nauthorized_keys id_rsa known_hosts tmp/\nabc@LiuzhMacbook:~/.ssh$ rm known_hosts\nabc@LiuzhMacbook:~/.ssh$ ssh -v [email protected]\nOpenSSH_6.2p2, OSSLShim 0.9.8r 8 Dec 2011\ndebug1: Reading configuration data /etc/ssh_config\ndebug1: /etc/ssh_config line 20: Applying options for *\ndebug1: Connecting to gitlab.corp.com [192.168.100.218] port 22.\ndebug1: Connection established.\ndebug1: identity file /Users/abc/.ssh/id_rsa type -1\ndebug1: identity file /Users/abc/.ssh/id_rsa-cert type -1\ndebug1: identity file /Users/abc/.ssh/id_dsa type -1\ndebug1: identity file /Users/abc/.ssh/id_dsa-cert type -1\ndebug1: Enabling compatibility mode for protocol 2.0\ndebug1: Local version string SSH-2.0-OpenSSH_6.2\ndebug1: Remote protocol version 2.0, remote software version OpenSSH_5.3\ndebug1: match: OpenSSH_5.3 pat OpenSSH_5*\ndebug1: SSH2_MSG_KEXINIT sent\ndebug1: SSH2_MSG_KEXINIT received\ndebug1: kex: server->client aes128-ctr hmac-md5 none\ndebug1: kex: client->server aes128-ctr hmac-md5 none\ndebug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent\ndebug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP\ndebug1: SSH2_MSG_KEX_DH_GEX_INIT sent\ndebug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY\ndebug1: Server host key: RSA d7:11:d8:62:a6:30:1d:4a:c7:f1:99:bd:ba:54:de:60\nThe authenticity of host 'gitlab.corp.com (192.168.100.218)' can't be established.\nRSA key fingerprint is d7:11:d8:62:a6:30:1d:4a:c7:f1:99:bd:ba:54:de:60.\nAre you sure you want to continue connecting (yes/no)? yes\nWarning: Permanently added 'gitlab.corp.com,192.168.100.218' (RSA) to the list of known hosts.\ndebug1: ssh_rsa_verify: signature correct\ndebug1: SSH2_MSG_NEWKEYS sent\ndebug1: expecting SSH2_MSG_NEWKEYS\ndebug1: SSH2_MSG_NEWKEYS received\ndebug1: Roaming not allowed by server\ndebug1: SSH2_MSG_SERVICE_REQUEST sent\ndebug1: SSH2_MSG_SERVICE_ACCEPT received\ndebug1: Authentications that can continue: publickey,password,hostbased\ndebug1: Next authentication method: publickey\ndebug1: Offering RSA public key: /Users/abc/.ssh/id_rsa.cn0\ndebug1: Authentications that can continue: publickey,password,hostbased\ndebug1: Offering RSA public key: /Users/abc/.ssh/id_rsa.cn6\ndebug1: Authentications that can continue: publickey,password,hostbased\ndebug1: Offering RSA public key: /Users/abc/.ssh/id_rsa.cn1\ndebug1: Authentications that can continue: publickey,password,hostbased\ndebug1: Offering RSA public key: /Users/abc/.ssh/id_rsa.cn2\ndebug1: Authentications that can continue: publickey,password,hostbased\ndebug1: Offering RSA public key: /Users/abc/.ssh/id_rsa.cn5\ndebug1: Authentications that can continue: publickey,password,hostbased\ndebug1: Offering RSA public key: /Users/abc/.ssh/id_rsa.cn8\nReceived disconnect from 192.168.100.218: 2: Too many authentication failures for git"
},
{
"role": "assistant",
"content": "You can use a different ssh url in order to reference the right public/private key you want.\nAdd in your HOME/.ssh a file named config:\nHost mygitlab\nHostname gitlab.xxx.com\nUser git\nIdentityFile ~/.ssh/id_rsa.gitlab\nIdentitiesOnly yes\n\nAnd change your url:\ngit clone mygitlab:xxx/myproj.git myproj\n\nThat way, you avoid the default ssh behavior which presents every keys for ssh to try."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to read the output from git diff?\nThe man page for git-diff is rather long, and explains many cases which don't seem to be necessary for a beginner. For example:\ngit diff origin/master"
},
{
"role": "assistant",
"content": "Lets take a look at example advanced diff from git history (in commit 1088261f in git.git repository):\ndiff --git a/builtin-http-fetch.c b/http-fetch.c\nsimilarity index 95%\nrename from builtin-http-fetch.c\nrename to http-fetch.c\nindex f3e63d7..e8f44ba 100644\n--- a/builtin-http-fetch.c\n+++ b/http-fetch.c\n@@ -1,8 +1,9 @@\n #include \"cache.h\"\n #include \"walker.h\"\n \n-int cmd_http_fetch(int argc, const char **argv, const char *prefix)\n+int main(int argc, const char **argv)\n {\n+ const char *prefix;\n struct walker *walker;\n int commits_on_stdin = 0;\n int commits;\n@@ -18,6 +19,8 @@ int cmd_http_fetch(int argc, const char **argv, const char *prefix)\n int get_verbosely = 0;\n int get_recover = 0;\n \n+ prefix = setup_git_directory();\n+\n git_config(git_default_config, NULL);\n \n while (arg < argc && argv[arg][0] == '-') {\n\nLets analyze this patch line by line.\n\nThe first line diff --git a/builtin-http-fetch.c b/http-fetch.c is a \"git diff\" header in the form diff --git a/file1 b/file2. The a/ and b/ filenames are the same unless rename/copy is involved (like in our case). The --git is to mean that diff is in the \"git\" diff format.\n\nNext are one or more extended header lines. The first threesimilarity index 95%\nrename from builtin-http-fetch.c\nrename to http-fetch.ctell us that the file was renamed from builtin-http-fetch.c to http-fetch.c and that those two files are 95% identical (which was used to detect this rename). The last line in extended diff header, which is index f3e63d7..e8f44ba 100644 tell us about mode of given file (100644 means that it is ordinary file and not e.g. symlink, and that it doesn't have executable permission bit), and about shortened hash of preimage (the version of file before given change) and postimage (the version of file after change). This line is used by git am --3way to try to do a 3-way merge if patch cannot be applied itself.\n\nNext is two-line unified diff header--- a/builtin-http-fetch.c\n+++ b/http-fetch.cCompared to diff -U result it doesn't have from-file-modification-time nor to-file-modification-time after source (preimage) and destination (postimage) file names. If file was created the source is /dev/null; if file was deleted, the target is /dev/null.If you set diff.mnemonicPrefix configuration variable to true, in place of a/ and b/ prefixes in this two-line header you can have instead c/, i/, w/ and o/ as prefixes, respectively to what you compare; see git-config(1)\n\nNext come one or more hunks of differences; each hunk shows one area where the files differ. Unified format hunks starts with line like@@ -1,8 +1,9 @@or@@ -18,6 +19,8 @@ int cmd_http_fetch(int argc, const char **argv, ... It is in the format @@ from-file-range to-file-range @@ [header]. The from-file-range is in the form -<start line>,<number of lines>, and to-file-range is +<start line>,<number of lines>. Both start-line and number-of-lines refer to position and length of hunk in preimage and postimage, respectively. If number-of-lines not shown it means that it is 1.\n\n\nThe optional header shows the C function where each change occurs, if it is a C file (like -p option in GNU diff), or the equivalent, if any, for other types of files.\n\nNext comes the description of where files differ. The lines common to both files begin with a space character. The lines that actually differ between the two files have one of the following indicator characters in the left print column:\n\n'+' -- A line was added here to the first file.\n\n'-' -- A line was removed here from the first file.\n\n\nSo, for example, first chunk\n #include \"cache.h\"\n #include \"walker.h\"\n \n -int cmd_http_fetch(int argc, const char **argv, const char *prefix)\n +int main(int argc, const char **argv)\n {\n + const char *prefix;\n struct walker *walker;\n int commits_on_stdin = 0;\n int commits;\n\nmeans that cmd_http_fetch was replaced by main, and that const char *prefix; line was added.\nIn other words, before the change, the appropriate fragment of then 'builtin-http-fetch.c' file looked like this:\n #include \"cache.h\"\n #include \"walker.h\"\n \n int cmd_http_fetch(int argc, const char **argv, const char *prefix)\n {\n struct walker *walker;\n int commits_on_stdin = 0;\n int commits;\n\nAfter the change this fragment of now 'http-fetch.c' file looks like this instead:\n #include \"cache.h\"\n #include \"walker.h\"\n \n int main(int argc, const char **argv)\n {\n const char *prefix;\n struct walker *walker;\n int commits_on_stdin = 0;\n int commits;\n\n\nThere might be \\ No newline at end of fileline present (it is not in example diff).\n\nAs Donal Fellows said it is best to practice reading diffs on real-life examples, where you know what you have changed.\nReferences:\n\ngit-diff(1) manpage, section \"Generating patches with -p\"\n(diff.info)Detailed Unified node, \"Detailed Description of Unified Format\"."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-log - Show commit logs --simplify-merges"
},
{
"role": "assistant",
"content": "First, build a history graph in the same way that --full-history with parent rewriting does (see above). Then simplify each commit C to its replacement C' in the final\nhistory according to the following rules: Set C' to C . Replace each parent P of C' with its simplification P' . In\nthe process, drop parents that are ancestors of other parents or that are\nroot commits TREESAME to an empty tree, and remove duplicates, but take care\nto never drop all parents that we are TREESAME to. If after this parent rewriting, C' is a root or merge commit (has\nzero or >1 parents), a boundary commit, or !TREESAME, it remains.\nOtherwise, it is replaced with its only parent. The effect of this is best shown by way of comparing to --full-history with parent rewriting. The example turns into: .-A---M---N---O\n\t / / /\n\tI B D\n\t \\ / /\n\t `---------' Note the major differences in N , P , and Q over --full-history : N 's parent list had I removed, because it is an ancestor of the\nother parent M . Still, N remained because it is !TREESAME. P 's parent list similarly had I removed. P was then\nremoved completely, because it had one parent and is TREESAME. Q 's parent list had Y simplified to X . X was then removed, because it\nwas a TREESAME root. Q was then removed completely, because it had one\nparent and is TREESAME."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "What's the difference between git reset --hard and git reset --merge\nIn my experiments I haven't been able to find any functional difference between\ngit reset --hard\n\nand\ngit reset --merge\n\nThe usage instructions don't give any hint either\n--hard reset HEAD, index and working tree\n--merge reset HEAD, index and working tree\n\nI regularly use the --hard option so understand how that works. What's the difference between the --merge and the --hard options?\nCheers,\nOlly\nPerhaps an example would help here, let's use the following sequence:\ncd git_repo\ntouch file_one\ngit add file_one\ngit commit -m \"commit one\" # sha1 of 123abc\necho \"one\" >> ./file_one\ngit commit -a -m \"commit two\" # sha1 of 234bcd\necho \"two\" >> ./file_one\ngit add . # populate index with a change\necho \"three\" >> ./file_one # populate working area with a change\n\nNow if I try\ngit reset --merge 123abc\n\nI get\nerror: Entry 'file_one' not uptodate. Cannot merge.\nfatal: Could not reset index file to revision '123abc'\n\nthe reason being that file_one has changes in both the working area and the index\nTo remedy this I do\ngit add .\ngit reset --merge 123abc\n\nThis time it works, however, I get the same result as git reset --hard. The index is empty, working area is empty, file_one is empty, as it was after first commit.\nCan someone come up with the steps that illustrate the difference?"
},
{
"role": "assistant",
"content": "From git reset manpage:\n\n--hard Matches the working tree and index to that of the tree being\n switched to. Any changes to tracked files in the working tree since\n <commit> are lost.\n\n--merge\n Resets the index to match the tree recorded by the named commit, and\n updates the files that are different between the named commit and\n the current commit in the working tree.\n\nThe git reset --merge is meant to be a safer version of git reset --hard, when your changes and somebody else changes are mixed together, trying to carry our changes around."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-config - Get and set repository or global options column"
},
{
"role": "assistant",
"content": "fill columns before rows"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How can I get a list of all pull requests for a repo through the github API?\n\nI want to obtain a list of all pull requests on a repo through the github API.\nI've followed the instructions at http://developer.github.com/v3/pulls/ but when I query /repos/:owner/:repo/pulls it's consistently returning fewer pull requests than displayed on the website.\nFor example, when I query the torvalds/linux repo I get 9 open pull requests (there are 14 on the website). If I add ?state=closed I get a different set of 11 closed pull requests (the website shows around 20).\nDoes anyone know where this discrepancy arises, and if there's any way to get a complete list of pull requests for a repo through the API?"
},
{
"role": "assistant",
"content": "You can get all pull requests (closed, opened, merged) through the variable state. \nJust set state=all in the GET query, like this->\nhttps://api.github.com/repos/:owner/:repo/pulls?state=all\n\nFor more info: check the Parameters table at https://developer.github.com/v3/pulls/#list-pull-requests\nEdit: As per Tomáš Votruba's comment:\n\nthe default value for, \"per_page=30\". The maximum is per_page=100. To get more than 100 results, you need to call it multiple itmes: \"&page=1\", \"&page=2\"..."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Using gitk, can I see the difference between 2 commits?\nI have tried:\ngit diff sha1 sha2\n\nBut the output isn't the best, is it possible to see the difference between 2 commits using gitk?"
},
{
"role": "assistant",
"content": "In windows at least it is perfectly possible :"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-diff - Show changes between commits, commit and working tree, etc --cumulative"
},
{
"role": "assistant",
"content": "Synonym for --dirstat=cumulative"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git - the stupid content tracker <tag>"
},
{
"role": "assistant",
"content": "a valid tag name (i.e. a refs/tags/<tag> reference)."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "lint-staged not running on precommit\nprettier is not running on precommit. This worked with the same configuration in other projects, so I'm baffled why it's not working this time. \nThis is the relevant section of my package.json file:\n\"scripts\": {\n \"precommit\": \"lint-staged\"\n },\n\"lint-staged\": {\n \"*.{js,json,css,scss,html,md}\": [\n \"prettier --write\",\n \"git add\"\n ]\n},\n\nEdit. Here are the relevant devDependencies:\n\"devDependencies\": {\n \"husky\": \"^0.14.3\",\n \"lint-staged\": \"^7.0.4\",\n \"prettier\": \"1.12.0\"\n},"
},
{
"role": "assistant",
"content": "I tried so many solutions on here but a combination finally worked!\n\nMake sure Husky v4 is installed. v6 was never triggering for me.\nCheck the output of git config core.hooksPath. This should not return anything. If it does run,\n\ngit config --unset core.hookspath\n\nAnd FINALLY it worked!"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How make Eclipse/EGit recognize existing repository information after update?\nAfter upgrading Eclipse from Helios to Indigo with EGit plugin 1.0.0, all my projects seem to have lost their metadata about their git repositories, respectively.\nIn Helios, every Eclipse project was a git repository on its own. When updating to Indigo, i hoped i could continue using the workspace from Helios. After the update, all projects are still present in the workspace; and in each project directory, there's still the .git subdirectory, but Eclipse seems to treat each project as if it wasn't a git repository already.\nSo, there's still all git metadata in the project folders, but eclipse doesn't recognize them. Is there another way to \"reactivate\" the git functionality?"
},
{
"role": "assistant",
"content": "Thanks to Jeremy, i found how to reactivate the repos myself. Basically, two steps were required:\n\nAdd the (already existing) local repository to EGit's Git Repositories view;\n\"Share\" each of the projects again using \"use or create repository\".\n\nThe second step won't work if the repo isn't available in the repository view. So, after an eclipse upgrade, do the following:\nAdd the (already existing) local repository to EGit's Git Repositories view\n\nOpen the Git Repositories view:\n\nHit the \"add\" button (Tooltip: Add an existing local Git Repository to this view)\n\nIn the \"Add Git Repositories\" dialogue, under Search criteria, enter the workspace directory, select \"Look for nested repositores\", and hit Search:\n\nSelect the repositories you want to add and click OK\n\n\"Share\" each of the projects again using \"use or create repository\"\n\nOpen you existing project in Eclipse's Project explorer;\nRight-click and select \"Team -> Share Project...\":\n\nSelect Git Project, and in the next dialogue, select \"Use or create Repository in parent folder of project\". Important: don't try to select the repository from the combo box that's visible when \"Use or create Repository in parent folder of project\" isn't selected - it won't work.\n\n\nThe wizard suggests the local git repository that's located in the current project, so just hit Finish."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-config - Get and set repository or global options repack.useDeltaIslands"
},
{
"role": "assistant",
"content": "If set to true, makes git repack act as if --delta-islands was passed. Defaults to false ."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to checkout merge request locally, and create new local branch?\nI have GitLab repository there and I need to test every merge request locally, before merging to the target branch. \nHow can I pull/fetch merge request as a new branch?"
},
{
"role": "assistant",
"content": "Pull merge request to new branch \ngit fetch origin merge-requests/REQUESTID/head:BRANCHNAME\ni.e \ngit fetch origin merge-requests/10/head:file_upload\nCheckout to newly created branch\ngit checkout BRANCHNAME\ni.e (git checkout file_upload)\n\nOR with single command \ngit fetch origin merge-requests/REQUESTID/head:BRANCHNAME && git checkout BRANCHNAME\ni.e \ngit fetch origin merge-requests/18/head:file_upload && git checkout file_upload"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-show - Show various types of objects --raw"
},
{
"role": "assistant",
"content": "For each commit, show a summary of changes using the raw diff\nformat. See the \"RAW OUTPUT FORMAT\" section of git-diff . This is different from showing the log\nitself in raw format, which you can achieve with --format=raw ."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "GitHub : Is it possible to search inside code and sort by stars\n\nI'm not sure if this is the right forum for this question. Saw quite a few Q&A related to search on GitHub, hence posting here. \nE.g. Search code inside a Github project \nGitHub advanced search allows terms like stars:>100 but the query term is restricted to repository names only. Is it possible to search for a term inside the files (code) & sort by stars? My aim is to see which popular repos are using a particular keyword in their code. It would be very useful if GitHub's advanced search options for Repositories worked for Code also."
},
{
"role": "assistant",
"content": "It is not possible to sort by stars when searching inside code.\nFrom an e-mail from github.com support:\n\nCode search does not support sorting by number of stars, but I will definitely add your +1 to that suggestion internally! I can't say if or when a change will happen, but your feedback is in the right hands.\n\n\nYou may want to vote for this feature: Add Stars count filter.\nThe feedback is related to this announcement: Improving GitHub code search"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Checking out an old commit and maintaining the head on the master branch?\nCurrently for switching to another git commit (on the same branch...actually, on the master branch!), I'm executing the command\ngit checkout ea3d5ed039edd6d4a07cc41bd09eb58edd1f2b3a\n\nNow, every time I do this git tells me that I'm now with a detached head. How do I go to an older commit and still maintain the head on the same branch?"
},
{
"role": "assistant",
"content": "Most of the time when I do this I checkout to a temp branch:\ngit checkout -b temp-branch-name ea3d5ed039edd6d4a07cc41bd09eb58edd1f2b3a\n\nThen after I'm done i just delete the branch"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-restore - Restore working tree files -W --worktree -S --staged"
},
{
"role": "assistant",
"content": "Specify the restore location. If neither option is specified,\nby default the working tree is restored. Specifying --staged will only restore the index. Specifying both restores both."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-merge - Join two or more development histories together --ff --no-ff --ff-only"
},
{
"role": "assistant",
"content": "Specifies how a merge is handled when the merged-in history is\nalready a descendant of the current history. --ff is the\ndefault unless merging an annotated (and possibly signed) tag\nthat is not stored in its natural place in the refs/tags/ hierarchy, in which case --no-ff is assumed. With --ff , when possible resolve the merge as a fast-forward (only\nupdate the branch pointer to match the merged branch; do not create a\nmerge commit). When not possible (when the merged-in history is not a\ndescendant of the current history), create a merge commit. With --no-ff , create a merge commit in all cases, even when the merge\ncould instead be resolved as a fast-forward. With --ff-only , resolve the merge as a fast-forward when possible.\nWhen not possible, refuse to merge and exit with a non-zero status."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Where do the settings in my Git configuration come from?\nI've noticed that I have two listings for core.autocrlf when I run git config -l\n$ git config -l\ncore.symlinks=false\ncore.autocrlf=false\ncolor.diff=auto\ncolor.status=auto\ncolor.branch=auto\ncolor.interactive=true\npack.packsizelimit=2g\nhelp.format=html\nhttp.sslcainfo=/bin/curl-ca-bundle.crt\nsendemail.smtpserver=/bin/msmtp.exe\ndiff.astextplain.textconv=astextplain\nrebase.autosquash=true\nuser.name=name\n[email protected]\ncore.autocrlf=true\n\nThose last three (from user.name down) are the only ones in my C:\\users\\username\\.gitconfig file. Where are all of the other ones coming from? Why is core.autocrlf listed twice?\nThis is with MSysGit 1.8.3, and I also have Sourcetree installed (Windows 7). In Sourcetree I have unchecked the \"Allow Sourcetree to modify your global Git config files\""
},
{
"role": "assistant",
"content": "Git checks four places for a configuration file:\n\nYour machine's system .gitconfig file.\nYour user .gitconfig file located at ~/.gitconfig.\nA second user-specific configuration file located at $XDG_CONFIG_HOME/git/config or $HOME/.config/git/config.\nThe local repository's configuration file .git/config.\n\nThe settings cascade in the following order, with each file adding or overriding settings defined in the file above it.\n\nSystem configuration.\nUser configuration.\nRepository-specific configuration.\n\nYou can see what each file has defined using the following commands:\n# System, applies to entire machine and all users\n$ git config --system --list\n$ git config --system --edit\n\n# User defined\n$ git config --global --list\n$ git config --global --edit\n\nYou can see what just the repository-specific file has defined by opening up the file .git/config for that repository.\nIf you're using MSysGit on Windows, you'll probably find your user ~/.gitconfig file where ever %homepath% points to if you use echo %homepath% from a Windows command prompt.\nFrom the documentation for git config:\n\nIf not set explicitly with --file, there are four files where git config will search for configuration options:\n\n$(prefix)/etc/gitconfig\nSystem-wide configuration file.\n$XDG_CONFIG_HOME/git/config\n\nSecond user-specific configuration file. If $XDG_CONFIG_HOME is\n not set or empty, $HOME/.config/git/config will be used. Any\n single-valued variable set in this file will be overwritten by\n whatever is in ~/.gitconfig. It is a good idea not to create this\n file if you sometimes use older versions of Git, as support for this\n file was added fairly recently.\n\n~/.gitconfig\n\nUser-specific configuration file. Also called \"global\" configuration\n file.\n\n$GIT_DIR/config\nRepository specific configuration file.\n\nIf no further options are given, all reading options will read all of\n these files that are available. If the global or the system-wide\n configuration file are not available they will be ignored. If the\n repository configuration file is not available or readable, git config will exit with a non-zero error code. However, in neither case\n will an error message be issued.\nThe files are read in the order given above, with last value found\n taking precedence over values read earlier. When multiple values are\n taken then all values of a key from all files will be used.\nAll writing options will per default write to the repository specific\n configuration file. Note that this also affects options like\n --replace-all and --unset. git config will only ever change\n one file at a time.\nYou can override these rules either by command-line options or by\n environment variables. The --global and the --system options will\n limit the file used to the global or system-wide file respectively.\n The GIT_CONFIG environment variable has a similar effect, but you\n can specify any filename you want."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-tag - Create, list, delete or verify a tag object signed with GPG --sort=<key>"
},
{
"role": "assistant",
"content": "Sort based on the key given. Prefix - to sort in\ndescending order of the value. You may use the --sort=<key> option\nmultiple times, in which case the last key becomes the primary\nkey. Also supports \"version:refname\" or \"v:refname\" (tag\nnames are treated as versions). The \"version:refname\" sort\norder can also be affected by the \"versionsort.suffix\"\nconfiguration variable.\nThe keys supported are the same as those in git for-each-ref .\nSort order defaults to the value configured for the tag.sort variable if it exists, or lexicographic order otherwise. See git-config ."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-cat-file - Provide contents or details of repository objects --[no-]mailmap --[no-]use-mailmap"
},
{
"role": "assistant",
"content": "Use mailmap file to map author, committer and tagger names\nand email addresses to canonical real names and email addresses.\nSee git-shortlog ."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Why does `git diff` not work with process substitution?\nWhy does git diff not work with process substitution?\n$ echo hallo > hallo\n$ echo holla > holla\n\n$ git diff hallo holla # works\n\n$ git diff hallo <(cat holla) # works not\n\ndiff --git a/hallo b/hallo\ndeleted file mode 100644\nindex 4cf5aa5..0000000\n--- a/hallo\n+++ /dev/null\n@@ -1 +0,0 @@\n-hallo\ndiff --git a/dev/fd/63 b/dev/fd/63\nnew file mode 120000\nindex 0000000..864a6ca`\n\nSame with git diff --no-index.\nIt works with plain diff. cat is only a trivial example, can be replaced by a non-trivial sed expression.\nWorkaround:\n$ cat holla | git diff hallo - # works\n\nBut it will not work if both arguments should be affected by process substitution, like described in many examples for diff and process substitution."
},
{
"role": "assistant",
"content": "git diff does not work with process substitution because a patch that added handling of process substitution was ignored."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git - the stupid content tracker git-fast-export"
},
{
"role": "assistant",
"content": "Git data exporter"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Bitbucket repository started returning \"remote: Too many invalid password attempts. Try logging in through the website.\" (403) since yesterday\nSince yesterday, bitbucket repository started returning this on any request:\nremote: Too many invalid password attempts. Try logging in through the website. \nfatal: unable to access 'https://[email protected]/xxxxxxxxxx/xxxxxxxxxxx.git/': The requested URL returned error: 403\n\nThis happens on both the server (trying to git pull) and client (SourceTree on mac).\nThe user employed on both sides is the same, I can login to bitbucket and see no problems.\nBoth SourceTree and git on the server use different \"App Password\" generated in bitbucket.\nI am the only person using this account daily.\nI created a new App Password and tried with it just to get the same error.\nWhat can I do to solve the case?\n\nUpdate #1: Generating a new App Password does not work for both server and client. Re-adding a SourceTree account with Basic authentication does not help too. Bitbucket even does not allow to come to authentication, as it seems - the new App Passwords \"Last Access\" snows nothing.\nUpdate #2: The accepted answer is indeed a solution. This is quite strange, but resetting the password of the main bitbucket user account works. But the sequence is as follows: reset bitbucket user password; create a new app password for both server and client (SourceTree); for mac, remove the record for bitbucket in KeyChain Access; only try to pull or push from SourceTree after removing the record or the account is locked immediately!"
},
{
"role": "assistant",
"content": "The reason for getting the above error is due to Atlassion account lock & not related with App passwords.\nSo I have reset my Atlassian account(as per Atlassian's servicedesk suggession ) using below url\nhttps://id.atlassian.com/\nSo now git fetch is working fine.\nIf you forgot your current password you can reset password by below url\nhttps://id.atlassian.com/login/resetpassword\nHope this help :)"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-rev-list - Lists commit objects in reverse chronological order %s"
},
{
"role": "assistant",
"content": "subject"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-rebase - Reapply commits on top of another base tip rename-threshold=<n>"
},
{
"role": "assistant",
"content": "Deprecated synonym for find-renames=<n> ."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-diff-index - Compare a tree to the working tree or index minimal"
},
{
"role": "assistant",
"content": "Spend extra time to make sure the smallest possible diff is\nproduced."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Deleting Git Repository Gitolite?\nI am wondering what the proper way is to delete a repository when using gitolite.\nIs there anything else I have to do besides delete the repository from the server and remove all configurations related to the repository I am removing?"
},
{
"role": "assistant",
"content": "Deleting the repository from the server and removing all configurations is all you have to do. \nQuoting from the manual:\n\nRemoving a repo is not so straightforward. You certainly must remove\n the appropriate lines from the conf/gitolite.conf file, but gitolite\n will not automatically delete the repo from the server. You have to\n log on to the server and do the dirty deed yourself :-)\nIt is best to make the change in the conf file, push it, and then go\n to the server and do what you need to."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Force Git to always choose the newer version during a merge?\nLet's assume I merge git and there is a merge conflict.\nMy question is: how can I force git to always choose the newer version of code in conflict so I won't need to resolve the conflict by hand?"
},
{
"role": "assistant",
"content": "It is not exactly the \"newer\" version, but you can tell git to always prefer the version on the current branch using git merge branch -X ours, or to prefer the version of the branch being merged, using git merge branch -X theirs.\nFrom man git-merge:\n\nours:\nThis option forces conflicting hunks to be auto-resolved cleanly by favoring our version. Changes from the other tree that do not\n conflict with our side are reflected to the merge result. For a binary file, the entire contents are taken from our side.\ntheirs:\nThis is the opposite of \"ours\"."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "An error occurred while installing rugged\nFollowing this tutorial [link] to install gitlab on a dedicated server. I need to :\nsudo -u git -H bundle install --deployment --without development test postgres aws\n\nBut an error occurred while installing rugged :\nGem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.\n\n /usr/local/bin/ruby extconf.rb\nchecking for cmake... no\nERROR: CMake is required to build Rugged.\n*** extconf.rb failed ***\nCould not create Makefile due to some reason, probably lack of necessary\nlibraries and/or headers. Check the mkmf.log file for more details. You may\nneed configuration options.\n\nProvided configuration options:\n --with-opt-dir\n --without-opt-dir\n --with-opt-include\n --without-opt-include=${opt-dir}/include\n --with-opt-lib\n --without-opt-lib=${opt-dir}/lib\n --with-make-prog\n --without-make-prog\n --srcdir=.\n --curdir\n --ruby=/usr/local/bin/ruby\n\n\n Gem files will remain installed in /home/git/gitlab/vendor/bundle/ruby/2.0.0/gems/rugged-0.21.2 for inspection.\n Results logged to /home/git/gitlab/vendor/bundle/ruby/2.0.0/gems/rugged-0.21.2/ext/rugged/gem_make.out\n An error occurred while installing rugged (0.21.2), and Bundler cannot continue.\n Make sure that `gem install rugged -v '0.21.2'` succeeds before bundling.\n\nSo I installed rugged -> I installed CMake & config-pkg :\n/home/git/gitlab$ sudo gem install rugged\nBuilding native extensions. This could take a while...\nSuccessfully installed rugged-0.21.2\nParsing documentation for rugged-0.21.2\nunable to convert \"\\xC0\" from ASCII-8BIT to UTF-8 for lib/rugged/rugged.so, skipping\n1 gem installed\n\nBut it doesnt change anything : \nErrno::EACCES: Permission denied - /home/git/gitlab/vendor/bundle/ruby/2.0.0/gems/rugged-0.21.2/LICENSE\nAn error occurred while installing rugged (0.21.2), and Bundler cannot continue.\nMake sure that `gem install rugged -v '0.21.2'` succeeds before bundling.\n\nAny idea ?"
},
{
"role": "assistant",
"content": "For OSX if you're using homebrew: \nbrew install cmake \nbundle install"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "In GitHub URL's: what is the difference between a tree and a blob?\n\nI keep noticing this whenever I'm trying to add links to github files. You can add a link using blob:\nhttps://github.com/facebook/pop/blob/master/Podfile\nAnd the same doc comes up if you change blob to tree:\nhttps://github.com/facebook/pop/tree/master/Podfile\nWhat is the difference? Whenever I want to add a link for posterity in a doc, which one should I prefer?"
},
{
"role": "assistant",
"content": "GitHub's website currently seems to be:\n\nUsing blob for files, and tree for directories, in URLs;\nRedirecting browsers which request file URLs containing tree to contain blob instead; and\nRedirecting browsers which request directory URLs containing blob to URLs containing tree instead.\n\nIt's possible that GitHub's website, at the time you asked the question, was only rewriting file URLs between tree and blob, instead of properly redirecting them. (Rewriting and redirecting URLs are activities of web servers.) If so, then the change wouldn't appear in your browser's address bar. But maybe you didn't mean that."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Is it possible for git-merge to ignore line-ending differences?\nIs it possible for git merge to ignore line-ending differences?\nMaybe I'm asking the wrong question ... but:\nI tried uisng config.crlf input but things got a bit messy and out of control, specially when I applied it after the fact.\nFor one thing, applying this config after the fact doesn't seem to affect files that were committed to the repository before applying this option. Another thing is that suddenly all commits now result in lots of annoying warning messages about CRLF being converted to LF.\nTo be honest, I don't really care what line-ending is used, I personally prefer the Unix style \\n, but whatever. All I care about, is for git merge to be a bit smarter and ignore the differences in line-endings.\nSometimes I have two identical files, but git would mark them as being in conflict (and the conflict is the whole file) simply because they use a different line ending character.\nUpdate:\nI found out that git diff accepts a --ignore-space-at-eol option, would it be possible to let git merge use this option as well?"
},
{
"role": "assistant",
"content": "Update 2013:\nMore recent git versions authorize using merge with strategy recursive and strategy option (-X):\n\nfrom \"Git Merge and Fixing Mixed Spaces and Tabs with two Branches\":\ngit merge -s recursive -Xignore-space-at-eol\n\n\n\nBut using \"-Xignore-space-change\" is also a possibility\n\nFab-V mentions below:\ngit merge master -s recursive -X renormalize\n\n\n\n\njakub.g also comments that the strategies work also with cherry-picking:\ngit cherry-pick abcd123456 --strategy=recursive --strategy-option=renormalize \n\nThis works much better than ignore-all-space.\n\nBefore Git 2.29 (Q4 2020), All \"mergy\" operations that internally use the merge-recursive machinery should honor the merge.renormalize configuration, but many of them didn't.\nSee commit 00906d6, commit 8d55225, commit 6f6e7cf, commit fe48efb (03 Aug 2020) by Elijah Newren (newren).\n(Merged by Junio C Hamano -- gitster -- in commit 4339259, 10 Aug 2020)\n\nmerge: make merge.renormalize work for all uses of merge machinery\nSigned-off-by: Elijah Newren\n\n\nThe 'merge' command is not the only one that does merges; other commands like checkout -m or rebase do as well.\nUnfortunately, the only area of the code that checked for the \"merge.renormalize\" config setting was in builtin/merge.c, meaning it could only affect merges performed by the \"merge\" command.\nMove the handling of this config setting to merge_recursive_config() so that other commands can benefit from it as well.\n\n\nOriginal answer (May 2009)\nThe patch for ignoring eol style has been proposed in June 2007, but it only concerns git diff --ignore-space-at-eol, not git merge.\nAt the time, the question has been askeed:\n\nShould --ignore-space-at-eol be an option to git-merge ?\nMerges are where this functionality matters.\nWhat are the semantics of an auto-resolved merge with those options in effect -- are they only used for rename detection, or do we, e.g., not flag conflicts with only whitespace changes ? And if we don't, which version do we accept automatically ?\n\nJulio C Hamano was not exactly enthusiastic:\n\nThis certainly is tempting, but I suspect that should be left to later rounds.\nI suspect that it would introduce a concept of two different kinds of diffs, one to be mechanically processed (i.e. use in merge with \"git-merge-recursive\", and apply with\n\"git-am\"), and another to be inspected by humans to understand.\nIt often may be useful to munge the input for the latter case, even though the output from comparing munged input files may not be readily usable for mechanical application.\n\nThe general idea, when it comes to git merge, is to rely on the third-party merge tool.\nFor instance, I have setup DiffMerge to be the tool for Git merge, setting a ruleset which allow that merge tool to ignore eol for certain type of files.\n\nSetup on Windows, with MSysGit1.6.3, either for DOS or Git bash session, with DiffMerge or KDiff3:\n\nset a directory into your PATH (here: c:\\HOMEWARE\\cmd).\nadd in that directory the script merge.sh (wrapper for your favorite merge tool)\n\nmerge.sh:\n#!/bin/sh\n\n# Passing the following parameters to mergetool:\n# local base remote merge_result\n\nalocal=$1\nbase=$2\nremote=$3\nresult=$4\n\nif [ -f $base ]\nthen\n #\"C:/Program Files/SourceGear/DiffMerge/DiffMerge.exe\" \"$alocal\" \"$base\" \"$remote\" -m --result=\"$result\" --title1=\"Mine\" --title2=\"Merging to: $result\" --title3=\"Theirs\"\n\n # for merge respecting eol, KDiff3 is better than DiffMerge (which will always convert LF into CRLF)\n # KDiff3 will display eol choices (if Windows: CRLF, if Unix LF)\n \"C:/Program Files/KDiff3/kdiff3.exe\" -m \"$base\" \"$alocal\" \"$remote\" -o \"$result\"\nelse\n #there is not always a common ancestor: DiffMerge needing 3 files, BASE will be the result\n #\"C:/Program Files/SourceGear/DiffMerge/DiffMerge.exe\" \"$alocal\" \"$result\" \"$remote\" -m --result=\"$result\" --title1=\"Mine\" --title2=\"Merging to: $result\" --title3=\"Theirs\"\n \n # KDiff3 however does know how to merge based on 2 files (not just 3)\n \"C:/Program Files/KDiff3/kdiff3.exe\" -m \"$base\" \"$remote\" -o \"$result\"\nfi\n\n\nDeclare your merge wrapper for Git\n\nGit config commands:\ngit config --global merge.tool diffmerge\ngit config --global mergetool.diffmerge.cmd \"merge.sh \\\"$PWD/$LOCAL\\\" \\\"$PWD/$BASE\\\" \\\"$PWD/$REMOTE\\\" \\\"$PWD/$MERGED\\\"\ngit config --global mergetool.diffmerge.trustExitCode false\ngit config --global mergetool.diffmerge.keepBackup false\n\n\nCheck that autoCRLF is false\n\ngit config at system level:\ngit config ---system core.autoCRLF=false\n\n\nTest that, when two lines are identical (but their eol chars), both DiffMerge or KDiff3 will ignore those line during a merge.\n\nDOS script (note: the dos2unix command comes from here, and is used to simulate a Unix eol-style. That command has been copied in the directory mentioned at the beginning of this answer.):\nC:\\HOMEWARE\\git\\test>mkdir test_merge\nC:\\HOMEWARE\\git\\test>cd test_merge\nC:\\HOMEWARE\\git\\test\\test_merge>git init\nC:\\HOMEWARE\\git\\test\\test_merge>echo a1 > a.txt & echo a2 >> a.txt\nC:\\HOMEWARE\\git\\test\\test_merge>git add a.txt\nC:\\HOMEWARE\\git\\test\\test_merge>git commit -m \"a.txt, windows eol style\"\nC:\\HOMEWARE\\git\\test\\test_merge>git checkout -b windows\nSwitched to a new branch 'windows'\nC:\\HOMEWARE\\git\\test\\test_merge>echo a3 >> a.txt & echo a4 >> a.txt\nC:\\HOMEWARE\\git\\test\\test_merge>git add a.txt\nC:\\HOMEWARE\\git\\test\\test_merge>git commit -m \"add two lines, windows eol style\"\nC:\\HOMEWARE\\git\\test\\test_merge>git checkout master\nC:\\HOMEWARE\\git\\test\\test_merge>git checkout -b unix\nSwitched to a new branch 'unix'\nC:\\HOMEWARE\\git\\test\\test_merge>echo au3 >> a.txt & echo au4 >> a.txt && echo au5 >> a.txt\nC:\\HOMEWARE\\git\\test\\test_merge>dos2unix a.txt\nDos2Unix: Processing file a.txt ...\nC:\\HOMEWARE\\git\\test\\test_merge>git add a.txt\nC:\\HOMEWARE\\git\\test\\test_merge>git commit -m \"add 3 lines, all file unix eol style\"\n[unix c433a63] add 3 lines, all file unix eol style\n\nC:\\HOMEWARE\\git\\test\\test_merge>git merge windows\nAuto-merging a.txt\nCONFLICT (content): Merge conflict in a.txt\nAutomatic merge failed; fix conflicts and then commit the result.\n\nC:\\HOMEWARE\\git\\test\\test_merge>git ls-files -u\n100644 39b4c894078a02afb9b1dfeda6f1127c138e38df 1 a.txt\n100644 28b3d018872c08b0696764118b76dd3d0b448fca 2 a.txt\n100644 3994da66530b4df80189bb198dcfac9b8f2a7b33 3 a.txt\n\nC:\\HOMEWARE\\git\\test\\test_merge>git mergetool\nMerging the files: a.txt\n\nNormal merge conflict for 'a.txt':\n {local}: modified\n {remote}: modified\nHit return to start merge resolution tool (diffmerge):\n\nAt this point (Hitting \"return\"), DiffMerge or KDiff3 will open, and you will see for yourself what lines are actually merged, and what lines are ignored.\nWarning: the result file will always be in Windows eol mode (CRLF) with DiffMerge...\nKDiff3 offers to save in one way or another."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "gitrevisions - Specifying revisions and ranges for Git The .. (two-dot) Range Notation"
},
{
"role": "assistant",
"content": "The ^r1 r2 set operation appears so often that there is a shorthand\nfor it. When you have two commits r1 and r2 (named according\nto the syntax explained in SPECIFYING REVISIONS above), you can ask\nfor commits that are reachable from r2 excluding those that are reachable\nfrom r1 by ^r1 r2 and it can be written as r1..r2 ."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-fetch - Download objects and refs from another repository --atomic"
},
{
"role": "assistant",
"content": "Use an atomic transaction to update local refs. Either all refs are\nupdated, or on error, no refs are updated."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Keeping a fork up to date\n\nI wanted to commit somthing to a github repository, but I (obviously) didn't have any rights to do so. I made a fork of that repo, commited my changes and submitted a pull-request.\nNow, the problem is that after a while other people have made commits to the original repo, which means my fork is no longer up-to-date.\nHow should now update my fork? Is this (https://stackoverflow.com/a/23853061/5513628) still a valid way or do I have to delete my repo and make a new fork every time?\nThis is what the fork looks like in github desktop:\n\nThe pull request was made by me but the two commits after that were made by other people. They are not contained in my repo..."
},
{
"role": "assistant",
"content": "To sync changes you make in a fork with the original repository, you must configure a remote that points to the upstream repository in Git.\nSpecify a new remote upstream repository that will be synced with the fork.\ngit remote add upstream https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git\n\nYou can check if it was succesful with:\ngit remote -v\n\nThen fetch it to update your project:\ngit fetch upstream\n\nMerge the changes from upstream/master into your local master branch.\ngit merge upstream/master\n\nAt last, you can commit new update from original repository to your fork repository.\nShortcut: you can also combine the last two commands into a single command:\ngit fetch upstream\ngit merge upstream/master\n\nIs equal to:\ngit pull upstream/master\n\nThis information can also be found on GitHub here and here."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "npm install from github pull request\n\nLoooking at the npm install docs it looks possible to npm install from a github repo. \nIs it also possible to install specifically from a pull request?\nIs the solution just to install based on the last commit (last sha) of the pull request?"
},
{
"role": "assistant",
"content": "GitHub is maintaining a namespace for each PR in the original repo, so this works as well:\nnpm install <user>/<repo>#pull/<id>/head\n\n\nNOTE: It doesn't seeem to be working with NPM v. 5. See the comment below.\nWorks with npm 7.0.23 and possibly earlier versions. See the comment below.\n\nfor example:\nnpm i --save-dev json-schema-faker/json-schema-faker#pull/129/head\n\nor with yarn:\nyarn add <user>/<repo>#<id>/head\n\nfor example:\nyarn add json-schema-faker/json-schema-faker#129/head\n\nNote that in Yarn case there is no pull/ segment in the package identifier.\nThis may be helpful if you need to automate the installation or repo / branch from where PR is originating is removed. See also Modifying an inactive pull request locally at GitHub."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Change GIT account of Visual Studio Team Explorer\n\nI am having a very weird situation when cloning a Git repository from our company private server. The repository is not anonymous (it requires authentication), but when cloning, VS didn't ask any username and password and automatically use an old authentication of old employee. Is there a way to remove the saved username and password and make Visual Studio to prompt them when cloning?"
},
{
"role": "assistant",
"content": "Look in the Windows Credential manager and remove/update your credentials there:"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-config - Get and set repository or global options gc.bigPackThreshold"
},
{
"role": "assistant",
"content": "If non-zero, all non-cruft packs larger than this limit are kept\nwhen git gc is run. This is very similar to --keep-largest-pack except that all non-cruft packs that meet\nthe threshold are kept, not just the largest pack. Defaults to\nzero. Common unit suffixes of k , m , or g are supported. Note that if the number of kept packs is more than gc.autoPackLimit,\nthis configuration variable is ignored, all packs except the base pack\nwill be repacked. After this the number of packs should go below\ngc.autoPackLimit and gc.bigPackThreshold should be respected again. If the amount of memory estimated for git repack to run smoothly is\nnot available and gc.bigPackThreshold is not set, the largest pack\nwill also be excluded (this is the equivalent of running git gc with --keep-largest-pack )."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-fsck - Verifies the connectivity and validity of the objects in the database badTree"
},
{
"role": "assistant",
"content": "(ERROR) A tree cannot be parsed."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Can Gitlab/Gitolite enforce correct username/email\n\nExperimenting with git, I've setup Gitlab for a self hosted repository and it looks great.\nThe one thing bugging me is that it appears anyone can make commits as anyone else (ie: spoof a commit). \nie: I have my users setup in Gitlab with public key access\n\nUser1 \nUser2\n\nNow only those users may push - using their private SSH keys - but it seems there is nothing stopping User2 tweaking their gitconfig to commit under the name of User1 and pushing that up?\nThe history in gitlab and git -show shows the committer as whatever the User1's gitconfig text was. I want Gitlab to stamp the username associated with the pushing ssh key into the history instead so I know whose ssh key was used to push.\nThe scenario is the repo would be used in a team environment and it just seems prudent to not allow spoofed commits. \nI've done some reading and understand that typically one might change the workflow to have a blessed repository and only have trusted committers that can push to that - but at this stage while learning git I want to stay in a more centralised/SVN type workflow. \nIs this possible using hooks?\nThere is a similar question answered for gitosis but even that appears to only enforce the committer is from a range of users which doesn't stop User1 spoofing as User2 - as far as I can tell.\nPS: Maybe I am asking the wrong question - is there a way in gitlab to discover which ssh key (and therefore real user) was used to push code into the repo? It doesn't appear so from what I can find."
},
{
"role": "assistant",
"content": "Update 2015\nAs this thread mention, GitLab Enterprise has among its git hooks associated to a project a way to control emails:\n\nGo to project settings -> git hooks and check validation of author email. \n\nAny email that doesn't match a known user is rejected.\n\nOriginal answer (2012)\nA partial way to achieve user id control is to make gitolite (which gitlab relies on) reject the push if at least one of the pushed commits isn't committed by the one pushing it.\nWhen you push, you are authenticated (either based on the name of the public key registered by Gitolite, or by another way like an LDAP connection).\nYou can add a pre-receive hook which will check all the new commits, and look for at least one committed by the right name (ie the id of the user pushing said commits).\nSee this pre-receive hook as an example."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-show - Show various types of objects --no-abbrev-commit"
},
{
"role": "assistant",
"content": "Show the full 40-byte hexadecimal commit object name. This negates --abbrev-commit , either explicit or implied by other options such\nas \"--oneline\". It also overrides the log.abbrevCommit variable."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-pull - Fetch from and integrate with another repository or a local branch --upload-pack <upload-pack>"
},
{
"role": "assistant",
"content": "When given, and the repository to fetch from is handled\nby git fetch-pack , --exec=<upload-pack> is passed to\nthe command to specify non-default path for the command\nrun on the other end."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Fork and synchronize Google Code Subversion repository into GitHub\nHow can I fork and keep in sync with an Google Code Subversion repository that I don't have write access to, into a GitHub repository?\nI want to be able to develop my own features in my Git repository, but I also want to synchronise against the Google Code Subversion repository. To fetch fixes from Google Code project side.\nI know about git-svn and used it before to up- and downstream to an Subversion repository I had full control over. But I don't know how keep in sync with a Google Code Subversion repository."
},
{
"role": "assistant",
"content": "The remote branch from git-svn is pretty much the same as a regular Git remote. So in your local repository you can have your git-svn clone and push changes out to GitHub. Git doesn't care. If you create your git-svn clone and push the exact same changes out to GitHub, you'll have an unofficial mirror of the Google Code repository. The rest is vanilla Git.\ngit svn clone http://example.googlecode.com/svn -s\ngit remote add origin [email protected]:example/example.git\ngit push origin master\n\nNow that you have this, occasionally you will have to synchronise the Subversion repository with Git. It'll look something like:\ngit svn rebase\ngit push\n\nIn gitk or whatever, this would look something like this:\no [master][remotes/trunk][remotes/origin/master]\n|\no\n|\no\n\nAnd when you run git svn rebase, you would have this:\no [master][remotes/trunk]\n|\no\n|\no [remotes/origin/master]\n|\no\n|\no\n\nSo now running git push would push those commits out to GitHub, the [remotes/origin/master] branch there. And you'd be back to the scenario in the first ASCII art diagram.\nThe problem now is, how do you work your changes into the mix? The idea is, you don't ever commit onto the same branch that you are git-svn-rebase-ing and git-pushing. You need a separate branch for your changes. Otherwise, you would end up rebasing your changes on top of the Subversion ones, which could upset anyone who clones your Git repository. Follow me? OK, so you create a branch, let's call it \"features\". And you make a commit and push it out to GitHub to the features branch. Your gitk would look something like this:\no [features][remotes/origin/features]\n|\no\n|\no [master][remotes/trunk][remotes/origin/master]\n|\no\n\nHere you've got your features branch a couple of commits ahead of the Google Code branch, right? So what happens when you want to incorporate new stuff from Google Code? You'd run git svn rebase first and get this:\n o [features][remotes/origin/features]\n[master][remotes/trunk] o |\n | o\n o /\n |/\n o[remotes/origin/master]\n |\n o\n\nIf you git push master out, you can imagine the [remotes/origin/master] being at the same point as master. But your feature branch doesn't have the changes. Your choices now are to merge master into features, or rebase features. A merge would look like this\ngit checkout features\ngit merge master \n\n o [features]\n /|\n / o [remotes/origin/features]\n[master] o |\n | o\n o /\n |/\n o\n |\n o\n\nThen you push features out to GitHub. I've left off the remotes for master to save space, they'd be at the same point as [master].\nThe rebase approach is slightly more evil - you'd have to push with --force as your push would not be a fast-forward merge (you'd pull the features branch from under someone who had cloned it). It's not really considered OK to do this, but nobody can stop you if you are determined. It does make some things easier too, such as when patches get accepted upstream in slightly reworked form. It'd save having to mess about with conflicts, you can just rebase --skip the upstreamed patches. Anyway, a rebase would be like this:\ngit rebase master features\n\n o [features]\n |\n o\n | o [remotes/origin/features]\n[master] o |\n | o\n o /\n |/\n o\n |\n o\n\nAnd then you would have to git push --force that. You can see why you need to force it, the history has a big old schism from the [remotes/origin/features] to the new current post-rebase [features].\nThis all works, but it is a lot of effort. If you are going to be a regular contributor, the best bet would be to work like this for a while, send some patches upstream and see if you can get commit access to Subversion. Failing that, perhaps don't push your changes out to GitHub. Keep them local and try and get them accepted upstream anyway."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git - the stupid content tracker GIT_AUTHOR_EMAIL"
},
{
"role": "assistant",
"content": "The email address used in the author identity when creating commit or\ntag objects, or when writing reflogs. Overrides the user.email and author.email configuration settings."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Unable to show a Git tree in terminal\nKillswitchcollective.com's old article, 30 June 2009, has the following inputs and outputs\ngit co master\ngit merge [your_branch]\ngit push\n\nupstream A-B-C-D-E A-B-C-D-E-F-G\n \\ ----> \\\nyour branch C-D-E G\n\nI am interested how you get the tree like-view of commits in your terminal without using Gitk or Gitx in OS/X.\nHow can you get the tree-like view of commits in terminal?"
},
{
"role": "assistant",
"content": "How can you get the tree-like view of commits in terminal?\ngit log --graph --oneline --all\n\nis a good start.\nYou may get some strange letters. They are ASCII codes for colors and structure. To solve this problem add the following to your .bashrc:\nexport LESS=\"-R\"\n\nsuch that you do not need use Tig's ASCII filter by\ngit log --graph --pretty=oneline --abbrev-commit | tig // Masi needed this \n\nThe article text-based graph from Git-ready contains other options:\ngit log --graph --pretty=oneline --abbrev-commit\n\n\nRegarding the article you mention, I would go with Pod's answer: ad-hoc hand-made output.\n\nJakub Narębski mentions in the comments tig, a ncurses-based text-mode interface for git. See their releases.\nIt added a --graph option back in 2007."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "What are the main functionality differences between Github Wiki and Readme,\n\nWhat are the main functionality differences between Github Wiki and Readme,\nAsking those that have used both readme and wikis extensively. So that we can better decide which to use for the purpose of outputing verbal information. This would be based on your answer. Thanks.\nAs examples, some have used wikis -- \nhttp://github.com/mbostock/d3/wiki\nhttp://github.com/ParticleCore/Particle/wiki/Features\nand some people have used readmes -- \nhttp://gist.github.com/atcuno/3425484ac5cce5298932\nno better place to ask? -- meta.stackexchange.com/questions/157888/what-site-is-good-for-github-questions"
},
{
"role": "assistant",
"content": "Talking about a project repository :\n\nReadme.md is the packaging\nwiki pages is made for development/contributors documentation\ngh-pages branch hosts user documentation"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-send-email - Send a collection of patches as emails --smtp-auth=<mechanisms>"
},
{
"role": "assistant",
"content": "Whitespace-separated list of allowed SMTP-AUTH mechanisms. This setting\nforces using only the listed mechanisms. Example: $ git send-email --smtp-auth=\"PLAIN LOGIN GSSAPI\" ... If at least one of the specified mechanisms matches the ones advertised by the\nSMTP server and if it is supported by the utilized SASL library, the mechanism\nis used for authentication. If neither sendemail.smtpAuth nor --smtp-auth is specified, all mechanisms supported by the SASL library can be used. The\nspecial value none maybe specified to completely disable authentication\nindependently of --smtp-user"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-send-email - Send a collection of patches as emails --no-smtp-auth"
},
{
"role": "assistant",
"content": "Disable SMTP authentication. Short hand for --smtp-auth=none"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-difftool - Show changes using common diff tools --prompt"
},
{
"role": "assistant",
"content": "Prompt before each invocation of the diff tool.\nThis is the default behaviour; the option is provided to\noverride any configuration settings."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-log - Show commit logs git log v2.6.12.. include/scsi drivers/scsi"
},
{
"role": "assistant",
"content": "Show all commits since version v2.6.12 that changed any file\nin the include/scsi or drivers/scsi subdirectories"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to rebase last x commits on different branch?\nI want to take the latest X commits from a branch and be able to apply them on top of different branch. For example doing git rebase -i HEAD~10 would allow me to interactively modify and apply the last 10 commits on the same branch I'm on. \nIs it possibly to do the same thing but apply the commits on a particularly other branch, where the history might have diverged a lot?"
},
{
"role": "assistant",
"content": "You can use the --onto flag.\ngit rebase -i HEAD~10 --onto another_branch\n\nNote that this will not create a new branch, nor will it move the actual changes to another_branch.\nAll changes will be applied to the same branch you are on.\nSo I suggest do it in several stages:\ngit checkout -b staging_branch\ngit rebase -i HEAD~10 --onto another_branch\ngit checkout another_branch\ngit merge staging_branch"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "how to make git not change line endings for one particular file?\ndue to a \"feature\" in Microsoft's Visual Studio, .sln files must have windows style line endings so that the windows explorer could open them in Visual studio. So I need to be able to commit this one particular file with line endings intact. It is fine if all other files get converted. The question is how to make git accept just one single file with windows endings?"
},
{
"role": "assistant",
"content": "Take a look at the gitatttributes documentation. With recent versions of git, you can set the eol attribute for files to control what end-of-lines will be used when the file is checked out.\nYou should be able to create a .gitattributes file in your repository that looking something like:\npath/to/my/file eol=crlf"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git request-pull: how to create a (github) pull request on the command line?\n\nI've cloned a project, and pushed a branch with just a renamed readme file to README. I am trying to create a pull-request on the command line, just to try PR from here instead of a website.\n$ git request-pull origin/master origin readme:readme\nThe following changes since commit 51320a3a42f82ba83cd7919d24ac4aa5c4c99ac6:\n\n first commit message\n\nare available in the git repository at:\n\n [email protected]:example/com:example.git readme\n\nfor you to fetch changes up to 891c05c5236341bcbe33ceddc415ae921ee42e44:\n\n second commit message\n\n----------------------------------------------------------------\nSimone Gentili (1):\n Fix\n\n readme.md => README.md | 0\n 1 file changed, 0 insertions(+), 0 deletions(-)\n rename readme.md => README.md (100%)\n\ngithub shows no pull request and I don't see errors.\n\nis possibile to create a pull request directly from bash?\nis PR correct and can I view pull request list?"
},
{
"role": "assistant",
"content": "Even though they are called exactly the same thing, a GitHub pull request and a 'git request-pull' are completely different.\nThe git request-pull is for generating a summary of pending changes to be sent to a mailing list. It has no integration by default with GitHub.\nThe GitHub Pull Requests is a fully featured function of GitHub only. It allows for merging and integration of code from a different branch/fork. You can resolve merge conflicts, do code reviews, or add additional comments to a GitHub pull request.\nUnfortunately the git command is named similarly to GitHub functionality which makes it sound like they should be doing the same thing."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Is there a permalink to the latest version of gist files?\n\nI created a gist with two files, the raw version of which I would like to use as a reference for an application which will query their contents. These contents will be updated on GitHub.\nI found however that the URL of the file changes with each version of the gist. Is there a permalink which would point to the latest version of a file in a gist?"
},
{
"role": "assistant",
"content": "Raw gist URLs follow the pattern below:\nhttps://gist.githubusercontent.com/[gist username]/[gist ID]/raw/[gist commit ID]/[file name]\n\nTo view the latest version, simply remove the [gist commit ID] part:\nhttps://gist.githubusercontent.com/[gist username]/[gist ID]/raw/[file name]\n\ne.g.\nhttps://gist.githubusercontent.com/mwek/9962f97f3bde157fd5dbd2b5dd0ec3ca/raw/user.js\n\nKeep in mind that the endpoint is cached, so your updates may be visible with a slight delay."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-format-patch - Prepare patches for e-mail submission histogram"
},
{
"role": "assistant",
"content": "This algorithm extends the patience algorithm to \"support\nlow-occurrence common elements\"."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "An error occurred while installing rugged\n\nFollowing this tutorial [link] to install gitlab on a dedicated server. I need to :\nsudo -u git -H bundle install --deployment --without development test postgres aws\n\nBut an error occurred while installing rugged :\nGem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.\n\n /usr/local/bin/ruby extconf.rb\nchecking for cmake... no\nERROR: CMake is required to build Rugged.\n*** extconf.rb failed ***\nCould not create Makefile due to some reason, probably lack of necessary\nlibraries and/or headers. Check the mkmf.log file for more details. You may\nneed configuration options.\n\nProvided configuration options:\n --with-opt-dir\n --without-opt-dir\n --with-opt-include\n --without-opt-include=${opt-dir}/include\n --with-opt-lib\n --without-opt-lib=${opt-dir}/lib\n --with-make-prog\n --without-make-prog\n --srcdir=.\n --curdir\n --ruby=/usr/local/bin/ruby\n\n\n Gem files will remain installed in /home/git/gitlab/vendor/bundle/ruby/2.0.0/gems/rugged-0.21.2 for inspection.\n Results logged to /home/git/gitlab/vendor/bundle/ruby/2.0.0/gems/rugged-0.21.2/ext/rugged/gem_make.out\n An error occurred while installing rugged (0.21.2), and Bundler cannot continue.\n Make sure that `gem install rugged -v '0.21.2'` succeeds before bundling.\n\nSo I installed rugged -> I installed CMake & config-pkg :\n/home/git/gitlab$ sudo gem install rugged\nBuilding native extensions. This could take a while...\nSuccessfully installed rugged-0.21.2\nParsing documentation for rugged-0.21.2\nunable to convert \"\\xC0\" from ASCII-8BIT to UTF-8 for lib/rugged/rugged.so, skipping\n1 gem installed\n\nBut it doesnt change anything : \nErrno::EACCES: Permission denied - /home/git/gitlab/vendor/bundle/ruby/2.0.0/gems/rugged-0.21.2/LICENSE\nAn error occurred while installing rugged (0.21.2), and Bundler cannot continue.\nMake sure that `gem install rugged -v '0.21.2'` succeeds before bundling.\n\nAny idea ?"
},
{
"role": "assistant",
"content": "For OSX if you're using homebrew: \nbrew install cmake \nbundle install"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git merge recursive theirs, how does it work?\nI'm having a bit of a problem. We have our own CMS which is using git for collaboration and versioning and stuff.\nNow I have two git repositories A and B, A which is a project and B which is the CMS itself. Now i want to get B into A, but when i do this i get alot of merge-conflicts and the solution for the conflicts is always to use the stuff from B. \nNow what I think i need is\ngit merge <branch> -s recursive theirs <commit>\n\nbecause I want to merge and when there is a merge conflict it should be forced to use the solution from B. But i can't get it to work. It always keeps telling me fatal: 'theirs' does not point to a commit.\nThe recursive theirs I found here.\nDoes anyone know what I do wrong?"
},
{
"role": "assistant",
"content": "You must use this form to pass merge strategy options:\ngit merge -s recursive -Xtheirs # short options\ngit merge --strategy recursive --strategy-option theirs # long options\n\nAlso make sure your version supports -Xtheirs, that's a quite recent feature(?)"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git - the stupid content tracker git-show-index"
},
{
"role": "assistant",
"content": "Show packed archive index"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git - the stupid content tracker gitprotocol-http"
},
{
"role": "assistant",
"content": "Git HTTP-based protocols"
}
] |
[
{
"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"
},
{
"role": "assistant",
"content": "EXCLUDE PATTERNS git ls-files can use a list of \"exclude patterns\" when\ntraversing the directory tree and finding files to show when the\nflags --others or --ignored are specified. gitignore specifies the format of exclude patterns. These exclude patterns can be specified from the following places,\nin order: The command-line flag --exclude=<pattern> specifies a\nsingle pattern. Patterns are ordered in the same order\nthey appear in the command line. The command-line flag --exclude-from=<file> specifies a\nfile containing a list of patterns. Patterns are ordered\nin the same order they appear in the file. The command-line flag --exclude-per-directory=<name> specifies\na name of the file in each directory git ls-files examines, normally .gitignore . Files in deeper\ndirectories take precedence. Patterns are ordered in the\nsame order they appear in the files. A pattern specified on the command line with --exclude or read\nfrom the file specified with --exclude-from is relative to the\ntop of the directory tree. A pattern read from a file specified\nby --exclude-per-directory is relative to the directory that the\npattern file appears in. Generally, you should be able to use --exclude-standard when you\nwant the exclude rules applied the same way as what Porcelain\ncommands do. To emulate what --exclude-standard specifies, you\ncan give --exclude-per-directory=.gitignore , and then specify: The file specified by the core.excludesfile configuration\nvariable, if exists, or the $XDG_CONFIG_HOME/git/ignore file. The $GIT_DIR/info/exclude file. via the --exclude-from= option."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Official badge for GitHub actions\n\nDoes GitHub have an official 'badge' for their new 'actions' feature? \nI came across this request on their official repo and there seems to be an official one:\nhttps://github.com/{github_id}/{repository}/workflows/{workflow_name}/badge.svg\n\nas per this comment, but I am unable to get it to work. Is it actually working? When I use it, I get the below output:\n\nNote that I have replaced {github_id} with my username, {repository} with my repo name and {workflow_name} with the corresponding workflow name (removing the curly braces). Does anyone else have this issue?\nEdit: I am working on a private repo, in case it makes a difference."
},
{
"role": "assistant",
"content": "You can get the actions badge by navigating to the required workflow on your repo on GitHub.com, clicking on the settings button on the right (the one with 3 dots beside the workflow search) and clicking on the Create status badge button.\n\nHere, you can select the badge for the required branch and event and use the generated markdown.\nFor eg, below is the badge that I generated for the default branch and event of the CI workflow of my fork:\n\nThe markdown for the above badge:\n[](https://github.com/kratostaine/spring-authorization-server/actions/workflows/continuous-integration-workflow.yml)"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Push git changes to a shared network drive\nHow can a team of four people use Git (specifically Github for Windows) to push local changes to a shared network drive? \nRight now (without Git) we have to copy the files from the network drive to our local machine, edit the files, and then re-upload them to the shared network drive. This is a painstaking process that can lead to lots of errors, but it seems like something Git could help us with.\nCan we simply install Git on the shared drive and go from there?"
},
{
"role": "assistant",
"content": "Not sure if you found something that works for you or not, but I have a writeup on how to do that very thing on a windows network drive:\nhttp://tony.halcyonlane.com/blog/2011/09/22/Using-git-at-work-on-a-Windows-network-drive/\nFrom a cmd prompt change to your mapped drive.\n\n$ cd g:\n\nThen cd into your soon to be git repository.\n\n$ cd scripts\n\nThen create an empty git repository. If you do not use the --bare option, you will have issues so don't leave that out.\n\n$ git init --bare\n\nNow if you don't have a local git repository yet, then you can clone your new repository wherever you like by navigating back to your local drive.\n\n$ c:\n$ cd work/scripts\n$ git clone file://g:\\scripts\n\nWhen you clone, you automatically get a remote called \"origin\" and you can push to the server for safe keeping any time you make changes locally.\n\n$ git push origin master\n\nIf you already have a git repository and you just want to push out to the shared drive then you can do this from within your local git dir.\n\n$ git remote add origin file://g:\\scripts\n$ git push origin master"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Gitkraken stuck at opening repo\nEvery time I open gitkrarken it gets stuck at opening repo icon. I can't open/clone/init repo.\nI heard some others have the same problem but no one seems to know why this is happening and what the solution is.\nCan anyone help with this?\nUPDATE 1\nReinstalled it. Still having the same problem"
},
{
"role": "assistant",
"content": "A possible solution for resolving this issue with GitKraken is to delete the hidden folder .gitkraken located in your home directory (macOS/Linux) or the %APPDATA% directory (Windows). Keep in mind that this action will reset all of your GitKraken settings and preferences.\nFor macOS and Linux users:\n\nClose GitKraken.\nOpen Terminal.\nExecute the following command to delete the folder:\nrm -rf ~/.gitkraken\n\n\nRestart GitKraken.\n\nFor Windows users:\n\nClose GitKraken.\nPress Win + R to open the Run dialog box.\nType %APPDATA% and press Enter. This should open the C:\\\\Users\\\\%USERNAME%\\\\AppData\\\\Roaming folder.\nLocate and delete the .gitkraken folder.\nRestart GitKraken."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to test github workflow without merging into master/main branch\n\nI am creating a new git workflow. And just like any other piece of code, I want to test it separately without having to merge it into master first.\nThis will also help if I have to make few corrections if something doesn't work in the workflow yaml.\nHere is the mechanism that I am looking for:\n\nmain branch has .github folder which contains all workflows\nI create a branch and add my workflow to .github folder\nNow I should be able to see(somewhere on Github) workflows from my branch running\nWhen I know that workflows are working fine, I merge my branch in master\nNow under github 'Action' tab, new workflows will reflect\n\nIs there a way to do this?"
},
{
"role": "assistant",
"content": "So, from the previous answers, seems that the (least-disrupting) solution is:\n\nAdd the following trigger to the workflow\n\n\non:\n pull_request:\n\n\n\nCreate a draft PR\n\nThe Workflow will then show-up under the Actions menu, it will immediately trigger, and it will again be triggered whenever new changes will be pushed to the branch you're using in the PR."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-config - Get and set repository or global options mergetool.<tool>.hideResolved"
},
{
"role": "assistant",
"content": "Allows the user to override the global mergetool.hideResolved value\nfor a specific tool. See mergetool.hideResolved for the full\ndescription."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git - the stupid content tracker git-init"
},
{
"role": "assistant",
"content": "Create an empty Git repository or reinitialize an existing one"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-rev-list - Lists commit objects in reverse chronological order --since-as-filter=<date>"
},
{
"role": "assistant",
"content": "Show all commits more recent than a specific date. This visits\nall commits in the range, rather than stopping at the first commit which\nis older than a specific date."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-apply - Apply a patch to files and/or to the index --allow-binary-replacement --binary"
},
{
"role": "assistant",
"content": "Historically we did not allow binary patch application\nwithout an explicit permission from the user, and this\nflag was the way to do so. Currently, we always allow binary\npatch application, so this is a no-op."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "MarkdownSharp & GitHub syntax for C# code\n\nIs there a way to get MarkdownSharp (I'm using the NuGet package) to handle 'GitHub flavored Markdown (GFM)' and especially syntax highlighting of c# code, which (in GFM) is written like this:\n```c#\n//my code.....\n```\n\nSo, if I pass Markdown formatted content to MarkDownSharp, containg a C# code block (as above) I want it to generate syntax highlighted html for that c# code. Any ideas? I know I can use the supported 4 spaces to indicate a code block, but again, I'm seeking a solution for getting it to support GitHub flavored Markdown."
},
{
"role": "assistant",
"content": "I have made some light modifications to MarkdownSharp that will transform github flavored fenced code blocks\nhttps://github.com/KyleGobel/MarkdownSharp-GithubCodeBlocks\n```cs\nConsole.WriteLine(\"Fenced code blocks ftw!\");\n```\n\nWould become\n<pre><code class='language-cs'>\nConsole.WriteLine(\"Fenced code blocks ftw!\");\n</code></pre>\n\nIt handles the cases I needed to use, there are probably lots of edge cases though, feel free to fork/change/modify/pull request. Markdown sharp has plenty of comments and is all only one file, so it's not too bad to modify."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Best workflow when forking and renaming a GitHub project [closed]\nClosed. This question is opinion-based. It is not currently accepting answers.\n \n \n\n\n\n\n\n\n\n\n\n\n\nWant to improve this question? Update the question so it can be answered with facts and citations by editing this post.\n\n\nClosed 9 years ago.\n\n\n\n\n\n\n\n Improve this question\n \n\n\n\nI am trying to figure out the best workflow for working with a fork of an existing opensource project in Github. I want to take an existing project and make significant changes to it, in this case to port it to android and add specific android only functionality. I would like to satisfy the following:\n\nBe able to pull changes from their public repo to the new android port as the original code is updated.\nBe able to sumbit changes (via pull requests) to the orginal project when I fix bugs that aren't just applicable to the android port.\nHave a seperate renamed version of the project to make it clear that it is a Android port. I looked at renaming a fork and Github gave me huge warnings about doing this.\n\nMy initial thoughts are I would fork the original project then fork and rename my fork to give me the following repos:\noriginal-author/projectA\nnicstrong/projectA\nnicstrong/projectA-android\n\nThis would allow me to work on my local repo local/projectA-android push changes to nicstrong/projectA-android. Then to update from the orginal project I could rebase nicstrong/projectA to the latest from original-author/projectA then fetch/merge from nicstrong/projectA to local/projectA-android.\nMy questions are:\n\nI am quite new to the whole Git\nthing. Does this seem like a good\napproach? Or is there a better\nworkflow for handling this scenerio?\nHow would I handle pushing from\nprojectA-android back to nicstrong/projectA so I can setup pull request for the original project?"
},
{
"role": "assistant",
"content": "2011:\n1/ Yes, that seems the safest approach, as any modification you end up back-porting in nicstrong/projectA will be in a project with the same structure as original-author/projectA.\nThat means pull requests will be easier to organize, since you will be in a project mirroring the original author's project.\n2/ If you have massive refactoring going on in nicstrong/projectA-android, I would make a backport branch, carefully merge or cherry-pick what you need from the numerous changes to the backport branch, and then push that branch to nicstrong/projectA.\n(which means you have added nicstrong/projectA as a remote of nicstrong/projectA-android)\n\n2022: Note that you can create a fork directly with a different name."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How do I squash my last N commits together?\nHow do I squash my last N commits together into one commit?"
},
{
"role": "assistant",
"content": "You can do this fairly easily without git rebase or git merge --squash. In this example, we'll squash the last 3 commits.\nIf you want to write the new commit message from scratch, this suffices:\ngit reset --soft HEAD~3\ngit commit\n\nIf you want to start editing the new commit message with a concatenation of the existing commit messages (i.e. similar to what a pick/squash/squash/…/squash git rebase -i instruction list would start you with), then you need to extract those messages and pass them to git commit:\ngit reset --soft HEAD~3 && \ngit commit --edit -m\"$(git log --format=%B --reverse HEAD..HEAD@{1})\"\n\nBoth of those methods squash the last three commits into a single new commit in the same way. The soft reset just re-points HEAD to the last commit that you do not want to squash. Neither the index nor the working tree are touched by the soft reset, leaving the index in the desired state for your new commit (i.e. it already has all the changes from the commits that you are about to “throw away”).\nEdit Based on Comments\nYou have rewritten that history you must than use the --force flag to push this branch back to remote. This is what the force flag is meant for, but you can be extra careful, and always fully define your target.\ngit push --force-with-lease origin <branch-name>"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Git pull asks me to write merge message\nI pull from my branch:\ngit checkout mybranchSample\ngit fetch\ngit pull origin master\n\nThen, Git gives me the following message:\n\nPlease enter a commit message to explain why this merge is necessary,\n especially if it merges an updated upstream into a topic branch\n\n\nAnd after entering a commit message, it merges master into my files. And even though I haven't worked on some files from master, it shows the files list in green when I type git status.\nThis issue is not happening with my colleagues, but me only.\nWhat can be the reason behind this?"
},
{
"role": "assistant",
"content": "git pull is basically two actions at once: git fetch followed by a git merge (unless you use git pull --rebase, in which case you can guess what happens).\nThe reason you're seeing this is because Git can't do a fast-forward merge, like it can most of the time. The reason for that is usually because you've git committed locally to the branch you're trying to pull, and now you need to merge the remote changes with your local ones.\nIt's also worth noting that Git pre-populated the merge message for you, so you don't really need to type anything. Just save and exit, and the merge should be complete. (Unless, of course, there are merge conflicts)."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Where does Github desktop install command line version of Git\nAccording to https://git-scm.com/book/en/v2/Getting-Started-Installing-Git\n\nThe installer includes a command line version of Git as well as the GUI. It also works well with Powershell, and sets up solid credential caching and sane CRLF settings.\n\nWhen I'm launching the latest download from https://desktop.github.com/, it just runs immediately and does not offer me to install command line version. I checked in cmd by typing git, command is not recognized.\nDo GithubDesktop really installed Git command line, if not can I force it to do so somehow ?\nUpdate: I've found the install but cannot access it from Powershell."
},
{
"role": "assistant",
"content": "On Windows the latest Electron / unified versions of github desktop has git stored here:\nC:\\Users\\UserName\\AppData\\Local\\GitHubDesktop\\app-1.0.5\\resources\\app\\git\\cmd\\git.exe"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "`git fetch` a remote branch\nThe remote repository contains various branches such as origin/daves_branch:\n$ git branch -r\norigin/HEAD -> origin/master\norigin/daves_branch\norigin/master\n\nHow do I switch to daves_branch in the local repository so that it tracks origin/daves_branch?\nI tried:\n$ git fetch origin daves_branch\n$ git checkout daves_branch"
},
{
"role": "assistant",
"content": "Update: Using Git Switch\nAll of the information written below was accurate, but a new command, git switch has been added that simplifies the effort.\nIf daves_branch exists on the remote repository, but not on your local branch, you can simply type:\ngit switch daves_branch\n\nSince you do not have the branch locally, this will automatically make switch look on the remote repo. It will then also automatically set up remote branch tracking.\nNote that if daves_branch doesn't exist locally you'll need to git fetch first before using switch.\n\nOriginal Post\nYou need to create a local branch that tracks a remote branch. The following command will create a local branch named daves_branch, tracking the remote branch origin/daves_branch. When you push your changes the remote branch will be updated.\nFor most recent versions of Git:\ngit checkout --track origin/daves_branch\n\n--track is shorthand for git checkout -b [branch] [remotename]/[branch] where [remotename] is origin in this case and [branch] is twice the same, daves_branch in this case.\nFor Git 1.5.6.5 you needed this:\ngit checkout --track -b daves_branch origin/daves_branch\n\nFor Git 1.7.2.3 and higher, this is enough (it might have started earlier, but this is the earliest confirmation I could find quickly):\ngit checkout daves_branch\n\nNote that with recent Git versions, this command will not create a local branch and will put you in a 'detached HEAD' state. If you want a local branch, use the --track option.\nFull details are here: 3.5 Git Branching - Remote Branches, Tracking Branches"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-rev-parse - Pick out and massage parameters --since=<datestring> --after=<datestring>"
},
{
"role": "assistant",
"content": "Parse the date string, and output the corresponding\n--max-age= parameter for git rev-list ."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Difference between Git and GitHub\nI have recently added a new project to Git using Eclipse, but do not see the project appear in my GitHub account.\nWhy do they have the same account information and different repositories?\nIsn't Git and GitHub the same thing?"
},
{
"role": "assistant",
"content": "Git is a revision control system, a tool to manage your source code history.\nGitHub is a hosting service for Git repositories.\nSo they are not the same thing: Git is the tool, GitHub is the service for projects that use Git.\nTo get your code to GitHub, have a look here."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How do I connect a local folder to an existing github repo?\n\nI made a repo on my laptop. It has a project page on github.com.\nI'm now working on my desktop computer. I manually copied over some files because I didn't think I would need every file from the repo (so I didn't clone the repo onto my desktop). How can I connect my desktop local folder with the existing repo so that I can push the files on my desktop to the repo (the desktop files are now the most recent versions of those files, since I stopped working from my laptop)"
},
{
"role": "assistant",
"content": "Adding an existing project to GitHub using the command line:\n# Initialize the local directory as a Git repository.\ngit init\n\n# Add files\ngit add .\n\n# Commit your changes\ngit commit -m \"First commit\"\n\n# Add remote origin\ngit remote add origin <Remote repository URL>\n# <Remote repository URL> looks like: https://github.com/user/repo.git\n\n# Verifies the new remote URL\ngit remote -v\n\n# Push your changes\ngit push origin master\n\nAnd 2nd way as @evolutionxbox suggest you:\n\nClone git repo\nCopy and paste into it\nPush your change at origin\n\nIf in any case git reject your push you can use git push origin master --force\nUPDATE (10-23-2020):\nBear in mind that since October 1st, 2020, Github renamed the default repository from master to main https://github.com/github/renaming"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Append the script on one stage .gitlab-ci.yml\n\nHow to append the script section in one stage in the .gitlab-ci.yml file?\ne.g in this example\nstages:\n - stage1_name\n\n.a:\n script:\n - echo \"String 1\"\n\n.b:\n script:\n - echo \"String 2\"\n\n\nstage1_name:\n stage: stage1_name\n extends: .a\n extends: .b\n script:\n - echo \"String 3\"\n\nhow to get as output:\nString 1\nString 2\nString 3\n\ninstead of: \nString 3"
},
{
"role": "assistant",
"content": "Gitlab 13.9 introduced a !reference-tag which makes this possible;\n.setup:\n script:\n - echo creating environment\n\ntest:\n script:\n - !reference [.setup, script]\n - echo running my own command"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Run jobs in the same stage sequentially in Gitlab CI\n\nI want to run jobs in the same stage sequentially instead of parallel in GitLab CI. Currently this is what I have:\n\nI want unit-test to run before integration-test and not in parallel. I have looked into the docs and have encountered DAG but it needs the job to be in a prior stage and cannot be on the same stage. Is there a way to achieve this?"
},
{
"role": "assistant",
"content": "Yes its already described in the documentation for stages, jobs are started in parallel in one stage.\nIt says:\n\nTo make a job start earlier and ignore the stage order, use the needs keyword.\n\nAs you said, this is not possible in GitLab < 14.2 within a stage (needs):\n\nneeds: is similar to dependencies: in that it must use jobs from prior stages, meaning it's impossible to create circular dependencies. Depending on jobs in the current stage is not possible either, but support is planned.\n\nAs an alternative, you could define several stages and use the keyword needs between jobs in these stages.\nSince GitLab 14.2 (issue) its possible."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to push nuget package in GitHub actions\n\nI am trying to use GitHub actions to generate a NuGet package from my project and push it to the (private) GitHub registry. \nMy script ([NAME] fields redacted):\nname: Update NuGet\n\non: [push]\n\njobs:\n build:\n runs-on: ubuntu-latest\n\n name: Update NuGet \n steps:\n - uses: actions/checkout@master\n - uses: actions/setup-dotnet@v1\n with:\n dotnet-version: '2.2.105'\n - name: Package Release\n run: | \n cd [SOLUTION_FOLDER]\n dotnet pack -c Release -o out\n - name: Publish Nuget to GitHub registry\n run: dotnet nuget push ./[SOLUTION_FOLDER]/[PROJECT_FOLDER]/out/$(ls ./[SOLUTION_FOLDER]/[PROJECT_FOLDER]/out) -s https://nuget.pkg.github.com/[USERNAME]/index.json -k ${GITHUB_TOKEN} \n env:\n GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \n\nLog output:\ninfo : Pushing [PROJECT_FOLDER].3.4.23.nupkg to 'https://nuget.pkg.github.com/[USERNAME]'...\ninfo : PUT https://nuget.pkg.github.com/[USERNAME]/\ninfo : An error was encountered when fetching 'PUT https://nuget.pkg.github.com/[USERNAME]/'. The request will now be retried.\ninfo : An error occurred while sending the request.\ninfo : The server returned an invalid or unrecognized response.\ninfo : PUT https://nuget.pkg.github.com/[USERNAME]/\ninfo : An error was encountered when fetching 'PUT https://nuget.pkg.github.com/[USERNAME]/'. The request will now be retried.\ninfo : An error occurred while sending the request.\ninfo : The server returned an invalid or unrecognized response.\ninfo : PUT https://nuget.pkg.github.com/[USERNAME]/\nerror: An error occurred while sending the request.\nerror: The server returned an invalid or unrecognized response.\n##[error]Process completed with exit code 1.\n\nThis is the coresponding GitHub issue (with a workaround option): https://github.com/NuGet/Home/issues/8580"
},
{
"role": "assistant",
"content": "Second Update:\nI got an answer in the GitHub issue from jcansdale that says (haven't tested this):\n\nSupport for the dotnet nuget push --api-key option has now been added to GitHub Packages. For some reason this works consistently, but using basic auth (password in nuget.config file) fails randomly!\n\nExample:\n - name: Publish Nuget to GitHub registry\n run: dotnet nuget push ./<project>/out/*.nupkg -k ${GITHUB_TOKEN} -s https://nuget.pkg.github.com/<organization>/index.json --skip-duplicate --no-symbols \n env:\n GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n\nUpdate:\nBased on Dids answer on GitHub my configuration works now like this:\nname: NuGet Generation\n\non:\n push:\n branches:\n - master\n pull_request:\n types: [closed]\n branches:\n - master\n\njobs:\n build:\n runs-on: ubuntu-18.04\n name: Update NuGet package\n steps:\n\n - name: Checkout repository\n uses: actions/checkout@v1\n\n - name: Setup .NET Core @ Latest\n uses: actions/setup-dotnet@v1\n with:\n source-url: https://nuget.pkg.github.com/<organization>/index.json\n env:\n NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} \n \n - name: Build solution and generate NuGet package\n run: | \n cd <project>\n dotnet pack -c Release -o out \n\n - name: Push generated package to GitHub registry\n run: dotnet nuget push ./<project>/out/*.nupkg --skip-duplicate --no-symbols true\n\n\nNote: At the time of writing I needed to use --no-symbols true instead of --no-symbols to prevent exceptions in the dotnet NuGet client.\n\nOld answer:\nI switched to the Windows image and got it to work based on the example of @anangaur. This is my final code:\nname: NuGet Generation\n\non:\n push:\n branches:\n - master\n\njobs:\n build:\n runs-on: windows-latest\n name: Update NuGet \n steps:\n\n - name: Checkout repository\n uses: actions/checkout@master\n\n# latest image has .NET already installed!\n# - name: Setup .NET environment\n# uses: actions/setup-dotnet@v1\n# with:\n# dotnet-version: '2.2.105' \n \n - name: Build solution and generate NuGet package\n run: | \n cd SOLUTION_FOLDER\n dotnet pack -c Release -o out \n\n - name: Install NuGet client\n uses: warrenbuckley/Setup-Nuget@v1\n \n - name: Add private GitHub registry to NuGet\n run: nuget sources add -name \"GPR\" -Source https://nuget.pkg.github.com/ORGANIZATION_NAME/index.json -Username ORGANIZATION_NAME -Password ${{ secrets.GITHUB_TOKEN }}\n \n - name: Push generated package to GitHub registry\n run: nuget push .\\SOLUTION_FOLDER\\PROJECT_FOLDER\\out\\*.nupkg -Source \"GPR\" -SkipDuplicate"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-config - Get and set repository or global options rebase.forkPoint"
},
{
"role": "assistant",
"content": "If set to false set --no-fork-point option by default."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Homebrew update fail: \"Please, commit your changes or stash them before you can merge\"\nI am running:\nbrew update\n\nAnd I get an error:\nerror: Your local changes to the following files would be overwritten by merge:\n samtools.rb\nPlease, commit your changes or stash them before you can merge.\nAborting\n\nIt turns out this is a well known error. In fact, it's mentioned on the Homebrew wiki:\nAfter running brew update, you receive a git error warning about untracked files or local changes that would be overwritten by a checkout or merge, followed by a list of files inside your Homebrew installation.\n\nThis is caused by an old bug in in the update code that has long since been fixed. However, the nature of the bug requires that you do the following:\n\ncd $(brew --repository)\ngit reset --hard FETCH_HEAD\n\nIf brew doctor still complains about uncommitted modifications, also run this command:\n\ncd $(brew --repository)/Library\ngit clean -fd\n\nI followed those instructions and am still seeing the same error. What is wrong?"
},
{
"role": "assistant",
"content": "I was able to resolve the issue myself.\nWhat tipped me off is running \"git status\" did not show that file.\nInstead of using the common solution:\ncd $(brew --repository)\ngit reset --hard FETCH_HEAD\n\nI had to do:\ncd [directory of the file in question]\ngit reset --hard FETCH_HEAD\n\nThat resolved the problem."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Where to find changes due to `git fetch`\nI didn't want to lose some information after a git pull, so I did a git fetch before. Where can I read the new modifications after a git fetch? I went to the FETCH_HEAD file, but there was nothing more than a big number."
},
{
"role": "assistant",
"content": "git fetch origin by default fetches everything from the remote named \"origin\" and updates (or creates) the so-called \"remote-tracking branches\" for that remote. Say, for the remote named \"origin\" which contain branches named \"master\" and \"feature\", running git fetch remote will result in the remote-tracking branches named \"origin/master\" and \"origin/feature\" being updated (or created, if they're not exist). You could see them in the output of git branch -a (notice \"-a\").\nNow, the usual Git setup is that (some of) your local branches follow certain remote branches (usually same-named). That is, your local \"master\" branch follows \"origin/master\" etc.\nSo, after you fetched, to see what remote \"master\" has compared to your local \"master\", you ask Git to show you exactly this:\ngit log origin/master ^master\n\nwhich means «all commits reachable from \"origin/master\" which do not include commits reachable from \"master\"»\nor, alternatively\ngit log master..origin/master\n\nwhich has the same meaning. See the \"gitrevisions\" manual page for more info, especially the \"Specifying ranges\" part. Also see the examples in the git-log manual page\nYou're free to customize the output of git log as you see fit as it supports a whole lot of options affecting it.\nNote that your local branch might also have commits which the matching remote branch does not contain (yet). To get an overview of them you have to reverse the revisions passed to git log for (hopefully) obvious reasons.\nAs usual, it's essential to educate yourself to understand the underlying concepts before starting to use a tool. Please do."
}
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.