[System] You are a helpful assistant.

[User]
SSH Key - Still asking for password and passphrase

I've been somewhat 'putting up' with Github always asking for my username and password when I clone a repository.  I want to bypass this step because it is an annoyance within my workflow.
I tried setting up an SSH key (which I successfully did) using this guide. https://help.github.com/articles/generating-ssh-keys and I was successful.
My problem is that I am still asked for my github password and passphrase when cloning a repository (using SSH).  My understanding was that after I set up this SSH key, I would no longer have to do that.
I am a little unsure what to ask, so I will just state my goal.

I want to be able to clone repositories without having to put in my Github information all the time.

What am I missing with my SSH key? If anyone can provide some guidance or resources I would appreciate it, because I've always felt a little lost when it came to SSH authentication in GitHub.
From my knowledge, this is a command that tests if things are working properly, here are the output from my console:
~ $ ssh -T [email protected]
Saving password to keychain failed
Enter passphrase for key '/Users/MYNAME/.ssh/id_rsa':
Hi MYNAME! You've successfully authenticated, but GitHub does not provide shell access.

When I input my password, should that fail first? Then, when I enter my passphrase, it passes.

[Assistant]
Add Identity without Keychain
There may be times in which you don't want the passphrase stored in the keychain, but don't want to have to enter the passphrase over and over again.
You can do that like this:
ssh-add ~/.ssh/id_rsa

This will ask you for the passphrase, enter it and it will not ask again until you restart.
Add Identity Using Keychain
As @dennis points out in the comments, to persist the passphrase through restarts by storing it in your keychain, you can use the --apple-use-keychain option (-k for Ubuntu) when adding the identity like this:
ssh-add --apple-use-keychain ~/.ssh/id_rsa

Once again, this will ask you for the passphrase, enter it and this time it will never ask again for this identity.


[System] You are a helpful assistant.

[User] git-log - Show commit logs  --output-indicator-new=<char>  --output-indicator-old=<char>  --output-indicator-context=<char>

[Assistant]
Specify the character used to indicate new, old or context
lines in the generated patch. Normally they are + , - and
' ' respectively.


[System] You are a helpful assistant.

[User] git-show - Show various types of objects  %N

[Assistant] commit notes


[System] You are a helpful assistant.

[User]
Cherry pick shows no -m option was given error
I have two branch master and development
I need to get some commit id from development branch in master branch so I do it by cherry-pick but it shows me some error
$> git cherry-pick cf0d52b

error: Commit cf0d52b900f990300c3aa17936ddbae1476d461a is a merge but no -m option was given.
fatal: cherry-pick failed

I am not getting this error, why this error comes and how will I get rid of this.

[Assistant]
You are trying to cherry-pick a merge. A merge is build up from at several parents. You have to supply the parent id to the merge.
You have to supply any of the followings:

-m parent-number / --mainline parent-number
Usually you cannot cherry-pick a merge because you do not know which side of the merge should be considered the mainline.
This option specifies the parent number (starting from 1) of the mainline and allows cherry-pick to replay the change relative to the specified parent.

How to find out what are the commit parents?
Use the git show command to view the commit parents and then you can choose the parent index or the SHA-1


[System] You are a helpful assistant.

[User]
Show history of a file? [duplicate]
This question already has answers here:

Closed 11 years ago.

Possible Duplicate:
View the change history of a file using Git versioning

Sometimes I want to step through the history of a particular file. In the past I used P4V and this was very quick and intuitive.

Right click on a file and select history.
Scrolling through the dates and see a nice diff of exactly what changed in that file on that date. Simple.

Switching to git this is now a grueling task.

"git log filename"
Look at history and pick a date, copy hash
"git diff hash"
Scroll through diff for the stuff that changed in the file I am interested in.
Nope, that's not it, lets try a different date - back to step 2, rinse and repeat.

I've searched SO, and I've tried a few of the commonly suggested guis: github, gitk, gitg, git-gui.
These all remove the need to manually run commands, but the workflow is the same for this. View history of file; view commit; search through diff of lots of irrelevant files. It's slow and repetitive.
All the data is in the repo so I see no reason this simple common use case could not be more streamlined.
Can anyone recommend a tool that does this - or a more efficient way to utilize the command line to do what I want?
Thanks for any suggestions.

[Assistant]
You can use git log to display the diffs while searching:
git log -p -- path/to/file


[System] You are a helpful assistant.

[User]
How to cherry-pick only changes to certain files?

If I want to merge into a Git branch the changes made only to some of the files changed in a particular commit which includes changes to multiple files, how can this be achieved?
Suppose the Git commit called stuff has changes to files A, B, C, and D but I want to merge only stuff's changes to files A and B. It sounds like a job for git cherry-pick but cherry-pick only knows how to merge entire commits, not a subset of the files.

[Assistant]
I'd do it with cherry-pick -n (--no-commit) which lets you inspect (and modify) the result before committing:
git cherry-pick -n <commit>

# unstage modifications you don't want to keep, and remove the
# modifications from the work tree as well.
# this does work recursively!
git checkout HEAD <path>

# commit; the message will have been stored for you by cherry-pick
git commit

If the vast majority of modifications are things you don't want, instead of checking out individual paths (the middle step), you could reset everything back, then add in what you want:
# unstage everything
git reset HEAD

# stage the modifications you do want
git add <path>

# make the work tree match the index
# (do this from the top level of the repo)
git checkout .


[System] You are a helpful assistant.

[User] git-checkout-index - Copy files from the index to the working tree  Using git checkout-index to "export an entire tree"

[Assistant]
The prefix ability basically makes it trivial to use git checkout-index as an "export as tree" function.
Just read the desired tree into the index, and do: $ git checkout-index --prefix=git-export-dir/ -a git checkout-index will "export" the index into the specified
directory. The final "/" is important. The exported name is literally just
prefixed with the specified string.  Contrast this with the
following example.


[System] You are a helpful assistant.

[User]
how can I list all the different versions of a file, and diff them also?
using git, I want to list all the different revisions of a given file.
Then, I want to choose a particular version and compare it when another.
How can I do this?

[Assistant]
To show a history of changes to a particular file, you can use git log:
git log -p -- path/to/file

The -p tells it to show the diff between each revision and its parent. To get a cumulative diff between two revisions, take the ID of the two revisions, and pass them to git diff:
git diff abc123 def456 -- path/to/file.

Where abc123 and def456 are the revision IDs.


[System] You are a helpful assistant.

[User]
What does 'git blame' do?
I saw a lot of questions about methods of using git blame, but I don't really understand them.
I see a Blame button on top of files on the GitHub interface. Upon clicking it, it shows some diff with usernames on the left bar. What does that indicate?
Why is git blame actually used, apart from GitHub?

[Assistant]
From git-blame:

Annotates each line in the given file with information from the revision which last modified the line. Optionally, start annotating from the given revision.
When specified one or more times, -L restricts annotation to the requested lines.

Example:
[email protected]:~# git blame .htaccess
...
^e1fb2d7 (John Doe 2015-07-03 06:30:25 -0300  4) allow from all
^72fgsdl (Arthur King 2015-07-03 06:34:12 -0300  5)
^e1fb2d7 (John Doe 2015-07-03 06:30:25 -0300  6) <IfModule mod_rewrite.c>
^72fgsdl (Arthur King 2015-07-03 06:34:12 -0300  7)     RewriteEngine On
...

Please note that git blame does not show the per-line modifications history in the chronological sense.
It only shows who was the last person to have changed a line in a document up to the last commit in HEAD.
That is to say that in order to see the full history/log of a document line, you would need to run a git blame path/to/file for each commit in your git log.


[System] You are a helpful assistant.

[User]
How do I set up a private Git repository on GitHub? Is it even possible?
I intend to share my source code on an invite-only basis to a few dozen users maybe. The source code itself should not be public. Participants are allowed and encouraged to submit their changes. So I need source control, preferably Git, hosted on a public server with private access for multiple users.
I learned that it is possible to set up private Git repositories on GitHub which use https:// links. On GitHub itself such a project does not show up in searches. For participating users the project shows a "lock" icon. So there are obviously private repositories; I just don't know how set one up. A lot of tutorials use SSH to set up private repositories but they all require you to have "your own server".
I don't care about secure connections when pushing/pulling source code nor do I have trust issues with GitHub. All I care about is giving access only to users I invite. Maybe I'm naive and such a solution is only available via commercial hosting (e.g., Unfuddle, Assembla), but if not, I'd really like to know how it's done!

[Assistant] On January 7th 2019, GitHub announced free and unlimited private repositories for all GitHub users, paying or not. When creating a new repository, you can simply select the Private option.


[System] You are a helpful assistant.

[User] git-filter-branch - Rewrite branches  --commit-filter <command>

[Assistant]
This is the filter for performing the commit.
If this filter is specified, it will be called instead of the git commit-tree command, with arguments of the form
"<TREE_ID> [(-p <PARENT_COMMIT_ID>)…]" and the log message on
stdin.  The commit id is expected on stdout. As a special extension, the commit filter may emit multiple
commit ids; in that case, the rewritten children of the original commit will
have all of them as parents. You can use the map convenience function in this filter, and other
convenience functions, too.  For example, calling skip_commit "$@" will leave out the current commit (but not its changes! If you want
that, use git rebase instead). You can also use the git_commit_non_empty_tree "$@" instead of git commit-tree "$@" if you don’t wish to keep commits with a single parent
and that makes no change to the tree.


[System] You are a helpful assistant.

[User] git-pull - Fetch from and integrate with another repository or a local branch

[Assistant] NAME git-pull - Fetch from and integrate with another repository or a local branch


[System] You are a helpful assistant.

[User]
Why does git stash pop say that it could not restore untracked files from stash entry?
I had a bunch of staged and unstaged changes and I wanted to quickly switch to another branch and then switch back.
So I staged my changes using:
$ git stash push -a

