messages
listlengths 3
3
|
---|
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to fix \"modified content, untracked content\" in git?\nThe objective is to commit a git branch. The output of \"git status\" for the branch is:\nOn branch zeromq_new\nYour branch is up to date with 'origin/zeromq'.\n\nChanges not staged for commit:\n (use \"git add <file>...\" to update what will be committed)\n (use \"git checkout -- <file>...\" to discard changes in working directory)\n (commit or discard the untracked or modified content in submodules)\n\n modified: log4cplus (modified content, untracked content)\n modified: ../lib/notification/cppzmq (modified content)\n\nThe directory structure looks like this:\nHySecureGateway\n├──fes\n│ └──log4cplus\n│ ├──.git\n│ ├──.gitattributes\n│ ├──.gitignore\n│ ├──.gitmodules\n│ ├──catch\n│ │ ├──.git\n│ │ ├──.gitattributes\n│ │ ├──.github\n│ │ ├──.gitignore\n│ │ └──.github\n│ │ ├──issue_template.md\n│ │ └──pull_request_template.md\n│ └──threadpool\n│ └──.github\n└──lib\n └──notification\n └──cppzmq\n ├──.git\n └──.gitignore\n\nI read an answer of to a similar question here: \nHow to track untracked content? , \nand couldn't understand it completely. \nAlso the logc4plus/.gitmodules contains this:\n[submodule \"threadpool\"]\n\n path = threadpool\n url = https://github.com/log4cplus/ThreadPool.git\n\n[submodule \"catch\"]\n\n path = catch\n url = https://github.com/philsquared/Catch.git"
},
{
"role": "assistant",
"content": "What I did was to run: \ngit rm -rf --cached myuntrackedfolder\n\nThis tells git to forget about it (since it was being tracked formally).\nThen I used: \ngit add myuntrackedfolder \n\nto add it and I was good to go."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-describe - Give an object a human readable name based on an available ref --long"
},
{
"role": "assistant",
"content": "Always output the long format (the tag, the number of commits\nand the abbreviated commit name) even when it matches a tag.\nThis is useful when you want to see parts of the commit object name\nin \"describe\" output, even when the commit in question happens to be\na tagged version. Instead of just emitting the tag name, it will\ndescribe such a commit as v1.2-0-gdeadbee (0th commit since tag v1.2\nthat points at object deadbee….)."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-rev-list - Lists commit objects in reverse chronological order --single-worktree"
},
{
"role": "assistant",
"content": "By default, all working trees will be examined by the\nfollowing options when there are more than one (see git-worktree ): --all , --reflog and --indexed-objects .\nThis option forces them to examine the current working tree\nonly."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-log - Show commit logs %cN"
},
{
"role": "assistant",
"content": "committer name (respecting .mailmap, see git-shortlog or git-blame )"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-log - Show commit logs --diff-algorithm={patience|minimal|histogram|myers}"
},
{
"role": "assistant",
"content": "Choose a diff algorithm. The variants are as follows: default , myers The basic greedy diff algorithm. Currently, this is the default. minimal Spend extra time to make sure the smallest possible diff is\nproduced. patience Use \"patience diff\" algorithm when generating patches. histogram This algorithm extends the patience algorithm to \"support\nlow-occurrence common elements\". For instance, if you configured the diff.algorithm variable to a\nnon-default value and want to use the default one, then you\nhave to use --diff-algorithm=default option."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to change the git-flow configuration in SourceTree?\nIn my team we are migrating from svn to git and we have agreed upon embracing the git-flow flow. I've been playing around a while with SourceTree and the Git-Flow extension. Now, we have decided that the develop branch will be called development/current instead, but I do not find in the SourceTree UI where to change the Git-Flow configuration.\nIs it possible, once initialized, to change the Git-Flow configuration for a given repository?"
},
{
"role": "assistant",
"content": "No, it is not possible (at least not at SourceTree 1.4.1.0).\nIt is possible however to do it manually by editing the file /.git/config in your git repository.\nThe Git-Flow extension adds it s configuration in the following two sections, which can be freely edited.\n[gitflow \"branch\"]\n master = master\n develop = development/current\n[gitflow \"prefix\"]\n feature = feature/\n release = release/\n hotfix = hotfix/\n versiontag = release/\n support = support/\n\nResource: http://www.crisi.ch/change-git-flow-settings-in-sourcetree/"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Git: cannot checkout branch - error: pathspec '...' did not match any file(s) known to git\nI'm not sure why I'm unable to checkout a branch that I had worked on earlier. See the commands below (note: co is an alias for checkout):\nramon@ramon-desktop:~/source/unstilted$ git branch -a\n* develop\n feature/datts_right\n feature/user_controlled_menu\n feature/user_controlled_site_layouts\n master\n remotes/origin/HEAD -> origin/master\n remotes/origin/develop\n remotes/origin/feature/datts_right\n remotes/origin/master\nramon@ramon-desktop:~/source/unstilted$ git co feature/user_controlled_site_layouts \nerror: pathspec 'feature/user_controlled_site_layouts' did not match any file(s) known to git.\n\nI'm not sure what it means, and I can't seem to find anything I can understand on Google. \nHow do I checkout that branch, and what may I have done to break this?\nUPDATE:\nI found this post, and running git show-ref gives me:\n97e2cb33914e763ff92bbe38531d3fd02408da46 refs/heads/develop\nc438c439c66da3f2356d2449505c073549b221c1 refs/heads/feature/datts_right\n11a90dae8897ceed318700b9af3019f4b4dceb1e refs/heads/feature/user_controlled_menu\nc889b37a5ee690986935c9c74b71999e2cf3c6d7 refs/heads/master\nc889b37a5ee690986935c9c74b71999e2cf3c6d7 refs/remotes/origin/HEAD\ne7c17eb40610505eea4e6687e4572191216ad4c6 refs/remotes/origin/develop\nc438c439c66da3f2356d2449505c073549b221c1 refs/remotes/origin/feature/datts_right\nc889b37a5ee690986935c9c74b71999e2cf3c6d7 refs/remotes/origin/master\n23768aa5425cbf29d10ff24274adad42d90d15cc refs/stash\ne572cf91e95da03f04a5e51820f58a7306ce01de refs/tags/menu_shows_published_only\n429ebaa895d9d41d835a34da72676caa75902e3d refs/tags/slow_dev\n\nUPDATE on .git directory (user_controlled_site_layouts is in the refs/heads/feature folder):\n$ ls .git/refs/heads/feature/\ndatts_right user_controlled_menu user_controlled_site_layouts\n$ cat .git/refs/heads/feature/user_controlled_site_layouts\n3af84fcf1508c44013844dcd0998a14e61455034\n\nUPDATE on git show 3af84fcf1508c44013844dcd0998a14e61455034\n$ git show 3af84fcf1508c44013844dcd0998a14e61455034\ncommit 3af84fcf1508c44013844dcd0998a14e61455034\nAuthor: Ramon Tayag <[email protected]>\nDate: Thu May 12 19:00:03 2011 +0800\n\n Removed site layouts migration\n\ndiff --git a/db/schema.rb b/db/schema.rb\nindex 1218fc8..2040b9f 100755\n--- a/db/schema.rb\n+++ b/db/schema.rb\n@@ -10,7 +10,7 @@\n #\n # It's strongly recommended to check this file into your version control system.\n\n-ActiveRecord::Schema.define(:version => 20110511012647) do\n+ActiveRecord::Schema.define(:version => 20110503040056) do\n\n create_table \"attachments\", :force => true do |t|\n t.string \"name\"\n@@ -205,15 +205,6 @@ ActiveRecord::Schema.define(:version => 20110511012647) do\n t.integer \"old_id\"\n end\n\n- create_table \"site_layouts\", :force => true do |t|\n- t.string \"name\"\n- t.text \"description\"\n- t.text \"content\"\n- t.integer \"site_id\"\n- t.datetime \"created_at\"\n- t.datetime \"updated_at\"\n- end\n-\n create_table \"site_styles\", :force => true do |t|\n t.text \"published\"\n t.datetime \"created_at\""
},
{
"role": "assistant",
"content": "Try git fetch so that your local repository gets all the new info from Github. It just takes the information about new branches and no actual code. After that, the git checkout should work fine."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Changing the Git remote 'push to' default\nI want to change the Git default remote branch destination so I could just\ngit push\n\nInstead of:\ngit push upstream\n\nCurrently this is set to the origin remote and I want to set it to a different remote.\nI tried to remove the original (cloned from) remote\ngit remote rm origin\n\nWhich did remove the original remote. But doesn't solve the git push problem. I still get:\n\nfatal: No configured push destination. Either specify the URL from the\n command-line or configure a remote repository using...\n\nI also tried to play with:\ngit remote set-url --push myfork origin\n\nand other options but none seem to work (maybe because I deleted the origin remote too soon?)\nFollowing the answer here I tried to change:\ngit config push.default upstream (or matching)\n\nbut neither worked."
},
{
"role": "assistant",
"content": "You can use git push -u <remote_name> <local_branch_name> to set the default upstream. See the documentation for git push for more details."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Prevent git from asking for the GnuPG password during signing a commit\nGit always asks me to enter a passphrase to unlock my secret key while signing a commit using.\ngit commit -S -m 'message'\n\nHow can I store in cache the password so that I don't have to enter it each and every time while signing the commit"
},
{
"role": "assistant",
"content": "Git never gets hold of the GnuPG passphrase. You must rely on GnuPG's capabilities of caching passphrases, which happens through gpg-agent which are easily set up by editing ~/.gnupg/gpg-agent.conf (hidden somewhere in your AppData folder in Windows).\nSet default-cache-ttl to the number of seconds the passphrase is cached after each invocation of GnuPG. maximum-cache-ttl sets the time after the passphrase was initially entered at which the cache is wiped. Make sure ignore-cache-for-signing is not set -- otherwise GnuPG will ignore the cache for signing operations.\nIf you want to sign commits without any user interaction, you can prefill the cache through gpg-preset-passphrase, often hidden somewhere in a location like /usr/lib/gnupg2/gpg-preset-passphrase; or by running an arbitrary decryption or signing operation. You might also configure git to use an option like --passphrase [your passphrase] to be passed to gpg, but read up on the restrictions and security implications of this approach (it involves your passphrase being stored in plaintext somewhere).\nFull list of options is here."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git - the stupid content tracker git-http-fetch"
},
{
"role": "assistant",
"content": "Download from a remote Git repository via HTTP"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Why git keeps showing my changes when I switch branches (modified,added, deleted files) no matter if I run git add or not?\nI'm really new to git and I've been trying to understand why git keeps showing whatever I changed in one branch in another branch when I run git checkout to switch between branches First I tried not using git add and didn't work. However, I tried then using git add, but didn't fix the problem. I'm not using git commit yet.\nThis is basically what I'm doing:\n$ git clone <a_repository> \n$ git branch \n* master \n$ git branch testing \n$ git checkout testing \n...edit a file, add a new one, delete... \n$ git status \n # On branch testing \n # Changed but not updated: \n # (use \"git add/rm <file>...\" to update what will be committed) \n # (use \"git checkout -- <file>...\" to discard changes in working directory) \n # \n # deleted: file1.txt \n # \n # Untracked files: \n # (use \"git add <file>...\" to include in what will be committed) \n # \n # file2.txt \nno changes added to commit (use \"git add\" and/or \"git commit -a\") \n$ git branch \n master \n* testing \n$ git checkout master \nD file1.txt \nSwitched to branch 'master' \n$ git status \n # On branch master \n # Changed but not updated: \n # (use \"git add/rm <file>...\" to update what will be committed) \n # (use \"git checkout -- <file>...\" to discard changes in working directory) \n # \n # deleted: file1.txt \n # \n # Untracked files: \n # (use \"git add <file>...\" to include in what will be committed) \n # \n # file2.txt \nno changes added to commit (use \"git add\" and/or \"git commit -a\") \n\nI thought that, while using branches, whatever you do in one branch, it's invisible to all the other branches. Is not that the reason of creating branches?\nI tried using \"git add\" but the changes are visible in both branches. \nDo I need to run \"git commit\" before switching between branches to avoid this?"
},
{
"role": "assistant",
"content": "Switching branches carries uncommitted changes with you. Either commit first, run git checkout . to undo them, or run git stash before switching. (You can get your changes back with git stash apply)"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-clone - Clone a repository into a new directory -- [ no- ] remote-submodules"
},
{
"role": "assistant",
"content": "All submodules which are cloned will use the status of the submodule’s\nremote-tracking branch to update the submodule, rather than the\nsuperproject’s recorded SHA-1. Equivalent to passing --remote to git submodule update ."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Fork and synchronize Google Code Subversion repository into GitHub\n\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": "github show commits on a specific date\n\nI can show/search a list of commits on a specific branch on github like this\n\nhttps://github.com/username/repository/commits/branch_name\n\nI can also filter by author name like\n\nhttps://github.com/username/repository/commits/branch_name?author=author_name\n\nBut I am looking for a way that I can search my commits on a specific date or date range. I tried to find an existing answer but could not find. I also tried some queries like before=2016-07-27 or after=2016-07-27 but it did not work. Any help will be appreciated. Thanks in advance"
},
{
"role": "assistant",
"content": "Per GitHub's REST API v3 documentation for list commits on a repository:\nGET /repos/:owner/:repo/commits\n\nincludes since and until parameters:\n+--------+---------+---------------------------------------------------------------+\n| Name | Type | Description |\n+--------+---------+---------------------------------------------------------------+\n| since | string | Only commits after this date will be returned. |\n| | | This is a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. |\n| until | string | Only commits before this date will be returned. |\n| | | This is a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. |\n+--------+---------+---------------------------------------------------------------+\n\nFor example, to select commits on master in June 2018 on github/linguist: https://github.com/github/linguist/commits/master?since=2018-05-31&until=2018-07-01\nAccording to the above-linked docs, the branch should be included as a query parameter, e.g. https://github.com/github/linguist/commits?branch=master&since=2018-05-31&until=2018-07-01 but it seems to work fine to use the branch name as a path parameter."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-log - Show commit logs --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": "git-config - Get and set repository or global options fetch.pruneTags"
},
{
"role": "assistant",
"content": "If true, fetch will automatically behave as if the refs/tags/*:refs/tags/* refspec was provided when pruning,\nif not set already. This allows for setting both this option\nand fetch.prune to maintain a 1=1 mapping to upstream\nrefs. See also remote.<name>.pruneTags and the PRUNING\nsection of git-fetch ."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git - the stupid content tracker --info-path"
},
{
"role": "assistant",
"content": "Print the path where the Info files documenting this\nversion of Git are installed and exit."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-push - Update remote refs along with associated objects !"
},
{
"role": "assistant",
"content": "for a ref that was rejected or failed to push; and"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-config - Get and set repository or global options lineNumber"
},
{
"role": "assistant",
"content": "line number prefix (when using -n )"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Why do I get \"fatal: git status --porcelain failed\"?\nThis is a huge pain in the bum. I've got this a few times before and I don't understand why. 5 mins ago the repo was fine and working, I move some files around (which is all cool and all) and git poops its pants. Any idea why this happens? How can I fix it apart from cloning the repo, moving the files, etc..."
},
{
"role": "assistant",
"content": "Oh dear I'm such a fail. It looks like the problem stems from Flash Builder copying over other .git repos into sub folders. The answer is to remove all .git folders that aren't the repo's one."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-diff - Show changes between commits, commit and working tree, etc diff.autoRefreshIndex"
},
{
"role": "assistant",
"content": "When using git diff to compare with work tree\nfiles, do not consider stat-only changes as changed.\nInstead, silently run git update-index --refresh to\nupdate the cached stat information for paths whose\ncontents in the work tree match the contents in the\nindex. This option defaults to true. Note that this\naffects only git diff Porcelain, and not lower level diff commands such as git diff-files ."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git clean is not removing a submodule added to a branch when switching branches\nHow do I get rid of submodules when switching branches. I do not understand why git clean says it removed the submodule but does not. Is this a bug? Below are cut&paste steps to reproduce.\ngit --version\ngit version 1.7.8.4\n\ngit init submod\ncd submod\necho \"This is a submodule\" > README.txt\ngit add .\ngit commit -m \"Initial commit\"\ncd ..\ngit init prog\ncd prog\necho \"This is a program\" > README.txt\ngit add .\ngit commit -a -m \"Initial commit\"\ngit checkout -b topic1\ngit submodule add ../submod\ngit commit -m \"Added submodule\"\n\ngit checkout master\n#warning: unable to rmdir submod: Directory not empty\n#Switched to branch 'master'\n\ngit status\n# On branch master\n# Untracked files:\n# (use \"git add <file>...\" to include in what will be committed)\n#\n# submod/\n#nothing added to commit but untracked files present (use \"git add\" to track)\n\ngit clean -fd\n#Removing submod/\n\ngit status\n# On branch master\n# Untracked files:\n# (use \"git add <file>...\" to include in what will be committed)\n#\n# submod/\n#nothing added to commit but untracked files present (use \"git add\" to track)"
},
{
"role": "assistant",
"content": "This isn't a bug, it's documented behaviour. From man git-clean:\n\nIf an untracked directory is managed by a different git repository, it is not removed by default.\n\nThe submod directory is a different git repository; if you want to remove it, Use -f option twice if you really want to remove such a directory.\ngit clean -f -f -d submod does remove submod. See my steps below (almost identical; different git version and hard-coded submodule path because otherwise git spits the dummy).\n\nSteps\n\n$ git --version\ngit version 1.7.5.4 # Note, different git-version. \n\nMake the two repositories\n\ngit init submod\ncd submod\necho \"This is a submodule\" > README.txt\ngit add .\ngit commit -m \"Initial commit\"\ncd ..\ngit init prog\ncd prog\necho \"This is a program\" > README.txt\ngit add .\ngit commit -a -m \"Initial commit\"\n\nAdd submod as a git submodule in topic1 branch.\n\ngit checkout -b topic1\ngit submodule add /Users/simont/sandbox/SOTESTING/Subdir-testing/submod\ngit commit -m \"Added submodule\"\n\nNow for the interesting section.\n\n$ git checkout master\nwarning: unable to rmdir submod: Directory not empty\nSwitched to branch 'master'\n\ngit status\n# On branch master\n# Untracked files:\n# (use \"git add ...\" to include in what will be committed)\n#\n# submod/\n#nothing added to commit but untracked files present (use \"git add\" to track)\n\nAttempt to git-clean, then actually git-clean.\n\ngit clean -fd\n#Removing submod/\n\ngit status\n# On branch master\n# Untracked files:\n# (use \"git add ...\" to include in what will be committed)\n#\n# submod/\n#nothing added to commit but untracked files present (use \"git add\" to track)\n\n$ # As we can see, we haven't actually removed anything yet. \n$ ls\nREADME.txt submod\n\n$ git clean -f -f -d submod\nRemoving submod/\n\n$ ls\nREADME.txt\n\n$ git status\n# On branch master\nnothing to commit (working directory clean)"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-config - Get and set repository or global options index.version"
},
{
"role": "assistant",
"content": "Specify the version with which new index files should be\ninitialized. This does not affect existing repositories.\nIf feature.manyFiles is enabled, then the default is 4."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Depend on a branch or tag using a git URL in a package.json?\nSay I've forked a node module with a bugfix and I want to use my fixed version, on a feature branch of course, until the bugfix is merged and released. \nHow would I reference my fixed version in the dependencies of my package.json?"
},
{
"role": "assistant",
"content": "Solution 1\nFrom the npm docs, using a git URL:\nhttps://github.com/<user>/<project>.git#<branch>\n\nhttps://github.com/<user>/<project>.git#feature\\/<branch>\n\nDon't use git:// protocol for GitHub, it is not longer supported\nSolution 2\nAs of NPM version 1.1.65, you can use a shorten github URL:\n<user>/<project>#<branch>"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-rev-parse - Pick out and massage parameters <rev>:<path> , e.g. HEAD:README , master:./README"
},
{
"role": "assistant",
"content": "A suffix : followed by a path names the blob or tree\nat the given path in the tree-ish object named by the part\nbefore the colon.\nA path starting with ./ or ../ is relative to the current working directory.\nThe given path will be converted to be relative to the working tree’s root directory.\nThis is most useful to address a blob or tree from a commit or tree that has\nthe same tree structure as the working tree."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-update-ref - Update the object name stored in a ref safely create"
},
{
"role": "assistant",
"content": "Create <ref> with <new-oid> after verifying it does not\nexist. The given <new-oid> may not be zero."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "LF will be replaced by CRLF in git - What is that and is it important? [duplicate]\nThis question already has answers here:\n \n \n\n\n\n\nGit replacing LF with CRLF\n\n (27 answers)\n \n\nClosed 4 years ago.\n\n\n\ngit init\ngit add .\n\nGives the following warnings for many files:\n\nThe file will have its original line endings in your working directory.\nwarning: LF will be replaced by CRLF in <filename>.\n\nWhat's the difference between LF and CRLF? What should I do about the warnings?"
},
{
"role": "assistant",
"content": "In Unix systems the end of a line is represented with a line feed (LF). In windows a line is represented with a carriage return (CR) and a line feed (LF) thus (CRLF). when you get code from git that was uploaded from a unix system they will only have an LF.\nIf you are a single developer working on a windows machine, and you don't care that git automatically replaces LFs to CRLFs, you can turn this warning off by typing the following in the git command line\ngit config core.autocrlf true\n\nIf you want to make an intelligent decision how git should handle this, read the documentation \nHere is a snippet\n\nFormatting and Whitespace\nFormatting and whitespace issues are some of the more frustrating and\n subtle problems that many developers encounter when collaborating,\n especially cross-platform. It’s very easy for patches or other\n collaborated work to introduce subtle whitespace changes because\n editors silently introduce them, and if your files ever touch a\n Windows system, their line endings might be replaced. Git has a few\n configuration options to help with these issues.\ncore.autocrlf\n\nIf you’re programming on Windows and working with people who are not\n (or vice-versa), you’ll probably run into line-ending issues at some\n point. This is because Windows uses both a carriage-return character\n and a linefeed character for newlines in its files, whereas Mac and\n Linux systems use only the linefeed character. This is a subtle but\n incredibly annoying fact of cross-platform work; many editors on\n Windows silently replace existing LF-style line endings with CRLF, or\n insert both line-ending characters when the user hits the enter key.\nGit can handle this by auto-converting CRLF line endings into LF when\n you add a file to the index, and vice versa when it checks out code\n onto your filesystem. You can turn on this functionality with the\n core.autocrlf setting. If you’re on a Windows machine, set it to true\n – this converts LF endings into CRLF when you check out code:\n$ git config --global core.autocrlf true\n\nIf you’re on a Linux or Mac system that uses LF line endings, then you\n don’t want Git to automatically convert them when you check out files;\n however, if a file with CRLF endings accidentally gets introduced,\n then you may want Git to fix it. You can tell Git to convert CRLF to\n LF on commit but not the other way around by setting core.autocrlf to\n input:\n$ git config --global core.autocrlf input\n\nThis setup should leave you with CRLF endings in Windows checkouts,\n but LF endings on Mac and Linux systems and in the repository.\nIf you’re a Windows programmer doing a Windows-only project, then you\n can turn off this functionality, recording the carriage returns in the\n repository by setting the config value to false:\n$ git config --global core.autocrlf false"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "GitLab rename branch and start over on another\n\nI just started on a new project and I'm using GitLab with SourceTree. I had created a branch (origin\\master) but I did the mistake of using this branch for my development, so I pushed my first few changes to this branch. Now I learned that this branch should actually have the production version and that an origin\\develop branch should be used for development.\nIs there any way I can rename the master branch to origin\\develop and somehow create a new origin\\master branch with the original version of the application?\nI'm the only developer in the project so it won't affect anyone. If possible, if you can explain how to do it in SourceTree since I don't use the command line git. I'm more familiar with SourceTree."
},
{
"role": "assistant",
"content": "You could try something like this. Answer modified from this great answer, to suit OP's needs.\ngit branch -m master develop # rename master on local\ngit push origin :master # delete master on remote\ngit push origin develop # create develop on remote\ngit checkout -b master develop # create a new local master on top of develop\ngit push origin master # create master on remote"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-format-patch - Prepare patches for e-mail submission lines"
},
{
"role": "assistant",
"content": "Compute the dirstat numbers by doing the regular line-based diff\nanalysis, and summing the removed/added line counts. (For binary\nfiles, count 64-byte chunks instead, since binary files have no\nnatural concept of lines). This is a more expensive --dirstat behavior than the changes behavior, but it does count rearranged\nlines within a file as much as other changes. The resulting output\nis consistent with what you get from the other --*stat options."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-update-index - Register file contents in the working tree to the index --add"
},
{
"role": "assistant",
"content": "If a specified file isn’t in the index already then it’s\nadded.\nDefault behaviour is to ignore new files."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-rev-list - Lists commit objects in reverse chronological order --ancestry-path[=<commit>]"
},
{
"role": "assistant",
"content": "When given a range of commits to display (e.g. commit1..commit2 or commit2 ^commit1 ), only display commits in that range\nthat are ancestors of <commit>, descendants of <commit>, or\n<commit> itself. If no commit is specified, use commit1 (the\nexcluded part of the range) as <commit>. Can be passed multiple\ntimes; if so, a commit is included if it is any of the commits\ngiven or if it is an ancestor or descendant of one of them."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-am - Apply a series of patches from a mailbox am.keepcr"
},
{
"role": "assistant",
"content": "If true, git-am will call git-mailsplit for patches in mbox format\nwith parameter --keep-cr . In this case git-mailsplit will\nnot remove \\r from lines ending with \\r\\n . Can be overridden\nby giving --no-keep-cr from the command line.\nSee git-am , git-mailsplit ."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-config - Get and set repository or global options receive.advertisePushOptions"
},
{
"role": "assistant",
"content": "When set to true, git-receive-pack will advertise the push options\ncapability to its clients. False by default."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "What's the common practice of gitignore for aspnet core project\nI know it depends on the project but i want to learn is there a common practice for typical asp.net core project(such as ignoring node_modules)."
},
{
"role": "assistant",
"content": "as of 2020, you should be using\ndotnet new gitignore"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Using capistrano to deploy from different git branches\nI am using capistrano to deploy a RoR application. The codebase is in a git repository, and branching is widely used in development. Capistrano uses deploy.rb file for it's settings, one of them being the branch to deploy from. \nMy problem is this: let's say I create a new branch A from master. The deploy file will reference master branch. I edit that, so A can be deployed to test environment. I finish working on the feature, and merge branch A into master. Since the deploy.rb file from A is fresher, it gets merged in and now the deploy.rb in master branch references A. Time to edit again.\nThat's a lot of seemingly unnecessary manual editing - the parameter should always match current branch name. On top of that, it is easy to forget to edit the settings each and every time.\nWhat would be the best way to automate this process?\nEdit: Turns out someone already had done exactly what I needed:\n\nThis morning I had occasion to deploy a branch of a git repository to\n a staging server but hadn’t the foggiest idea how. A quick search\n through the capistrano source code revealed that I could use set\n :branch \"branch_name\" in my deploy script. I tried it and it worked.\n I then figured I would need to make a similar change across all my\n branches. Of course, I’m a lazy sod and wondered if there wasn’t a\n better way.\nIf you’re not familiar with git, the output of the git branch command\n is a list of branches with an asterisk marking the one currently\n checked out on your local machine. For example:\n> git branch\n* drupal_authentication\nfragment_caching\nmaster\n\nSo, I figured, what if I just parsed the output and searched for the\n branch marked as current:\nset :branch, $1 if `git branch` =~ /\\* (\\S+)\\s/m\n\nNow I’m able to deploy whatever branch is current on my local machine\n from a single, shared, deploy script."
},
{
"role": "assistant",
"content": "This works with Capistrano >= 3.1:\nadd this line to config/deploy.rb:\nset :branch, ENV['BRANCH'] if ENV['BRANCH']\n\nand then call capistrano with:\ncap production deploy BRANCH=master\n\nThis solution works with Capistrano < 3.1:\n# call with cap -s env=\"<env>\" branch=\"<branchname>\" deploy\n\nset :branch, fetch(:branch, \"master\")\nset :env, fetch(:env, \"production\")"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-blame - Show what revision and author last modified each line of a file"
},
{
"role": "assistant",
"content": "MAPPING AUTHORS See gitmailmap ."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-show - Show various types of objects -O<orderfile>"
},
{
"role": "assistant",
"content": "Control the order in which files appear in the output.\nThis overrides the diff.orderFile configuration variable\n(see git-config ). To cancel diff.orderFile ,\nuse -O/dev/null . The output order is determined by the order of glob patterns in\n<orderfile>.\nAll files with pathnames that match the first pattern are output\nfirst, all files with pathnames that match the second pattern (but not\nthe first) are output next, and so on.\nAll files with pathnames that do not match any pattern are output\nlast, as if there was an implicit match-all pattern at the end of the\nfile.\nIf multiple pathnames have the same rank (they match the same pattern\nbut no earlier patterns), their output order relative to each other is\nthe normal order. <orderfile> is parsed as follows: Blank lines are ignored, so they can be used as separators for\nreadability. Lines starting with a hash (\" # \") are ignored, so they can be used\nfor comments. Add a backslash (\" \\ \") to the beginning of the\npattern if it starts with a hash. Each other line contains a single pattern. Patterns have the same syntax and semantics as patterns used for\nfnmatch(3) without the FNM_PATHNAME flag, except a pathname also\nmatches a pattern if removing any number of the final pathname\ncomponents matches the pattern. For example, the pattern \" foo*bar \"\nmatches \" fooasdfbar \" and \" foo/bar/baz/asdf \" but not \" foobarx \"."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Why does the 'git blame' timeline sometimes appear in vscode, and how do I hide it?\nI use vscode. Sometimes I seem to click or type something accidentally and a timeline view (similar to the one described in How can I view the Git history in Visual Studio Code?) appears.\n\nHow do I close the timeline view?\nI thought the option to hide the timeline would be in View > Appearance but I can't see any references to 'timeline' history' 'commits' etc.\nRight now I just close the file and reopen it but I'm sure there's a proper solution."
},
{
"role": "assistant",
"content": "I also unintentionally opened blame history and didn't know how.\nThe reason why the timeline is opening unexpectedly is that clicking the message above the first line in a file opens and close the latest blame - see red area in the screenshot.\n\nTo fix it (thanks GitKraken for the advice on Twitter):\nCommand/ctrl + shift + P > GitLens: Open Settings > then scroll down to Git CodeLens:"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Git conflict markers [duplicate]\nThis question already has answers here:\n \n \n\n\n\n\nGit merge left HEAD marks in my files\n\n (6 answers)\n \n\nClosed 11 years ago.\n\n\n\nAfter I pulled from remote branch, I got conflict, when I open the file it looks something like below:\n<<<<<<< HEAD:file.txt\nHello world\n=======\nGoodbye\n>>>>>>> 77976da35a11db4580b80ae27e8d65caf5208086:file.txt\n\nI need some explanations of the markers, which portion of code is pulled from remote and which is from local?\nWhat does the code 77976da35a11db4580b80ae27e8d65caf5208086 stand for?"
},
{
"role": "assistant",
"content": "The line (or lines) between the lines beginning <<<<<<< and ====== here:\n<<<<<<< HEAD:file.txt\nHello world\n=======\n\n... is what you already had locally - you can tell because HEAD points to your current branch or commit. The line (or lines) between the lines beginning ======= and >>>>>>>:\n=======\nGoodbye\n>>>>>>> 77976da35a11db4580b80ae27e8d65caf5208086:file.txt\n\n... is what was introduced by the other (pulled) commit, in this case 77976da35a11. That is the object name (or \"hash\", \"SHA1sum\", etc.) of the commit that was merged into HEAD. All objects in git, whether they're commits (version), blobs (files), trees (directories) or tags have such an object name, which identifies them uniquely based on their content."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git - the stupid content tracker GIT_INDEX_VERSION"
},
{
"role": "assistant",
"content": "This environment variable specifies what index version is used\nwhen writing the index file out. It won’t affect existing index\nfiles. By default index file version 2 or 3 is used. See git-update-index for more information."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Mirroring from GitLab to GitHub\nI have been using a private GitLab instance to hold all my code. But since most of the staff that work with me now have a GitHub account, i would really like to get moving and mirror my Gitlab repo to Github.\nMy situation:\n\na server running Gitlab (Omnibus)\na Github account for which I'll create an organization for where me and my staff can be organized together.\n\nI know that there is the --mirror switch in git, but I am not really sure how this is ment to work. Documentation I found online was very wonky... So it would be nice if someone could help me out. :)"
},
{
"role": "assistant",
"content": "GitLab has now an option to do this from the UI, go to the Settings->Repository of your repo:\nhttps://gitlab.com/yourUserNameInGitLab/yourRepoName/settings/repository\nThen find the option \"Mirror a repository\" and click on expand. What you want to do is choose the \"Push\" mirror direction and fill this URL:\nhttps://[email protected]/yourUserNameInGitHub/yourRepoName.git\nIn the password field, you have to use a Personal Access Token (as GitHub has deprecated password access now), which you can generate here: https://github.com/settings/tokens (don't forget to enable the \"repo\" and \"workflow\" permissions when generating it)"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Using git commands in a TeamCity Build Step\nOne of my TeamCity v7.0 build projects relies on using a diff between the current development branch and the master branch to determine what needs to be run. I've written a small script that uses something like:\ngit diff origin/master..origin/QA --name-only --diff-filter=AM | DoSomethingWithThoseFiles\n\nUnfortunately, the build log indicates that git diff is not working. When I go into the buildAgent/work directory for this project, I see that there is no .git folder, so it cannot perform the git operations required.\nI've put teamcity.git.use.local.mirrors=true in the buildAgent.properties file as mentioned at TW-15873, but that does not seem to help in any way.\nIs there anything I can do to get the list of files changed between two branches in a script for my build step?"
},
{
"role": "assistant",
"content": "Try changing the VCS checkout mode to \"Always checkout files on agent\" as documented here. That should give the build script access to the .git folder."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How can I remove an applied git patch?\n\nI have a git repo, where we apply many patches in test environment.\ngit apply --stat --check --ignore-whitespace /home/kent/Desktop/patches/test.patch --exclude .gitignore\n\ngit am -s --ignore-whitespace /home/kent/Desktop/patches/test.patch --exclude .gitignore --exclude .gitignore\n\nIf I have to remove the patch and apply a new one, at present I clone the live content and reapply all the test patches and push again.\nThis process is somehow cumbersome and also leads to errors at times I also miss one or two patches.\nI wanted to know if there is a way to remove a patch and apply the new one\nAlso, to add one way is there if we commit each time to the patch and then i can use:\ngit revert <<commit id>>\n\nThe above does not work for me at all times."
},
{
"role": "assistant",
"content": "TL;DR\nYou can revert a patch with:\n$ git apply -R <patch>\n\n\nYou can generate a patch either by one of the following:\nThis will generate a patch from a diff\n$ git diff --patch > 0001-some-modifications.patch\n\nIf you want to generate a patch for just the HEAD commit:\n$ git show --patch HEAD^ > 0001-some-modifications.patch\n\nYou can generate a patch for the previous 3 commits from HEAD:\n$ git show --patch HEAD~3 > 0001-some-modifications.patch\n\nYou can apply the patch by:\n$ git apply -- 0001-some-modifications.patch\n\nYou can revert a patch with:\n$ git apply -R <patch>\n\nWhen you generate a patch it is just a diff with metadata; files, line numbers adds/removes; something along the following:\ncommit 9dad147cbf16befecdef2e812c1249499bdef5ac\nAuthor: My Name <[email protected]>\nDate: Mon Dec 21 20:46:01 2015 +0000\n\n Example commit message.\n\ndiff --git a/src/example.md b/src/example.md\nnew file mode 100644\nindex 0000000..ab73512\n--- /dev/null\n+++ b/src/example.md\n@@ -0,0 +1,3 @@\n+# Example document\n+\n+ Hello World\n\nSo when you use git apply you're essentially applying the edits as per to the tree.\nWhen you then run git apply -R git will simply do the opposite to the patch."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-init - Create an empty Git repository or reinitialize an existing one <perm>"
},
{
"role": "assistant",
"content": "<perm> is a 3-digit octal number prefixed with 0 and each file\nwill have mode <perm> . <perm> will override users' umask (2)\nvalue (and not only loosen permissions as group and all do). 0640 will create a repository which is group-readable, but\nnot group-writable or accessible to others. 0660 will create a repo\nthat is readable and writable to the current user and group, but\ninaccessible to others (directories and executable files get their x bit from the r bit for corresponding classes of users)."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How does Git save space and is fast at the same time?\n\nI just saw the first Git tutorial at http://blip.tv/play/Aeu2CAI.\nHow does Git store all the versions of all the files, and how can it still be more economical in space than Subversion which saves only the latest version of the code?\nI know this can be done using compression, but that would be at the cost of speed, but this also says that Git is much faster (though where it gains the maximum is the fact that most of its operations are offline).\nSo, my guess is that\n\nGit compresses data extensively\nIt is still faster because uncompression + work is still faster than network_fetch + work\n\nAm I correct? Even close?"
},
{
"role": "assistant",
"content": "I assume you are asking how it is possible for a git clone (full repository + checkout) to be smaller than checked-out sources in Subversion. Or did you mean something else?\nThis question is answered in the comments\n\nRepository size\nFirst you should take into account that along checkout (working version) Subversion stores pristine copy (last version) in those .svn subdirectories. Pristine copy is stored uncompressed in Subversion.\nSecond, git uses the following techniques to make repository smaller:\n\neach version of a file is stored only once; this means that if you have only two different versions of some file in 10 revisions (10 commits), git stores only those two versions, not 10.\nobjects (and deltas, see below) are stored compressed; text files used in programming compress really well (around 60% of original size, or 40% reduction in size from compression)\nafter repacking, objects are stored in deltified form, as a difference from some other version; additionally git tries to order delta chains in such a way that the delta consists mainly of deletions (in the usual case of growing files it is in recency order); IIRC deltas are compressed as well.\n\nPerformance (speed of operations)\nFirst, any operation that involves network would be much slower than a local operation. Therefore for example comparing current state of working area with some other version, or getting a log (a history), which in Subversion involves network connection and network transfer, and in Git is a local operation, would of course be much slower in Subversion than in Git. BTW. this is the difference between centralized version control systems (using client-server workflow) and distributed version control systems (using peer-to-peer workflow), not only between Subversion and Git.\nSecond, if I understand it correctly, nowadays the limitation is not CPU but IO (disk access). Therefore it is possible that the gain from having to read less data from disk because of compression (and being able to mmap it in memory) overcomes the loss from having to decompress data.\nThird, Git was designed with performance in mind (see e.g. GitHistory page on Git Wiki):\n\nThe index stores stat information for files, and Git uses it to decide without examining files if the files were modified or not (see e.g. core.trustctime config variable).\nThe maximum delta depth is limited to pack.depth, which defaults to 50. Git has delta cache to speed up access. There is (generated) packfile index for fast access to objects in packfile.\nGit takes care to not touch files it doesn't have to. For example when switching branches, or rewinding to another version, Git updates only files that changed. The consequence of this philosophy is that Git does support only very minimal keyword expansion (at least out of the box).\nGit uses its own version of LibXDiff library, nowadays also for diff and merge, instead of calling external diff / external merge tool.\nGit tries to minimize latency, which means good perceived performance. For example it outputs first page of \"git log\" as fast as possible, and you see it almost immediately, even if generating full history would take more time; it doesn't wait for full history to be generated before displaying it.\nWhen fetching new changes, Git checks what objects you have in common with the server, and sends only (compressed) differences in the form of thin packfile. Admittedly Subversion can (or perhaps by default it does) also send only differences when updating.\n\nI am not a Git hacker, and I probably missed some techniques and tricks that Git uses for better performance. Note however that Git heavily uses POSIX (like memory mapped files) for that, so the gain might be not as large on MS Windows."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How do I add files and folders into GitHub repos?\nI created an account on GitHub and I'm facing a problem with adding files. I have added readme.txt. Also, I have 3 other PHP files and a folder including images.\nHow do I add the files and folder? I tried it with git pull because git push origin -u master showed me an error."
},
{
"role": "assistant",
"content": "You can add files using git add, example git add README, git add <folder>/*, or even git add *\nThen use git commit -m \"<Message>\" to commit files\nFinally git push -u origin master to push files.\nWhen you make modifications run git status which gives you the list of files modified, add them using git add * for everything or you can specify each file individually, then git commit -m <message> and finally, git push -u origin master\nExample - say you created a file README, running git status gives you\n$ git status\n# On branch master\n# Untracked files:\n# (use \"git add <file>...\" to include in what will be committed)\n#\n# README\n\nRun git add README, the files are staged for committing. Then run git status again, it should give you - the files have been added and ready for committing.\n$ git status\n# On branch master\n# Changes to be committed:\n# (use \"git reset HEAD <file>...\" to unstage)\n#\n# new file: README\n#\n\nnothing added to commit but untracked files present (use \"git add\" to track)\n\nThen run git commit -m 'Added README'\n$ git commit -m 'Added README'\n[master 6402a2e] Added README\n 0 files changed, 0 insertions(+), 0 deletions(-)\n create mode 100644 README\n\nFinally, git push -u origin master to push the remote branch master for the repository origin.\n$ git push -u origin master\nCounting objects: 4, done.\nDelta compression using up to 2 threads.\nCompressing objects: 100% (2/2), done.\nWriting objects: 100% (3/3), 267 bytes, done.\nTotal 3 (delta 1), reused 0 (delta 0)\nTo [email protected]:xxx/xxx.git\n 292c57a..6402a2e master -> master\nBranch master set up to track remote branch master from origin.\n\nThe files have been pushed successfully to the remote repository.\nRunning a git pull origin master to ensure you have absorbed any upstream changes\n$ git pull origin master\nremote: Counting objects: 12, done.\nremote: Compressing objects: 100% (4/4), done.\nremote: Total 8 (delta 4), reused 7 (delta 3)\nUnpacking objects: 100% (8/8), done.\nFrom xxx.com:xxx/xxx\n * branch master -> FETCH_HEAD\nUpdating e0ef362..6402a2e\nFast-forward\n public/javascript/xxx.js | 5 ++---\n 1 files changed, 2 insertions(+), 3 deletions(-)\n create mode 100644 README\n\nIf you do not want to merge the upstream changes with your local repository, run git fetch to fetch the changes and then git merge to merge the changes. git pull is just a combination of fetch and merge.\nI have personally used gitimmersion - http://gitimmersion.com/ to get upto curve on git, its a step-by-step guide, if you need some documentation and help"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to change the File Mode on GitHub?\n\n$ git add test-file\n\n$ git commit -m 'first commit'\n create mode 100644 test-file\n\n$ git push\n\n\n$ git update-index --add --chmod=+x test-file\n\n$ git commit -m 'change mode'\n mode change 100644 => 100755 test-file\n\n$ git push\n\n\nAfter that if you go to GitHub it still shows as 100644 no matter what."
},
{
"role": "assistant",
"content": "MSYS is not the problem. Even if MSYS chmod doesn't work (it doesn't), Git has a built in way of getting around that problem, i.e. git update-index --chmod=+x. Let it be clear that git update-index only messes with the index (staging area), not the local repository (working directory).\nI am convinced the problem is with GitHub. On GitHub if a file is initially pushed with mode 100775, all is well. If a file is initially pushed as 100644 it causes a problem. Attempts to change the file mode will succeed with git add, succeed with git commit, succeed with git push, and even show up in the GitHub file history, but not be reflected on the \"blob/master\" page on GitHub.\nUpdate\n\nFrom: Petros Amiridis (GitHub Staff)\nSubject: How to change FIle Mode on GitHub?\nI have some good news. Our awesome team has just confirmed it is a caching bug\non our end. Our team has deployed a fix."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Git repo inside repo [duplicate]\nThis question already has answers here:\n \n \n\n\n\n\nHow do I work with a git repository within another repository?\n\n (5 answers)\n \n\nClosed 8 years ago.\n\n\n\nI want to clone https://github.com/getyouridx/pychargify into my django project, and will need to pull updates from time-to-time.\nJust for clarification, could I simply write a gitignore from the root directory of the django project e.g. .gitignore: pychargify/.git or are there other pitfalls I should be aware of?"
},
{
"role": "assistant",
"content": "Git has a feature for having a repository within another: submodules.\ngit submodule add https://github.com/getyouridx/pychargify.git\n\nBe sure to read the entire documentation on submodules, as there as a few quirks involved with using them, and additional steps that need to be taken when doing a fresh clone of your own repository to initialize the submodules.\nAlso note that all submodule commands must be done in the root directory of your repository."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Able to push to all git remotes with the one command?\nInstead of doing:\ngit push origin --all && git push nodester --all && git push duostack --all\n\nIs there a way to do that with just one command?\nThanks :)"
},
{
"role": "assistant",
"content": "Create an all remote with several repo URLs to its name:\ngit remote add all origin-host:path/proj.git\ngit remote set-url --add all nodester-host:path/proj.git\ngit remote set-url --add all duostack-host:path/proj.git\n\nThen just git push all --all.\n\nThis is how it looks in .git/config:\n [remote \"all\"]\n url = origin-host:path/proj.git\n url = nodester-host:path/proj.git\n url = duostack-host:path/proj.git"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-config - Get and set repository or global options status.relativePaths"
},
{
"role": "assistant",
"content": "By default, git-status shows paths relative to the\ncurrent directory. Setting this variable to false shows paths\nrelative to the repository root (this was the default for Git\nprior to v1.5.4)."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-config - Get and set repository or global options receive.advertiseAtomic"
},
{
"role": "assistant",
"content": "By default, git-receive-pack will advertise the atomic push\ncapability to its clients. If you don’t want to advertise this\ncapability, set this variable to false."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to \"resolve fatal: Not a git repository\"?\nI was trying to remove one sub-module from the project\nTried rm -rf .git/modules/submodulePath \nAfter that I am having the issue\nfatal: Not a git repository"
},
{
"role": "assistant",
"content": "These two files contains absolute submodule path:\n{submodule}/.git\n.git/modules/{submodule}/config\n\nSo, if you moved the repo, the absolute path in these two files are not valid, and cause the 'not a git repository' error. Just fix these files manually.\nUpdate:\n\nDelete the relevant section from the .gitmodules file. You can use below command:\ngit config -f .gitmodules --remove-section \"submodule.submodule_name\"\n\n\nStage the .gitmodules changes\ngit add .gitmodules\n\n\nDelete the relevant section from .git/config. You can use below command:\ngit submodule deinit -f \"submodule_name\"\n\n\nRemove the gitlink (no trailing slash):\ngit rm --cached path_to_submodule\n\n\nCleanup the .git/modules:\nrm -rf .git/modules/path_to_submodule\n\n\nCommit:\ngit commit -m \"Removed submodule <name>\"\n\n\nDelete the now untracked submodule files\nrm -rf path_to_submodule"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to push from one branch to another and checkout?\nI am trying to implement the setup outlined here http://toroid.org/ams/git-website-howto but with one difference. On my local repository I want to use a branch different to master.\nSo when I go to push the initial files rather than push the master files I want to push the files from my demo branch to the master branch on the remote repository. For example:\ngit push web +master:refs/heads/demo\n\nBut when I do this I get the following error after it completes uploading all of the files:\nremote: fatal: You are on a branch yet to be born\n\nIs it possible to do what I am trying to do with this setup?"
},
{
"role": "assistant",
"content": "If the local branch is called \"demo\" and you want to push to branch called \"master\" on the remote called \"web\", then do the following:\ngit push web demo:master\n\nIf you want to merge from the \"master\" branch on the remote \"web\" into your current branch, you can do the following:\ngit fetch web\ngit merge web/master"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Fast-forward merge is not possible. To merge this request, first rebase locally\n\nRecently, I have created newbranch and created a merge request to Master branch. Before TeamLead accept merge request into Master branch another team member was committed another fix to the same branch(newbranch). After that I committed my local changes and pulled the changes in newbranch to local branch. And I pushed my local commit to newbranch\n\nMy TeamLead told me to rebase my branch to an earlier version.\nAnd resolve conflicts.\nI don't know what to do now. Any idea?"
},
{
"role": "assistant",
"content": "Starting on your newBranch:\ngit checkout master to get back on the master branch\ngit pull origin master to get the most up-to-date version of the master branch\ngit checkout newBranch to get back on your newBranch\ngit rebase origin/master -i to perform an interactive rebase. The command will take you through and let you pick commits, rename them, squash them, etc. Assuming you will want to keep them all, it will pause when there are merge conflicts and then you'll have to resolve them in your text editor, it will tell you where (in your text editor) that the conflicts occur. You will have to add those files after fixing them then do git rebase --continue to proceed with the rebase.\nWhen you're done with the rebase your newBranch will be synced up with master and have any commits in master that weren't there when you started your work, and all merge conflicts will be resolved so that you can easily merge your newBranch."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-format-patch - Prepare patches for e-mail submission --in-reply-to=<message-id>"
},
{
"role": "assistant",
"content": "Make the first mail (or all the mails with --no-thread ) appear as a\nreply to the given <message-id>, which avoids breaking threads to\nprovide a new patch series."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to use Go with a private GitLab repo\n\nGitLab is a free, open-source way to host private .git repositories but it does not seem to work with Go. When you create a project it generates a URL of the form:\n[email protected]:private-developers/project.git\n\nwhere:\n\n1.2.3.4 is the IP address of the gitlab server\nprivate-developers is a user group which has access to the private repo\n\nGolang 1.2.1 doesn't seem to understand this syntax.\ngo get [email protected]:private-developers/project.git\n\nresults in:\npackage [email protected]/project.git: unrecognized import path \"[email protected]/project.git\"\n\nIs there a way to get this to work?"
},
{
"role": "assistant",
"content": "Run this command:\ngit config --global url.\"[email protected]:\".insteadOf \"https://1.2.3.4/\"\n\nAssuming you have the correct privileges to git clone the repository, this will make go get work for all repos on server 1.2.3.4. \nI tested this with go version 1.6.2, 1.8, and 1.9.1."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Switch to another Git tag\n\nHow do I check out version version/tag 1.1.4 of the rspec bundle?\ncd ~/Library/Application\\ Support/TextMate/Bundles/\ngit clone git://github.com/rspec/rspec-tmbundle.git RSpec.tmbundle\nosascript -e 'tell app \"TextMate\" to reload bundles'"
},
{
"role": "assistant",
"content": "Clone the repository as normal:\ngit clone git://github.com/rspec/rspec-tmbundle.git RSpec.tmbundle\n\nThen checkout the tag you want like so:\ngit checkout tags/1.1.4\n\nThis will checkout out the tag in a 'detached HEAD' state. In this state, \"you can look around, make experimental changes and commit them, and [discard those commits] without impacting any branches by performing another checkout\".\nTo retain any changes made, move them to a new branch:\ngit checkout -b 1.1.4-jspooner\n\nYou can get back to the master branch by using:\ngit checkout master\n\nNote, as was mentioned in the first revision of this answer, there is another way to checkout a tag:\ngit checkout 1.1.4\n\nBut as was mentioned in a comment, if you have a branch by that same name, this will result in git warning you that the refname is ambiguous and checking out the branch by default:\nwarning: refname 'test' is ambiguous.\nSwitched to branch '1.1.4'\n\nThe shorthand can be safely used if the repository does not share names between branches and tags."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "renamed heroku app from website, now it's not found\nAfter renaming my heroku app from the heroku website, whenever I cd to its directory in a terminal and run any heroku command, I get App not found. Does anybody know of a way to remedy this?"
},
{
"role": "assistant",
"content": "Try to update the git remote for the app:\ngit remote rm heroku\ngit remote add heroku [email protected]:yourappname.git"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to connect existing Android Studio project to existing Github repository\nSo I am new to Android development and Android Studio.\nI used Android Studio to create an Android project, and each time I wanted to commit the code to GitHub, I switched over to the command line and committed/pushed the code from there. \nHowever, I realize now that Android Studio has it's own features for connecting to GitHub. I'd like to use those features. \nSince the project already exists, I prefer not to just create a new GitHub repository from Android Studio and delete the old one. I just want to connect the existing GitHub repository with the Android Studio project.\nHow can I sync these up?"
},
{
"role": "assistant",
"content": "Maybe it is a little bit late, but if it helps to someone here is what I do in command line:\ncd <proyect folder>\ngit init\ngit remote add origin <link to repo>\ngit fetch origin\ngit checkout master\n\nnote: if there are commits on the repo it may require you to remove conflicting files\ngit add --all\ngit commit -m \"<message>\"\ngit push"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-rev-list - Lists commit objects in reverse chronological order --cherry"
},
{
"role": "assistant",
"content": "A synonym for --right-only --cherry-mark --no-merges ; useful to\nlimit the output to the commits on our side and mark those that\nhave been applied to the other side of a forked history with git log --cherry upstream...mybranch , similar to git cherry upstream mybranch ."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How do you find your GitLab host name (to test your SSH key)?\n\nI just created a personal GitLab account and am trying to follow the steps on \nhttps://gitlab.com/help/ssh/README\nto deploy my SSH key to GitLab. I've completed up to step 5, and see my SSH key among 'Your SSH keys' in my User Settings -> SSH keys:\n\nI'm trying to now complete the optional 6th step, testing the key:\n\nMy GitLab username is khpeek, so I guessed my 'GitLab domain' is gitlab.com/khpeek. However, the test command\nssh -T [email protected]/khpeek\n\nyields an error message:\nssh: Could not resolve hostname gitlab.com/khpeek: Name or service not known\n\nApparently this is the wrong hostname. What would be the right one?"
},
{
"role": "assistant",
"content": "If you're using Gitlab on gitlab.com then the domain is simply gitlab.com so you should run ssh -T [email protected]"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-write-tree - Create a tree object from the current index"
},
{
"role": "assistant",
"content": "DESCRIPTION Creates a tree object using the current index. The name of the new\ntree object is printed to standard output. The index must be in a fully merged state. Conceptually, git write-tree sync()s the current index contents\ninto a set of tree files.\nIn order to have that match what is actually in your directory right\nnow, you need to have done a git update-index phase before you did the git write-tree ."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-worktree - Manage multiple working trees"
},
{
"role": "assistant",
"content": "BUGS Multiple checkout in general is still experimental, and the support\nfor submodules is incomplete. It is NOT recommended to make multiple\ncheckouts of a superproject."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to show Git log history (i.e., all the related commits) for a sub directory of a Git repository\nLet’s say that I have a Git repository that looks like this:\nfoo/\n .git/\n A/\n ... big tree here\n B/\n ... big tree here\n\nIs there a way to ask git log to show only the log messages for a specific directory? For example, I want to see what commits touched files in foo/A only."
},
{
"role": "assistant",
"content": "From directory foo/, use\n git log -- A\n\nYou need the '--' to separate <path>.. from the <since>..<until> refspecs.\n# Show changes for src/nvfs\n$ git log --oneline -- src/nvfs\nd6f6b3b Changes for Mac OS X\n803fcc3 Initial Commit\n\n# Show all changes (one additional commit besides in src/nvfs).\n$ git log --oneline\nd6f6b3b Changes for Mac OS X\n96cbb79 gitignore\n803fcc3 Initial Commit"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-status - Show the working tree status --ignored[=<mode>]"
},
{
"role": "assistant",
"content": "Show ignored files as well. The mode parameter is used to specify the handling of ignored files.\nIt is optional: it defaults to traditional . The possible options are: traditional - Shows ignored files and directories, unless\n--untracked-files=all is specified, in which case\nindividual files in ignored directories are\ndisplayed. no - Show no ignored files. matching - Shows ignored files and directories matching an\nignore pattern. When matching mode is specified, paths that explicitly match an\nignored pattern are shown. If a directory matches an ignore pattern,\nthen it is shown, but not paths contained in the ignored directory. If\na directory does not match an ignore pattern, but all contents are\nignored, then the directory is not shown, but all contents are shown."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Trouble setting up git with my GitHub Account error: could not lock config file\nI'm getting this error when trying to set the global config:\n$ git config --global user.name \"Your Name Here\"\nerror: could not lock config file /pathto/file/.gitconfig: No such file or directory\n\nand the file .gitconfig is already exists, anyone have any ideas??"
},
{
"role": "assistant",
"content": "A bit like in \"Trouble setting up Tower with my GitHub Account - error: could not lock config file\", check how that ~/.gitconfig file has been created.\nIe: with which rights associated to it?\nMake also sure your $HOME variable is correctly set when you are executing the git config --global command."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-fetch - Download objects and refs from another repository <repository>"
},
{
"role": "assistant",
"content": "The \"remote\" repository that is the source of a fetch\nor pull operation. This parameter can be either a URL\n(see the section GIT URLS below) or the name\nof a remote (see the section REMOTES below)."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Cannot push to Heroku because key fingerprint\nI am new to Rails, and I was trying to deploy a very simple app to Heroku. This is the second app that I deploy, and the first one I was able to do it just fine. However I am having some issues with this one. Whenever I \"git push heroku master\", I get this error:\n\n! Your key with fingerprint xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx is not authorized to >access my_heroku_app.\nfatal: The remote end hung up unexpectedly\n\nI have tried to manage my keys after logging in heroku. If I type in my console \"heroku keys\", then I get:\n\nNo keys for myemailaddress.\n\nHowever, If I run the comand \"heroku keys:add\" I get\n\nFound existing public key: /Users/michele/.ssh/id_rsa.pub\n Uploading ssh public key /Users/michele/.ssh/id_rsa.pub\n ! Fingerprint already exists. Please use one ssh key per Heroku account\n\nPlease help me! This is soo frustating, I have no idea what's wrong!\nThank you"
},
{
"role": "assistant",
"content": "I had to add my new rsa identity in my machine!\nSo, first of all I created a new rsa key:\nssh-keygen -t rsa -C \"giordano.scalzo[at]gmail.com\" -f ~/.ssh/id_rsa_heroku\n\nthen added it to my machine\nssh-add ~/.ssh/id_rsa_heroku\n\nand, finally, to Heroku\nheroku keys:add ~/.ssh/id_rsa_heroku.pub\n\nAfter that,\ngit push heroku master"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-rebase - Reapply commits on top of another base tip --update-refs --no-update-refs"
},
{
"role": "assistant",
"content": "Automatically force-update any branches that point to commits that\nare being rebased. Any branches that are checked out in a worktree\nare not updated in this way. If the configuration variable rebase.updateRefs is set, then this option\ncan be used to override and disable this setting. See also INCOMPATIBLE OPTIONS below."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "In Git how can you check which repo in Github you are pushing to from the command line?\nI have several projects I am working on. I am constantly pulling and pushing. Recently I made some changes to one of my files, added and committed and decided to push my project A, however it pushed into my Github Project B. I then did git pull for kicks and it this happened.\n\nbranch master -> FETCH_HEAD\nAlready up-to-date.\n\nIt did not pull none of my files from Project B. I then did git status and it showed every single file/folders in my directory as needing to be committed. How would I know which \"init\" I am on? How can I switch out of this state and how can I disregard these blind commits without losing my files?"
},
{
"role": "assistant",
"content": "I think you need to reconfig git remote\ntype git remote -v and see if there's a mismatch or not.\nIf there is, follow this instruction from github: https://help.github.com/articles/changing-a-remote-s-url/"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": ".gitignore after commit [duplicate]\nThis question already has answers here:\n \n \n\n\n\n\nHow do I make Git forget about a file that was tracked, but is now in .gitignore?\n\n (35 answers)\n \n\nClosed 3 years ago.\n\n\n\nI have a git repository hosted on Github. After committing many files, I am realizing that I need to create .gitignore and exclude .exe, .obj files.\nHowever, will it automatically remove these committed files from the repository? Is there any way to force that?"
},
{
"role": "assistant",
"content": "No you cannot force a file that is already committed in the repo to be removed just because it is added to the .gitignore \nYou have to git rm --cached to remove the files that you don't want in the repo. ( --cached since you probably want to keep the local copy but remove from the repo. ) So if you want to remove all the exe's from your repo do\ngit rm --cached /\\*.exe\n\n(Note that the asterisk * is quoted from the shell - this lets git, and not the shell, expand the pathnames of files and subdirectories)"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Resolving a merge request locally with a protected branch\n\nI am using Gitlab, and I have a conflict on my merge request that I cannot resolve with the online tool. I checkout the target branch and resolve the conflict, then ... Then what ?\n\nThe branch is protected, so no one is allowed to push on it.\nNo option available on Gitlab to do something like this.\n\nWhat is supposed to be the correct \"way\" of doing in those cases ? Are we supposed to create another branch to solve the conflict, then another merge request ? Or is there a commmand line / an alternative I failed to see when searching for a solution, like \"push the result of the solving conflict which is not a commit per se\" ?"
},
{
"role": "assistant",
"content": "Are we supposed to create another branch to solve the conflict, then\n another merge request ?\n\nYes, I'd suggest doing this.\n1) Create a new branch off the destination branch\n2) Merge your feature branch in it\n3) Solve conflicts, add them, and commit the merge\n4) Push that new branch to remote\n5) Create a new PR from the new branch to the destination one"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How do I generate a git commit log for the last month, and export it as CSV?\n\nIs there a way to generate a git commit log for the last month, and export it as a CSV file? I'm looking for something I can run from the command line, or a 3rd party app. I'd like the following columns: author, date of commit, subject, file edited and hash."
},
{
"role": "assistant",
"content": "You can use the --since and --pretty option of git log, for instance:\ngit log --since=\"last month\" --pretty=format:'%h,%an,%ar,%s' > log.csv\n\nRefer to the PRETTY FORMATS section of the Git log man page for more options."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Why am I merging \"remote-tracking branch 'origin/develop' into develop\"?\nI'm the only one in my organization who's making commits with the following message:\n\nMerge remote-tracking branch 'origin/develop' into develop \n\nNot sure what I'm doing to cause them, but I'd like to stop.\nWhat command am I issuing to create this commit, and what is the proper command I ought to be using to not produce it?"
},
{
"role": "assistant",
"content": "git pull is probably creating the commit. If you make a local commit and then run git pull after someone else pushes a commit up to the repository, Git downloads the other developer's commit and then merges it into your local branch.\nHow to avoid these merge commits in the future\nYou could use git pull --rebase to prevent this from happening in the future, but rebasing has its perils, and I recommend avoiding pull altogether.\nInstead, I encourage you to follow this usage pattern:\n# download the latest commits\ngit remote update -p\n\n# update the local branch\ngit merge --ff-only @{u}\n\n# if the above fails with a complaint that the local branch has\n# diverged:\ngit rebase -p @{u}\n\nExplanation\n\ngit remote update -p downloads all of the commits in the remote repositories and updates the remote tracking branches (e.g., origin/master). It does NOT touch your working directory, index, or local branches.\nThe -p argument prunes deleted upstream branches. Thus, if the foo branch is deleted in the origin repository, git remote update -p will automatically delete your origin/foo ref.\ngit merge --ff-only @{u} tells Git to merge the upstream branch (the @{u} argument) into your local branch but only if your local branch can be \"fast forwarded\" to the upstream branch (in other words, if it hasn't diverged).\ngit rebase -p @{u} effectively moves the commits you've made but haven't yet pushed on top of the upstream branch, which eliminates the need to create the silly merge commits you're trying to avoid. This improves the linearity of the development history, making it easier to review.\nThe -p option tells Git to preserve merges. This prevents Git from linearizing the commits being rebased. This is important if, for example, you merged a feature branch into master. Without -p, every commit on the feature branch would be duplicated on master as part of the linearization done by git rebase. This would make the development history harder to review, not easier.\nBeware: git rebase might not do what you expect it to do, so review the results before pushing. For example:\ngit log --graph --oneline --decorate --date-order --color --boundary @{u}..\n\n\nI prefer this approach over git pull --rebase for the following reasons:\n\nIt allows you to see the incoming upstream commits before your modify your history to incorporate them.\nIt allows you to pass the -p (--preserve-merges) option to git rebase in case you need to rebase an intentional merge (e.g., merge of an already-pushed feature branch into master).\n\nShorthand: git up instead of git pull\nTo make it easy to do the above, I recommend creating an alias called up:\ngit config --global alias.up '!git remote update -p; git merge --ff-only @{u}'\n\nNow all you need to do to bring your branch up to date is to run:\ngit up\n\ninstead of git pull. If you get an error because your local branch has diverged from the upstream branch, that's your cue to rebase.\nWhy not git pull --rebase?\nRunning git pull --rebase is equivalent to running git fetch followed by git rebase. This attempts to fast-forward to the new upstream commits, but if that's not possible then it will rebase your local commits onto the new upstream commits. This is usually OK, but be careful:\n\nRebase is an advanced topic, and you should understand the implications before rebasing.\ngit pull --rebase does not give you an opportunity to examine the commits before incorporating them. Depending on what changed upstream, it's quite possible that rebase is the wrong operation—a rebase --onto, merge, reset, or push -f might be more appropriate than a plain rebase.\nIt is not (currently) possible to pass --preserve-merges to the rebase operation, so any intentional merge of a feature branch will be linearized, replaying (and thus duplicating) all of the feature branch commits.\n\n\"Fixing\" an existing merge commit created by git pull\nIf you haven't yet pushed a merge commit created by git pull, you can rebase out the merge commit. Assuming you haven't made any intentional merges (e.g., merging an already-pushed feature branch into your current branch), the following should do it:\ngit rebase @{u}\n\nThe above command tells Git to select all of the non-merge commits reachable from HEAD (the current commit), minus all the commits reachable from @{u} (which is shorthand for \"the upstream branch\", i.e., origin/master if HEAD is master), replay (cherry-pick) them on top of the upstream branch, and then move the current branch reference to point to the result of replaying the commits. This effectively moves the non-merge commits onto the most recent upstream commit, which eliminates the merge created by git pull.\nIf you have an intentional merge commit, you don't want to run git rebase @{u} because it will replay everything from the other branch. Dealing with this case is substantially more complicated, which is why it's good to use git up and avoid git pull altogether. You'll probably have to use reset to undo the merge created by pull and then do git rebase -p @{u}. The -p argument to git rebase hasn't worked reliably for me, so you might end up having to use reset to undo the intentional merge, update your local branch to @{u}, and then redo the intentional merge (which is a pain if there were a lot of hairy merge conflicts)."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Add previously ignored directory to Git repository\nMy .gitignore file looks like:\nhtml/\ncache/\nresources/\n# Temp files often created by editors\n*.~\n\nI know wish to start tracking a specific directory in html, so I add `!html/support/\nhtml/\ncache/\nresources/\n# Temp files often created by editors\n*.~\n# Track support\n!html/support/\n\nAfter doing so, however, Git still doesn't seem to track html/support/ and all its children.\nHow do I add a previously ignored directory to Git repository?"
},
{
"role": "assistant",
"content": "Not ignoring doesn't mean tracking.\nJust use \ngit add html/support/\n\nat the root of your git repository.\nIf the file is still ignored, though, you can use git add -f to force adding it (this will not modify the .gitignore file, just allow one little exception) :\ngit add -f html/support/"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Git always asks for my ssh-key passphrase\n\nI have a problem that occurs when using git.\nWhen I use the command git pull origin my_branch or git fetch or git push origin my_branch, git always asks for my passphrase for key. I don't understand why this occurs?\nCan someone please explain why and how to avoid entering the passphrase each time.\n$ git fetch\nEnter passphrase for key '/home/khanhpn/.ssh/id_rsa':"
},
{
"role": "assistant",
"content": "Like Nasreddine says, it's because your key is encrypted with a passphrase to prevent others from reading it.\nThe most convenient way of using passphrased keys is by using ssh-agent to start an authentication agent (which runs in the background):\n$ eval \"$(ssh-agent)\"\nAgent pid 44304\n\n...and then using ssh-add to register your key with the agent so that it's used automatically for subsequent SSH connections:\n$ ssh-add ~/.ssh/id_rsa\nEnter passphrase for /home/khanhpn/.ssh/id_rsa:\n\nYou'll be asked to enter your passphrase when you run ssh-add, but you won't need to do so again while ssh-agent is running.\nYou can find more information on GitHub. Also note that you'll have to do this every time you log in, so you might like to add the eval \"$(ssh-agent)\" step to your .profile script."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Git LFS: Get the complete list from the whole repository\nI have only found git lfs ls-files but this command give only the list from a specific ref.\nThere is a way to have the whole list of LFS object from a Git repository?"
},
{
"role": "assistant",
"content": "You can do this in Git LFS v2.4.0 and later using the --all flag\ngit lfs ls-files --all\n\nYou can read more about it in this pull request."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "\"Unable to find remote helper for 'https'\" during git clone\nI am unable to clone HTTPS repositories. I can clone SSH repos fine, but not HTTPS repos. I cannot test the GIT protocol since I am behind a corporate firewall.\nThis is what I am trying to do:\n$ git clone https://github.com/nvie/gitflow.git\nCloning into gitflow...\nfatal: Unable to find remote helper for 'https'\n\nI have so far tried the following (based on Google searches)\n\nPurging and installing Git through apt-get\nInstalling build-deps for Git through apt-get\nInstalling curl dev libraries \nInstalling expat libraries\nDownloading Git source and building using:\n\n./configure --prefix=/usr --with-curl --with-expat\nAlso tried pointing configure at curl binary (./configure --prefix=/usr --with-curl=/usr/bin/curl)\n\n\nI have tried everything I can find on the internet with no luck. Can anyone help me?\nGit version = 1.7.6.4\nOS = Ubuntu 11.04"
},
{
"role": "assistant",
"content": "It looks like not having (lib)curl-devel installed when you compile git can cause this.\nIf you install (lib)curl-devel, and then rebuild/install git, this should solve the problem:\n$ yum install curl-devel\n$ # cd to wherever the source for git is\n$ cd /usr/local/src/git-1.7.9 \n$ ./configure\n$ make\n$ make install\n\nThis worked for me on Centos 6.3.\nIf you don't have yum, you can download the source to curl-devel here:\n\nhttp://curl.se/dlwiz/?type=devel\n\n\nIf you are running Ubuntu instead:\nsudo apt-get install libcurl4-openssl-dev"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "gitglossary - A Git Glossary dereference"
},
{
"role": "assistant",
"content": "Referring to a symbolic ref : the action of accessing the reference pointed at by a symbolic ref. Recursive\ndereferencing involves repeating the aforementioned process on the\nresulting ref until a non-symbolic reference is found. Referring to a tag object : the action of accessing the object a tag points at. Tags are recursively dereferenced by\nrepeating the operation on the result object until the result has either a\nspecified object type (where applicable) or any non-\"tag\"\nobject type. A synonym for \"recursive dereference\" in the context of tags is\n\" peel \". Referring to a commit object : the action of accessing\nthe commit’s tree object. Commits cannot be dereferenced recursively. Unless otherwise specified, \"dereferencing\" as it used in the context of Git\ncommands or protocols is implicitly recursive."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "gitcli - Git command-line interface and conventions"
},
{
"role": "assistant",
"content": "NOTES ON FREQUENTLY CONFUSED OPTIONS Many commands that can work on files in the working tree\nand/or in the index can take --cached and/or --index options. Sometimes people incorrectly think that, because\nthe index was originally called cache, these two are\nsynonyms. They are not — these two options mean very\ndifferent things. The --cached option is used to ask a command that\nusually works on files in the working tree to only work\nwith the index. For example, git grep , when used\nwithout a commit to specify from which commit to look for\nstrings in, usually works on files in the working tree,\nbut with the --cached option, it looks for strings in\nthe index. The --index option is used to ask a command that\nusually works on files in the working tree to also affect the index. For example, git stash apply usually\nmerges changes recorded in a stash entry to the working tree,\nbut with the --index option, it also merges changes to\nthe index as well. git apply command can be used with --cached and --index (but not at the same time). Usually the command\nonly affects the files in the working tree, but with --index , it patches both the files and their index\nentries, and with --cached , it modifies only the index\nentries. See also https://lore.kernel.org/git/[email protected]/ and https://lore.kernel.org/git/[email protected]/ for further\ninformation. Some other commands that also work on files in the working tree and/or\nin the index can take --staged and/or --worktree . --staged is exactly like --cached , which is used to ask a\ncommand to only work on the index, not the working tree. --worktree is the opposite, to ask a command to work on the\nworking tree only, not the index. The two options can be specified together to ask a command to work\non both the index and the working tree."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "What happens when I do git pull origin master in the develop branch?\nLet's say I have a private topic branch called develop with 2 commits ahead of master.\nWhat does git pull origin master do?\nPull everything from the remote master in the local develop and merge it? Pull everything in the local master branch and merge it?\nAnd is there a way to update master from develop without git checkout master first?"
},
{
"role": "assistant",
"content": "git pull origin master pulls the master branch from the remote called origin into your current branch. It only affects your current branch, not your local master branch.\nIt'll give you history looking something like this:\n- x - x - x - x (develop)\n \\ /\n x - x - x (origin/master)\n\nYour local master branch is irrelevant in this. git pull is essentially a combination of git fetch and git merge; it fetches the remote branch then merges it into your current branch. It's a merge like any other; it doesn't do anything magical.\nIf you want to update your local master branch, you have no choice but to check it out. It's impossible to merge into a branch that's not checked out, because Git needs a work tree in order to perform the merge. (In particular, it's absolutely necessary in order to report merge conflicts and allow you to resolve them.)\nIf you happen to know that pulling into master would be a fast-forward (i.e. you have no commits in your local master branch that aren't in origin's master) you can work around, as described in this answer."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Can I use \"git checkout --\" on two files?\nIs it possible to use git checkout -- on multiple files in order to discard the changes? \nIf so how would I specify multiple files?"
},
{
"role": "assistant",
"content": "Run the command multiple times\ngit checkout -- path/to/file/one\ngit checkout -- path/to/file/two\n\nOr specify the multiple files in the same line:\ngit checkout -- path/to/file/one path/to/file/two\n\nYou can also specify entire folders which will recurse to all files below them.\ngit checkout -- path/to/folder\ngit checkout -- . # for the current path"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "GitHub Pull Request to a new Upstream Branch\n\nMy workflow: I have a fork (origin) of a remote project (upstream). I have created a branch, topic/TICKET. I want to create a pull request of my origin branch to the upstream project in a same-named, brand new \"topic/TICKET\" branch. In other words, I don't want my pull request toward the master branch or any existing branch.\nWhen using BitBucket I have this option. When I create my PR, I select my origin branch and then the remote branch selection allows \"Create new branch (topic/TICKET)\".\nIn GitHub I don't appear to have this option. I can type in the new branch name; but then the option to continue greys out until I select a valid, existing branch upstream.\nThe annoying work-around is creating the branches upstream before I perform the PR; but it requires asking someone who can commit upstream -- it seems to me like there must be an easier way to do this. \nSo, is there any way with GitHub to create a pull request to create a new upstream branch, or is this just a known limitation?"
},
{
"role": "assistant",
"content": "I was trying a similar thing, and the only solution I got is to have an user with push permission to upstream.\nThat way you could do a first push to upstream. Right after that, you also do a push to origin; and afterwards you can make your pull requests from branch to branch as you wish in first place.\nJust be careful when you create the pull request, because the default selected branch for upstream is always \"master\""
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to rebase after squashing commits in the original branch?\nI have\nA--B--C master\n \\\n D branch0\n\nThen I squash B and C into B'.\nHow do I rebase branch0 such that it looks like this:\nA--B' master\n \\\n D branch0"
},
{
"role": "assistant",
"content": "Use the --onto argument to git rebase, which changes the baseline that git replays work on.\ngit checkout branch0\n\nAt this state you should still see C in your git history.\ngit rebase --onto B' C\n\nThis translates to: Take all commits in my current branch since commit C (In your case that's just D) and play back on top of B'\nYou can also use the optional <branch> argument to do both the checkout and rebase at once:\ngit rebase --onto B' C branch0"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "My new Github page isn't showing up\nSo I'm following this guide here to create a Github page\nI created a repository, cloned it to my project directory and pushed, finally got to this last step:\nFire up a browser and go to http://username.github.io. Give it a couple of minutes for your page to show up—there will be a delay this very first time. In the future, changes will show up pretty much instantly.\n\nMy Github repo link is this:\nhttps://github.com/leongaban/gabanco\nSo I assumed my Github page link would be either:\nhttp://leongaban.gabanco.github.io/\nor\nhttp://leongaban.github.io/\nHowever neither link is working at the moment :(\nAnyone create a Github page before? Eventually I want to try out Jekyll on it."
},
{
"role": "assistant",
"content": "Try to push an empty commit and refresh the page. It should work.\ngit commit --allow-empty -m \"Trigger rebuild\"\ngit push"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-rebase - Reapply commits on top of another base tip <branch>"
},
{
"role": "assistant",
"content": "Working branch; defaults to HEAD ."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Difference between GIT and CVS\nWhat is the difference between Git and CVS version control systems? \nI have been happily using CVS for over 10 years, and now I have been told that Git is much better. Could someone please explain what the difference between the two is, and why one is better than the other?"
},
{
"role": "assistant",
"content": "The main difference is that (as it was already said in other responses) CVS is (old) centralized version control system, while Git is distributed.\nBut even if you use version control for single developer, on single machine (single account), there are a few differences between Git and CVS:\n\nSetting up repository. Git stores repository in .git directory in top directory of your project; CVS require setting up CVSROOT, a central place for storing version control info for different projects (modules). The consequence of that design for user is that importing existing sources into version control is as simple as \"git init && git add . && git commit\" in Git, while it is more complicated in CVS.\n\nAtomic operations. Because CVS at beginning was a set of scripts around per-file RCS version control system, commits (and other operations) are not atomic in CVS; if an operation on the repository is interrupted in the middle, the repository can be left in an inconsistent state. In Git all operations are atomic: either they succeed as whole, or they fail without any changes.\n\nChangesets. Changes in CVS are per file, while changes (commits) in Git they always refer to the whole project. This is very important paradigm shift. One of consequences of this is that it is very easy in Git to revert (create a change that undoes) or undo whole change; other consequence is that in CVS is easy to do partial checkouts, while it is currently next to impossible in Git. The fact that changes are per-file, grouped together led to invention of GNU Changelog format for commit messages in CVS; Git users use (and some Git tools expect) different convention, with single line describing (summarizing) change, followed by empty line, followed by more detailed description of changes.\n\nNaming revisions / version numbers. There is another issue connected with the fact that in CVS changes are per files: version numbers (as you can see sometimes in keyword expansion, see below) like 1.4 reflects how many time given file has been changed. In Git each version of a project as a whole (each commit) has its unique name given by SHA-1 id; usually first 7-8 characters are enough to identify a commit (you can't use simple numbering scheme for versions in distributed version control system -- that requires central numbering authority). In CVS to have version number or symbolic name referring to state of project as a whole you use tags; the same is true in Git if you want to use name like 'v1.5.6-rc2' for some version of a project... but tags in Git are much easier to use.\n\nEasy branching. Branches in CVS are in my opinion overly complicated, and hard to deal with. You have to tag branches to have a name for a whole repository branch (and even that can fail in some cases, if I remember correctly, because of per-file handling). Add to that the fact that CVS doesn't have merge tracking, so you have to either remember, or manually tag merges and branching points, and manually supply correct info for \"cvs update -j\" to merge branches, and it makes for branching to be unnecessary hard to use. In Git creating and merging branches is very easy; Git remembers all required info by itself (so merging a branch is as easy as \"git merge branchname\")... it had to, because distributed development naturally leads to multiple branches.\n\n\nThis means that you are able to use topic branches, i.e. develop a separate feature in multiple steps in separate feature branch.\n\nRename (and copy) tracking. File renames are not supported in CVS, and manual renaming might break history in two, or lead to invalid history where you cannot correctly recover the state of a project before rename. Git uses heuristic rename detection, based on similarity of contents and filename (This solution works well in practice). You can also request detecting of copying of files. This means that:\n\nwhen examining specified commit you would get information that some file was renamed,\n\nmerging correctly takes renames into account (for example if the file was renamed only in one branch)\n\n\"git blame\", the (better) equivalent of \"cvs annotate\", a tool to show line-wise history of a file contents, can follow code movement also across renames\n\nBinary files. CVS has only a very limited support for binary files (e.g. images), requiring users to mark binary files explicitly when adding (or later using \"cvs admin\", or via wrappers to do that automatically based on file name), to avoid mangling of binary file via end-of-line conversion and keyword expansion. Git automatically detects binary file based on contents in the same way CNU diff and other tools do it; you can override this detection using gitattributes mechanism. Moreover binary files are safe against unrecoverable mangling thanks to default on 'safecrlf' (and the fact that you have to request end-of-line conversion, although this might be turned on by default depending on distribution), and that (limited) keyword expansion is a strict 'opt-in' in Git.\n\nKeyword expansion. Git offers a very, very limited set of keywords as compared to CVS (by default). This is because of two facts: changes in Git are per repository and not per file, and Git avoids modifying files that did not change when switching to other branch or rewinding to other point in history. If you want to embed revision number using Git, you should do this using your build system, e.g. following example of GIT-VERSION-GEN script in Linux kernel sources and in Git sources.\n\nAmending commits. Because in distributed VCS such as Git act of publishing is separate from creating a commit, one can change (edit, rewrite) unpublished part of history without inconveniencing other users. In particular if you notice typo (or other error) in commit message, or a bug in commit, you can simply use \"git commit --amend\". This is not possible (at least not without heavy hackery) in CVS.\n\nMore tools. Git offers much more tools than CVS. One of more important is \"git bisect\" that can be used to find a commit (revision) that introduced a bug; if your commits are small and self-contained it should be fairly easy then to discover where the bug is.\n\n\n\nIf you are collaboration with at least one other developer, you would find also the following differences between Git and CVS:\n\nCommit before merge Git uses commit-before-merge rather than, like CVS, merge-before-commit (or update-then-commit). If while you were editing files, preparing for creating new commit (new revision) somebody other created new commit on the same branch and it is now in repository, CVS forces you to first update your working directory and resolve conflicts before allowing you to commit. This is not the case with Git. You first commit, saving your state in version control, then you merge other developer changes. You can also ask the other developer to do the merge and resolve conflicts.\n\nIf you prefer to have linear history and avoid merges, you can always use commit-merge-recommit workflow via \"git rebase\" (and \"git pull --rebase\"), which is similar to CVS in that you replay your changes on top of updated state. But you always commit first.\n\nNo need for central repository With Git there is no need to have single central place where you commit your changes. Each developer can have its own repository (or better repositories: private one in which he/she does development, and public bare one where she/he publishes that part which is ready), and they can pull/fetch from each other repositories, in symmetric fashion. On the other hand it is common for larger project to have socially defined/nominated central repository from which everyone pull from (get changes from).\n\n\nFinally Git offers many more possibilities when collaboration with large number of developers is needed. Below there are differences between CVS in Git for different stages of interest and position in a project (under version control using CVS or Git):\n\nlurker. If you are interested only in getting latest changes from a project, (no propagation of your changes), or doing private development (without contributing back to original projects); or you use foreign projects as a basis of your own project (changes are local and doesn't it make sense to publish them).\n\nGit supports here anonymous unauthenticated read-only access via custom efficient git://protocol, or if you are behind firewall blocking DEFAULT_GIT_PORT (9418) you can use plain HTTP.\nFor CVS most common solution (as I understand it) for read-only access is guest account for 'pserver' protocol on CVS_AUTH_PORT (2401), usually called \"anonymous\" and with empty password. Credentials are stored by default in $HOME/.cvspass file, so you have to provide it only once; still, this is a bit of barrier (you have to know name of guest account, or pay attention to CVS server messages) and annoyance.\n\nfringe developer (leaf contributor). One way of propagating your changes in OSS is sending patches via email. This is most common solution if you are (more or less) accidental developer, sending single change, or single bugfix. BTW. sending patches might be via review board (patch review system) or similar means, not only via email.\n\nGit offers here tools which help in this propagation (publishing) mechanism both for sender (client), and for maintainer (server). For people who want send their changes via email there is \"git rebase\" (or \"git pull --rebase\") tool to replay your own changes on top of current upstream version, so your changes are on top of current version (are fresh), and \"git format-patch\" to create email with commit message (and authorship), change in the form of (extended) unified diff format (plus diffstat for easier review). Maintainer can turn such email directly into commit preserving all information (including commit message) using \"git am\".\nCVS offer no such tools: you can use \"cvs diff\" / \"cvs rdiff\" to generate changes, and use GNU patch to apply changes, but as far as I know there is no way to automate applying commit message. CVS was meant to be used in client <-> server fashion...\n\nlieutenant. If you are maintainer of separate part of a project (subsystem), or if development of your project follows \"network of trust\" workflow used in development of Linux kernel... or just if you have your own public repository, and the changes you want to publish are too large to send via email as patch series, you can send pull request to (main) maintainer of project.\n\nThis is solution specific to distributed version control systems, so of course CVS doesn't support such way of collaboration. There is even a tool called \"git request-pull\" which help to prepare email to send to maintainer with request to pull from your repository. Thanks to \"git bundle\" you can use this mechanism even without having public repository, by sending bundle of changes via email or sneakernet. Some of Git hosting sites like GitHub have support for notifying that somebody is working (published some work) on your project (provided that he/she uses the same Git hosting site), and for PM-ing a kind of pull request.\n\nmain developer, i.e. somebody who directly publish his/her changes (to main/canonical repository). This category is broader for distributed version control systems, as having multiple developers with write access to central repository is not only possible workflow (you can have single maintainer who pushes changes to canonical repository, a set of lieutenants/subsystem maintainers from which he/she pulls, and broad range of leaf developers who send patches via mail either to maintainer/project mailing list, or to one of lieutenants/submaintainers).\n\nWith Git you have choice of using SSH protocol (git protocol wrapped in SSH) to publish changes, with tools such as \"git shell\" (to help security, limiting access of shell accounts) or Gitosis (to manage access without requiring separate shell accounts), and HTTPS with WebDAV, with ordinary HTTP authentication.\nWith CVS there is a choice between custom unencrypted (plain text) pserver protocol, or using remote shell (where you really should use SSH) to publish your changes, which for centralized version control system means committing your changes (creating commits). Well, you can also tunnel 'pserver' protocol using SSH, and there are thir party tools automating this... but I don't think this is as easy as e.g. Gitosis.\nIn general distributed version control systems, such as Git, provide much wider selection of possible workflows. With centralized version control systems, such as CVS, by necessity you have to distinguish between people with commit access to repository, and those without... and CVS doesn't offer any tools to help with accepting contributions (via patches) from people without commit access.\nKarl Fogel in Producing Open Source Software in section about version control states that it is better to not provide too strict, rigid and rigorous controls on areas where one is allowed to make changes to public repository; it is much better to rely (for this) on social restrictions (such as code review) than on technical restrictions; distributed version control systems reduce that IMHO even further..."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-for-each-ref - Output information on each ref signature:signer"
},
{
"role": "assistant",
"content": "The signer of the GPG signature of a commit."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Viewing all `git diffs` with vimdiff\nI setup git diff to wrap into vimdiff, using \"Git Diff with Vimdiff\" as a guide, and it's working as expected unless there are many files with changes. \nWhen there are multiple files with changes and I run git diff, it opens the first file and, after quitting the first instance of vimdiff, I'm presented with the following message:\nexternal diff died, stopping at filename\n\nThis is a completely different behavior than I am used to. I had a similar setup in the past with SVN and, when diffing against multiple files, I would review the first file, then write and quit using :wq and the next file with differences would open up.\nThis is not the case with Git. I tried :n[ext], but doing so does not fill the left window with the original file so that it can be diffed against the modified version."
},
{
"role": "assistant",
"content": "git config --global diff.tool vimdiff\ngit config --global difftool.prompt false\n\nTyping git difftool yields the expected behavior.\nNavigation commands,\n\n:qa in vim cycles to the next file in the changeset without saving anything.\n\nAliasing (example)\ngit config --global alias.d difftool\n\n.. will let you type git d to invoke vimdiff.\nAdvanced use-cases,\n\nBy default, git calls vimdiff with the -R option. You can override it with git config --global difftool.vimdiff.cmd 'vimdiff \"$LOCAL\" \"$REMOTE\"'. That will open vimdiff in writeable mode which allows edits while diffing.\n:wq in vim cycles to the next file in the changeset with changes saved."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-show - Show various types of objects -t"
},
{
"role": "assistant",
"content": "Show the tree objects in the diff output."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": ".gitignore and Visual Studio project: Ignore bin/Debug directory but not bin/Release directory\nI have a C# Visual Studio project in a git repository. I want to ignore the contents bin/Debug directory but not the contents of the bin/Release' directory. I've added bin/Debug to my .gitignore file, but it doesn't seem to work - it is including the entire contents of the bin directory. What would the correct entry be to do this?"
},
{
"role": "assistant",
"content": "You shouldn't have to delete anything. After you added the .gitignore file, run this command to clear the cache, then stage and commit again:\ngit rm -r . --cached"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-diff - Show changes between commits, commit and working tree, etc --textconv --no-textconv"
},
{
"role": "assistant",
"content": "Allow (or disallow) external text conversion filters to be run\nwhen comparing binary files. See gitattributes for\ndetails. Because textconv filters are typically a one-way\nconversion, the resulting diff is suitable for human\nconsumption, but cannot be applied. For this reason, textconv\nfilters are enabled by default only for git-diff and git-log , but not for git-format-patch or\ndiff plumbing commands."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git log the difference between 1 branch from another\nI have 2 branches A and B.\nWhenever I run a build, Branch A gets merged into Branch B. I want to be able to email out all the updates made in A, since the last time the build was ran. How can I use git log to be able to copy all the commits made in A since the last A -> B merge?"
},
{
"role": "assistant",
"content": "That'll be\ngit log B..A\n\nE.g. \"display all commits that are in A but not in B\" Or if you wish to do it against non local branches\ngit log origin/B..origin/A"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Commit only part of a file's changes in Git\nWhen I make changes to a file in Git, how can I commit only some of the changes?\nFor example, how could I commit only 15 lines out of 30 lines that have been changed in a file?"
},
{
"role": "assistant",
"content": "You can use:\ngit add --patch <filename>\n\nor for short:\ngit add -p <filename>\n\nGit will break down your file into what it thinks are sensible \"hunks\" (portions of the file). It will then prompt you with this question:\nStage this hunk [y,n,q,a,d,/,j,J,g,s,e,?]?\n\nHere is a description of each option:\n\ny stage this hunk for the next commit\nn do not stage this hunk for the next commit\nq quit; do not stage this hunk or any of the remaining hunks\na stage this hunk and all later hunks in the file\nd do not stage this hunk or any of the later hunks in the file\ng select a hunk to go to\n/ search for a hunk matching the given regex\nj leave this hunk undecided, see next undecided hunk\nJ leave this hunk undecided, see next hunk\nk leave this hunk undecided, see previous undecided hunk\nK leave this hunk undecided, see previous hunk\ns split the current hunk into smaller hunks\ne manually edit the current hunk\n\nYou can then edit the hunk manually by replacing +/- by # (thanks veksen)\n\n\n? print hunk help\n\nIf the file is not in the repository yet, you can first do git add -N <filename>. Afterwards you can go on with git add -p <filename>.\nAfterwards, you can use:\n\ngit diff --staged to check that you staged the correct changes\ngit reset -p to unstage mistakenly added hunks\ngit commit -v to view your commit while you edit the commit message.\n\nNote this is far different than the git format-patch command, whose purpose is to parse commit data into a .patch files.\nReference for future: Git Tools - Interactive Staging"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "ssh : Permission denied (publickey,gssapi-with-mic)\n\ni'm use centos 5.9.\nafter installing gitlab by this link ssh not working.\nbefore install gitlab ssh correctly working.\ni'm using this server localy and other services such as elastix and apache,mysql installed on server.\nappeare this error :\nOpenSSH_6.9p1 Ubuntu-2ubuntu0.1, OpenSSL 1.0.2d 9 Jul 2015\ndebug1: Reading configuration data /etc/ssh/ssh_config\ndebug1: /etc/ssh/ssh_config line 19: Applying options for *\ndebug2: ssh_connect: needpriv 0\ndebug1: Connecting to 192.168.88.23 [192.168.88.23] port 22.\ndebug1: Connection established.\ndebug1: permanently_set_uid: 0/0\ndebug1: key_load_public: No such file or directory\ndebug1: identity file /root/.ssh/id_rsa type -1\ndebug1: key_load_public: No such file or directory\ndebug1: identity file /root/.ssh/id_rsa-cert type -1\ndebug1: key_load_public: No such file or directory\ndebug1: identity file /root/.ssh/id_dsa type -1\ndebug1: key_load_public: No such file or directory\ndebug1: identity file /root/.ssh/id_dsa-cert type -1\ndebug1: key_load_public: No such file or directory\ndebug1: identity file /root/.ssh/id_ecdsa type -1\ndebug1: key_load_public: No such file or directory\ndebug1: identity file /root/.ssh/id_ecdsa-cert type -1\ndebug1: key_load_public: No such file or directory\ndebug1: identity file /root/.ssh/id_ed25519 type -1\ndebug1: key_load_public: No such file or directory\ndebug1: identity file /root/.ssh/id_ed25519-cert type -1\ndebug1: Enabling compatibility mode for protocol 2.0\n debug1: Local version string SSH-2.0-OpenSSH_6.9p1 Ubuntu-2ubuntu0.1\ndebug1: Remote protocol version 2.0, remote software version OpenSSH_4.3\ndebug1: match: OpenSSH_4.3 pat OpenSSH_4* compat 0x00000000\ndebug2: fd 3 setting O_NONBLOCK\ndebug1: Authenticating to 192.168.88.23:22 as 'root'\ndebug1: SSH2_MSG_KEXINIT sent\ndebug1: SSH2_MSG_KEXINIT received\ndebug2: kex_parse_kexinit: [email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1\ndebug2: kex_parse_kexinit: [email protected],[email protected],ssh-rsa,[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-ed25519,ssh-dss\ndebug2: kex_parse_kexinit: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected],arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,[email protected]\ndebug2: kex_parse_kexinit: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected],arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,[email protected]\ndebug2: kex_parse_kexinit: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1,[email protected],[email protected],[email protected],[email protected],hmac-md5,hmac-ripemd160,[email protected],hmac-sha1-96,hmac-md5-96\ndebug2: kex_parse_kexinit: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1,[email protected],[email protected],[email protected],[email protected],hmac-md5,hmac-ripemd160,[email protected],hmac-sha1-96,hmac-md5-96\ndebug2: kex_parse_kexinit: none,[email protected],zlib\ndebug2: kex_parse_kexinit: none,[email protected],zlib\ndebug2: kex_parse_kexinit: \ndebug2: kex_parse_kexinit: \ndebug2: kex_parse_kexinit: first_kex_follows 0 \ndebug2: kex_parse_kexinit: reserved 0 \ndebug2: kex_parse_kexinit: diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1\ndebug2: kex_parse_kexinit: ssh-rsa,ssh-dss\ndebug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,[email protected]\ndebug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,[email protected]\ndebug2: kex_parse_kexinit: hmac-md5,hmac-sha1,hmac-ripemd160,[email protected],hmac-sha1-96,hmac-md5-96\ndebug2: kex_parse_kexinit: hmac-md5,hmac-sha1,hmac-ripemd160,[email protected],hmac-sha1-96,hmac-md5-96\ndebug2: kex_parse_kexinit: none,[email protected]\ndebug2: kex_parse_kexinit: none,[email protected]\ndebug2: kex_parse_kexinit: \ndebug2: kex_parse_kexinit: \ndebug2: kex_parse_kexinit: first_kex_follows 0 \ndebug2: kex_parse_kexinit: reserved 0 \ndebug1: kex: server->client aes128-ctr hmac-sha1 none\ndebug1: kex: client->server aes128-ctr hmac-sha1 none\ndebug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<7680<8192) sent\ndebug1: got SSH2_MSG_KEX_DH_GEX_GROUP\ndebug2: bits set: 3111/6144\ndebug1: SSH2_MSG_KEX_DH_GEX_INIT sent\ndebug1: got SSH2_MSG_KEX_DH_GEX_REPLY\ndebug1: Server host key: ssh-rsa SHA256:7J6JOe94H9PedNKlx6yG/wMy6ZYC8iB74WdOVGDgY7A\ndebug1: Host '192.168.88.23' is known and matches the RSA host key.\n debug1: Found key in /root/.ssh/known_hosts:1\ndebug2: bits set: 3102/6144\ndebug2: set_newkeys: mode 1\ndebug1: SSH2_MSG_NEWKEYS sent\ndebug1: expecting SSH2_MSG_NEWKEYS\ndebug2: set_newkeys: mode 0\ndebug1: SSH2_MSG_NEWKEYS received\ndebug1: SSH2_MSG_SERVICE_REQUEST sent\ndebug2: service_accept: ssh-userauth\ndebug1: SSH2_MSG_SERVICE_ACCEPT received\ndebug2: key: /root/.ssh/id_rsa ((nil)),\ndebug2: key: /root/.ssh/id_dsa ((nil)),\ndebug2: key: /root/.ssh/id_ecdsa ((nil)),\ndebug2: key: /root/.ssh/id_ed25519 ((nil)),\ndebug1: Authentications that can continue: publickey,gssapi-with-mic\ndebug1: Next authentication method: gssapi-with-mic\ndebug1: Unspecified GSS failure. Minor code may provide more information\nNo Kerberos credentials available\n\ndebug1: Unspecified GSS failure. Minor code may provide more information\nNo Kerberos credentials available\n\ndebug1: Unspecified GSS failure. Minor code may provide more information\n\n\ndebug1: Unspecified GSS failure. Minor code may provide more information\nNo Kerberos credentials available\n\ndebug2: we did not send a packet, disable method\ndebug1: Next authentication method: publickey\ndebug1: Trying private key: /root/.ssh/id_rsa\ndebug1: Trying private key: /root/.ssh/id_dsa\ndebug1: Trying private key: /root/.ssh/id_ecdsa\ndebug1: Trying private key: /root/.ssh/id_ed25519\ndebug2: we did not send a packet, disable method\ndebug1: No more authentication methods to try.\nPermission denied (publickey,gssapi-with-mic)."
},
{
"role": "assistant",
"content": "Setting 700 to .ssh and 600 to authorized_keys solved the issue.\nchmod 700 /root/.ssh\nchmod 600 /root/.ssh/authorized_keys"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-reflog - Manage reflog information --stale-fix"
},
{
"role": "assistant",
"content": "Prune any reflog entries that point to \"broken commits\". A\nbroken commit is a commit that is not reachable from any of\nthe reference tips and that refers, directly or indirectly, to\na missing commit, tree, or blob object. This computation involves traversing all the reachable objects, i.e. it\nhas the same cost as git prune . It is primarily intended to fix\ncorruption caused by garbage collecting using older versions of Git,\nwhich didn’t protect objects referred to by reflogs."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-config - Get and set repository or global options rebase.rescheduleFailedExec"
},
{
"role": "assistant",
"content": "Automatically reschedule exec commands that failed. This only makes\nsense in interactive mode (or when an --exec option was provided).\nThis is the same as specifying the --reschedule-failed-exec option."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Commit changes only in one directory in Git\nI'm using Git 1.7.4.1 on Mac 10.6.6. From the command line, how do I commit changes in only a single directory? I added the directory by doing:\ngit add my-dir\n\nbut doing\ngit commit -a\n\nbrings up a list of all changes in my repo, and I only want to commit and push changes from my-dir."
},
{
"role": "assistant",
"content": "Why does no one mention you can simply\ngit commit -m 'message' -- my-dir\n\nIt seems to me the OP isn't used to / doesn't like to use the staging area directly. This approach is also a lot safer to recommend without further context, because chances are that a defaault commit (of everything that's staged) will \n\ncommit more than just my-dir if it already had been staged \nwill produce confusing results when the OP is not used to managing the staging area explicitly (because the working tree can have gotten out of synch with the index)"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-log - Show commit logs --ancestry-path[=<commit>]"
},
{
"role": "assistant",
"content": "Limit the displayed commits to those which are an ancestor of\n<commit>, or which are a descendant of <commit>, or are <commit>\nitself. As an example use case, consider the following commit history: D---E-------F\n\t / \\ \\\n\t B---C---G---H---I---J\n\t / \\\n\tA-------K---------------L--M A regular D..M computes the set of commits that are ancestors of M ,\nbut excludes the ones that are ancestors of D . This is useful to see\nwhat happened to the history leading to M since D , in the sense\nthat “what does M have that did not exist in D ”. The result in this\nexample would be all the commits, except A and B (and D itself,\nof course). When we want to find out what commits in M are contaminated with the\nbug introduced by D and need fixing, however, we might want to view\nonly the subset of D..M that are actually descendants of D , i.e.\nexcluding C and K . This is exactly what the --ancestry-path option does. Applied to the D..M range, it results in: E-------F\n\t\t \\ \\\n\t\t G---H---I---J\n\t\t\t \\\n\t\t\t\tL--M We can also use --ancestry-path=D instead of --ancestry-path which\nmeans the same thing when applied to the D..M range but is just more\nexplicit. If we instead are interested in a given topic within this range, and all\ncommits affected by that topic, we may only want to view the subset of D..M which contain that topic in their ancestry path. So, using --ancestry-path=H D..M for example would result in: E\n\t\t \\\n\t\t G---H---I---J\n\t\t\t \\\n\t\t\t\tL--M Whereas --ancestry-path=K D..M would result in K---------------L--M"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-log - Show commit logs --patience"
},
{
"role": "assistant",
"content": "Generate a diff using the \"patience diff\" algorithm."
}
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.