I moved between two machines and now all my git status commands outputs are filled with #
I have the same .gitconfig and .bashrc files.
Also tested making a new git clone, same happens.
On my old computer it looks normal:
On branch xxx
Your branch is up to date with 'origin/xxx'.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: xxx
On my new computer it's full of "comments":
# On branch xxx
# Your branch is up to date with 'origin/xxx'.
# Changes not staged for commit:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: xxx
How do I remove those tags?
Older git versions just printed # in front of the lines in git status by default. And it was removed in newer version.
See https://github.com/git/git/commit/2556b9962e7c0353d562b7bf70eed11d8f29d0b0#diff-21ecaaf4e2318a39cdedf505941dbfbabd3329f041c839a03fb84906b4dae4fb this commit.
status: disable display of '#' comment prefix by default
Historically, "git status" needed to prefix each output line with '#'
so that the output could be added as comment to the commit message.
This prefix comment has no real purpose when "git status" is ran from
the command-line, and this may distract users from the real content.
Disable this prefix comment by default, and make it re-activable for
users needing backward compatibility with status.displayCommentPrefix.
Obviously, "git commit" ignores status.displayCommentPrefix and keeps
the comment unconditionnaly when writing to COMMIT_EDITMSG (but not
when writing to stdout for an error message or with --dry-run).
Signed-off-by: Matthieu Moy Matthieu.Moy#imag.fr Signed-off-by:
Junio C Hamano gitster#pobox.com
Related
After adding files in a bunch of different ways, the files are still not added to the commit, no matter which way I am trying to add them. This is my console output so you understand better:
daniel#padamtuts:~/github/dotfiles$ git status
On branch master
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
(commit or discard the untracked or modified content in submodules)
modified: .vim/bundle/auto-pairs (modified content)
modified: .vim/bundle/ctrlp.vim (modified content)
modified: .vim/bundle/emmet-vim (modified content)
modified: .vim/bundle/nerdtree (modified content)
<a lot of files>
no changes added to commit (use "git add" and/or "git commit -a")
daniel#padamtuts:~/github/dotfiles$ git add *
daniel#padamtuts:~/github/dotfiles$ git add -A
daniel#padamtuts:~/github/dotfiles$ git commit -m "Vim bundles"
On branch master
Changes not staged for commit:
modified: .vim/bundle/auto-pairs (modified content)
...
<same files>
no changes added to commitPdaniel#padamtuts:~/github/dotfiles$ git status
On branch master
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
(commit or discard the untracked or modified content in submodules)
modified: .vim/bundle/auto-pairs (modified content)
<same files>
no changes added to commit (use "git add" and/or "git commit -a")
daniel#padamtuts:~/github/dotfiles$ git add *
daniel#padamtuts:~/github/dotfiles$ git add -A
daniel#padamtuts:~/github/dotfiles$ git commit -m "Vim bundles"
On branch master
Changes not staged for commit:
modified: .vim/bundle/auto-pairs (modified content)
<same files>
no changes added to commit
```
Files/directories that begin with . are 'hidden' and will be ignored by git when you add with the glob character. You can read about these 'dotfiles' if you want to learn more; usually they are configuration files (e.g. for vim) and such that you may not want to interact with directly and by default will not appear in a file explorer, or in the output of ls, etc.
For your purposes, git add . should do the trick.
I did a commit and after trying to crate a diff with
arc diff dev command but I've got an error
ARC: Cannot mix D and F
UNIX: No such file or directory
Any ideas how to solve it?
The steps I did before arc diff command:
$ git commit -am "<commit message>"
$ git pull --rebase
$ git push origin my_working_branch
The git status output:
$ git status
On branch ATD-86
Untracked files:
(use "git add <file>..." to include in what will be committed)
../javaproject/
nothing added to commit but untracked files present (use "git add" to
track)
The branch dev is protected, could it be a reason?
This error message seems to come from the arc command at https://github.com/hyc/arc/
This is not the arc command you want for using Phabricator's arcanist. Try export PATH=/path/to/arcansit/bin:$PATH to prepend arcanist to your path before that foreign arc command, or use alias arc='/path/to/arcanist/bin/arc' to force the correct arc command.
I usually does the following with
$ mv file1.py file2.py
$ git add .
$ git rm file1.py
How can I skip the last step? So that whenever I add the newly name
files it will automatically remove the old one file1.py in the git repository.
I know I can do git mv file1.py file2.py. But in my workflow I tend to do many mv commands and prefer to add and commit them at the very end.
If you want to stage all current files you can do it with git add -u So you can try the following combination:
git add . #add new files
git add -u #stage removed files
Example
lol4t0#lol4t0-VirtualBox:~/gtets$ mv foo bar
lol4t0#lol4t0-VirtualBox:~/gtets$ git status
On branch master
Changes not staged for commit:
(use "git add/rm <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
deleted: foo
Untracked files:
(use "git add <file>..." to include in what will be committed)
bar
no changes added to commit (use "git add" and/or "git commit -a")
lol4t0#lol4t0-VirtualBox:~/gtets$ git add -u
lol4t0#lol4t0-VirtualBox:~/gtets$ git status
On branch master
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
deleted: foo
Untracked files:
(use "git add <file>..." to include in what will be committed)
bar
lol4t0#lol4t0-VirtualBox:~/gtets$ git add .
lol4t0#lol4t0-VirtualBox:~/gtets$ git status
On branch master
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
renamed: foo -> bar
Simple git question. After executing:
git reset HEAD file && git checkout -- file
The file is still under "Changes not staged for commit" section, but it shouldn't. If I execute the two operations seperately (ie. pressing enter and seeing git status between and after them), it works.
Platform: Linux amd64, git version 1.8.1.3
This is because git reset returns a non-zero exit code when the file has unstaged commits after the reset. So the && prevents the git checkout from running -- it will only run the second command if the first "succeeds" (i.e. exits with zero).
git reset HEAD file just updates the index (i.e., any staged changes to the file are lost), the changed file stays as is.
Why do it this way, if a simple git checkout file (perhaps with -f if file has been changed) acomplishes the same?
In Perforce, how do I revert changes I have made a file?
$ p4 status
UI\FormMain.cs - reconcile to edit //UI/FormMain.cs#73
$ p4 revert UI/FormMain.cs
UI/FormMain.cs - file(s) not opened on this client.
In Git I do this with the command git checkout.
$ git status
# On branch master
# Changes not staged for commit:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: Form.cs
#
no changes added to commit (use "git add" and/or "git commit -a")
$ git checkout Form.cs
$ git status
# On branch master
nothing to commit, working directory clean
If the file isn't opened, yet you have made changes to it locally, use
p4 sync -f UI/FormMain.cs
to tell Perforce to forcibly (-f) sync the copy of FormMain.cs that you have on your machine with the version from the server.
Instead of p4 revert UI/FormMain.cs you should call p4 revert //UI/FormMain.cs since that's the absolute path in depot notation.
The file with out the leading // marks a file relative to your current location in the client workspace.