(In hindsight I probably could have used --include-untracked instead of --all)
Then when I went to pop the stash I get a whole lot of errors along the lines of:
$ git stash pop
foo.txt already exists, no checkout
bar.txt already exists, no checkout
...
Could not restore untracked files from stash entry

There doesn't seem to be any changes restored from the stash.
I also tried $ git stash branch temp but that shows the same errors.
I did figure out a way around this which was to use:
$ git stash show -p | git apply

Disaster averted for now but this raises some questions.
Why did this error happen in the first place and how do I avoid it next time?

[Assistant]
I managed to recreate your issue. It seems if you stash untracked files and then you create those files (in your example, foo.txt and bar.txt), then you have local changes to untracked files that would be overwritten when you apply git stash pop.
To get around this issue, you can use the following command. This will override any unsaved local changes so be careful.
git checkout stash -- .

Here is some further information I found on the previous command.


[System] You are a helpful assistant.

[User]
Azure DevOps - Pull Request Git "Next steps: Manually resolve these conflicts and push new changes to the source branch."
I have created a branch named dev.
I have done a pull request to send dev code to master, when I do this pull request it tell me:

50+ conflicts prevent automatic merging
"Next steps: Manually resolve these conflicts and push new changes to the source branch."
Where do I go from here? I just want all the dev branch to replace whatever is in master. I see no options to resolve these conflicts.

[Assistant]
You will have to do the following on your PC
On branch dev
$ git pull --no-rebase origin master - This will create a merge commit and you will have to resolve the conflicts in the files which are changed both on dev and master. git status will show the list of files with conflicting changes.
After resolving conflicts, commit all the changes and push your branch. After that you should be able to complete the PR.
FYI: --no-rebase makes sure that a merge is done even if the pull behavior is overwritten to default to rebase.
Help link for more details


[System] You are a helpful assistant.

[User] git-log - Show commit logs  notes.rewriteRef

[Assistant]
When copying notes during a rewrite, specifies the (fully
qualified) ref whose notes should be copied.  May be a glob,
in which case notes in all matching refs will be copied.  You
may also specify this configuration several times. Does not have a default value; you must configure this variable to
enable note rewriting.  Set it to refs/notes/commits to enable
rewriting for the default commit notes. Can be overridden with the GIT_NOTES_REWRITE_REF environment variable.
See notes.rewrite.<command> above for a further description of its format.


[System] You are a helpful assistant.

[User] git-diff - Show changes between commits, commit and working tree, etc  git diff HEAD:file1 file2

[Assistant] compares an (o)bject and a (w)ork tree entity;


[System] You are a helpful assistant.

[User]
Favicon with GitHub Pages

I'm hosting a few sites with GitHub Pages (User and Project Pages), but they are not displaying their favicons (in the browser).
<link rel="shortcut icon" type="image/png" href="/favicon.png">

Is the problem that GitHub displays the site with <frameset>? I know it's possible to display favicons (at least with Jekyll), but can I display a favicon on it's own?

[Assistant]
Yes, you can.
Put this into the head part of your webpage:
 <link rel="shortcut icon" type="image/x-icon" href="favicon.ico">

It is important to not put the slash before the favicon.ico part. Put the favicon.ico file in your repository's home directory.


[System] You are a helpful assistant.

[User] git-apply - Apply a patch to files and/or to the index  -p<n>

[Assistant]
Remove <n> leading path components (separated by slashes) from
traditional diff paths. E.g., with -p2 , a patch against a/dir/file will be applied directly to file . The default is
1.


[System] You are a helpful assistant.

[User]
How can I delete all commits before a given date in Git history?
Given a repository, I want to delete all commits that were before a particular commit, or a date in history.
I have around 10000 commits in my repository, and I want to only keep the last 1000 or so, and delete the rest. Basically what I want to do is to say move the first commit forward to X.
At first I thought I could just rebase and squash all of those commits into one, but that causes a lot of merge conflicts during the rebase. If there was a way to squash commits such that the version after the squash is the last commit, that'd work too.

[Assistant]
Warning: the following is dangerous, as it rewrites history. Always make sure you have a backup of your repo before doing any kind of major history rewriting like this.
Replace the hash in the following with the hash of the parent of the commit you want to have as your new first commit.
git filter-branch --parent-filter '
    read parent
    if [ "$parent" = "-p 5bdd44e5919cb0a95a9924817529cd7c980f88b5" ]
    then
        echo
    else
        echo "$parent"
    fi'

This rewrites the parents of each commit; for most commits, it leaves them the same, but the one with the parent matching the given hash, it replaces with an empty parent, meaning it will now become a commit with no parent. This will detach all of your old history.
Note that if what you want to be your first commit is a merge commit, you'll need to match against something like -p parent1 -p parent2 -p parent3 for each of the parents of the merge commit, in the correct order.
If you want to apply this to all branches and tags instead of just the current branch, pass in --all at the end of the command (after the script).
After you have done this, and checked that it worked properly, you can delete the original branch and run a gc to clean out the now unreferenced commits:
git update-ref -d refs/original/refs/heads/master

Note that since git tends to try to preserve data, in order to actually free up the space you will also have to remove the commits from your reflog, and then run the gc to clean it up.
git reflog expire --expire-unreachable=all --all
git gc --prune=all

