messages
listlengths 3
3
|
---|
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Git diff --name-only and copy that list\nI just want to get a list of changed files between two revisions, which is simple:\ngit diff -–name-only commit1 commit2 > /path/to/my/file\n\nBut, what should I write, if I want copy all that listed files to another place? And I need completely identical directory structure for copied files.\nFor example, I have modified and added files:\n/protected/texts/file1.txt\n/protected/scripts/index.php\n/public/pics/pic1.png\n\nI want to have in /home/changes/ all those changed and added files:\n/home/changes/protected/texts/file1.txt\n/home/changes/protected/scripts/index.php\n/home/changes/public/pics/pic1.png"
},
{
"role": "assistant",
"content": "Try the following command, which I have tested:\n$ cp -pv --parents $(git diff --name-only) DESTINATION-DIRECTORY"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-config - Get and set repository or global options core.hooksPath"
},
{
"role": "assistant",
"content": "By default Git will look for your hooks in the $GIT_DIR/hooks directory. Set this to different path,\ne.g. /etc/git/hooks , and Git will try to find your hooks in\nthat directory, e.g. /etc/git/hooks/pre-receive instead of\nin $GIT_DIR/hooks/pre-receive . The path can be either absolute or relative. A relative path is\ntaken as relative to the directory where the hooks are run (see\nthe \"DESCRIPTION\" section of githooks ). This configuration variable is useful in cases where you’d like to\ncentrally configure your Git hooks instead of configuring them on a\nper-repository basis, or as a more flexible and centralized\nalternative to having an init.templateDir where you’ve changed\ndefault hooks."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-branch - List, create, or delete branches branch.autoSetupMerge"
},
{
"role": "assistant",
"content": "Tells git branch , git switch and git checkout to set up new branches\nso that git-pull will appropriately merge from the\nstarting point branch. Note that even if this option is not set,\nthis behavior can be chosen per-branch using the --track and --no-track options. The valid settings are: false — no\nautomatic setup is done; true — automatic setup is done when the\nstarting point is a remote-tracking branch; always — automatic setup is done when the starting point is either a\nlocal branch or remote-tracking branch; inherit — if the starting point\nhas a tracking configuration, it is copied to the new\nbranch; simple — automatic setup is done only when the starting point\nis a remote-tracking branch and the new branch has the same name as the\nremote branch. This option defaults to true."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Git: created new branch from a wrong branch\nI usually create new branch from develop\ngit checkout -b new-feature develop\n\nthen after the last commit I merge back to develop\ngit checkout develop\ngit merge new-feature\n\nbut this time I created new-feature2 brach from new-feature and now I cannot merge to develop.\nIs there a way to switch new-feature2's parent to develop?\n(The files I worked on were the same version as in develop so this should not require merging.)"
},
{
"role": "assistant",
"content": "Note: Be sure to have a clean workspace before you begin. Read all messages git shows you. If in doubt, read more about the topic before starting.\n\nYou could rebase your feature over to the main base:\ngit checkout new-feature2 \ngit rebase --onto develop new-feature new-feature2\n# rebase the stuff from new-feature to new-feature2 onto develop branch\n\nor do it 'manually' by using cherry pick\ngit checkout develop\ngit log --oneline new-feature..new-feature2 \n# for every commit call:\ngit cherry-pick <commit-id> # note, newer versions of cherry-pick allow multiple commits at once"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-config - Get and set repository or global options remote.<name>.receivepack"
},
{
"role": "assistant",
"content": "The default program to execute on the remote side when pushing. See\noption --receive-pack of git-push ."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git branch -d gives warning\nJust want to get a better understanding of the warning message after I deleted a local branch\n\nwarning: deleting branch 'old_branch' that has been merged to\n 'refs/remotes/origin/old_branch', but not yet merged to HEAD."
},
{
"role": "assistant",
"content": "This is just warning you that you have changes pushed to the branch on origin, but they are not merged into the currently checked out branch, so you are only deleting it locally.\nIt is warning you that you no longer have a local copy of that branch, but it exists in origin\nIf you want to delete the remote branch as well, use git push --delete origin old_branch"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Is git not case sensitive?\nIn the first commitment of my partial called _Electronics it was written beginning with a capital letters, then I changed it to _electronics.\nGit under cygwin ignored the case after commiting the new name, so I changed the name by hand in the target repo.\nNow it sometimes changes the commited _electronics partial to _Electronics.\nWhat have I done wrong?"
},
{
"role": "assistant",
"content": "It is going to depend on the core.ignorecase configuration value, which is set to false in case-sensitive filesystems and true in msysgit on Windows.\n\ncore.ignorecase\nIf true, this option enables various workarounds to enable git to work better on filesystems that are not case sensitive, like FAT. For\n example, if a directory listing finds \"makefile\" when git expects\n \"Makefile\", git will assume it is really the same file, and continue\n to remember it as \"Makefile\".\nThe default is false, except git-clone(1) or git-init(1) will probe and set core.ignorecase true if appropriate when the repository\n is created.\n\nMore detail in this reply to Changing capitalization of filenames in Git."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Difference between 'rebase master' and 'rebase --onto master' from a branch derived from a branch of master\nGiven the following branch structure:\n *------*---*\nMaster \\\n *---*--*------*\n A \\\n *-----*-----*\n B (HEAD)\n\nIf I want to merge my B changes (and only my B changes, no A changes) into master what is the difference between these two set of commands?\n>(B) git rebase master\n>(B) git checkout master\n>(master) git merge B\n\n\n>(B) git rebase --onto master A B\n>(B) git checkout master\n>(master) git merge B\n\nI'm mainly interested in learning if code from Branch A could make it into master if I use the first way."
},
{
"role": "assistant",
"content": "Bear with me for a while before I answer the question as asked. One the earlier answers is right but there are labeling and other relatively minor (but potentially confusing) issues, so I want to start with branch drawings and branch labels. Also, people coming from other systems, or maybe even just new to revision control and git, often think of branches as \"lines of development\" rather than \"traces of history\" (git implements them as the latter, rather than the former, so a commit is not necessarily on any specific \"line of development\").\nFirst, there is a minor problem with the way you drew your graph:\n *------*---*\nMaster \\\n *---*--*------*\n A \\\n *-----*-----*\n B (HEAD)\n\nHere's the exact same graph, but with the labels drawn in differently and some more arrow-heads added (and I've numbered the commit nodes for use below):\n0 <- 1 <- 2 <-------------------- master\n \\\n 3 <- 4 <- 5 <- 6 <------ A\n \\\n 7 <- 8 <- 9 <-- HEAD=B\n\nWhy this matters is that git is quite loose about what it means for a commit to be \"on\" some branch—or perhaps a better phrase is to say that some commit is \"contained in\" some set of branches. Commits cannot be moved or changed, but branch labels can and do move.\nMore specifically, a branch name like master, A, or B points to one specific commit. In this case, master points to commit 2, A points to commit 6, and B points to commit 9. The first few commits 0 through 2 are contained within all three branches; commits 3, 4, and 5 are contained within both A and B; commit 6 is contained only within A; and commits 7 through 9 are contained only in B. (Incidentally, multiple names can point to the same commit, and that's normal when you make a new branch.)\nBefore we proceed, let me re-draw the graph yet one more way:\n0\n \\\n 1\n \\\n 2 <-- master\n \\\n 3 - 4 - 5\n |\\\n | 6 <-- A\n \\\n 7\n \\\n 8\n \\\n 9 <-- HEAD=B \n\nThis just emphasizes that it's not a horizontal line of commits that matter, but rather the parent/child relationships. The branch label points to a starting commit, and then (at least the way these graphs are drawn) we move left, maybe also going up or down as needed, to find parent commits.\n\nWhen you rebase commits, you're actually copying those commits.\nGit can never change any commit\nThere's one \"true name\" for any commit (or indeed any object in a git repository), which is its SHA-1: that 40-hex-digit string like 9f317ce... that you see in git log for instance. The SHA-1 is a cryptographic1 checksum of the contents of the object. The contents are the author and committer (name and email), time stamps, a source tree, and the list of parent commits. The parent of commit #7 is always commit #5. If you make a mostly-exact copy of commit #7, but set its parent to commit #2 instead of commit #5, you get a different commit with a different ID. (I've run out of single digits at this point—normally I use single uppercase letters to represent commit IDs, but with branches named A and B I thought that would be confusing. So I'll call a copy of #7, #7a, below.)\nWhat git rebase does\nWhen you ask git to rebase a chain of commits—such as commits #7-8-9 above—it has to copy them, at least if they're going to move anywhere (if they're not moving it can just leave the originals in place). It defaults to copying commits from the currently-checked-out branch, so git rebase needs just two extra pieces of information:\n\nWhich commits should it copy?\nWhere should the copies land? That is, what's the target parent-ID for the first-copied commit? (Additional commits simply point back to the first-copied, second-copied, and so on.)\n\nWhen you run git rebase <upstream>, you let git figure out both parts from one single piece of information. When you use --onto, you get to tell git separately about the both parts: you still supply an upstream but it doesn't compute the target from <upstream>, it only computes the commits to copy from <upstream>. (Incidentally, I think <upstream> is not a good name, but it's what rebase uses and I don't have anything way better, so let's stick with it here. Rebase calls target <newbase>, but I think target is a much better name.)\nLet's take a look at these two options first. Both assume that you're on branch B in the first place:\n\ngit rebase master\ngit rebase --onto master A\n\nWith the first command, the <upstream> argument to rebase is master. With the second, it's A.\nHere's how git computes which commits to copy: it hands the current branch to git rev-list, and it also hands <upstream> to git rev-list, but using --not—or more precisely, with the equivalent of the two-dot exclude..include notation. This means we need to know how git rev-list works.\nWhile git rev-list is extremely complicated—most git commands end up using it; it's the engine for git log, git bisect, rebase, filter-branch, and so on—this particular case is not too hard: with the two-dot notation, rev-list lists every commit reachable from the right-hand side (including that commit itself), excluding every commit reachable from the left-hand side.\nIn this case, git rev-list HEAD finds all commits reachable from HEAD—that is, almost all commits: commits 0-5 and 7-9—and git rev-list master finds all commits reachable from master, which is commit #s 0, 1, and 2. Subtracting 0-through-2 from 0-5,7-9 leaves 3-5,7-9. These are the candidate commits to copy, as listed by git rev-list master..HEAD.\nFor our second command, we have A..HEAD instead of master..HEAD, so the commits to subtract are 0-6. Commit #6 doesn't appear in the HEAD set, but that's fine: subtracting away something that's not there, leaves it not there. The resulting candidates-to-copy is therefore 7-9.\nThat still leaves us with figuring out the target of the rebase, i.e., where should copied commits land? With the second command, the answer is \"the commit identified by the --onto argument\". Since we said --onto master, that means the target is commit #2.\nrebase #1\ngit rebase master\nWith the first command, though, we didn't specify a target directly, so git uses the commit identified by <upstream>. The <upstream> we gave was master, which points to commit #2, so the target is commit #2.\nThe first command is therefore going to start by copying commit #3 with whatever minimal changes are needed so that its parent is commit #2. Its parent is already commit #2. Nothing has to change, so nothing changes, and rebase just re-uses the existing commit #3. It must then copy #4 so that its parent is #3, but the parent is already #3, so it just re-uses #4. Likewise, #5 is already good. It completely ignores #6 (that's not in the set of commits to copy); it checks #s 7-9 but they're all good as well, so the whole rebase ends up just re-using all the original commits. You can force copies anyway with -f, but you didn't, so this whole rebase ends up doing nothing.\nrebase #2\ngit rebase --onto master A\nThe second rebase command used --onto to select #2 as its target, but told git to copy just commits 7-9. Commit #7's parent is commit #5, so this copy really has to do something.2 So git makes a new commit—let's call this #7a—that has commit #2 as its parent. The rebase moves on to commit #8: the copy now needs #7a as its parent. Finally, the rebase moves on to commit #9, which needs #8a as its parent. With all commits copied, the last thing rebase does is move the label (remember, labels move and change!). This gives a graph like this:\n 7a - 8a - 9a <-- HEAD=B\n /\n0 - 1 - 2 <-- master\n \\\n 3 - 4 - 5 - 6 <-- A\n \\\n 7 - 8 - 9 [abandoned]\n\nOK, but what about git rebase --onto master A B?\nThis is almost the same as git rebase --onto master A. The difference is that extra B at the end. Fortunately, this difference is very simple: if you give git rebase that one extra argument, it runs git checkout on that argument first.3\nYour original commands\nIn your first set of commands, you ran git rebase master while on branch B. As noted above, this is a big no-op: since nothing needs to move, git copies nothing at all (unless you use -f / --force, which you didn't). You then checked out master and used git merge B, which—if it it is told to4—creates a new commit with the merge. Therefore Dherik's answer, as of the time I saw it at least, is correct here: The merge commit has two parents, one of which is the tip of branch B, and that branch reaches back through three commits that are on branch A and therefore some of what's on A winds up being merged into master.\nWith your second command sequence, you first checked out B (you were already on B so this was redundant, but was part of the git rebase). You then had rebase copy three commits, producing the final graph above, with commits 7a, 8a, and 9a. You then checked out master and made a merge commit with B (see footnote 4 again). Again Dherik's answer is correct: the only thing missing is that the original, abandoned commits are not drawn-in and it's not as obvious that the new merged-in commits are copies.\n\n1This only matters in that it's extraordinarily difficult to target a particular checksum. That is, if someone you trust tells you \"I trust the commit with ID 1234567...\", it's almost impossible for someone else—someone you may not trust so much—to come up with a commit that has that same ID, but has different contents. The chances of it happening by accident are 1 in 2160, which is much less likely than you having a heart attack while being struck by lightning while drowning in a tsunami while being abducted by space aliens. :-)\n2The actual copy is made using the equivalent of git cherry-pick: git compares the commit's tree with its parent's tree to get a diff, then applies the diff to the new parent's tree.\n3This is actually, literally true at this time: git rebase is a shell script that parses your options, then decides which kind of internal rebase to run: the non-interactive git-rebase--am or the interactive git-rebase--interactive. After it's figured out all the arguments, if there's the one left-over branch name argument, the script does git checkout <branch-name> before starting the internal rebase.\n4Since master points to commit 2 and commit 2 is an ancestor of commit 9, this would normally not make a merge commit after all, but instead do what Git calls a fast-forward operation. You can instruct Git not to do these fast-forwards using git merge --no-ff. Some interfaces, such as GitHub's web interface and perhaps some GUIs, may separate the different kinds of operations, so that their \"merge\" forces a true merge like this.\nWith a a fast-forward merge, the final graph for the first case is:\n0 <- 1 <- 2 [master used to be here]\n \\\n 3 <- 4 <- 5 <- 6 <------ A\n \\\n 7 <- 8 <- 9 <-- master, HEAD=B\n\nIn either case, commits 1 through 9 are now on both branches, master and B. The difference, compared to the true merge is that, from the graph, you can see the history that includes the merge.\nIn other words, the advantage to a fast-forward merge is that it leaves no trace of what is otherwise a trivial operation. The disadvantage of a fast-forward merge is, well, that it leaves no trace. So the question of whether to allow the fast-forward is really a question of whether you want to leave an explicit merge in the history formed by the commits."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Gitlab CI/CD and Nx affected:build\n\nI'm having trouble getting Nx to build properly inside Gitlab's CI/CD tool.\n\n> nx affected:build \"--prod\" \"--base=remotes/origin/development~1\" \"--head=remotes/origin/development\"\n\n\nfatal: Not a valid object name remotes/origin/development~1 Command\n failed: git merge-base remotes/origin/development~1\n remotes/origin/development fatal: Not a valid object name\n remotes/origin/development~1\n\nI've tried different branches/commands such as just a plain: nx affected:build and I get the same error(just with a master branch indicated in the error message)\nAnyone able to get the Nx monorepo working with Gitlab?"
},
{
"role": "assistant",
"content": "Had a similar problem. Running \"git fetch\" before the nx command fixed the issue."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-log - Show commit logs -g --walk-reflogs"
},
{
"role": "assistant",
"content": "Instead of walking the commit ancestry chain, walk\nreflog entries from the most recent one to older ones.\nWhen this option is used you cannot specify commits to\nexclude (that is, ^commit , commit1..commit2 ,\nand commit1...commit2 notations cannot be used). With --pretty format other than oneline and reference (for obvious reasons),\nthis causes the output to have two extra lines of information\ntaken from the reflog. The reflog designator in the output may be shown\nas ref@{<Nth>} (where <Nth> is the reverse-chronological index in the\nreflog) or as ref@{<timestamp>} (with the <timestamp> for that entry),\ndepending on a few rules: If the starting point is specified as ref@{<Nth>} , show the index\nformat. If the starting point was specified as ref@{now} , show the\ntimestamp format. If neither was used, but --date was given on the command line, show\nthe timestamp in the format requested by --date . Otherwise, show the index format. Under --pretty=oneline , the commit message is\nprefixed with this information on the same line.\nThis option cannot be combined with --reverse .\nSee also git-reflog . Under --pretty=reference , this information will not be shown at all."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "gitrevisions - Specifying revisions and ranges for Git <rev>^{/<text>} , e.g. HEAD^{/fix nasty bug}"
},
{
"role": "assistant",
"content": "A suffix ^ to a revision parameter, followed by a brace\npair that contains a text led by a slash,\nis the same as the :/fix nasty bug syntax below except that\nit returns the youngest matching commit which is reachable from\nthe <rev> before ^ ."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Is it possible to use GitHub and GitLab on one machine?\n\nI have accounts in GitHub and GitLab. I generated and added an RSA key to my account in GitLab, but now I need to work with GitHub on a second project. \nI know that GitLab and GitHub both use git. Please tell me if it's possible to use GitHub and GitLab on one machine?"
},
{
"role": "assistant",
"content": "Yes you can, you can share the same key between them both (ssh key) or create a new one per git server.\nCreate a SSH config file\n\nWhen you have multiple identity files(in your case one for gitlab and one for github) , create a SSH config file to store your various identities.\n\n\nThe format for the alias entries use in this example is:\n\n\nHost alias \n\n\n HostName github.com \n IdentityFile ~/.ssh/identity\n\n\nTo create a config file for two identities (workid and personalid), you would do the following:\n\nOpen a terminal window.\nEdit the ~/.ssh/config file. \n\nIf you don't have a config file, create one.\nAdd an alias for each identity combination for example:\nHost github\nHostName github.com \nIdentityFile ~/.ssh/github\n\nHost gitlab\nHostName gitlab.com \nIdentityFile ~/.ssh/gitlab\n\nThis way you can have as many accounts as you wish each one with a different ssh key attached to it."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git diff two files on same branch, same commit\nsorry if this question exists, I surprisingly could not find it :/\nHow can I perform a git diff between two files within the same branch & same commit?\ni.e. git diff fileA.php fileB.php\n(ideally with the easy to read color coding that git offers....or similar to what the program BeyondCompare does!)"
},
{
"role": "assistant",
"content": "If you want to use git diff on two arbitrary files you can use git diff --no-index <file_a> <file_b>. The two files do not need to be tracked in git for this to work."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-config - Get and set repository or global options repack.useDeltaBaseOffset"
},
{
"role": "assistant",
"content": "By default, git-repack creates packs that use\ndelta-base offset. If you need to share your repository with\nGit older than version 1.4.4, either directly or via a dumb\nprotocol such as http, then you need to set this option to\n\"false\" and repack. Access from old Git versions over the\nnative protocol are unaffected by this option."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "github Readme - reference issue\n\nHow can I reference (insert a relative link to) an issue in my github Readme.md?\nI found the following document GitHub Flavored Markdown where it is described how to reference to an issue in a commit, but not in the readme.\nE.g. if the Issue is: https://github.com/user/project/issues/5 how can I set a link to it in my readme without using absolute links?"
},
{
"role": "assistant",
"content": "There's a pretty ugly way of doing something like that if you only want to refer to issues from the same repo, which as of 2015-04-29 works:\nsee also [#3](/../../issues/3)"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Why is Github asking for username/password when following the instructions on screen and pushing a new repo?\n\nI'm the owner of an organization on github and just created a repo and tried pushing but I'm running into an issue where it's asking me for my username even though I can SSH just fine:\n$ ssh -T [email protected]\nHi Celc! You've successfully authenticated, but GitHub does not provide shell access.\n$ git add .\n$ git commit -m 'first commit'\n[master (root-commit) 3f1b963] first commit\n 6 files changed, 59 insertions(+)\n create mode 100644 .gitignore\n create mode 100644 main.js\n create mode 100644 package.json\n create mode 100644 readme.markdown\n create mode 100644 views/index.ejs\n create mode 100644 views/layout.ejs\n$ git remote add origin https://github.com/WEMP/project-slideshow.git\n$ git push -u origin master\nUsername for 'https://github.com':\n\nWhat am I doing wrong? This has never happened to me before but I recently also upgraded to git 1.7.10.3."
},
{
"role": "assistant",
"content": "Don't use HTTP use SSH instead\nchange \nhttps://github.com/WEMP/project-slideshow.git \n\nto \n[email protected]:WEMP/project-slideshow.git\n\nyou can do it in .git/config file"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Can I make a pull request on a gist on GitHub?\nCan I make a pull request on some else's gist on GitHub?\nI'm aware of the fork, clone and commit workflow for a gist I own. I'd like to know if I can request to update someone else's gist with my fork."
},
{
"role": "assistant",
"content": "You cannot currently open a pull request on a Gist.\nYou can comment though on the Gist and ask the author to update the Gist from your fork."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-tag - Create, list, delete or verify a tag object signed with GPG --omit-empty"
},
{
"role": "assistant",
"content": "Do not print a newline after formatted refs where the format expands\nto the empty string."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How can I find out which files have been modified in a branch?\nI have two branches: master and bug1. I checked out bug1, did bunch of changes and multiple commits. How do I get a list of all files that were changed on the branch? I'm not interested in hashes, dates or any other commit related details. I just want to get a simple list of touched files."
},
{
"role": "assistant",
"content": "git diff --name-only master bug1"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How can I get a list of Git branches that I've recently checked out?\nWhen moving between Git branches I sometimes forget the name of a branch I was recently on. How can I display a list of recently checked out branches/tags/commits in order of checkout?"
},
{
"role": "assistant",
"content": "Summary:\nYou can use Git's reflog to show recent movements in order of checkout: git reflog\nScript:\nHere's a script you can download and use via git recent from inside any Git repository: https://gist.github.com/jordan-brough/48e2803c0ffa6dc2e0bd\nUsage:\n$ (master) git recent -n 5\n\n1) master 4) deleted-branch\n2) stable 5) improve-everything\n3) fun\nChoose a branch: 2\n\n$ (stable) …\n\nSee the gist for more details/options.\nDetails:\nHere's essentially what the script does to make the reflog output more usable:\n$ git reflog | egrep -io \"moving from ([^[:space:]]+)\" | awk '{ print $3 }' | awk ' !x[$0]++' | egrep -v '^[a-f0-9]{40}$' | head -n5\nmaster\nstable\nfix-stuff\nsome-cool-feature\nfeature/improve-everything"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "x509: certificate signed by unknown authority - both with docker and with github\n\ndocker build -t oreng/iojs .\nINFO[0000] Get https://index.docker.io/v1/repositories/library/iojs/images: x509: certificate signed by unknown authority. \n\nmy Dockerfile is\nFROM iojs:latest\nRUN useradd -ms /bin/bash developer\nWORKDIR /home/developer\nUSER developer\n\nAlso hub create (using https://github.com/github/hub)\nPost https://api.github.com/user/repos: x509: certificate signed by unknown authority"
},
{
"role": "assistant",
"content": "As mentioned in crypto/x509/root_unix.go, Go (which is what Docker uses) will check CA certificates in\n\"/etc/ssl/certs/ca-certificates.crt\", // Debian/Ubuntu/Gentoo etc.\n\"/etc/pki/tls/certs/ca-bundle.crt\", // Fedora/RHEL\n\"/etc/ssl/ca-bundle.pem\", // OpenSUSE\n\"/etc/ssl/cert.pem\", // OpenBSD\n\"/usr/local/share/certs/ca-root-nss.crt\", // FreeBSD/DragonFly\n\"/etc/pki/tls/cacert.pem\", // OpenELEC\n\"/etc/certs/ca-certificates.crt\", // Solaris 11.2+\n\nMake sure those files are available and not corrupted.\nThere can be also sporadic issue with the CDN, as in this comment:\n\nbecause now it works :+1: . It must be a amazon edge isssue \n\nThe last thread also includes the following check:\n\nThe user reporting the issue either has non of those files or those files don't include the rapidssl cert.\n We could ask them to send us those files and check if the certificate is included.\n The user may also try this:\n\nopenssl s_client -showcerts -verify 32 -connect index.docker.io:443\n\n\nIf that fails, the certificates are missing.\n\nRegarding GitHub, be aware it is under a massive DDoS attack at the moment, which could have other side-effects beside the certificate issue."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Should I .gitignore my gradlew?\nMy gradle project includes gradlew and gradlew.bat files inside of the repository, should they be pushed to git or not? I did not see anybody say they should be removed here. What is the purpose of these files?"
},
{
"role": "assistant",
"content": "NOT Really. Reason being if someone download or clone your repo and try to run your application through command line and they do not have gradle installed on their local machine, they have to install and configure Gradle and then run it. The gradlew provides a convenient way to run a gradle build with installing it.\nHere is what Gradle documentation says:\n\nMost tools require installation on your computer before you can use them. If the installation is easy, you may think that’s fine. But it can be an unnecessary burden on the users of the build. Equally importantly, will the user install the right version of the tool for the build? What if they’re building an old version of the software?\nThe Gradle Wrapper (henceforth referred to as the “Wrapper”) solves both these problems and is the preferred way of starting a Gradle build."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-diff - Show changes between commits, commit and working tree, etc diff.<driver>.command"
},
{
"role": "assistant",
"content": "The custom diff driver command. See gitattributes for details."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Change first commit of project with Git? [duplicate]\nThis question already has answers here:\n \n \n\n\n\n\nEdit the root commit in Git?\n\n (5 answers)\n \n\nClosed 10 years ago.\n\n\n\nI want to change something in the first commit of my project with out losing all subsequent commits. Is there any way to do this?\nI accidentally listed my raw email in a comment within the source code, and I'd like to change it as I'm getting spammed from bots indexing GitHub."
},
{
"role": "assistant",
"content": "As mentioned by ecdpalma below, git 1.7.12+ (August 2012) has enhanced the option --root for git rebase:\n\"git rebase [-i] --root $tip\" can now be used to rewrite all the history leading to \"$tip\" down to the root commit.\nThat new behavior was initially discussed here:\n\nI personally think \"git rebase -i --root\" should be made to just work without requiring \"--onto\" and let you \"edit\" even the first one in the history.\n It is understandable that nobody bothered, as people are a lot less often rewriting near the very beginning of the history than otherwise. \n\nThe patch followed.\n\n(original answer, February 2010)\nAs mentioned in the Git FAQ (and this SO question), the idea is:\n\nCreate new temporary branch \nRewind it to the commit you want to change using git reset --hard\nChange that commit (it would be top of current HEAD, and you can modify the content of any file)\nRebase branch on top of changed commit, using:\ngit rebase --onto <tmp branch> <commit after changed> <branch>`\n\n\nThe trick is to be sure the information you want to remove is not reintroduced by a later commit somewhere else in your file. If you suspect that, then you have to use filter-branch --tree-filter to make sure the content of that file does not contain in any commit the sensible information.\nIn both cases, you end up rewriting the SHA1 of every commit, so be careful if you have already published the branch you are modifying the contents of. You probably shouldn’t do it unless your project isn’t yet public and other people haven’t based work off the commits you’re about to rewrite."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How does Git store files?\nI just started learning Git and to do so, I started reading the Git Community Book, and in this book they say that SVN and CVS store the difference between files and that Git stores a snapshot of all the files.\nBut I didn't really get what they mean by snapshot. Does Git really make a copy of all the files in each commit? Because that's what I understood from their explanation."
},
{
"role": "assistant",
"content": "Git does include for each commit a full copy of all the files, except that, for the content already present in the Git repo, the snapshot will simply point to said content rather than duplicate it.\nThat also means that several files with the same content are stored only once.\nSo a snapshot is basically a commit, referring to the content of a directory structure.\nSome good references are:\n\ngit.github.io/git-reference\n\n\nYou tell Git you want to save a snapshot of your project with the git commit command and it basically records a manifest of what all of the files in your project look like at that point\n\n\n2020: \"A commit in Git: Is it a snapshot/state/image or is it a change/diff/patch/delta?\"\ngit immersion\n\nLab 12 illustrates how to get previous snapshots\n\n\"You could have invented git (and maybe you already have!)\"\n\nWhat is a git “Snapshot”?\n\nLearn GitHub\n\n\n\nThe progit book has the more comprehensive description of a snapshot:\n\nThe major difference between Git and any other VCS (Subversion and friends included) is the way Git thinks about its data.\nConceptually, most other systems store information as a list of file-based changes. These systems (CVS, Subversion, Perforce, Bazaar, and so on) think of the information they keep as a set of files and the changes made to each file over time\n\nGit doesn’t think of or store its data this way. Instead, Git thinks of its data more like a set of snapshots of a mini filesystem.\nEvery time you commit, or save the state of your project in Git, it basically takes a picture of what all your files look like at that moment and stores a reference to that snapshot.\nTo be efficient, if files have not changed, Git doesn’t store the file again—just a link to the previous identical file it has already stored.\nGit thinks about its data more like as below:\n\nThis is an important distinction between Git and nearly all other VCSs. It makes Git reconsider almost every aspect of version control that most other systems copied from the previous generation. This makes Git more like a mini filesystem with some incredibly powerful tools built on top of it, rather than simply a VCS.\n\nSee also:\n\n\"If git functions off of snapshots of files, why doesn't .git/ become huge over time?\"\n\"What information is stored as each git commit's tree object content\"\n\n\nJan Hudec adds this important comment:\n\nWhile that's true and important on the conceptual level, it is NOT true at the storage level.\nGit does use deltas for storage.\nNot only that, but it's more efficient in it than any other system. Because it does not keep per-file history, when it wants to do delta compression, it takes each blob, selects some blobs that are likely to be similar (using heuristics that includes the closest approximation of previous version and some others), tries to generate the deltas and picks the smallest one. This way it can (often, depends on the heuristics) take advantage of other similar files or older versions that are more similar than the previous. The \"pack window\" parameter allows trading performance for delta compression quality. The default (10) generally gives decent results, but when space is limited or to speed up network transfers, git gc --aggressive uses value 250, which makes it run very slow, but provide extra compression for history data."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "In Git and Subversion, how do I find out the current user at the terminal?\nIn Perforce, I can check who I am by running p4 info, here's the p4 doc. What's the equivalent for Git and Subversion at the terminal?"
},
{
"role": "assistant",
"content": "Presumably you are after the git user name that will be attached to any commits:\n$ git config user.name\nWilbert Wilbert\n\n$ git config --list\nuser.name=Wilbert Wilbert\n[email protected]\ncolor.status=auto\ncolor.branch=auto\n...\n\nKeys might appear more than once because Git reads from several files (/etc/gitconfig and ~/.gitconfig, for example). Git uses the last value for each key it sees."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Temporarily switch working copy to a specific Git commit\nHow to switch to specific Git commit without losing all the commits made after it?\nI want that local files will be changed, but commits' database will remain intact, only the current position pointer is set to currently selected commit.\nI want to change files' state to specific commit, run project and, when finished, restore files back to last commit.\nHow to do this without zipping the whole project's folder?"
},
{
"role": "assistant",
"content": "If you are at a certain branch mybranch, just go ahead and git checkout commit_hash. Then you can return to your branch by git checkout mybranch. I had the same game bisecting a bug today :) Also, you should know about git bisect."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Is it possible to add border to image in GitHub markdown?\n\nI need to add border to the image in GitHub README.md file. This is how image should be embeded:\n\n\nI have tried to wrap image with the table:\n|--------------------------------|\n||\n\nbut it is not possible to create table without header.\nI have also tried to include image as html tag:\n<img src=\"/images/logo.png\" style=\"border: 1px solid black\" />\n\nbut without success. Is there any way how to do this?"
},
{
"role": "assistant",
"content": "It's hacky and not always pretty, but surround the image with a <kbd> tag.\nBefore\n<img src=\"https://i.sstatic.net/CtiyS.png\">\n\nAfter\n<kbd>\n <img src=\"https://i.sstatic.net/CtiyS.png\">\n</kbd>\n\nAnd it renders like this:\n\n\n\n\nSurrounding the markdown image syntax might not work for some markdown implementations. If the following does not work\n<kbd></kbd>\n\nTry embedding the image as an HTML <img> tag instead\n<kbd><img src=\"https://example.com/image.png\" /></kbd>"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Logon failed, use Ctrl + C to cancel basic credential prompt\n\nI'm facing problems while trying to pull/push my code into a GitHub repository using the cmd prompt for the last two days. How can I resolve this issue?\n\nLogon failed, use Ctrl + C to cancel basic credential prompt. Username for 'https://github.com': satyendrasingh8 Password for 'https://[email protected]': remote: Invalid username or password. fatal: Authentication failed for 'https://github.com/satyendrasingh8/chatApp.git/'"
},
{
"role": "assistant",
"content": "Fitz_Hoo is right! I just wanted to give a more detailed explanation that fix my issue. Essentially GitHub deprecated their password authentication recently (you can read more by clicking here).\n\nNow instead of adding your username/email and password, you will login with your browser. The image below is the new interface. As Fitz_hoo mentions, you must update your Git to see the new changes!\n\nIf you are using Windows, you can simply use this command below to update your Git:\ngit update-git-for-windows"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-log - Show commit logs"
},
{
"role": "assistant",
"content": "DISCUSSION Git is to some extent character encoding agnostic. The contents of the blob objects are uninterpreted sequences\nof bytes. There is no encoding translation at the core\nlevel. Path names are encoded in UTF-8 normalization form C. This\napplies to tree objects, the index file, ref names, as well as\npath names in command line arguments, environment variables\nand config files ( .git/config (see git-config ), gitignore , gitattributes and gitmodules ). Note that Git at the core level treats path names simply as\nsequences of non-NUL bytes, there are no path name encoding\nconversions (except on Mac and Windows). Therefore, using\nnon-ASCII path names will mostly work even on platforms and file\nsystems that use legacy extended ASCII encodings. However,\nrepositories created on such systems will not work properly on\nUTF-8-based systems (e.g. Linux, Mac, Windows) and vice versa.\nAdditionally, many Git-based tools simply assume path names to\nbe UTF-8 and will fail to display other encodings correctly. Commit log messages are typically encoded in UTF-8, but other\nextended ASCII encodings are also supported. This includes\nISO-8859-x, CP125x and many others, but not UTF-16/32,\nEBCDIC and CJK multi-byte encodings (GBK, Shift-JIS, Big5,\nEUC-x, CP9xx etc.). Although we encourage that the commit log messages are encoded\nin UTF-8, both the core and Git Porcelain are designed not to\nforce UTF-8 on projects. If all participants of a particular\nproject find it more convenient to use legacy encodings, Git\ndoes not forbid it. However, there are a few things to keep in\nmind. git commit and git commit-tree issue\na warning if the commit log message given to it does not look\nlike a valid UTF-8 string, unless you explicitly say your\nproject uses a legacy encoding. The way to say this is to\nhave i18n.commitEncoding in .git/config file, like this: [i18n]\n\tcommitEncoding = ISO-8859-1 Commit objects created with the above setting record the value\nof i18n.commitEncoding in their encoding header. This is to\nhelp other people who look at them later. Lack of this header\nimplies that the commit log message is encoded in UTF-8. git log , git show , git blame and friends look at the encoding header of a commit object, and try to re-code the\nlog message into UTF-8 unless otherwise specified. You can\nspecify the desired output encoding with i18n.logOutputEncoding in .git/config file, like this: [i18n]\n\tlogOutputEncoding = ISO-8859-1 If you do not have this configuration variable, the value of i18n.commitEncoding is used instead. Note that we deliberately chose not to re-code the commit log\nmessage when a commit is made to force UTF-8 at the commit\nobject level, because re-coding to UTF-8 is not necessarily a\nreversible operation."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-log - Show commit logs [--] <path>…"
},
{
"role": "assistant",
"content": "Show only commits that are enough to explain how the files\nthat match the specified paths came to be. See History\nSimplification below for details and other simplification\nmodes. Paths may need to be prefixed with -- to separate them from\noptions or the revision range, when confusion arises."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Git: Ignore tracked files\nI have some tracked files in a repository which are automatically modified when building the code. I don't want to untrack them, I just don't want them to appear as modified and I don't want them to be staged when I git add.\nIs this possible?"
},
{
"role": "assistant",
"content": "Sure.\ngit update-index --assume-unchanged [<file> ...]\n\nTo undo and start tracking again:\ngit update-index --no-assume-unchanged [<file> ...]"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git - the stupid content tracker GIT_LITERAL_PATHSPECS"
},
{
"role": "assistant",
"content": "Setting this Boolean environment variable to true will cause Git to treat all\npathspecs literally, rather than as glob patterns. For example,\nrunning GIT_LITERAL_PATHSPECS=1 git log -- '*.c' will search\nfor commits that touch the path *.c , not any paths that the\nglob *.c matches. You might want this if you are feeding\nliteral paths to Git (e.g., paths previously given to you by git ls-tree , --raw diff output, etc)."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-config - Get and set repository or global options color.advice"
},
{
"role": "assistant",
"content": "A boolean to enable/disable color in hints (e.g. when a push\nfailed, see advice.* for a list). May be set to always , false (or never ) or auto (or true ), in which case colors\nare used only when the error output goes to a terminal. If\nunset, then the value of color.ui is used ( auto by default)."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Why doesn't git recognize that my file has been changed, therefore git add not working\nI am trying to push my files to github using bash. They are already on there, and I am uploading a newer version with new lines and code, etc. But when I try git add and then git status it says:\n\nOn branch master\nnothing to commit, working directory clean\n\nAnd the file I am using was just modified."
},
{
"role": "assistant",
"content": "I had a problem where once upon a time I set the git index to 'assume unchanged' on my file.\nYou can tell git to stop ignoring changes to the file with:\ngit update-index --no-assume-unchanged path/to/file\n\nIf that doesn't help a reset may be enough for other weird cases. \n\nIn practice I found removing the cached file and resetting it to work:\ngit rm --cached path/to/file\ngit reset path/to/file\n\nThe git rm --cached means to only remove the file from the index, and reset tells git to reload the git index from the last commit."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Git pull: error: Entry foo not uptodate. Cannot merge\nI'm trying to update my repo from a remote branch and keep getting this error when I do a \"git pull\". I haven't made any local changes, and even if I have I don't need to keep them.\nI've tried:\ngit reset --hard\n\nand I get the same problem\nThe only thing that seems to work is deleting the offending file and try a git pull again.\nI've also tried git stash followed by a git pull. No go.\nedit: using PortableGit-1.6.4-preview20090729 so any previous bugs with spurious errors should be fixed."
},
{
"role": "assistant",
"content": "This may happen if you update the index to ignore certain files: \ngit update-index --assume-unchanged <file>\n\nand then for instance checkout some other branch:\ngit checkout <branch>\n> error: Entry '<file>' not uptodate. Cannot merge.\n\nForcing index refresh fixes the issue:\ngit update-index --really-refresh\n<file>: needs update\n\nFollowed by:\ngit reset --hard \n\nAnd then everything should be back to normal."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-diff-index - Compare a tree to the working tree or index -C[<n>] --find-copies[=<n>]"
},
{
"role": "assistant",
"content": "Detect copies as well as renames. See also --find-copies-harder .\nIf n is specified, it has the same meaning as for -M<n> ."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-daemon - A really simple server for Git repositories --strict-paths"
},
{
"role": "assistant",
"content": "Match paths exactly (i.e. don’t allow \"/foo/repo\" when the real path is\n\"/foo/repo.git\" or \"/foo/repo/.git\") and don’t do user-relative paths. git daemon will refuse to start when this option is enabled and no\ndirectory arguments are provided."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-config - Get and set repository or global options mergetool.<tool>.cmd"
},
{
"role": "assistant",
"content": "Specify the command to invoke the specified merge tool. The\nspecified command is evaluated in shell with the following\nvariables available: BASE is the name of a temporary file\ncontaining the common base of the files to be merged, if available; LOCAL is the name of a temporary file containing the contents of\nthe file on the current branch; REMOTE is the name of a temporary\nfile containing the contents of the file from the branch being\nmerged; MERGED contains the name of the file to which the merge\ntool should write the results of a successful merge."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-config - Get and set repository or global options remote.<name>.pushurl"
},
{
"role": "assistant",
"content": "The push URL of a remote repository. See git-push ."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "how to set desired language in git-gui?\nI recently came to git for a project I participate to. I found git gui rather handy (under OSX Snow Leopard) to srtat with but I would much like if it were not localized (in French, in my case). Is there preference or hack to have git gui displayed in english?"
},
{
"role": "assistant",
"content": "For Windows users the are two choices as well:\n1) Set the LANG environment variable to en.\na) Overall for Windows: http://www.itechtalk.com/thread3595.html\nb) For the git shell only:\nIf you don't want to affect anything else except git applications you might add the following line in the beginning of C:\\Program Files\\Git\\cmd\\git.cmd file:\n@set LANG=en\n\nPlease note that this will only work when launching commands from the git shell - GIT GUI launched from the start menu will not be affected\n2) Delete or rename relevant *.msg file in C:\\Program Files\\Git\\share\\git-gui\\lib\\msgs\nYou save on not modifying any setup shell (especially if you use cmd.exe shells) but\nyou lose on international functionality.\nCredits: These answers originated in the official issue raised in msysgit project which can be found here: http://code.google.com/p/msysgit/issues/detail?id=302"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Git on Windows: What do the crlf settings mean?\nI don't understand the complexities related to CrLf settings in git: core.autocrlf, core.safecrlf\nI'm developing a cross-platform project in a team and would like both Windows and Linux developers to be able to work together without git marking files as modified just because of line ending style.\nWhat do the various settings mean? What would be the consequences of choosing any of the options? And what would be the best solution for my case?\nYes, I'm aware of this question and the answers there were not insightful, thus not helpful."
},
{
"role": "assistant",
"content": "The three values for autocrlf:\n\ntrue - when content goes into the repository (is committed), its line endings will be converted to LF, and when content comes out of the repository (is checked out), the line endings be converted to CRLF. This is in general meant for clueless windows users/editors. Given the assumption that an editor (or user) is going to create files with CRLF endings, and will freak out if it sees normal LF endings, but that you want LF endings in the repo, this will hopefully cover you. It's possible for things to go awry, though. There are examples of spurious merge conflicts and reports of modified files in the linked questions.\ninput - when content goes into the repository, its line endings will be converted to LF, but content is left untouched on the way out. This is basically in the same realm as true, with the assumption that the editors actually can deal with LF endings correctly; you're just guarding against the possibility of accidentally creating a file with CRLF endings.\nfalse - git doesn't deal with line endings at all. It's up to you. This is what a lot of people recommend. With this setting, if a file's line endings are going to be messed with, you'll have to be aware of it, so merge conflicts are a lot less likely (assuming informed users). Educating developers about how to use their editors/IDEs can pretty much take care of the problem. All of the editors I've seen designed for programmers are capable of dealing with this if configured properly.\n\nNote that autocrlf will not affect content which is already in the repository. If you've committed something with CRLF endings previously, they'll stay that way. This is a very good reason to avoid depending on autocrlf; if one user doesn't have it set, they can get content with CRLF endings into the repo, and it'll stick around. A stronger way to force normalization is with the text attribute; setting it to auto for a given path will mark it for end-of-line normalization, assuming git decides the content is text (not binary).\nA related option is safecrlf, which is basically just a way to make sure you don't irreversably perform CRLF conversion on a binary file.\nI don't have a ton of experience dealing with Windows issues and git, so feedback about implications/pitfalls is certainly welcome."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-diff: Only show changes staged for committing\nI want to see diff on files that I've added to commit (git add something). I can do this:\ngit diff HEAD `git status -s | grep ^M | cut -c 4-`\n\nIs there a shorter way?"
},
{
"role": "assistant",
"content": "You can use git diff --staged (or git diff --cached) to see the diff that will be used when committing.\nFrom the manpage:\n\ngit diff [--options] --cached [<commit>] [--] [<path>...]\n This form is to view the changes you staged for the next commit relative to the named <commit>. Typically you would want comparison with the latest commit, so if you do not give <commit>, it defaults to HEAD. If HEAD does not exist (e.g. unborned branches) and <commit> is not given, it shows all staged changes. --staged is a synonym of --cached."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Force Git submodules to always stay current\nI love git submodules. Also, I hate git submodules. What I love about them is how it enables to you to cleanly compartmentalize dependencies etc. I get the point of having them point to a specific commit on a repo, I do. But in my case, I'm building a library that will be used in another project, so I want to keep it in that seperate repo.\nHowever, the annoyance comes when I'm working on a daily basis on this library and I constantly have to switch back to the app using my library to commit the pointer update.\nSo, is it possible to have a git submodule just always be on the head of the repo it's pointing at while I'm constantly updating and adding to this library?"
},
{
"role": "assistant",
"content": "As I mention in \"git submodule tracking latest\", you can since git 1.8.2 (March 2013) make a submodule track the HEAD of branch:\ngit submodule add -b <branch> <repository> [<path>]\n\nA submodule SHA1 is still recorded in the parent repo as a gitlink (special entry in the index)\nBut a git submodule update --remote will update that entry to the SHA1 matching the HEAD of a branch of the submodule remote repo.\nIf you have an existing submodule, you can make it follow a branch with:\ncd /path/to/your/parent/repo\ngit config -f .gitmodules submodule.<path>.branch <branch>\n\ncd path/to/your/submodule\ngit checkout -b <branch> --track origin/<branch>\n # if the master branch already exist:\n git branch -u origin/<branch> <branch>\n\ncd /path/to/your/parent/repo\ngit add path/to/your/submodule\ngit commit -m \"Make submodule tracking <branch>\""
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Pull all commits from a branch, push specified commits to another\nI have the following branches:\n\nmaster\nproduction\n\nand the following remote branches:\n\norigin/master\norigin/production\n\nI have a script that fetches the origin/master branch and gets the diff of what changed from my last fetch (log -p master..origin/master). Then I merge origin/master.\nThe commits found are pushed to a code review tool.\nI want to push the successful commits – and only them – to the production branch, and then of course to origin/production.\nHow can I do so?\nAlso, I have 2 scripts running: the one that fetch from origin/master, push commits details to a database, and merge, and the other that I'm currently writing that will have to push the successful commits. \nI'd like to have those 2 scripts running while avoiding race conditions/merge conflict. Since I only want to work with specified commits, maybe there's a way to get rid of the commits that I don't want?"
},
{
"role": "assistant",
"content": "The term I think you're looking for is a 'cherry pick'. That is, take a single commit from the middle of one branch and add it to another:\nA-----B------C\n \\\n \\\n D\n\nbecomes\nA-----B------C\n \\\n \\\n D-----C'\n\nThis, of course, can be done with the git cherry-pick command.\nThe problem with this commit is that git considers commits to include all history before them - thus, if you have three commits like so:\nA-----B-----C\n\nAnd try to get rid of B, you have to create an entirely new commit like so:\nA-----------C'\n\nWhere C' has a different SHA-1 ID. Likewise, cherry picking a commit from one branch to another basically involves generating a patch, then applying it, thus losing history that way as well.\nThis changing of commit IDs breaks git's merging functionality among other things (though if used sparingly there are heuristics that will paper over this). More importantly though, it ignores functional dependencies - if C actually used a function defined in B, you'll never know.\nPerhaps a better way to handle this would be to have more fine grained branches. That is, instead of just having a 'master', have 'featureA', 'bugfixB', etc. Perform code review on an entire branch at a time - where each branch is very focused on doing only one thing - and then merge that one branch when you're done. This is the workflow that git is designed for, and what it's good at :)\nIf you insist on dealing with things at the level of patches, you may want to look at darcs - it considers a repository to be a set of patches, and thus cherry picking becomes the fundamental operation. However this has its own set of problems, such as being very slow :)\nEdit: Also, I'm not sure I understand your second question, about the two scripts. Maybe you could describe it in more detail, possibly as a separate question to keep things from getting confusing?"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Retrieve deleted stash in Git using SourceTree\nI am using source tree. I had created a stash of multiple changes and by mistake deleted it. Is there a way to retrieve them back?"
},
{
"role": "assistant",
"content": "Based on previous answers, here is a simple sequence:\nOpen a terminal window and cd into a folder under the repository. Then:\ngit fsck | awk '{print $3}' > tmp.txt\ncat tmp.txt | xargs git show > tmp2.txt\n\nNow open tmp2.txt in editor, locate your lost code, and find the commit-id on top of it. Then apply the code:\ngit stash apply <commit id>\nrm tmp.txt tmp2.txt\n\nThis saved my life! I really thank all those who answered this question. I bless the git creator Linus Torvalds for keeping deleted stuff in the git database. Genius!!\nEDIT 2021: note that Windows users can do the same using Git Bash."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-diff - Show changes between commits, commit and working tree, etc Munging the diff output"
},
{
"role": "assistant",
"content": "$ git diff --find-copies-harder -B -C (1) $ git diff -R (2) Spend extra cycles to find renames, copies and complete\nrewrites (very expensive). Output diff in reverse."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Unable to resolve \"unable to get local issuer certificate\" using git on Windows with self-signed certificate\nI am using Git on Windows. I installed the msysGit package. My test repository has a self signed certificate at the server. I can access and use the repository using HTTP without problems. Moving to HTTPS gives the error:\n\nSSL Certificate problem: unable to get local issuer certificate. \n\nI have the self signed certificate installed in the Trusted Root Certification Authorities of my Windows 7 - client machine. I can browse to the HTTPS repository URL in Internet Explorer with no error messages.\nThis blog post by Philip Kelley explained that cURL does not use the client machine's certificate store. I followed the blog post's advice to create a private copy of curl-ca-bundle.crt and configure Git to use it. I am sure Git is using my copy. If I rename the copy; Git complains the file is missing.\nI pasted in my certificate, as mentioned in the blog post, I still get the message \"unable to get local issuer certificate\".\nI verified that Git was still working by cloning a GitHub Repository via HTTPS.\nThe only thing I see that's different to the blog post is that my certificate is the root - there is no chain to reach it. My certificate originally came from clicking the IIS8 IIS Manager link 'Create Self Signed Certificate'. Maybe that makes a certificate different in some way to what cURL expects.\nHow can I get Git/cURL to accept the self signed certificate?"
},
{
"role": "assistant",
"content": "The problem is that git by default using the \"Linux\" crypto backend.\nBeginning with Git for Windows 2.14, you can now configure Git to use SChannel, the built-in Windows networking layer as the crypto backend. This means that it will use the Windows certificate storage mechanism and you do not need to explicitly configure the curl CA storage mechanism: https://msdn.microsoft.com/en-us/library/windows/desktop/aa380123(v=vs.85).aspx\nJust execute:\ngit config --global http.sslbackend schannel\n\nThat should help.\nUsing schannel is by now the standard setting when installing git for Windows, also it is recommended to not checkout repositories by SSH anmore if possible, as https is easier to configure and less likely to be blocked by a firewall it means less chance of failure."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Is there anyway to programmatically fetch a zipball of private github repo?\n\nWe got a necessity to fetch a zipball of a private repo. For public ones it's pretty easy either through GitHub API or manually (https://github.com/user/repo/zipball/master). But what about private repos? Not exactly obvious how to do it even having oAuth token."
},
{
"role": "assistant",
"content": "New Alternative\nBecause the given accepted answer does not work anymore, I thought I would explain how I was able to do it with the new changes in the github API.\nThe new Download Api Link\nFirst, I found information about downloading the archive here:\nhttps://developer.github.com/v3/repos/contents/#get-archive-link\nPublic Repo\nIf it's a public repo then it is very easy... you can do:\ncurl -L https://api.github.com/repos/pengwynn/octokit/tarball > octokit.tar.gz\n\nPrivate Repo\nIf it's it is a private repo, you need to create an oAuth token by going to your settings and then selecting \"Developer settings\" / \"Personal access tokens\".\nI created a personal token.\nThen using the instructions on the following page I found out how to get private repo that you have permission to:\nhttps://developer.github.com/v3/#authentication\nFull Code\ncurl -H \"Authorization: token ab499f3b...\" \\\n-L https://api.github.com/repos/godzilla/my_priv_repo/tarball > wut.tar.gz\n\nBe sure to replace ab499f3b... with your actual token."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "error: could not lock config file filepath/../.git/config :permission denied\n\ni created a folder called \"try\" in the path /home/bhishan/Copy/try\nthen inside that folder i gave some commands:\nmy commands are follwing:\ncurl -s -O \\\nhttp://github-media-downloads.s3.amazonaws.com/osx/git-credential-osxkeychain\n\nchmod u+x git-credential-osxkeychain\n\nsudo mv git-credential-osxkeychain `dirname \\`which git\\``\n\ngit config --global credential.helper osxkeychain\n\ngit init\n\ngit remote add origin https:\n\ngit remote add origin https:\n\ngit push origin master\n\n==============================\nit worked fine but, when i try to delete try folder i cannot delete the folder.\ni also can not give command:\ngit init\n\ninside the try folder ( i have a .git folder there)\n=====================================================\nmy command line and error report is this:\nbhishan@bhishan-HP-Pavilion-dv6-Notebook-PC:~/Copy/try$ git init\nerror: could not lock config file /home/bhishan/Copy/try/.git/config: Permission denied\n\nnow, my question is how can i delete the folder called \"try\" ?"
},
{
"role": "assistant",
"content": "These kinds of problems occur when you use sudo to run commands with side effects such as file creation. \nIt's quite common to find files and directories in your home directory that are owned by root. In this case it seems your .git/config file is owned by root and thus gives you the permissions error when you try to lock it. \nsudo chown bhishan -R .git from the ~/Copy/try directory should fix the permissions issue."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Gantt Chart for GitHub [closed]\n\nClosed. This question is seeking recommendations for software libraries, tutorials, tools, books, or other off-site resources. It does not meet Stack Overflow guidelines. It is not currently accepting answers.\n \n \n\n\n\n\n\n\n\n\n\n\n\n We don’t allow questions seeking recommendations for software libraries, tutorials, tools, books, or other off-site resources. You can edit the question so it can be answered with facts and citations.\n\n\nClosed 8 years ago.\n\n\n\n\n\n\n\n Improve this question\n \n\n\n\nWe've been using GitHub for 6-months now and have more/less figured out \"best practices\" with regards on how to put in tasks, milestones, etc. However, from a management point of view, there are a few features that are lacking. For instance, Gantt Chart capabilities found in solutions such as RedMine, or even overlaying on top of a calendar tasks/milestone markers, roadmaps, etc.\nIs there some sort of \"add on\" or 3rd party website that can hook into GitHub and generate these for me? Since we've already integrated so much within GitHub, I'd like to stay on it, but if a migration to another system is possible with the functionality we require, I may be willing to transfer. \nAny advice/help would be greatly appreciated!"
},
{
"role": "assistant",
"content": "I started a project which does exactly that :\nhttps://github.com/neyric/gh-issues-gantt\nIt only handles issue durations in days, but we found it to be easier to maintain and quite accurate for our usage."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Put current changes in a new Git branch [duplicate]\nThis question already has answers here:\n \n \n\n\n\n\nMove existing, uncommitted work to a new branch in Git\n\n (14 answers)\n \n\nClosed 10 years ago.\n\n\n\nI've been editing some modules on the master branch but I haven't committed them. I'm now thinking that these changes should really be on an experimental branch and not the master branch.\nHow can I get these edits into an experimental branch? Copy them to some temp location, create the branch, and then copy them back in?\nAnd how do I configure things so that when I do a git push from the new experimental branch it will it go into a branch of the same name in my GitHub repo?"
},
{
"role": "assistant",
"content": "You can simply check out a new branch, and then commit:\ngit checkout -b my_new_branch\ngit commit\n\nChecking out the new branch will not discard your changes."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to check real git diff before merging from remote branch?\nI want to check the real diff between remote branch and local branch. How can I do that?\nIssuing the below command partially works, but it shows the diff of the new changes of my local branch too.\ngit diff remote/branch"
},
{
"role": "assistant",
"content": "Since this topic comes up frequently, and can be confusing without a bit of background on how git works, I thought I'd try to explain the simplest case possible, but with sufficient depth that newcomers will have enough of a handle on it to do additional research.\nIf you set up your git repository via a normal 'clone' and have the default refspecs, meaning that your remote is named 'origin' and you pull/fetch from the branch 'master', you may sometimes need to see what's in the remote repository before pulling it down.\nSince the \"git pull\" does an automatic merge (unless there are conflicts), it can be nice to see what's \"incoming\" next. If you're not familiar with how git works, and how refspecs in particular are managed, this can be a bit non-intuitive. \nSuppose someone makes a change in the remote repository (for sake of illustration, adding a line to the remote repository by committing a change and pushing it), and you type:\n$ git diff origin/master\n\nYou probably won't see any changes; however if you do the following:\n$ git fetch; git diff ..origin/master \n\nyou'll see the difference between what's been committed to your local git repository and what's in the remote repository. You will NOT see any changes which are in your local filesystem or staged in your index. \nOk, why do we do this? origin/master is a refspec (see man pages). In short, this is what we refer to in order to compare against, pull or fetch from, and push to. All of the following are functionally equivalent:\norigin/master\nremotes/origin/master\nrefs/remotes/origin/master\n\nTo begin to untangle this, just take a peek at your repository's .git directory structure. A typical layout looks like this:\n.git/refs\n.git/refs/heads\n.git/refs/heads/master\n.git/refs/remotes\n.git/refs/remotes/origin\n.git/refs/remotes/origin/HEAD\n.git/refs/remotes/origin/master\n.git/refs/tags\n\nLook at .git/refs/remotes/origin/HEAD; in the default case it will point to the branch you use to pull from and push to. In my case, since I'm on master, the contents of this text file look like this:\nref: refs/remotes/origin/master\n\nThis tells me that the HEAD of my remote is identified by the refspec 'refs/remotes/origin/master'(which happens to have the aliases mentioned above).\nThis doesn't tell us much; what's the state of the remote repository? Look at the state of the remote master: \n$ cat .git/refs/heads/master \n6d0fb0adfdfa5af861931bb06d34100b349f1d63\n\nOk, it's a SHA1 hash; probably a commit. How does it get put in this file? Well, whenever you do a pull or a fetch, this file is updated with the most recent commit from the remote which was pulled or fetched. This explains why we have to git fetch prior to performing the diff. Remember, git fetch just updates your local copy of a remote branch, but doesn't merge it with your working copy. It is completely safe. A git fetch; git merge is equivalent to a git pull. \nOnce you do the fetch, git will be able to see the most recent commit in the remote \nrepository as of the time of the fetch.\nYou can use various combinations of specifiers to git to see your diffs as you desire (the following examples use the local working copy as the implicit first commit):\n$ git diff remote/origin \nThis shows the incoming remote additions as deletions; any additions in your local \nrepository are shown as additions.\n\n$ git diff ...remote/origin\nShows incoming remote additions as additions; the triple-dot excludes changes\ncommitted to your local repository.\n\n$ git diff ..remote/origin\nShows incoming remote additions as additions; the double-dot includes changes\ncommitted to your local repository as deletions (since they are not yet pushed).\n\nFor info on \"..\" vs \"...\" see git help diff as well as the excellent documentation at git-scm revision selection: commit ranges Briefly, for the examples above, double-dot syntax shows all commits reachable from origin/master but not your working copy. Likewise, the triple-dot syntax shows all the commits reachable from either commit (implicit working copy, remote/origin) but not from both.\nI'm going through this step by step because I'm fairly new to git and this is exactly the type of thing that had me confused... I'm sure that git experts can find flaws with the details... I just hope this answer bridges the gap for some people who find all the various posts a bit terse."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Command to get latest Git commit hash from a branch\n\nHow can I check with the command line the latest commit hash of a particular Git branch?"
},
{
"role": "assistant",
"content": "git log -n 1 [branch_name]\n\nbranch_name (may be remote or local branch) is optional. Without branch_name, it will show the latest commit on the current branch.\nFor example:\ngit log -n 1\ngit log -n 1 origin/master\ngit log -n 1 some_local_branch\n\ngit log -n 1 --pretty=format:\"%H\" #To get only hash value of commit"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-submodule - Initialize, update or inspect submodules sync [--recursive] [--] [<path>…]"
},
{
"role": "assistant",
"content": "Synchronizes submodules' remote URL configuration setting\nto the value specified in .gitmodules . It will only affect those\nsubmodules which already have a URL entry in .git/config (that is the\ncase when they are initialized or freshly added). This is useful when\nsubmodule URLs change upstream and you need to update your local\nrepositories accordingly. git submodule sync synchronizes all submodules while git submodule sync -- A synchronizes submodule \"A\" only. If --recursive is specified, this command will recurse into the\nregistered submodules, and sync any nested submodules within."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-rev-list - Lists commit objects in reverse chronological order Default mode"
},
{
"role": "assistant",
"content": "Simplifies the history to the simplest history explaining the\nfinal state of the tree. Simplest because it prunes some side\nbranches if the end result is the same (i.e. merging branches\nwith the same content)"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-show - Show various types of objects --pickaxe-all"
},
{
"role": "assistant",
"content": "When -S or -G finds a change, show all the changes in that\nchangeset, not just the files that contain the change\nin <string>."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-rebase - Reapply commits on top of another base tip rebase.abbreviateCommands"
},
{
"role": "assistant",
"content": "If set to true, git rebase will use abbreviated command names in the\ntodo list resulting in something like this: p deadbee The oneline of the commit\n\tp fa1afe1 The oneline of the next commit\n\t... instead of: pick deadbee The oneline of the commit\n\tpick fa1afe1 The oneline of the next commit\n\t... Defaults to false."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-diff-index - Compare a tree to the working tree or index --shortstat"
},
{
"role": "assistant",
"content": "Output only the last line of the --stat format containing total\nnumber of modified files, as well as number of added and deleted\nlines."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Where can I see my pull requests on GitHub?\n\nIs there a way to view on GitHub:\n\nAll my pull requests\nMy open pull requests\n\nThe only place where I usually see that is in my Contribution Activity, which unfortunately does not go further than 1 month ago."
},
{
"role": "assistant",
"content": "On the main homepage (not your userpage) there is a bar at the top with four buttons:\nNews Feed Pull Requests Issues Stars\n\nClick Pull Requests. \nThis home page can be accessed by clicking the octocat logo in the top-left, whereas your userpage is accessed by clicking your username in the top-right.\nIt should look like this:"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git - the stupid content tracker git-update-index"
},
{
"role": "assistant",
"content": "Register file contents in the working tree to the index"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-diff - Show changes between commits, commit and working tree, etc --ws-error-highlight=<kind>"
},
{
"role": "assistant",
"content": "Highlight whitespace errors in the context , old or new lines of the diff. Multiple values are separated by comma, none resets previous values, default reset the list to new and all is a shorthand for old,new,context . When\nthis option is not given, and the configuration variable diff.wsErrorHighlight is not set, only whitespace errors in new lines are highlighted. The whitespace errors are colored\nwith color.diff.whitespace ."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to set variable within 'script' section of gitlab-ci.yml file\n\nI am trying to set an environment variable for my GitLab Runner based on the branch that the commit originated from.\nI have 4 kubernetes clusters: staging, integration, production, and qa. Essentially I want to deploy my application to the proper cluster based on the branch I am pushing to.\nimage: google/cloud-sdk:latest\nvariables:\nDOCKER_HOST: tcp://docker:2375/\nDOCKER_DRIVER: overlay2\nservices:\n - docker:dind\nbefore_script:\n - docker info\nstages:\n - publish\npublish:\nstage: publish\nscript:\n - if [ \"$CI_COMMIT_REF_NAME\" = \"master\" ]; then $ENVIRONMENT=\"production\"; else $ENVIRONMENT=\"$CI_COMMIT_REF_NAME\"; fi\n - echo $ENVIRONMENT\n .\n .\n .\n - kubectl apply -f cfg/${ENVIRONMENT}/web-deployment.yaml\nonly:\n - master\n - integration\n - qa\n - staging\n\nAny time I run my script with a different form of the if statement I get the following error:\n/bin/bash: line 83: =integration: command not found\nERROR: Job failed: exit code 1\n\nSo from what I can tell the variable is being set, but the script exits. I've seen several SO questions related to this problem, but nothing about how to set a variable and then continue a script. How can I fix this issue?"
},
{
"role": "assistant",
"content": "The comment above helped me figure it out. So I use a VERSION file that right now contains 0.0.0 which I manipulate to create other variables\n # determine what branch I am on\n - if [ \"$CI_COMMIT_REF_NAME\" = \"master\" ]; then ENVIRONMENT=\"qa\"; else ENVIRONMENT=\"$CI_COMMIT_REF_NAME\"; fi\n\n # determine patch number for semver\n - PATCH=`git log --pretty=oneline | wc -l | sed -e 's/^[[:space:]]*//'`\n - VERSION=`cat VERSION`\n\n # drop trailing 0 from VERSION\n - VERSION=${VERSION%?}\n\n # set all env variables\n - TAG=\"${VERSION}${PATCH}\"\n - IMAGE=\"${TAG}-${ENVIRONMENT}\" # used for Kubernetes\n - API_HOST=\"https://api.${ENVIRONMENT}.my-app.com/\"\n - WEB_HOST=\"https://www.${ENVIRONMENT}.my-app.com/\"\n\n # pass enviornment variables to make \n - ENVIRONMENT=\"$ENVIRONMENT\" IMAGE=\"$IMAGE\" API_HOST=\"$API_HOST\" WEB_HOST=\"$WEB_HOST\" make\n\n # make has a step that calls sed and replaces text inline in this file to prepare Kubernetes\n - kubectl apply -f cfg/web-deployment.yaml\n\n # create a tag in the repo after deployment is done\n - curl -X POST --silent --insecure --show-error --fail \"https://gitlab.com/api/v4/projects/${CI_PROJECT_ID}/repository/tags?tag_name=${TAG}&ref=${CI_COMMIT_SHA}&private_token=${GITLAB_TOKEN}\""
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Merging to a branch in git without switching to it\nI have an application running in a git repository on a branch (say dev). The application modifies the content in some the repository and commits them. I now have to merge these changes into another branch (say master) but the snag is that I don't want to git checkout master before doing this. Is there some way to say \"merge current branch into master\"?"
},
{
"role": "assistant",
"content": "The \"master\" in your case appears to be \"fast-forwardable\". You could \"push\" the branch to master.\ncd /path_to_dir_with_no_branch_switch/\ngit push . appbranch:master"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Git Extensions: Win32 error 487: Couldn't reserve space for cygwin's heap, Win32 error 0\nGit Extensions: Everything was working fine until yesterday.\nBut suddenly I am get this error when I try to pull some repositories using git extensions \nC:\\Program Files\\Git\\bin\\git.exe pull --progress \"origin\" \nDone\n 0 [main] us 0 init_cheap: VirtualAlloc pointer is null, Win32 error 487\nAllocationBase 0x0, BaseAddress 0x68560000, RegionSize 0x390000, State 0x10000\nC:\\Program Files\\Git\\bin\\sh.exe: *** Couldn't reserve space for cygwin's heap, Win32 error 0\n\nIt is happening for all the repositories which I have cloned. \nBut, my git bash is working fine.\nI don't have any idea what is going on. Any idea as to why this is happening?"
},
{
"role": "assistant",
"content": "I had the same problem. I found solution here http://jakob.engbloms.se/archives/1403 \nc:\\msysgit\\bin>rebase.exe -b 0x50000000 msys-1.0.dll\n\nFor me solution was slightly different. It was\nC:\\Program Files (x86)\\Git\\bin>rebase.exe -b 0x50000000 msys-1.0.dll\n\nBefore you rebase dlls, you should make sure it is not in use: \ntasklist /m msys-1.0.dll\n\nAnd make a backup:\ncopy msys-1.0.dll msys-1.0.dll.bak\n\nIf the rebase command fails with something like: \n\nReBaseImage (msys-1.0.dll) failed with last error = 6\n\nYou will need to perform the following steps in order:\n\nCopy the dll to another directory\nRebase the copy using the commands above\nReplace the original dll with the copy.\n\nIf any issue run the commands as Administrator"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git push: refs/heads/my/subbranch exists, cannot create\nIs this not possible to create somme sub-sub-folder in a repo on a server?\nif i do:\ngit push origin dev/master \n\neverything work find\nbut if i do\ngit push origin dev/sub/master\n\ni got this:\nerror: 'refs/heads/dev/sub' exists; cannot create 'refs/heads/dev/sub/master'\n\ni checked with git branch -r and directly with ssh, there isn't dev/sub folder already created.\nwhat's wrong?"
},
{
"role": "assistant",
"content": "It's not a folder that exists, it's a branch. (Well, there may be a folder/directory involved somewhere—or maybe not, as references get \"packed\" and stop existing as files within directories.)\n\nIf branch b exists, no branch named b/anything can be created. \nLikewise, if branch dev/b exists, dev/b/c cannot be created.\n\nThis is a git internal limitation. In this particular case, remote origin has a branch named dev/sub (regardless of whether you have it or not, the important thing is whether the remote has it). In order to create, on origin, a branch named dev/sub/master, you must first delete the branch named dev/sub on origin:\ngit push origin :dev/sub\n\n(Of course, deleting this branch may delete something important over there, so be sure you know what you are doing. Generally, you might want to git fetch origin first, capturing their dev/sub as your origin/dev/sub. You can then make a local branch named dev/renamed-sub pointing to the same commit, create dev/renamed-sub on the remote, delete the remote dev/sub, and then create dev/sub/master on the remote.)\n\nIf you can log in on the remote (the system that origin is hosted on), you can go into the repository over there and simply rename the local dev/sub branch. (Based on comments below, I suspect that there's a broken auto-deploy script over there as well, which probably should be fixed to only deploy \"deployable\" branches, rather than everything that gets pushed. But I am just guessing here.)"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Merge stashed change with current changes\nI made some changes to my branch and realized I forgot I had stashed some other necessary changes to the said branch. What I want is a way to merge my stashed changes with the current changes.\nIs there a way to do this?\nIt’s more for convenience, I eventually gave up and committed my current changes first, then my stashed changes, but I would have preferred to get them in with one fell swoop."
},
{
"role": "assistant",
"content": "tl;dr\nRun git add first.\n\nI just discovered that if your uncommitted changes are added to the index (i.e. \"staged\", using git add ...), then git stash apply (and, presumably, git stash pop) will actually do a proper merge. If there are no conflicts, you're golden. If not, resolve them as usual with git mergetool, or manually with an editor.\nTo be clear, this is the process I'm talking about:\nmkdir test-repo && cd test-repo && git init\necho test > test.txt\ngit add test.txt && git commit -m \"Initial version\"\n\n# here's the interesting part:\n\n# make a local change and stash it:\necho test2 > test.txt\ngit stash\n\n# make a different local change:\necho test3 > test.txt\n\n# try to apply the previous changes:\ngit stash apply\n# git complains \"Cannot apply to a dirty working tree, please stage your changes\"\n\n# add \"test3\" changes to the index, then re-try the stash:\ngit add test.txt\ngit stash apply\n# git says: \"Auto-merging test.txt\"\n# git says: \"CONFLICT (content): Merge conflict in test.txt\"\n\n... which is probably what you're looking for."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-update-index - Register file contents in the working tree to the index --"
},
{
"role": "assistant",
"content": "Do not interpret any more arguments as options."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Git: Checkout all files except one\nWhen I do a git status, I see files like this:\nmodified: dir/A/file.txt\nmodified: dir/B/file.txt\nmodified: dir/C/file.txt\nmodified: dir/D/file.txt\n\nWhat I want to do is to discard changes to all files EXCEPT for dir/C/file.txt\nI want to do something like this:\ngit checkout -- dir/!C/file.txt"
},
{
"role": "assistant",
"content": "git add dir/C/file.txt # this file will stay modified and staged\ngit checkout .\n\nIf you want to unstage the file after that:\ngit reset"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How do I rename a repository on GitHub?\n\nI wanted to rename one of my repositories on GitHub, but I got scared when a big red warning said:\n\n\nWe will not set up any redirects from the old location\nYou will need to update your local repositories to point to the new location\nRenaming may take a few minutes to complete\n\n\nDoes anyone have step-by-step instructions on how to accomplish #1 and #2 manually? Or what do I have to do locally?"
},
{
"role": "assistant",
"content": "If you are the only person working on the project, it's not a big problem, because you only have to do #2.\nLet's say your username is someuser and your project is called someproject.\nThen your project's URL will be1\n[email protected]:someuser/someproject.git\n\nIf you rename your project, it will change the someproject part of the URL, e.g.\n[email protected]:someuser/newprojectname.git\n\n(see footnote if your URL does not look like this).\nYour working copy of Git uses this URL when you do a push or pull.\nSo after you rename your project, you will have to tell your working copy the new URL.\nYou can do that in two steps:\nFirstly, cd to your local Git directory, and find out what remote name(s) refer to that URL:\n$ git remote -v\norigin [email protected]:someuser/someproject.git\n\nThen, set the new URL\n$ git remote set-url origin [email protected]:someuser/newprojectname.git\n\nOr in older versions of Git, you might need:\n$ git remote rm origin\n$ git remote add origin [email protected]:someuser/newprojectname.git\n\n(origin is the most common remote name, but it might be called something else.)\nBut if there are lots of people who are working on your project, they will all need to do the above steps, and maybe you don't even know how to contact them all to tell them. That's what #1 is about.\nFurther reading:\n\nGitHub - working with remotes\nGit Reference - remotes\nGit Book - Distributed Workflows\n\nFootnotes:\n1 The exact format of your URL depends on which protocol you are using, e.g.\n\nSSH = [email protected]:someuser/someproject.git\nHTTPS = https://[email protected]/someuser/someproject.git\nGIT = git://github.com/someuser/someproject.git"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Export a stash to another computer\nI need a way to export a stashed change to another computer.\nOn computer 1 I did\n$ git stash save feature\n\nI'm trying to get the stash patch to a file and then import it to another computer\n$ git stash show -p > patch\n\nThis command gives me a file that I can move to another computer where this repo is cloned, but the question is how to import it as a stash again."
},
{
"role": "assistant",
"content": "You can apply a patch file (without committing the changes yet) by simply running\ngit apply patchfile\n\nThen you can simply create a new stash from the current working directory:\ngit stash"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git - the stupid content tracker git-show"
},
{
"role": "assistant",
"content": "Show various types of objects"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Using GIT, how can I selectively merge changes from one commit on another 'fork'?\nTake this scenario:\n\nI decide to 'fork' a codebase on github.com, and start doing my routine: Edit - Commit - Push; aka hack hack hack.\nAfter I made some changes, I see some changes another person has made on the same project, and I like them!\nI decide I want to merge them into mine. Problem is, I only want a 'portion' of one particular commit, out of several commits he has made.\n\nWhat would be the most efficient method of getting these select amount of changes, merged into my 'fork'?"
},
{
"role": "assistant",
"content": "After trolling the waves of the IRC world, someone gave a great solution:\ngit cherry-pick SHA1 --no-commit\ngit add --patch\n\nHopefully that helps anyone else with the same question!\nEDIT: OK, maybe it isn't quite that simple. Here are the full steps:\n\nFirst you have to be in your repository, do the necessary cd-ing to get to your working directory.\nYou now need to add the remote branch, and then fetch it. Do this by:\ngit remote add someUser git://github.com/someUser/someRepo.git\ngit fetch someUser\nYou can now run commands such as git log someUser/master to find the commit SHA1 you want to merge in 'partially'.\nOnce you have the SHA, you can now run:\ngit cherry-pick -n SHA1\nwhere SHA1 is the commit SHA, duh!\nThere quite possibly will be conflicts, depending how old the commit is, and how often that particular area of the project changes. Sorry, but you have to manually resolve these with your trusty editor. So pull out VIM, or whatever else you use, and hack away at the conflicts until you get to the stage where you like the changes.\nYou now have to reset the index to the HEAD revision, then you can then use the trusty GIT add --patch command to pick and choose what changes you want:\ngit reset HEAD\ngit add --patch or git add -p\nYay! Commit time:\ngit commit -m \"I merged a select amount of changes\"\nTo clean up the mess (The stuff you said no to in git add --patch) and only keep the selected changes in your working repository, run:\ngit reset --hard HEAD\nApparently git checkout -f is another option as well."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Why is git apply of a patch with binary files not creating the binary files?\nI have a git patch with two binary files (it's libraries, newly added). I tried to apply the patches but the binary files are not created. I tried git apply with the --binary option. Is there any other option to add the binary files from git patch? I only need the binary files."
},
{
"role": "assistant",
"content": "The --binary option is used when you create the patch file, not when you apply it.\nThat means, instead of your current git diff branch1 branch2 > patch-file, you have to do this instead: git diff branch1 branch2 --binary > patch-file. And, then, apply the patch with git apply patch-file in the same way as you're doing."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-format-patch - Prepare patches for e-mail submission --[no-]cover-letter"
},
{
"role": "assistant",
"content": "In addition to the patches, generate a cover letter file\ncontaining the branch description, shortlog and the overall diffstat. You can\nfill in a description in the file before sending it out."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-config - Get and set repository or global options --get-regexp"
},
{
"role": "assistant",
"content": "Like --get-all, but interprets the name as a regular expression and\nwrites out the key names. Regular expression matching is currently\ncase-sensitive and done against a canonicalized version of the key\nin which section and variable names are lowercased, but subsection\nnames are not."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "What's the difference between \"git reset\" and \"git checkout\"?\nI've always thought of git reset and git checkout as the same, in the sense that both bring the project back to a specific commit. However, I feel they can't be exactly the same, as that would be redundant. What is the actual difference between the two? I'm a bit confused, as the svn only has svn co to revert the commit. \nADDED\nVonC and Charles explained the differences between git reset and git checkout really well. My current understanding is that git reset reverts all of the changes back to a specific commit, whereas git checkout more or less prepares for a branch. I found the following two diagrams quite useful in coming to this understanding:\n\n\nADDED 3\nFrom http://think-like-a-git.net/sections/rebase-from-the-ground-up/using-git-cherry-pick-to-simulate-git-rebase.html, checkout and reset can emulate the rebase. \n\ngit checkout bar \ngit reset --hard newbar \ngit branch -d newbar"
},
{
"role": "assistant",
"content": "git reset is specifically about updating the index, moving the HEAD.\ngit checkout is about updating the working tree (to the index or the specified tree). It will update the HEAD only if you checkout a branch (if not, you end up with a detached HEAD).\n(actually, with Git 2.23 Q3 2019, this will be git restore, not necessarily git checkout)\n\nBy comparison, since svn has no index, only a working tree, svn checkout will copy a given revision on a separate directory.\nThe closer equivalent for git checkout would:\n\nsvn update (if you are in the same branch, meaning the same SVN URL)\nsvn switch (if you checkout for instance the same branch, but from another SVN repo URL)\n\nAll those three working tree modifications (svn checkout, update, switch) have only one command in git: git checkout.\nBut since git has also the notion of index (that \"staging area\" between the repo and the working tree), you also have git reset.\n\nThinkeye mentions in the comments the article \"Reset Demystified \".\n\nFor instance, if we have two branches, 'master' and 'develop' pointing at different commits, and we're currently on 'develop' (so HEAD points to it) and we run git reset master, 'develop' itself will now point to the same commit that 'master' does.\nOn the other hand, if we instead run git checkout master, 'develop' will not move, HEAD itself will. HEAD will now point to 'master'.\nSo, in both cases we're moving HEAD to point to commit A, but how we do so is very different. reset will move the branch HEAD points to, checkout moves HEAD itself to point to another branch.\n\n\nOn those points, though:\nLarsH adds in the comments:\n\nThe first paragraph of this answer, though, is misleading: \"git checkout ... will update the HEAD only if you checkout a branch (if not, you end up with a detached HEAD)\".\nNot true: git checkout will update the HEAD even if you checkout a commit that's not a branch (and yes, you end up with a detached HEAD, but it still got updated).\ngit checkout a839e8f updates HEAD to point to commit a839e8f.\n\n\nDe Novo concurs in the comments:\n\n@LarsH is correct.\nThe second bullet has a misconception about what HEAD is in will update the HEAD only if you checkout a branch.\nHEAD goes wherever you are, like a shadow.\nChecking out some non-branch ref (e.g., a tag), or a commit directly, will move HEAD. Detached head doesn't mean you've detached from the HEAD, it means the head is detached from a branch ref, which you can see from, e.g., git log --pretty=format:\"%d\" -1.\n\nAttached head states will start with (HEAD ->,\ndetached will still show (HEAD, but will not have an arrow to a branch ref."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-remote - Manage set of tracked repositories -v --verbose"
},
{
"role": "assistant",
"content": "Be a little more verbose and show remote url after name.\nFor promisor remotes, also show which filters ( blob:none etc.)\nare configured.\nNOTE: This must be placed between remote and subcommand."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git - the stupid content tracker git-upload-archive"
},
{
"role": "assistant",
"content": "Send archive back to git-archive"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How would I extract a single file (or changes to a file) from a git stash?\nIs it possible to extract a single file or diff of a file from a git stash without popping the stash changeset off?"
},
{
"role": "assistant",
"content": "On the git stash manpage you can read (in the \"Discussion\" section, just after \"Options\" description) that:\n\nA stash is represented as a commit whose tree records the state of the\nworking directory, and its first parent is the commit at HEAD when the\nstash was created.\n\nSo you can treat stash (e.g. stash@{0} is first / topmost stash) as a merge commit, and use:\n$ git diff stash@{0}^1 stash@{0} -- <filename>\n\nExplanation: stash@{0}^1 means the first parent of the given stash, which as stated in the explanation above is the commit at which changes were stashed away. We use this form of \"git diff\" (with two commits) because stash@{0} / refs/stash is a merge commit, and we have to tell git which parent we want to diff against. More cryptic:\n$ git diff stash@{0}^! -- <filename>\n\nshould also work (see git rev-parse manpage for explanation of rev^! syntax, in \"Specifying ranges\" section).\nLikewise, you can use git checkout to check a single file out of the stash:\n$ git checkout stash@{0} -- <filename>\n\nor to save it under another filename:\n$ git show stash@{0}:<full filename> > <newfile>\n\nor\n$ git show stash@{0}:./<relative filename> > <newfile>\n\n(note that here <full filename> is full pathname of a file relative to top directory of a project (think: relative to stash@{0})).\n\nYou might need to protect stash@{0} from shell expansion, i.e. use \"stash@{0}\" or 'stash@{0}'."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git - the stupid content tracker git-status"
},
{
"role": "assistant",
"content": "Show the working tree status"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-diff - Show changes between commits, commit and working tree, etc no"
},
{
"role": "assistant",
"content": "Moved lines are not highlighted."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-log - Show commit logs --sparse"
},
{
"role": "assistant",
"content": "All commits in the simplified history are shown."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-worktree - Manage multiple working trees"
},
{
"role": "assistant",
"content": "DESCRIPTION Manage multiple working trees attached to the same repository. A git repository can support multiple working trees, allowing you to check\nout more than one branch at a time. With git worktree add a new working\ntree is associated with the repository, along with additional metadata\nthat differentiates that working tree from others in the same repository.\nThe working tree, along with this metadata, is called a \"worktree\". This new worktree is called a \"linked worktree\" as opposed to the \"main\nworktree\" prepared by git-init or git-clone .\nA repository has one main worktree (if it’s not a bare repository) and\nzero or more linked worktrees. When you are done with a linked worktree,\nremove it with git worktree remove . In its simplest form, git worktree add <path> automatically creates a\nnew branch whose name is the final component of <path> , which is\nconvenient if you plan to work on a new topic. For instance, git\nworktree add ../hotfix creates new branch hotfix and checks it out at\npath ../hotfix . To instead work on an existing branch in a new worktree,\nuse git worktree add <path> <branch> . On the other hand, if you just\nplan to make some experimental changes or do testing without disturbing\nexisting development, it is often convenient to create a throwaway worktree not associated with any branch. For instance, git worktree add -d <path> creates a new worktree with a detached HEAD at the same commit as the current branch. If a working tree is deleted without using git worktree remove , then\nits associated administrative files, which reside in the repository\n(see \"DETAILS\" below), will eventually be removed automatically (see gc.worktreePruneExpire in git-config ), or you can run git worktree prune in the main or any linked worktree to clean up any\nstale administrative files. If the working tree for a linked worktree is stored on a portable device\nor network share which is not always mounted, you can prevent its\nadministrative files from being pruned by issuing the git worktree lock command, optionally specifying --reason to explain why the worktree is\nlocked."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git rebase upstream/master vs git pull --rebase upstream master\nIs there a difference between git rebase upstream/master and git pull --rebase upstream master, and if so, what? The remote could be any remote, not necessarily upstream."
},
{
"role": "assistant",
"content": "The git pull --rebase will fetch (git fetch) first, updating upstream/master commits.\nIf you just rebase without first updating upstream/master, you won't get the same result.\nI illustrate it in \"master branch and 'origin/master' have diverged, how to 'undiverge' branches'?\"\n\nSnakE mentions in the comments that git pull --rebase isn't exactly git fetch && git rebase origin/master.\nSee \"what does \"git pull --rebase\" do?\"\n(origin/master)\n |\nA--B--C (master)\n \\ \n B'--D (actual origin/master after changing B and force pushing)\n\nWhat git pull --rebase does, in this case, is:\ngit fetch origin\ngit rebase --onto origin/master B master\n\nHere:\n\norigin/master is the new updated origin/master (B')\nB is the old origin/master (before a fetch updated it)\nmaster is the branch to replay on top of origin/master\n\nThis differs from git fetch + git rebase origin/master in that the pull --rebase command tries to find out which commits are really your local ones, and which had come from upstream in an earlier fetch.\n\nTo do this, it looks at the reflog of the remote tracking branch (origin/master, in this case). This reflog represents the tips of successive git fetch operations on origin, in \"most recent first\" order.\nFor each reflog entry, (origin/master@{1}, then ...{2}, and so on) it checks if that commit is an ancestor of the current branch head master. As soon as it finds one, it picks it as the starting point for the rebase (B in the example above)."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Jenkins-Build when a change is pushed to GitHub option is not working\n\nJenkins is running on localhost.\nI have my repository in GitHub. I have the option to 'Build when a change is pushed to GitHub' checked. \nWhen I click 'Build Now', build is done successfully, no issues there. But when am committing code to my repository, auto build is not happening. I can access GitHub from my system as the repository is public and I believe even Jenkins should be able to detect it. I know there is a polling option but I want Jenkins to build when change is detected in repository(as this is what we have been trying to achieve).\nConfiguration:\nJenkins 1.615\nGit Plugin 2.3.5\nGit Client Plugin 1.17.1\n————————————————————————————————————————————\nEDIT: \"Build when a change is pushed to GitHub\" option has been renamed to \"GitHub hook trigger for GITScm polling\" in most recent version of GitHub plugin. \n(thanks to @smrubin's feedback.)"
},
{
"role": "assistant",
"content": "I suspect you missed the webhook url. \nBesides checking the Build when a change is pushed to GitHub option, you should also add the webhook url into your Github repository to get the Auto trigger mechanism to work and here is how:\nGo to your Github repository: \n\nSettings--> Webhooks&Services-->Service--> Add Services--> Choose \"Jenkins (GitHub plugin)\"\n\nThen fill in the Jenkins hook url with your jenkins url like this:\nhttp://your_jenkins_url/github-webhook/\n\n\nAnd, VERY IMPORTANT, since you are installing your jenkins server in your localhost, please be aware that you shouldn't fill in above Jenkins hook url like http://localhost:8080/github-webhook/ because Github is not able to recognize localhost or 127.0.0.1 or 192.168.*.*. \nEither you should use an externally accessible DNS name or an IP address, which can be recognized by Github."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Git push hangs when pushing to Github?\nGit push hangs everytime I try to push to github. I am using Cygwin and Windows 7. Git functions fine locally tracking branches, providing status, setting global user.name and user.email and allowing commits. \nI'm still new and learning.\nI enter git push , git push origin master or git push -u origin master and I get nothing but a blank line requiring me to ctl-c to get the prompt back. \nssh-keygen -t rsa -C \"[email protected]\" asks me for a file name and hangs\ngit push heroku master hangs\n$ git status returns On branch master nothing to commit, working directory clean\n$ git pull returns Already up to date\n$ git remote -v returns:\nheroku [email protected]:myherokusite.git (fetch)\n\nheroku [email protected]:myherokusite.git (push) origin \n\nhttps://github.com/gitusername/appname.git (fetch) origin \n\nhttps://github.com/gitusername/appname.git (push)\n\nor the correct ssh remote settings are returned when trying this with ssh\n\nUpdated: Using the SSH url [email protected]:gitusername/gitrepo.git also hangs\ngit remote set-url origin https://github.com/gitusername/appname.git is correct\nUpdated: I can see the git processes running in Windows Task Manager while it hangs.\nI've tried:\nUsing different internet connection locations\nswitching between https and ssh and it hangs\nUninstalled git. Reinstalled from: https://code.google.com/p/msysgit/downloads/list \nUninstalled git. Installed Cygwin's git\nUninstalled git. Installed Github for Windows GUI app and it I WAS able to push. But this app has limited functionality, forces me out of my Cygwin window into another app which then forces me into a Windows command prompt for complete functionality which I thought I had escaped by using Cygwin. \nSpent many, many hours trying to resolve this, it worked faultlessly before, thanks.\nUPDATE 4/2014: I rebuilt my entire machine Win 7, Cygwin etc and all is now working fine"
},
{
"role": "assistant",
"content": "Restart your ssh agent!\nkillall ssh-agent; eval `ssh-agent`"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How do I clone a github project to run locally?\nI am trying to follow this railscast tutorial for authlogic - and it points to the source here - \nI have git installed - how do I replicate the source onto my localhost so that I can follow the tutorial like in the screencast?"
},
{
"role": "assistant",
"content": "git clone git://github.com/ryanb/railscasts-episodes.git"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Telling git to ignore symlinks\nThis question has appeared in similar forms here and here, but they don't seem to match up with what I'm looking for.\nI'm making a project in StaticMatic, a Ruby static site generator. Basically, it's just a src/ directory with Haml templates, Sass, and CoffeeScript. StaticMatic provides a development server to keep compiling these into a static site, as well as a build command that generates the static site in build/.\nMy modification to StaticMatic is to allow the addition of src/_modules/foo/, which might contain src/_modules/foo/bar.haml. When running the server or building the site, a symlink would be created at src/bar.haml which points to the file in foo/.\nSo far so good. (Conflicts are handled, etc.)\nThe reasoning behind separate directories in _modules/ is that they could be tracked as git submodules and checked out independently by other teams. Essentially, this allows multiple teams to work on different pages (actually JS apps) in one static site without duplicating the main layout and such.\nThe hitch is that git wants to think of these symlinks as files. For instance, git status shows:\n# On branch master\n# Untracked files:\n# (use \"git add <file>...\" to include in what will be commited)\n#\n# src/_modules/bar/foo.haml\n# src/foo.haml\n\n...when I really just want it to show src/_modules/bar/foo.haml and to ignore src/foo.haml\nOne approach would be to have my link-generating code append the links to .gitignore, but messing with .gitignore programmatically strikes me as prone to error. (Perhaps this concern isn't reasonable?)\nMy ideal fix would be something like:\n[filetype = link]\n\n...in .gitignore. As far as I know nothing like this is possible, or is it?"
},
{
"role": "assistant",
"content": "This seems to be a better idea\nfind . -type l | sed -e s'/^\\.\\///g' >> .gitignore\n\nFind outputs a \"./\" prefix for all files. Unless you trim it off, gitignore is unable to act on them . Once you trim the \".\\\" at the beginning , it works like a charm"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Git checkout/pull doesn't remove directories?\nI've got my repo @ github. I did some work at home and pushed it to github. It involved some deleting of files and directories. Now I'm on my work box, which had a copy of the code before deleting the files and directories.\nI issued the following:\ngit remote update\ngit checkout HEAD\ngit pull origin HEAD\n\nIt deleted all of the files it should have, but not the directories the files were in.\nTwo questions: \n\nWhy did it not remove the directories?\nIs there a git command I can issue in the current state to remove them?"
},
{
"role": "assistant",
"content": "Git doesn't track directories, so it won't remove ones that become empty as a result of a merge or other change. However, you can use git clean -fd to remove untracked directories (the -fd flag means force removal of untracked files and directories)."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "View markdown files offline [closed]\n\nClosed. This question is seeking recommendations for software libraries, tutorials, tools, books, or other off-site resources. It does not meet Stack Overflow guidelines. It is not currently accepting answers.\n \n \n\n\n\n\n\n\n\n\n\n\n\n We don’t allow questions seeking recommendations for software libraries, tutorials, tools, books, or other off-site resources. You can edit the question so it can be answered with facts and citations.\n\n\nClosed 2 years ago.\n\n\nThe community reviewed whether to reopen this question 2 years ago and left it closed:\n\nOriginal close reason(s) were not resolved\n\n\n\n\n\n\n Improve this question\n \n\n\n\nIs there a way to display .md files offline so we know what it will look like once it's uploaded in Github? I'm referring to showing the README.md file as it would come out in Github, and not as for editing purposes.\nNeeds to work on Mac and Windows since I use both."
},
{
"role": "assistant",
"content": "There are a few Chrome plug-ins that work well. I've been using Markdown Preview Plus.\nAfter install, enable \"Allow access to file URLs\" in Extensions (menu > More tools > Extensions or enter URL chrome://extensions/ instead).\n\nThen drag-n-drop a Markdown file onto Chrome and use your favorite editor to edit."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "GIT_DISCOVERY_ACROSS_FILESYSTEM problem when working with terminal and MacFusion\nI'm using MacFusion with OSXFuse(similar to MacFuse) to mount my server over SSH onto my office machine. When I cd into my rails work directory on the server, i can't see any git info in my zsh prompt. If i try a git pull origin, i get the following error message:\nfatal: Not a git repository (or any parent up to mount parent /Volumes)\nStopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set)\n\nI know I can ssh to the server but then wouldn't I lose zsh autocorrection & history? Wouldn't I also need to set up textmate and other software to use ssh? And wouldn't I need to remote desktop to install DMG's and so on? All of that seems like a bit of a hassle.\nIs there a better way to do what I want to do? Otherwise is there a way to enable GIT_DISCOVERY_ACROSS_FILESYSTEM?\nPS - MacFusion can also mount the server over FTP - would that be preferable to SSH?"
},
{
"role": "assistant",
"content": "I got this error until I realized that I hadn't intialized a Git repository in that folder, on a mounted vagrant machine.\nSo I typed git init and then git worked."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-for-each-ref - Output information on each ref contents:body"
},
{
"role": "assistant",
"content": "The remainder of the commit or the tag message that follows\nthe \"subject\"."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-log - Show commit logs %Cred"
},
{
"role": "assistant",
"content": "switch color to red"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-apply - Apply a patch to files and/or to the index --whitespace=<action>"
},
{
"role": "assistant",
"content": "When applying a patch, detect a new or modified line that has\nwhitespace errors. What are considered whitespace errors is\ncontrolled by core.whitespace configuration. By default,\ntrailing whitespaces (including lines that solely consist of\nwhitespaces) and a space character that is immediately followed\nby a tab character inside the initial indent of the line are\nconsidered whitespace errors. By default, the command outputs warning messages but applies the patch.\nWhen git-apply is used for statistics and not applying a\npatch, it defaults to nowarn . You can use different <action> values to control this\nbehavior: nowarn turns off the trailing whitespace warning. warn outputs warnings for a few such errors, but applies the\npatch as-is (default). fix outputs warnings for a few such errors, and applies the\npatch after fixing them ( strip is a synonym — the tool\nused to consider only trailing whitespace characters as errors, and the\nfix involved stripping them, but modern Gits do more). error outputs warnings for a few such errors, and refuses\nto apply the patch. error-all is similar to error but shows all errors."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How do you rebase the current branch's changes on top of changes being merged in?\nOkay. If I'm on a branch (say working), and I want to merge in the changes from another branch (say master), then I run the command git-merge master while on the working branch, and the changes get merged in without rebasing the history at all. If I run git-rebase master, then the changes in master are rebased to be put on the top of my working branch. But what if I want to merge in the changes from master but rebase my changes in working to be on top? How do I do that? Can it be done?\nI could run git-rebase working on my master branch to put my changes on top in the master branch, but I'd like to be able to do that in my working branch, and I have no idea how. The closest that I can think of doing is creating a new branch from master and then rebase working's changes on top of that, but then I'd have a new branch instead of altering the working branch."
},
{
"role": "assistant",
"content": "You've got what rebase does backwards. git rebase master does what you're asking for — takes the changes on the current branch (since its divergence from master) and replays them on top of master, then sets the head of the current branch to be the head of that new history. It doesn't replay the changes from master on top of the current branch."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-diff - Show changes between commits, commit and working tree, etc git diff [<options>] --cached [--merge-base] [<commit>] [--] [<path>…]"
},
{
"role": "assistant",
"content": "This form is to view the changes you staged for the next\ncommit relative to the named <commit>. Typically you\nwould want comparison with the latest commit, so if you\ndo not give <commit>, it defaults to HEAD.\nIf HEAD does not exist (e.g. unborn branches) and\n<commit> is not given, it shows all staged changes.\n--staged is a synonym of --cached. If --merge-base is given, instead of using <commit>, use the merge base\nof <commit> and HEAD. git diff --cached --merge-base A is equivalent to git diff --cached $(git merge-base A HEAD) ."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-remote - Manage set of tracked repositories show"
},
{
"role": "assistant",
"content": "Gives some information about the remote <name>. With -n option, the remote heads are not queried first with git ls-remote <name> ; cached information is used instead."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Gitlab-ci is not using the node version I have specified\n\nI'm very new to GitLab and am trying to set up the CI/CD system for my project.\nMy .gitlab-ci.yml file is as follows:\nimage: node:10.15.3\n\ncache:\n paths:\n - node_modules/\n\nbefore_script:\n - node -v\n - npm install\n\nstages:\n - test\n\nall-tests:\n stage: test\n script:\n - npm run lint\n - npm run test:unit:cov\n - npm run test:server\n\n\nHowever the node -v line outputs 6.12.0 not 10.15.3 and my tests are failing because the node version is wrong.\nHow do I tell GitLab CI to use Node 10.15.3?"
},
{
"role": "assistant",
"content": "You are not tagging your job so perhaps it is running on a shell-executor and not a docker-executor. Check for .dockerenv in your job spec to ensure you're running in a container;\nGiven this simple pipeline (based on yours):\nimage: node:10.15.3\n\nbefore_script:\n - node -v\n\nstages:\n - test\n\nall-tests:\n tags:\n - docker\n stage: test\n script:\n # are we in a docker-executor\n - if [ -f /.dockerenv ]; then echo \"docker-executor\"; fi\n\nI get the following output, which suggests we are pulling the correct node image version:\nRunning with gitlab-runner 11.3.1 (0aa5179e)\n on gitlab-docker-runner fdcd6979\nUsing Docker executor with image node:10.15.3 ...\nPulling docker image node:10.15.3 ...\nUsing docker image sha256:64c810caf95adbe21b5f41be687aa77aaebc197aa92f2b2283da5d57269d2b92 for node:10.15.3 ...\nRunning on runner-fdcd6979-project-862-concurrent-0 via af166b7f5bef...\nFetching changes...\nHEAD is now at b46bb77 output container id\nFrom https://gitlab/siloko/node-test\n b46bb77..adab1e3 master -> origin/master\nChecking out adab1e31 as master...\nSkipping Git submodules setup\n$ node -v\nv10.15.3\n$ if [ -f /.dockerenv ]; then echo \"docker-executor\"; fi\ndocker-executor\nJob succeeded"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to undelete a file previously deleted in git's history?\nUsing Chris's answer on another question I could prepend a snapshot-history to my git repository. Since one of the files is not part of my history but only in the snapshots, the first original commit now also contains the deletion of this file. How can I undo that?\nAt first I thought this was the opposite of How do I remove sensitive files from git’s history, but actually I don't want to insert a file into history but just remove the deletion from history."
},
{
"role": "assistant",
"content": "git checkout <commit> <filename>"
}
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.