If you are not doing this to save space or eradicate the old commits, you can keep the old history around in a branch, such as git branch old-master refs/original/refs/heads/master; you can even "virtually reattach" it using git replace, at which point you would have two unconnected histories (so when you push to a remote repo, you'll only push the truncated history) but when you look through history in your local repo you will see the full history.


[System] You are a helpful assistant.

[User] git-log - Show commit logs  notes.rewriteMode

[Assistant]
When copying notes during a rewrite (see the
"notes.rewrite.<command>" option), determines what to do if
the target commit already has a note.  Must be one of overwrite , concatenate , cat_sort_uniq , or ignore .
Defaults to concatenate . This setting can be overridden with the GIT_NOTES_REWRITE_MODE environment variable.


[System] You are a helpful assistant.

[User]
Git - Cherry pick a single commit for pull request
I might not have the terminology down yet.
I made file to be added to a open project on git.
I forked the project.
I made some changes and my last commit is the file I want to request to the project and not the small changes I made before hand.
When I go to github site and make pull request, I get all the commits before the one I want (which is last one of a file).
I don't want to submit all of the other commits, because I don't think it's necessary for the project. Just my own changes.
What do I do?
Should I just make another res, or attach the file singularly and submit?

[Assistant]
You need to create a fresh branch from the remote HEAD, cherry-pick the commit to that branch, push the branch to your repo on GitHub, then create a pull request.
git checkout -b mybranch
git fetch upstream
git reset --hard upstream/master
git cherry-pick <commit-hash>
git push origin mybranch:mybranch


[System] You are a helpful assistant.

[User] git-shortlog - Summarize git log output  --stdin

[Assistant]
In addition to getting arguments from the command line, read
them from standard input as well. This accepts commits and
pseudo-options like --all and --glob= . When a -- separator
is seen, the following input is treated as paths and used to
limit the result. Flags like --not which are read via standard input
are only respected for arguments passed in the same way and will not
influence any subsequent command line arguments.


[System] You are a helpful assistant.

[User]
Pushing to a different git repo

I have a repo called react.
I cloned it into a different repo locally called different-repo.
How can I then get different-repo to push remotely to different-repo because currently it is pushing to react.
Effectively I want to clone many times from react into different named repos but then when i push from those repos they push to their own repo.

[Assistant]
You have to add an other remote. Usually, you have an origin remotes, which points to the github (maybe bitbucket) repository you cloned it from. Here's a few example of what it is:

https://github.com/some-user/some-repo (the .git is optional)
[email protected]:some-user/some-repo (this is ssh, it allows you to push/pull without having to type your ids every single time)
C:/some/folder/on/your/computer Yes! You can push to an other directory on your own computer.

So, when you
$ git push origin master

origin is replaced with it's value: the url
So, it's basically just a shortcut. You could type the url yourself each time, it'd do the same!
Note: you can list all your remotes by doing git remote -v.
For your problem

How can I then get different-repo to push remotely to different-repo because currently it is pushing to react.

I'm guessing you want to create a second repository, right? Well, you can create an other remote (or replace the current origin) with the url to this repo!
Add an other remote — recommended
git remote add <remote-name> <url>

So, for example:
$ git remote add different-repo https://github.com/your-username/your-repo

And then, just
$ git push different-repo master

Change the origin remote
git remote set-url <remote-name> <url>

So
git remote set-url origin https://github.com/your-username/your-repo


[System] You are a helpful assistant.

[User]
What does git fsck stand for?
What is the meaning in behind the fsck command name?
The documentation of the command does not seem to mention what the name stands for.

[Assistant]
It stands for File System ChecK. The name is taken from the Unix fsck command, which is used to validate a file system.
While Git is not technically a file system, it can be used analogously and the command name is a metaphor on this.


[System] You are a helpful assistant.

[User]
How do I push a local repo to Bitbucket using SourceTree without creating a repo on bitbucket first?
Is there a way to import my local git repos to SourceTree and push them to my Bitbucket account, having new repos identical to my local repos be created on my account? Or do I have to make a repo online first and push to that? Github has a way to publish your local repos directly from it's client, and it creates it automatically when you publish, but it has limited private repos. I'm just doing homework so there's no reason for it to be public, hence why I'm trying to use bitbucket.

[Assistant]
(updated on 3-29-2019 to use the https instead of ssh, so you don't need to use ssh keys)
It seems like for BitBucket, you do have to create a repo online first. Using the instructions from Atlassian, simply create a new BitBucket repository, copy the repository url to the clipboard, and then add that repository as a new remote to your local repository (full steps below):
Get Repo URL

in your BitBucket repo, choose "Clone" on the top-right
choose "HTTPS" instead of "SSH" in the top-right of the dialog
it should show your repo url in the form git clone <repository url>

Add Remote Using CLI

cd /path/to/my/repo
git remote add origin https://bitbucket.org/<username>/<reponame>.git
git push -u origin --all

Add Remote Using SourceTree

Repository>Add Remote...
Paste the BitBucket repository url (https://bitbucket.org/<username>/<reponame>.git)

Old Method: Creating & Registering SSH Keys
(this method is if you use the ssh url instead of the https url, which looks like ssh://[email protected]/<username>/<reponame>.git. I recommend just using https)
BitBucket is great for private repos, but you'll need to set up an ssh key to authorize your computer to work with your BitBucket account. Luckily Sourcetree makes it relatively simple:
Creating a Key In SourceTree:

In Tools>Options, make sure SSH Client: is set to PuTTY/Plink under the General tab
Select Tools>Create or Import SSH Keys
In the popup window, click Generate and move your mouse around to give randomness to the key generator
You should get something like whats shown in the screenshot below. Copy the public key (highlighted in blue) to your clipboard

Click Save private Key and Save public key to save your keys to wherever you choose (e.g. to <Home Dir>/putty/ssk-key.ppk and <Home Dir>/putty/ssh-key.pub respectively) before moving on to the next section

Registering The Key In BitBucket

Log in to your BitBucket account, and on the top right, click your profile picture and click Settings
Go to the SSH Keys tab on the left sidebar
Click Add SSH Key, give it a name, and paste the public key you copied in step 4 of the previous section

That's it! You should now be able to push/pull to your BitBucket private repos. Your keys aren't just for Git either, many services use ssh keys to identify users, and the best part is you only need one. If you ever lose your keys (e.g. when changing computers), just follow the steps to create and register a new one.
Sidenote: Creating SSH Keys using CLI
Just follow this tutorial


[System] You are a helpful assistant.

[User]
error: pathspec 'test-branch' did not match any file(s) known to git

I am a new user of Git. I have forked a repository called Spoon-Knife (available for practicing forking with Git). Then, I cloned it locally by running
git clone https://github.com/rohinichoudhary/Spoon-Knife.git

This repository contains three branches, i.e.

master,
test-branch,
change-the-title.

When I run git branch, it only shows *master, not the remaining two branches. And when I run
git checkout test-branch

I get the following error:

error: pathspec 'test-branch' did not match any file(s) known to git.

Why is this happening? How can I solve this problem?

[Assistant]
The modern Git should able to detect remote branches and create a local one on checkout.
However if you did a shallow clone (e.g. with --depth 1), try the following commands to correct it:
git config remote.origin.fetch '+refs/heads/*:refs/remotes/origin/*'
git fetch --all

and try to checkout out the branch again.
Alternatively try to unshallow your clone, e.g. git fetch --unshallow and try again.
See also: How to fetch all remote branches?


[System] You are a helpful assistant.

[User]
Why can't I delete a branch in a remote GitLab repository?

I'm trying to delete a branch both locally and in a remote GitLab repository. Its name is origin/feat. I tried git push --delete origin feat. Git complains:
remote: error: By default, deleting the current branch is denied, because the next
remote: 'git clone' won't result in any file checked out, causing confusion.
remote:
remote: You can set 'receive.denyDeleteCurrent' configuration variable to
remote: 'warn' or 'ignore' in the remote repository to allow deleting the
remote: current branch, with or without a warning message.
remote:
remote: To squelch this message, you can set it to 'refuse'.
remote: error: refusing to delete the current branch: refs/heads/feat

OK makes sense, so I tried switching to origin/master with git checkout master and it tells me: Already on 'master'. Does the current branch also need to be set in the remote directory? How would I do that?

[Assistant]
Try
git push origin --delete <branch-name>


[System] You are a helpful assistant.

[User] git-rev-list - Lists commit objects in reverse chronological order  --missing=<missing-action>

[Assistant]
A debug option to help with future "partial clone" development.
This option specifies how missing objects are handled. The form --missing=error requests that rev-list stop with an error if
a missing object is encountered.  This is the default action. The form --missing=allow-any will allow object traversal to continue
if a missing object is encountered.  Missing objects will silently be
omitted from the results. The form --missing=allow-promisor is like allow-any , but will only
allow object traversal to continue for EXPECTED promisor missing objects.
Unexpected missing objects will raise an error. The form --missing=print is like allow-any , but will also print a
list of the missing objects.  Object IDs are prefixed with a “?” character. If some tips passed to the traversal are missing, they will be
considered as missing too, and the traversal will ignore them. In case
we cannot get their Object ID though, an error will be raised.


[System] You are a helpful assistant.

[User]
Link to a line Markdown file on GitHub

I often link to GitHub source code via the #L param in the URI.
e.g. : https://github.com/github/learn.github.com/blob/gh-pages/episodes.yaml#L1
But is there a way to link to lines within a Markdown file?
e.g. https://github.com/github/learn.github.com/blob/gh-pages/README.md#L1 (does not work!)
I know I can link to 'sections', but lines are much better!
e.g. https://github.com/github/learn.github.com/blob/gh-pages/README.md#learngithubcom

[Assistant] As it is currently not possible, I take the next best option: use blame and then highlight the lines, e.g. https://github.com/rails/rails/blame/master/guides/source/configuring.md#L166


[System] You are a helpful assistant.

[User]
How to complete a milestone on GitHub?

How do I close/complete milestones on GitHub projects? I've already three milestones that are "overdue" but they are completed already. I simply don't know how to mark them "completed" - can anyone help me?
I already tried to Google this issue, and browsed the GitHub help pages, but couldn't find any information on using milestones.

[Assistant]
Update: this is an old answer for an old question. The nowerdays correct answer is the one by seeker.
Milestones now must be closed manually. --- A.J. Brown

Simply creating and closing an issue for a milestone, will mark the milestone completed:

When all issues of the milestone are closed, the milestone should be closed as well.

--- Felix King
Thanks.


[System] You are a helpful assistant.

[User] git-update-index - Register file contents in the working tree to the index  --stdin

[Assistant]
Instead of taking a list of paths from the command line,
read a list of paths from the standard input.  Paths are
separated by LF (i.e. one path per line) by default.


[System] You are a helpful assistant.

[User]
How to copy commits from one branch to another?
I've got two branches from my master:

v2.1: (version 2) I've been working on for several months
wss: that I created yesterday to add one specific feature to my master (in production)

Is there a way to copy yesterday's commits from wss to v2.1?

[Assistant]
Use
git cherry-pick <commit>

to apply <commit> to your current branch.
I myself would probably cross-check the commits I pick in gitk and cherry-pick them with right-clicks on the commit entry there instead.

If you want to go more automatic (with all its dangers) and assuming all commits since yesterday happened on wss you could generate the list of commits using git log (with --pretty suggested by Jefromi)
git log --reverse --since=yesterday --pretty=%H

so everything together assuming you use bash
for commit in $(git log --reverse --since=yesterday --pretty=%H);
do
    git cherry-pick $commit
done

If something goes wrong here (there is a lot of potential) you are in trouble since this works on the live checkout, so either do manual cherry-picks or use rebase like suggested by Jefromi.


[System] You are a helpful assistant.

[User]
Revert changes to a file in a commit
I want to revert changes made by a particular commit to a given file only.
Can I use git revert command for that?
Any other simple way to do it?

[Assistant]
The cleanest way I've seen of doing this is described here
git show some_commit_sha1 -- some_file.c | git apply -R

Similar to VonC's response but using git show and git apply.


[System] You are a helpful assistant.

[User]
Which are the plumbing and porcelain commands?
For git commands there is this distinction between "plumbing" and "porcelain" commands.  How can I determine what would be classified as a plumbing one or a porcelain one?  i.e. What is the border line that allows me to differentiate?
I'm not asking what a porcelain or plumbing command is, but rather how, given a command, I can say which type it is.

[Assistant]
As blue112 noted, the dividing line is fuzzy.  The very first documentation page, however, has an explicit list (and as R.M. notes below, one primary criterion is, or at least is supposed to be, stability of interface—for which some nominally-porcelain commands have --porcelain1 to force a more stable and/or more machine-readable output).  You can choose to use their list, or decide that some commands are too high level to be low level, or too low level to be high level.  For instance you might disagree that git apply is a plumbing command, yet the Git page says it is.  Or, you might consider things like git fast-import to be something you would only use inside a script.

Edit, 31 May 2020: The Git documentation has changed since 2016 to reassign commands to new sections; the data below are now out of date.  Consult the documentation for your own Git version (via git help git for instance) to see what your own system says.  See also VonC's answer with a link to a 2018 change to the documentation.

The list below is simply extracted from the documentation, with descriptions and additional classifications stripped to leave only "porcelain" vs "plumbing".  (Sub-classifications remain visible as inversions in the alphabetic sort order.  I did not construct links for each entry, as this would be considerably more difficult with StackOverflow markdown—this just needed a simple <pre>...</pre> wrapper.)
porcelain

git-add                 git-rebase              git-cherry
git-am                  git-reset               git-count-objects
git-archive             git-revert              git-difftool
git-bisect              git-rm                  git-fsck
git-branch              git-shortlog            git-get-tar-commit-id
git-bundle              git-show                git-help
git-checkout            git-stash               git-instaweb
git-cherry-pick         git-status              git-merge-tree
git-citool              git-submodule           git-rerere
git-clean               git-tag                 git-rev-parse
git-clone               git-worktree            git-show-branch
git-commit              gitk                    git-verify-commit
git-describe            git-config              git-verify-tag
git-diff                git-fast-export         git-whatchanged
git-fetch               git-fast-import         gitweb
git-format-patch        git-filter-branch       git-archimport
git-gc                  git-mergetool           git-cvsexportcommit
git-grep                git-pack-refs           git-cvsimport
git-gui                 git-prune               git-cvsserver
git-init                git-reflog              git-imap-send
git-log                 git-relink              git-p4
git-merge               git-remote              git-quiltimport
git-mv                  git-repack              git-request-pull
git-notes               git-replace             git-send-email
git-pull                git-annotate            git-svn
git-push                git-blame

plumbing

git-apply               git-for-each-ref        git-receive-pack
git-checkout-index      git-ls-files            git-shell
git-commit-tree         git-ls-remote           git-upload-archive
git-hash-object         git-ls-tree             git-upload-pack
git-index-pack          git-merge-base          git-check-attr
git-merge-file          git-name-rev            git-check-ignore
git-merge-index         git-pack-redundant      git-check-mailmap
git-mktag               git-rev-list            git-check-ref-format
git-mktree              git-show-index          git-column
git-pack-objects        git-show-ref            git-credential
git-prune-packed        git-unpack-file         git-credential-cache
git-read-tree           git-var                 git-credential-store
git-symbolic-ref        git-verify-pack         git-fmt-merge-msg
git-unpack-objects      git-daemon              git-interpret-trailers
git-update-index        git-fetch-pack          git-mailinfo
git-update-ref          git-http-backend        git-mailsplit
git-write-tree          git-send-pack           git-merge-one-file
git-cat-file            git-update-server-info  git-patch-id
git-diff-files          git-http-fetch          git-sh-i18n
git-diff-index          git-http-push           git-sh-setup
git-diff-tree           git-parse-remote        git-stripspace

1It would seem more logical to call this --plumbing, but as VonC notes in this answer to a related question, one can view this instead as a request: "I am implementing porcelain so please give me plumbing-style output."  The flaw in this argument is that you might be implementing complex plumbing, and want to use simple plumbing to do it: now there's no porcelain in sight, and yet, your complex plumbing passes --porcelain to some simple plumbing.


[System] You are a helpful assistant.

[User] git - the stupid content tracker  git-difftool

[Assistant] Show changes using common diff tools


[System] You are a helpful assistant.

[User] gitglossary - A Git Glossary  object type

[Assistant]
One of the identifiers " commit ",
" tree ", " tag " or
" blob " describing the type of an object .


[System] You are a helpful assistant.

[User]
How can I sync documentation with Github Pages?

I have a project together with several people and we have a README.md file with a bunch of GitHub Flavored Markdown that is rendered on our GitHub page. We also set up a GitHub Pages branch which is hosted under our GitHub Organization's subdomain, and used the Automatic Page Generator simply loading in our README.md file when we created our page. However, I notice that when I update our README.md file, it does not update the project page. Instead, we must go to the GitHub settings tab and recreate the project page, reloading the README.md file when we do it.
Also, after reading about relative linking working between documentation files on the GitHub project directory pages. I very much like the markdown as it saves tons of time from having to write all the HTML out by hand for our documentation. What I would like however is to be able to have one README.md file which is able to include relative links to other documentation files located at docs/*.md. I was hoping there was an easy solution so that my other documentation files might also be included in my gh-pages branch and be hosted under my GitHub Pages subdomain and be rendered and/or themed.
In other words, my questions are:

Is there a way to have my README.md file automatically update on my Github Page subdomain?

[ EDIT ] : No appears to be the answer if using the Automatic Page Generator. You must go to the settings page for the repo and reload it every time there is a change in order to update it.

Is there a way I can have my relative links to my documentation on my README.md file work on my Github Pages, perhaps my somehow syncing my /docs/*.md to my Github Pages and somehow rendering and/or theming them?

[ EDIT ] : From what I've learned since writing this question it appears that this is only possible on GitHub pages through the use of a static site generator like the ruby gem Jekyll and probably some uses of the webhooks supported by GitHub that are mentioned in the comments below. I am trying currently trying to find an optimal solution.

Better yet, is there an even easier way I can do this and perhaps have just one copy of my README.md and documentation that is used on both gh-pages and my main branch and makes everything easiest?

[ EDIT ] : It seems this one is almost definitely a no. I was thinking about the possibility of something built into GitHub to allow this. It seems that better support for this kind of thing may could be built into GitHub Pages in the future, or at least I definitely hope it will be.

[Assistant]
I am going to post a solution that I setup that takes advantage of the fact that GitHub Pages uses Jekyll already using the Automatic Page Generator.

git checkout gh-pages
mkdir _layouts
mv index.html _layouts
git checkout master -- README.md
mv README.md index.md
Prepend the following text to index.md

---
layout: index
---

You also need to open the index.html file and make the following changes:

Remove the rendered HTML from the markdown in your README.md file. This is usually between <section> or <article> tags. Replace this HTML with the text {{ content }} this will allow us to use this file as a jekyll. The file we apply the layout to will be placed where the content tag is.
Locate the CSS for your project page theme. for me this was a line like the following:

<link rel='stylesheet' href='stylesheets/stylesheet.css' />

This needs to be changed to

<link rel='stylesheet' href='{{ site.path }}/stylesheets/stylesheet.css' />

Any other assets stored on your site that will be used in this layout will also need to be prefixed with {{ site.path }}.

By doing this, Jekyll will render the markdown file as the content of the index.html layout in the _layouts directory. In order to automate this process for not just the README.md file, but also other docs you may have in your master branch, I have taken the following steps:
Created the file called post-commit containing the following:

#!/bin/bash
###
### The following block runs after commit to "master" branch
###
if [ `git rev-parse --abbrev-ref HEAD` == "master" ]; then

    # Layout prefix is prepended to each markdown file synced
    ###################################################################
    LAYOUT_PREFIX='---\r\nlayout: index\r\n---\r\n\r\n'

    # Switch to gh-pages branch to sync it with master
    ###################################################################
    git checkout gh-pages

    # Sync the README.md in master to index.md adding jekyll header
    ###################################################################
    git checkout master -- README.md
    echo -e $LAYOUT_PREFIX > index.md
    cat README.md >> index.md
    rm README.md
    git add index.md
    git commit -a -m "Sync README.md in master branch to index.md in gh-pages"

    # Sync the markdown files in the docs/* directory
    ###################################################################
    git checkout master -- docs
    FILES=docs/*
    for file in $FILES
    do
        echo -e $LAYOUT_PREFIX | cat - "$file" > temp && mv temp "$file"
    done

    git add docs
    git commit -a -m "Sync docs from master branch to docs gh-pages directory"

    # Uncomment the following push if you want to auto push to
    # the gh-pages branch whenever you commit to master locally.
    # This is a little extreme. Use with care!
    ###################################################################
    # git push origin gh-pages

    # Finally, switch back to the master branch and exit block
    git checkout master
fi

EDIT: I updated the above script for both the README.md file and the markdown in docs/* to both use the same layout file. This is a much better setup than what I had before. This script goes in your .git/hooks/ directory. bash must be in your path.
Create the file _config.yml with the following
markdown: redcarpet
path: http://username.github.io/reponame

The above script also syncs markdown files found in the docs/* directory of the master branch, in order that they may be viewed on the GitHub Pages site as well. Relative linking to these documents works if you include the following jQuery function in order to strip the .md extension from the anchors on the gh-pages branch. You can add the following script to index.html in the _layouts directory:
$(document).on('ready', function () {
    $('a').each(function (i, e) {
        var href = e.href;
        if (href.search('.md') > 0)
            $(this).attr('href', href.split('.md')[0]);
    });
});

EDIT: I changed the code above in my repository, this was a quick and dirty way to do this, but it won't work right in all cases if you know what I mean.. For example, the markdown file company.mdata.md would not be processed correctly. To fix this I updated this to the following script which more carefully checks out the href and removes the extension if found. I also made the script more generic, allowing it to be used to remove other extensions by changing the ext variable. Here is the code:
$(function () {
    $('a').each(function () {
        var ext = '.md';
        var href = $(this).attr('href');
        var position = href.length - ext.length;
        if (href.substring(position) === ext)
            $(this).attr('href', href.substring(0, position));
    });
});

I setup an example repo at CoryG89/docsync, which has a project page here, if you'd like to see how all this works together.


[System] You are a helpful assistant.

[User] git-log - Show commit logs  %GS

[Assistant] show the name of the signer for a signed commit


[System] You are a helpful assistant.

[User] git-diff-index - Compare a tree to the working tree or index  ignore-space-change

[Assistant]
Ignore changes in amount of whitespace.  This ignores whitespace
at line end, and considers all other sequences of one or
more whitespace characters to be equivalent.


[System] You are a helpful assistant.

[User]
How can I merge two commits into one if I already started rebase?
I am trying to merge 2 commits into 1, so I followed “squashing commits with rebase” from git ready.
I ran
git rebase --interactive HEAD~2

In the resulting editor, I change pick to squash and then save-quit, but the rebase fails with the error

Cannot 'squash' without a previous commit

Now that my work tree has reached this state, I’m having trouble recovering.
The command git rebase --interactive HEAD~2 fails with:

Interactive rebase already started

and git rebase --continue fails with

Cannot 'squash' without a previous commit

[Assistant]
Summary
The error message

Cannot 'squash' without a previous commit

means you likely attempted to “squash downward.” Git always squashes a newer commit into an older commit or “upward” as viewed on the interactive rebase todo list, that is into a commit on a previous line. Changing the command on your todo list’s very first line to squash will always produce this error as there is nothing for the first commit to squash into.
The Fix
First get back to where you started with
$ git rebase --abort

Say your history is
$ git log --pretty=oneline
a931ac7c808e2471b22b5bd20f0cad046b1c5d0d c
b76d157d507e819d7511132bdb5a80dd421d854f b
df239176e1a2ffac927d8b496ea00d5488481db5 a

That is, a was the first commit, then b, and finally c. After committing c we decide to squash b and c together:
(Note: Running git log pipes its output into a pager, less by default on most platforms. To quit the pager and return to your command prompt, press the q key.)
Running git rebase --interactive HEAD~2 gives you an editor with
pick b76d157 b
pick a931ac7 c

# Rebase df23917..a931ac7 onto df23917
#
# Commands:
#  p, pick = use commit
#  r, reword = use commit, but edit the commit message
#  e, edit = use commit, but stop for amending
#  s, squash = use commit, but meld into previous commit
#  f, fixup = like "squash", but discard this commit's log message
#
# If you remove a line here THAT COMMIT WILL BE LOST.
# However, if you remove everything, the rebase will be aborted.
#

(Notice that this todo list is in the reverse order as compared with the output of git log.)
Changing b’s pick to squash will result in the error you saw, but if instead you squash c into b (newer commit into the older or “squashing upward”) by changing the todo list to
pick   b76d157 b
squash a931ac7 c

and save-quitting your editor, you'll get another editor whose contents are
# This is a combination of 2 commits.
# The first commit's message is:

b

# This is the 2nd commit message:

c

When you save and quit, the contents of the edited file become commit message of the new combined commit:
$ git log --pretty=oneline
18fd73d3ce748f2a58d1b566c03dd9dafe0b6b4f b and c
df239176e1a2ffac927d8b496ea00d5488481db5 a

Note About Rewriting History
Interactive rebase rewrites history. Attempting to push to a remote that contains the old history will fail because it is not a fast-forward.
If the branch you rebased is a topic or feature branch in which you are working by yourself, no big deal. Pushing to another repository will require the --force option, or alternatively you may be able, depending on the remote repository’s permissions, to first delete the old branch and then push the rebased version. Examples of those commands that will potentially destroy work is outside the scope of this answer.
Rewriting already-published history on a branch in which you are working with other people without very good reason such as leaking a password or other sensitive details forces work onto your collaborators and is antisocial and will annoy other developers. The “Recovering From an Upstream Rebase” section in the git rebase documentation explains, with added emphasis.

Rebasing (or any other form of rewriting) a branch that others have based work on is a bad idea: anyone downstream of it is forced to manually fix their history. This section explains how to do the fix from the downstream’s point of view. The real fix, however, would be to avoid rebasing the upstream in the first place. …


[System] You are a helpful assistant.

[User] git-diff - Show changes between commits, commit and working tree, etc  git diff [<options>] [--merge-base] <commit> <commit> [--] [<path>…]

[Assistant]
This is to view the changes between two arbitrary
<commit>. If --merge-base is given, use the merge base of the two commits for the
"before" side. git diff --merge-base A B is equivalent to git diff $(git merge-base A B) B .


[System] You are a helpful assistant.

[User] git-config - Get and set repository or global options  boolean

[Assistant]
When a variable is said to take a boolean value, many
synonyms are accepted for true and false ; these are all
case-insensitive. true Boolean true literals are yes , on , true ,
and 1 .  Also, a variable defined without = <value> is taken as true. false Boolean false literals are no , off , false , 0 and the empty string. When converting a value to its canonical form using the --type=bool type
specifier, git config will ensure that the output is "true" or
"false" (spelled in lowercase).


[System] You are a helpful assistant.

[User]
How can I view file history in Git?
With Subversion I could use TortoiseSVN to view the history/log of a file.
How can I do this with Git?
I am just looking for the history record for a particular file, and then the ability to compare the different versions.

[Assistant]
Use git log to view the commit history. Each commit has an associated revision specifier that is a hash key (e.g. 14b8d0982044b0c49f7a855e396206ee65c0e787 and b410ad4619d296f9d37f0db3d0ff5b9066838b39). To view the difference between two different commits, use git diff with the first few characters of the revision specifiers of both commits, like so:
# diff between commits 14b8... and b410...
git diff 14b8..b410
# only include diff of specified files
git diff 14b8..b410 path/to/file/a path/to/file/b

If you want to get an overview over all the differences that happened from commit to commit, use git log or git whatchanged with the patch option:
# include patch displays in the commit history
git log -p
git whatchanged -p
# only get history of those commits that touch specified paths
git log path/a path/b
git whatchanged path/c path/d


[System] You are a helpful assistant.

[User]
Undo a git merge (hasn't been pushed yet)
I just committed some changes into one of my feature branches ("feedback_tab") then, checked out "master" and merged them in there.  I actually meant to merge them into my "development" branch.
Now, master is ahead of 'origin/master' (its remote) by 17 commits - I haven't pushed the merge up (and don't want to, obviously).  How can I revert master back to the same state as before the accidental merge?  I'm confused between git revert and git reset with this stuff.
I looked in my git log and there's no entry for merging feedback_tab into master.  I'd have thought it would be the top entry?
Bit confused :/ any help welcome!  max

[Assistant]
To undo a merge that was NOT pushed:
git reset --merge ORIG_HEAD

If during the merge you get a conflict, the best way to undo the merge is:
git merge --abort


[System] You are a helpful assistant.

[User] git-log - Show commit logs  %cn

[Assistant] committer name


[System] You are a helpful assistant.

[User] git-am - Apply a series of patches from a mailbox  -3  --3way  --no-3way

[Assistant]
When the patch does not apply cleanly, fall back on
3-way merge if the patch records the identity of blobs
it is supposed to apply to and we have those blobs
available locally. --no-3way can be used to override
am.threeWay configuration variable. For more information,
see am.threeWay in git-config .


[System] You are a helpful assistant.

[User]
How to enter command with password for git pull?
I want to do this command in one line:
git pull && [my passphrase]

How to do it?

[Assistant]
This is not exactly what you asked for, but for http(s):

you can put the password in .netrc file (_netrc on windows). From there it would be picked up automatically. It would go to your home folder with 600 permissions.
you could also just clone the repo with https://user:pass@domain/repo but that's not really recommended as it would show your user/pass in a lot of places...
a new option is to use the credential helper. Note that credentials would be stored in clear text in your local config using standard credential helper. credential-helper with wincred can be also used on windows.

Usage examples for credential helper

git config credential.helper store - stores the credentials indefinitely.
git config credential.helper 'cache --timeout=3600'- stores for 60 minutes

For ssh-based access, you'd use ssh agent that will provide the ssh key when needed. This would require generating keys on your computer, storing the public key on the remote server and adding the private key to relevant keystore.


[System] You are a helpful assistant.

[User]
could not find compatible versions for pod
I am new in IOS development and git. I am having a problem after merging my local repo to the dev repo. After merging when I build the project I get an error in the Xcode that says, "The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation."
Build Error
I searched about this and tried the usual solution reinstalling the pods. But executing
pod install

I get another error in terminal that says
Terminal Error
At this point I tried deleting the files associated with the "FTPopOverMenu" pod and reinstalling with pod install. The error doesn't go away. Also, I tried solving it in this way - Error:“The sandbox is not in sync with the Podfile.lock…” after installing RestKit with cocoapods

But both error in the Xcode and in the terminal still remains. I'm new to IOS and Git. I really don't understand what is really happening here.

[Assistant]
As per my guess you are working on an old project means which is already developed in Xcode 8 series and now you are working with latest Xcode and you have updated the code accordingly.
So just do the below steps:

"pod deintegrate"
"pod install"
"pod update" (if it is necessary so do it else if you have all latest pod so don't use it.)

It will remove all old cocoapods traces.
OR Alternate way to do it (Temp Work Around)

Remove that cocoa pod temporary, after all your work finish add to your project and give a try cause in my case it is the only work around i have that worked.


[System] You are a helpful assistant.

[User] git-diff - Show changes between commits, commit and working tree, etc  diff.<driver>.wordRegex

[Assistant]
The regular expression that the diff driver should use to
split words in a line.  See gitattributes for
details.


[System] You are a helpful assistant.

[User]
git, msysgit, accents, utf-8, the definitive answers
I've read in some places that there are problems with git (or just msysgit?) and character encoding - I believe it's only a problem in file names.
What I'd like is some 'definitive' (or at least authoritative) information about:

What exactly are the 'problems'? (The symptoms)
What are the causes? (Briefly)
In what scenarios is this a show stopper?
Is there any resolution in sight, or failing that any workarounds?

I hope this question isn't too vague, I think it would be good to have all of this information in one place to be able to point people to it...

[Assistant]
Update Oct. 2023: with Git 2.43 (Q4 2023), the display width table for unicode characters has been updated for Unicode 15.1
See commit 872976c (25 Sep 2023) by Beat Bolli (bbolli).
(Merged by Junio C Hamano -- gitster -- in commit 64b2419, 04 Oct 2023)

unicode: update the width tables to Unicode 15.1
Signed-off-by: Beat Bolli

Unicode 15.1 has been announced on 2023-09-12, so update the character width tables to the new version.

Update Apr. 2023: with Git 2.41 (Q2 2023), the Unicode character width table (used for output alignment) has been updated.
See commit b10cbda (30 Mar 2023) by Beat Bolli (bbolli).
(Merged by Junio C Hamano -- gitster -- in commit 5ae4bd1, 31 Mar 2023)

unicode: update the width tables to Unicode 15
Signed-off-by: Beat Bolli

Unicode version 15 was released in September 2022, and we have so far neglected to update our width tables.
Do this now.

Update Oct. 2021: With Git 2.34 (Q4 2021), the Unicode character width table (used for output alignment) has been updated.
See commit 187fc8b (17 Sep 2021) by Carlo Marcelo Arenas Belón (carenas).
(Merged by Junio C Hamano -- gitster -- in commit 3d875f9, 28 Sep 2021)

unicode: update the width tables to Unicode 14

Update Feb. 2017 (Git 2.12): The character width table has been updated to match Unicode 9.0.
The update_unicode.sh is moved it into contrib/update-unicode: see its README.
Update August 2014 (git 2.1): commit a67c821 (Torsten Bögershausen (tboegi)) adds support for Unicode 7.0.
Update April 2014: commit d813ab9 (Torsten Bögershausen (tboegi)) adds support for Unicode 6.3
(git 1.9.2):

Unicode 6.3 defines more code points as combining or accents.
For example, the character "ö" could be expressed as an "o" followed by U+0308 COMBINING DIARESIS (aka umlaut, double-dot-above).
We should consider that such a sequence of two codepoints occupies one display column for the alignment purposes, and for that, git_wcwidth() should return 0 for them.
Affected codepoints are:
U+0358..U+035C
U+0487
U+05A2, U+05BA, U+05C5, U+05C7
U+0604, U+0616..U+061A, U+0659..U+065F

Earlier unicode standards had defined these as "reserved".
Only the range 0..U+07FF has been checked to see which codepoints need to be marked as 0-width while preparing for this commit; more updates may be needed.

Update April 2012: Unicode support is released in version 1.7.10. See this page for notes and settings you should set.
Namely:
git config [--global] core.quotepath off
git config [--global] i18n.logoutputencoding utf8
git config [--global] i18n.commitencoding utf8
git config [--global] --unset svn.pathnameencoding

The recodetree check command scans the entire history of a git repository and prints all non-ASCII file names. If the output is empty, no migration is necessary.

Update February 2012: patches for UTF-8 supports are comming in branch 'devel' of msysgit repo on GitHub, including Update less settings for UTF-8 .
The Git for Windows Google+ page mentions:

Karsten Blees' UTF-8 patches for Git for Windows has now been merged to 'devel'.
This means the upcoming release will support Unicode filenames!

May 2011
I believe the msysgit issue 80 has the latest on that bug.
Also described in issue 376.
For example:

This is what happens:

git on Windows operates on file names and treats them essentially as byte streams.
In your case, the streams happen to be UTF8 encoded text.

git on Windows asks the runtime to create a file, and passes it the byte stream.

Since internally on Windows everything is Unicode, the runtime converts the byte
stream to UTF16 using the currently set locale (aka "codepage").
That is, it effectively interprets the byte stream as CP949 (Korean) encoded text.
Apparently, some of the UTF8 byte sequences are invalid CP949 sequences, and the conversion fails ("Invalid argument"); or if the UTF8 sequences happen to be correct CP949 sequences, the result is (most likely) a different character.

The true fix should be on MingW though:

It occurs to me that one solution would be this: solve it at the GCC C run-time
library level.
That is, for the mingw GCC run-time library on Windows, make it possible via build-time options to be in a mode where the command-line parameters (passed to main()) and file I/O functions use the underlying Windows Unicode API calls, and translate to/from UTF-8 encoding in C's standard function APIs that use byte-strings.
That would "just work" for git perhaps, and could be useful for other Linux-originated open source projects running the Windows environment.

ak2 comments that MingW isn't the right place for this fix:

"MinGW compilers provide access to the functionality of the Microsoft C runtime and some language-specific runtimes.
MinGW, being Minimalist, does not, and never will, attempt to provide a POSIX runtime environment for POSIX application deployment on MS-Windows.
If you want POSIX application deployment on this platform, please consider Cygwin instead."

There is some work in progress on a msysgit variant to support unicode.


[System] You are a helpful assistant.

[User]
How do I get Jenkins to build on push to a BitBucket git repository?
I have a git repository hosted on BitBucket, and have set up SSH authentication between the repository and my Jenkins server.  I can build on Jenkins manually, but cannot get the Jenkins service on BitBucket to trigger builds.
Jenkins configuration:
- Project Name: [my_jenkins_job]
- Build Triggers:
--Trigger Builds Remotely:
---Token: [token]

BitBucket configuration:
- Endpoint: http://[my_jenkins_address]/job/[my_jenkins_job]/build (I've also tried build?token=[token])
- Project Name: [my_jenkins_job]
- Module Name: [blank]
- Token: [token]

Visiting http://{my_jenkins_address}/job/{my_jenkins_job}/build?token={token} kicks off a build properly.
Why doesn't pushing a change to BitBucket cause Jenkins to initiate a build?

[Assistant]
Due to the Jenkins Hook of Bitbucket is not working at all for me and I have different Jenkins projects for different branches I had come to this solution:

Install Bitbucket Plugin at your Jenkins
Add a normal Post as Hook to your Bitbucket repository (Settings -> Hooks) and use following url:

https://YOUR.JENKINS.SERVER:PORT/bitbucket-hook/

and if you have setup authentication on jenkins then URL must be like

https://USERNAME:[email protected]:PORT/bitbucket-hook/

Configure your Jenkins project as follows:
under build trigger enable Build when a change is pushed to BitBucket
under Source Code Management select GIT; enter your credentials and define Branches to build (like **feature/*)

By this way I have three build projects, one for all features, one for develop and one for release branch.  Make sure to include the slash ('/') on the end of the URL or the hook won't work.
And best of it, you don't have to ad new hooks for new Jenkins projects.


[System] You are a helpful assistant.

[User]
GitLab CI secret variables for Gradle publish

How to setup Gradle publish task user credentials with GitLab CI secret variables? I am using gradle maven publish plugin, and here is snippet from build.gradle
repositories {
    maven {
      credentials {
        username artifactUser
        password artifactPass
      }
      url "..."
    }
  }

I've tried to use gradle.properties as below
artifactUser=${env.MAVEN_REPO_USER}
artifactPass=${env.MAVEN_REPO_PASS}

And several ways of accessing secret variables in .gitlab-ci.yml file (because gradle.properties is not picked up from gradle or variables are not transformed correctly, it is in root project dir)
Method 1
'./gradlew publish -x test -PartifactUser=${env.MAVEN_REPO_USER} -PartifactPass=${env.MAVEN_REPO_PASS}'

Error: /bin/bash: line 56: -PartifactUser=${env.MAVEN_REPO_USER}: bad substitution
Method 2
    before_script:
      - chmod +x ./gradlew
      - export REPO_USER=${env.MAVEN_REPO_USER}
      - export REPO_PASS=${env.MAVEN_REPO_PASS}
    ...
    deploy:
  stage: deploy
  script:
    - ./gradlew publish -x test -PartifactUser=$REPO_USER -PartifactPass=$REPO_PASS

I am using openjdk:8-jdk-slim image for build using gradle wrapper. Seems like there are several issues with this kind of variable usage, do we have any workaround?

[Assistant]
You don't need env. prefinx in your .gitlab-ci.yml. You don't need to re-export the variables as well.
If you have defined a variables named MAVEN_REPO_USER and MAVEN_REPO_PASS in Gitlab CI/CD settings for the project, you can just use them in Gradle script:
repositories {
    maven {
        credentials {
            username System.getenv("MAVEN_REPO_USER")
            password System.getenv("MAVEN_REPO_PASS")
        }
        url "…"
    }
}


[System] You are a helpful assistant.

[User]
gitignore - fatal: no files added
I have an issue with git, more precisely with gitignore.
I have created an empty folder
Initialized git
mkdir fold
cd fold
git init

Updated gitignore (as below)
 *.prjx

Committed gitignore
git add .gitignore
git commit -m "update gitignore"

Now I have several files (among them a .prjx) and folders in my root (fold) and I'd like to add all of them, but when I run
git add *

I get the message below
The following paths are ignored by one of your .gitignore files:
ftc.prjx
Use -f if you really want to add them.
fatal: no files added

I don't want to add it, I simply want add all the other files and folders.
From my understanding .gitignore should handle exactly that so why I get the message above?
Am I missing something?

[Assistant]
you should run git add . rather than git add *
the * is interpreted by the shell and substituted with all file and folder in the current location.  obviously ftc.prjx is one of them and git is just warning that the file is in the ignorelist.


[System] You are a helpful assistant.

[User] git-rev-parse - Pick out and massage parameters  <sha1> , e.g. dae86e1950b1277e545cee180551750029cfe735 , dae86e

[Assistant]
The full SHA-1 object name (40-byte hexadecimal string), or
a leading substring that is unique within the repository.
E.g. dae86e1950b1277e545cee180551750029cfe735 and dae86e both
name the same commit object if there is no other object in
your repository whose object name starts with dae86e.


[System] You are a helpful assistant.

[User] git-config - Get and set repository or global options  --unset-all

[Assistant] Remove all lines matching the key from config file.


[System] You are a helpful assistant.

[User]
How to customise config.toml on Kubernetes?

I'm have a Gitlab cloud connected to a k8s cluster running on Google (GKE).
The cluster was created via Gitlab cloud.
I want to customise the config.toml because I want to fix the cache on k8s as suggested in this issue.
I found the config.toml configuration in the runner-gitlab-runner ConfigMap.
I updated the ConfigMap to contain this config.toml setup:
  config.toml: |
    concurrent = 4
    check_interval = 3
    log_level = "info"
    listen_address = '[::]:9252'
    [[runners]]
      executor = "kubernetes"
      cache_dir = "/tmp/gitlab/cache"
      [runners.kubernetes]
        memory_limit = "1Gi"
        [runners.kubernetes.node_selector]
          gitlab = "true"
        [[runners.kubernetes.volumes.host_path]]
          name = "gitlab-cache"
          mount_path = "/tmp/gitlab/cache"
          host_path = "/home/core/data/gitlab-runner/data"

To apply the changes I deleted the runner-gitlab-runner-xxxx-xxx pod so a new one gets created with the updated config.toml.
However, when I look into the new pod, the /home/gitlab-runner/.gitlab-runner/config.toml now contains 2 [[runners]] sections:
listen_address = "[::]:9252"
concurrent = 4
check_interval = 3
log_level = "info"

[session_server]
  session_timeout = 1800

[[runners]]
  name = ""
  url = ""
  token = ""
  executor = "kubernetes"
  cache_dir = "/tmp/gitlab/cache"
  [runners.kubernetes]
    host = ""
    bearer_token_overwrite_allowed = false
    image = ""
    namespace = ""
    namespace_overwrite_allowed = ""
    privileged = false
    memory_limit = "1Gi"
    service_account_overwrite_allowed = ""
    pod_annotations_overwrite_allowed = ""
    [runners.kubernetes.node_selector]
      gitlab = "true"
    [runners.kubernetes.volumes]

      [[runners.kubernetes.volumes.host_path]]
        name = "gitlab-cache"
        mount_path = "/tmp/gitlab/cache"
        host_path = "/home/core/data/gitlab-runner/data"

[[runners]]
  name = "runner-gitlab-runner-xxx-xxx"
  url = "https://gitlab.com/"
  token = "<my-token>"
  executor = "kubernetes"
  [runners.cache]
    [runners.cache.s3]
    [runners.cache.gcs]
  [runners.kubernetes]
    host = ""
    bearer_token_overwrite_allowed = false
    image = "ubuntu:16.04"
    namespace = "gitlab-managed-apps"
    namespace_overwrite_allowed = ""
    privileged = true
    service_account_overwrite_allowed = ""
    pod_annotations_overwrite_allowed = ""
    [runners.kubernetes.volumes]

The file /scripts/config.toml is the configuration as I created it in the ConfigMap.
So I suspect the /home/gitlab-runner/.gitlab-runner/config.toml is somehow updated when registering the Gitlab-Runner with the Gitlab cloud.
If if changing the config.toml via the ConfigMap does not work, how should I then change the configuration? I cannot find anything about this in Gitlab or Gitlab documentation.

[Assistant]
Inside the mapping you can try to append the volume and the extra configuration parameters:
# Add docker volumes
cat >> /home/gitlab-runner/.gitlab-runner/config.toml << EOF

      [[runners.kubernetes.volumes.host_path]]
        name = "var-run-docker-sock"
        mount_path = "/var/run/docker.sock"
EOF

I did the runner deployment using a helm chart; I guess you did the same, in the following link you will find more information about the approach I mention: https://gitlab.com/gitlab-org/gitlab-runner/issues/2578
If after appending the config your pod is not able to start, check the logs, I did test the appending approach and had some errors like "Directory not Found," and it was because I was appending in the wrong path, but after fixing those issues, the runner works fine.


[System] You are a helpful assistant.

[User]
What's the difference between git-tf and git-tfs?
I've recently been getting really fed up with TFS. I've heard that there is a light at the end of the tunnel though. Apparently I can use either git-tf or git-tfs and treat my code as if it was managed by git, but be able to push/pull to/from a central TFS server.
My main question is I'm not sure which one of these I should use. There is git-tf which is officially supported by Microsoft, and there is git-tfs which has been around a lot longer. What's the differences between these and which should I try out first?

[Assistant]
Disclaimer: I started the git-tf project and although the project is now in very capable hands without me as a frequent contributor, you should absolutely consider my opinions on this to be strongly biased.  (And, assuming you're on Windows, perhaps unexpected.)
There are two fundamental differences between the two tools:

git-tfs was built for Windows users and written on top of the .NET TFS SDK.  The TFS SDK will not run under Mono, so this makes git-tfs unsuitable for cross-platform use.
git-tf was built for cross-platform users and written on top of the Java TFS SDK.  Thus, it will run anywhere that's supported by the Java TFS SDK (Windows, Mac, Linux, AIX, HP-UX, Solaris, etc...)  git-tf was explicitly created to allow Xcode users to access TFS.

On Windows, of course, you can use either.  I'm not going to necessarily say one is better than the other.  But I will say:

My biggest complaint about git-tfs is that it won't work on Mac OS.  If there was a way to make git-tfs cross-platform, then git-tf almost certainly wouldn't exist.
git-tfs is faster in some cases than git-tf.  Performance was not our priority in the first few revisions, correctness was.
Because git-tf has a wide platform support matrix, this means that its functionality is necessarily constrained.  For example, there is no UI.  git-tfs, on the other hand, has a checkintool command that will open the normal TFS Checkin dialog.  This can be exceptionally helpful in visualizing your changes.  (If I recall, you can open up a proper visual diff from there, etc.)
git-tf works by populating the git repository directly, downloading TFS objects directly into the git object database.  git-tfs works by creating a TFS working folder mapping in a hidden folder, then populating the git repository from that.  There's a disk penalty here, so if you have superginormous repositories, you might feel this.
git-tfs can try to map your TFS branches to your git branches.  A lot of people will see this as a positive for git-tfs, though I don't:  git's branching model (at the repository level) and TFS's branching model (represented as folders in the repository) are so radically different as to cause problems in anything but the most simplistic workflows.  But your mileage may vary.
git-tfs is actively developed by a community.  git-tf has not had the community adoption.

I don't want to make it sound like I'm saying git-tf is bad.  It's not.  I think it's actually pretty good.  But it may not be your best choice.

Update: git-tf has reached end-of-life.  It is no longer maintained or supported by Microsoft.  We recommend git-tfs if you want a bidirectional TFS <-> git solution.


[System] You are a helpful assistant.

[User] git-log - Show commit logs  --check

[Assistant]
Warn if changes introduce conflict markers or whitespace errors.
What are considered whitespace errors is controlled by core.whitespace configuration.  By default, trailing whitespaces (including
lines that consist solely of whitespaces) and a space character
that is immediately followed by a tab character inside the
initial indent of the line are considered whitespace errors.
Exits with non-zero status if problems are found. Not compatible
with --exit-code.


[System] You are a helpful assistant.

[User]
Git log out user from command line
Is there a command for logging out of git? I'm turning my computer over to somebody else and don't want the git to be attached to my account in the terminal.

[Assistant]
I came across this same problem, and the above answer didn't work for me because github was being fed my credentials through windows credential manager instead of git bash.
You may have to check windows credential manager and delete the github entry under control panel > user accounts > credential manager > Windows credentials > Generic credentials


[System] You are a helpful assistant.

[User]
git : empty ident name (for <>) not allowed
I was applying a diff file of an opensource project on the top of my repository using git-am :
 git am -3 < /Downloads/refactorWork.diff

but it had conflicts and i had to resolve them; but after resolving the conflicts and staging them, when i did git am --continue i got :
fatal : empty ident name (for <>) not allowed

I looked up on the internet and found this which seemed to be similar to my problem but my usename and email were already added up in global and local git directories. Here is the output of git config list :
rohan@~/Documents/libo : $ git config --global --list
[email protected]
user.name=Rohan Kumar
alias.l=log --oneline --graph --pretty
credential.helper=cache

Although i solved this by first commiting the staged changes and then using git am --skip, I am interested in knowing what does that error means and whether what i did was the correct way of doing it, or is there any better way?

[Assistant]
This diff file is a plain diff, not something generated by git format-patch. A format-patch generated diff contains information about the commit author, author date, commit message, ... and maintains this information when creating the commit(s).
Your plain diff does not have these information, so git am will complain that it is missing, naturally.
You should instead have used git apply which is meant to apply simple patch files like you have in this case which will only apply the patch to the worktree (and index if you tell it to) but does not create any commit automatically.


[System] You are a helpful assistant.

[User] git - the stupid content tracker  git-imap-send

[Assistant] Send a collection of patches from stdin to an IMAP folder


[System] You are a helpful assistant.

[User]
Make some files private in a repository
I want to host the source code for a website I created in a public repository on Github. I want it to be public so that I can also show the source code to others, however there are some files that I want to remain private. Files that may contain passwords and such (like when connecting to databases). Is there a way to do that?

[Assistant]
Although keeping passwords in the repository is a bad practice as @aspyct has explained, I want to add that not all things that one might want to keep private in a repository are passwords, e.g., one might want to develop a new feature but not expose it until it's done(or maybe expose it never).
In these cases, we can create two remote repositories both associated with the same local repository, but each corresponding to a different branch. Here's a step by step instruction:

Create two remote repositories(on GitHub or BitBucket or wherever else) with different names, for example: one myrepo and the other privates.myrepo. Make the myrepo a public repository and the privates.myrepo a private repository.
On local, initiate a single git repository: git init.
Add the non-private files now in the repository and make an initial commit.
Connect this repository to the public remote:

git remote add <remote_branch_name> <remote_repository_address>

in our example which becomes:
git remote add origin https://github.com/<YOUR_USERNAME>/myrepo.git

Push: git push -u origin master

Now add a branch to the local repository and switch to it: git checkout -b private_work

Here comes the important step: Connect this branch to the other remote, i.e, the private one. In our example:

git remote add privates https://github.com/<YOUR_USERNAME>/privates.myrepo.git

Next, add the private files to the local repository and make a commit.
Push the private_work branch to the privates remote: git push -u privates private_work

Read more explanation on how it works here: https://24ways.org/2013/keeping-parts-of-your-codebase-private-on-github/. I've also learned this from him.
See a cool terminal-show recording of all these steps together here: http://showterm.io/04130676d3401229e7df6
Also, you can add an alias like alias private_push='git push privates private_work in an startup script like .bashrc in case you're on Linux, in order to lower the chances of making a wrong push of private work to the public repository.


[System] You are a helpful assistant.

[User] git-log - Show commit logs  %S

[Assistant]
ref name given on the command line by which the commit was reached
(like git log --source ), only works with git log


[System] You are a helpful assistant.

[User]
Gitlab Runner Docker login not working error during connect: Post http://docker:2375/v1.40/auth: dial tcp: lookup docker on 67.207.67.3:53

I am using docker executor on gitlab runner as an image I am using docker:stable
I am getting this error:
$ docker login gitlab.mydomain.com:5050 -u myusername-p mytoken
WARNING! Using --password via the CLI is insecure. Use --password-stdin.
error during connect: Post http://docker:2375/v1.40/auth: dial tcp: lookup docker on 67.207.67.3:53: no such host
Cleaning up project directory and file based variables
00:01
ERROR: Job failed: exit code 1

Here is my config.toml
concurrent = 1
check_interval = 0

[session_server]
  session_timeout = 1800

[[runners]]
  name = "dev-env"
  url = "https://gitlab.mydomain.com/"
  token = "REDACTED"
  executor = "docker"
  [runners.custom_build_dir]
  [runners.cache]
    [runners.cache.s3]
    [runners.cache.gcs]
    [runners.cache.azure]
  [runners.docker]
    tls_verify = false
    image = "docker:stable"
    privileged = false
    disable_entrypoint_overwrite = false
    oom_kill_disable = false
    disable_cache = false
    volumes = ["/cache"]
    shm_size = 0

Here is my ci file
deploy-dev:
  stage: deploy
  before_script:
    - apk add make
  script:
    - docker login gitlab.mydomain.com:5050 -u myusnerma -p mytoken
  only:
    - mybranch
  tags:
    - dev

[Assistant]
You must add the docker:dind service to your job configuration:
deploy-dev:
  variables:
    # these values may need to be different if using TLS, k8s, etc.
    # You can alternatively set defaults in your runner config
    DOCKER_TLS_CERTDIR: ""
    DOCKER_HOST: "tcp://docker:2375"
  services:
    - docker:dind
  # ...

For the dind container to work, your runner must allow privileged containers:
  [runners.docker]
    privileged = true
    # ...


[System] You are a helpful assistant.

[User] git-submodule - Initialize, update or inspect submodules  absorbgitdirs

[Assistant]
If a git directory of a submodule is inside the submodule,
move the git directory of the submodule into its superproject’s $GIT_DIR/modules path and then connect the git directory and
its working directory by setting the core.worktree and adding
a .git file pointing to the git directory embedded in the
superprojects git directory. A repository that was cloned independently and later added as a submodule or
old setups have the submodules git directory inside the submodule instead of
embedded into the superprojects git directory. This command is recursive by default.


[System] You are a helpful assistant.

[User]
How can I pass GitLab artifacts to another stage?

I'd like to use GitLab CI with the .gitlab-ci.yml file to run different stages with separate scripts. The first stage produces a tool that must be used in a later stage to perform tests. I've declared the generated tool as an artifact.
Now how can I execute that tool in a later stage job? What is the correct path, and what files will there be around it?
For example the first stage builds artifacts/bin/TestTool/TestTool.exe and that directory contains other required files (DLLs and others). My .gitlab-ci.yml file looks like this:
releasebuild:
  script:
    - chcp 65001
    - build.cmd
  stage: build
  artifacts:
    paths:
      - artifacts/bin/TestTool/

systemtests:
  script:
    - chcp 65001
    - WHAT TO WRITE HERE?
  stage: test

The build and test jobs run on Windows if that's relevant.

[Assistant]
Use dependencies. With this config, the test stage will download the untracked files that were created during the build stage:
build:
  stage: build
  artifacts:
    untracked: true
  script:
    - ./Build.ps1

test:
  stage: test
  dependencies:
    - build
  script:
    - ./Test.ps1


[System] You are a helpful assistant.

[User] git - the stupid content tracker  git-grep

[Assistant] Print lines matching a pattern


[System] You are a helpful assistant.

[User]
What is a good workflow for submodule forks
Suppose we have the following repository structure on github:
company:project.git
  \- company:submodule.git

A developer in my company forks the company project, making his workspace look like this:
developer:project.git
  \- company:submodule.git

This is fine for 90% of the developers since they don't change the submodule library, they only work in the project. Now suppose there's a new feature which requires improvements in the submodule. The developer charged with this converts his workspace to this:
developer:project.git
   \- developer:submodule.git

Getting there is not trivial as he needs to replace a submdule with another submodule (to git, the original and the fork of the submodule are two different things).
If this developer works on the library for a bit longer, he commits this structure to his master branch, so his fork on github always uses the forked submodule.
Once he's ready with development, he'll create a pull request. The problem is that when merging the pull request the main repository will look like this:
company:project.git
   \- developer:submodule.git

This is problematic as now every developer that tracks the company branch will end up with the developer's submodule.
To workaround the problem, before the developer makes a pull request, his master branch should be moved back to the company:submodule.git - which is just very awkward, especially since locally he'll always still want to work with developer:submodule.git.
We've tried several workflows, and the above issue is the only one where we don't have a good workflow yet.

[Assistant]
When the developer creates a commit with the submodule at a particular version, that's a strong statement that the supermodule works with the submodule at that exact version.  If his code does actually work with the company's version of the submodule, I think the right thing to do is for the developer to:

branch the supermodule
checkout the company version in the submodule
update .gitmodules in the supermodule, if the developer changed that from the upstream version
stage and commit that change
test everything
issue the pull request

He can then switch back to his normal development branch in the supermodule.
One thing I don't understand about your question is the following:

Getting there is not trivial as he needs to replace a submdule with another submodule (to git, the original and the fork of the submodule are two different things).

On the contrary, the submodule can be any git repository so long as it contains the commit which the supermodule points to.  If there are two different remote repositories, he can just add an extra remote in the submodule.  (The developer should change .gitmodules as well if they're going to share their repository with anyone else.)

In response to your comment below, perhaps it's worth going through how to switch a submodule from pointing to one version to another.  Let's suppose that the developer is using their own repositories for the super and submodule, but those are both cloned from the company's versions (i.e. so most of the history is the same), and the submodule is at the path lib.  The developer now wants to switch the submodule to point to the company's version instead.  They can do the following:

Edit the url parameter for the submodule in .gitmodules to point to the company's repository.
cd lib
git remote add company developer@company:/srv/git/lib.git
git fetch company
git checkout -b upstream-master company/master
cd ..
git add .gitmodules lib
git commit -m "Switch the lib submodule to point back to the company's version"

Steps 3 to 5 can just be changed to git checkout <whatever> once the remote and branch are set up.


[System] You are a helpful assistant.

[User]
How do I remove local (untracked) files from the current Git working tree?
How do I delete untracked local files from the current working tree?

[Assistant]
git-clean - Remove untracked files from the working tree
Synopsis
git clean [-d] [-f] [-i] [-n] [-q] [-e <pattern>] [-x | -X] [--] <path>…

Description
Cleans the working tree by recursively removing files that are not under version control, starting from the current directory.
Normally, only files unknown to Git are removed, but if the -x option is specified, ignored files are also removed. This can, for example, be useful to remove all build products.
If any optional <path>... arguments are given, only those paths are affected.

Step 1 is to show what will be deleted by using the -n option:
# Print out the list of files and directories which will be removed (dry run)
git clean -n -d

Clean Step - beware: this will delete files:
# Delete the files from the repository
git clean -f

To remove directories, run git clean -f -d or git clean -fd
To remove ignored files, run git clean -f -X or git clean -fX
To remove ignored and non-ignored files, run git clean -f -x or git clean -fx

Note the case difference on the X for the two latter commands.
If clean.requireForce is set to "true" (the default) in your configuration, one needs to specify -f otherwise nothing will actually happen.
Again see the git-clean docs for more information.

Options
-f, --force
If the Git configuration variable clean.requireForce is not set to
false, git clean will refuse to run unless given -f, -n or -i.
-x
Don’t use the standard ignore rules read from .gitignore (per
directory) and $GIT_DIR/info/exclude, but do still use the ignore
rules given with -e options. This allows removing all untracked files,
including build products. This can be used (possibly in conjunction
with git reset) to create a pristine working directory to test a clean
build.
-X
Remove only files ignored by Git. This may be useful to rebuild
everything from scratch, but keep manually created files.
-n, --dry-run
Don’t actually remove anything, just show what would be done.
-d
Remove untracked directories in addition to untracked files. If an
untracked directory is managed by a different Git repository, it is
not removed by default. Use -f option twice if you really want to
remove such a directory.


[System] You are a helpful assistant.

[User] git-config - Get and set repository or global options  format.subjectPrefix

[Assistant] The default for format-patch is to output files with the [PATCH] subject prefix. Use this variable to change that prefix.


[System] You are a helpful assistant.

[User]
How to get diff between all files inside 2 folders that are on the web?
So I want to compare this folder http://cloudobserver.googlecode.com/svn/branches/v0.4/Boost.Extension.Tutorial/libs/boost/extension/ with this http://svn.boost.org/svn/boost/sandbox/boost/extension/. I want to get a diff file as a result. These folders are under svn control but I'd prefer git styled diff file (like one shown here) I tried git diff but it seems not to work that way for web folders. So how to do the same thing with one command on Linux?
Update:
So we had a great answer. But it works strangely - it seems to me it shows that all files (same files) have all theire contents replaced with very same contents (while I know for sure that there were only like 3-4 code lines changed at all)...
Update 2:
To achieve what I really needed (dif file with only really changed lines, with git styling, on Linux) do:
$ svn export http://cloudobserver.googlecode.com/svn/branches/v0.4/Boost.Extension.Tutorial/libs/boost/extension/ repos2 --native-eol CRLF
$ svn export http://svn.boost.org/svn/boost/sandbox/boost/extension/ repos --native-eol CRLF
$ git diff repos repos2 > fileWithReadableDiff.diff

[Assistant]
Once you have the source trees, e.g.
diff -ENwbur repos1/ repos2/

Even better
diff -ENwbur repos1/ repos2/  | kompare -o -

and have a crack at it in a good gui tool :)

-Ewb ignore the bulk of whitespace changes
-N detect new files
-u unified
-r recurse


[System] You are a helpful assistant.

[User] gitattributes - Defining attributes per path  Set to string value "lf"

[Assistant]
This setting uses the same line endings in the working directory as
in the index when the file is checked out.


[System] You are a helpful assistant.

[User] git - the stupid content tracker  <head>

[Assistant] a valid head name (i.e. a refs/heads/<head> reference).


[System] You are a helpful assistant.

[User] git-log - Show commit logs  git log --since="2 weeks ago" -- gitk

[Assistant]
Show the changes during the last two weeks to the file gitk .
The -- is necessary to avoid confusion with the branch named gitk


[System] You are a helpful assistant.

[User] git-clean - Remove untracked files from the working tree  -x

[Assistant]
Don’t use the standard ignore rules (see gitignore ), but
still use the ignore rules given with -e options from the command
line.  This allows removing all untracked
files, including build products.  This can be used (possibly in
conjunction with git restore or git reset ) to create a pristine
working directory to test a clean build.


[System] You are a helpful assistant.

[User] git-init - Create an empty Git repository or reinitialize an existing one  --separate-git-dir= <git-dir>

[Assistant]
Instead of initializing the repository as a directory to either $GIT_DIR or ./.git/ , create a text file there containing the path to the actual
repository.  This file acts as a filesystem-agnostic Git symbolic link to the
repository. If this is a reinitialization, the repository will be moved to the specified path.