git-status

How to list all unchanged (tracked) files?

青春壹個敷衍的年華 提交于 2019-12-05 07:22:08
I unzipped an older "git-image" onto my git repository and most of the files have been changed. I would like to know which files remained untouched. How to list these files? Chris Maes I didn't find anything purely git, but with some bash it is possible: ( git ls-files --modified ; git ls-files ) | sort | uniq -u explanation git ls-files lists all files tracked by git git ls-files --modified lists all the modified files tracked by git the rest is some bash scripting to remove the duplicates from both lists. Maybe, if you unzip a archive, you may also won't use git but unzip -u ? It echos (the

git: programmatically know by how much the branch is ahead/behind a remote branch

ぐ巨炮叔叔 提交于 2019-12-04 07:40:09
问题 I would like to extract the information that is printed after a git status , which looks like: # On branch master # Your branch is ahead of 'origin/master' by 2 commits. Of course I can parse the output of git status but this is not recommended since this human readable output is liable to change. There are two problems: How to know the remote tracked branch? It is often origin/branch but need not be. How to get the numbers? How to know whether it is ahead/behind? By how many commits? And

How to check if there's nothing to be committed in the current branch?

烂漫一生 提交于 2019-12-04 07:24:05
问题 The goal is to get an unambiguous status that can be evaluated in a shell command. I tried git status but it always returns 0, even if there are items to commit. git status echo $? #this is always 0 I have an idea but I think it is rather a bad idea. if [ git status | grep -i -c "[a-z]"> 2 ]; then code for change... else code for nothing change... fi any other way? update with following solve, see Mark Longair's post I tried this but it causes a problem. if [ -z $(git status --porcelain) ];

git: Why doesn't git diff show any differences?

匆匆过客 提交于 2019-12-03 14:25:18
问题 If I run 'git status' on my repo it gives: # On branch master # Changes to be committed: # (use "git reset HEAD <file>..." to unstage) # # modified: myfile However, if I do a 'git diff myfile' it shows no differences. Is this because I have made a change and removed it so it is back to the original? Should I run 'git checkout myfile' to clear it? 回答1: Your file is already staged to be committed. You can show it's diff using the --cached option of git. git diff --cached myfile To unstage it,

How can I restrict git status to regular files in the current directory only?

旧城冷巷雨未停 提交于 2019-12-03 11:07:11
问题 I would like to see the status of the current directory. Because there are lots of changes in sub-directories, which I do not want to see, the following command doesn't do the trick: git status . Is there any way of getting this kind of report, short of grepping the output of git status ? 回答1: Use git-status -- <pathspec>... The synopsis of the git-status man page tells you that you can filter by paths: git status [<options>...] [--] [<pathspec>...] Therefore, all you have to do is get a list

git: Why doesn't git diff show any differences?

谁都会走 提交于 2019-12-03 04:12:52
If I run 'git status' on my repo it gives: # On branch master # Changes to be committed: # (use "git reset HEAD <file>..." to unstage) # # modified: myfile However, if I do a 'git diff myfile' it shows no differences. Is this because I have made a change and removed it so it is back to the original? Should I run 'git checkout myfile' to clear it? Your file is already staged to be committed. You can show it's diff using the --cached option of git. git diff --cached myfile To unstage it, just do what git status suggests in it's output ;) You can check The Git Index For more info. I have a

How can I tell which remote “parent” branch my branch is based on?

ぐ巨炮叔叔 提交于 2019-12-03 03:37:45
问题 I have a scenario in which there a several remote tracking branches within my local repository that I must sync up to. Our workflow model is: make a branch locally, based off of the desired remote tracking branch make our changes build/test/fix commit push back to the remote server I've noticed that "git status" doesn't show me what branch my local branch is based on unless something has changed; i.e. uncommitted local changes or a recent fetch puts my local branch behind the times. Is there

How can I restrict git status to regular files in the current directory only?

﹥>﹥吖頭↗ 提交于 2019-12-03 01:29:19
I would like to see the status of the current directory. Because there are lots of changes in sub-directories, which I do not want to see, the following command doesn't do the trick: git status . Is there any way of getting this kind of report, short of grepping the output of git status ? jub0bs Use git-status -- <pathspec>... The synopsis of the git-status man page tells you that you can filter by paths: git status [<options>...] [--] [<pathspec>...] Therefore, all you have to do is get a list of paths corresponding to the regular (non-directory) files in the current directory, and pass that

How can I tell which remote “parent” branch my branch is based on?

大城市里の小女人 提交于 2019-12-02 17:04:15
I have a scenario in which there a several remote tracking branches within my local repository that I must sync up to. Our workflow model is: make a branch locally, based off of the desired remote tracking branch make our changes build/test/fix commit push back to the remote server I've noticed that "git status" doesn't show me what branch my local branch is based on unless something has changed; i.e. uncommitted local changes or a recent fetch puts my local branch behind the times. Is there some way of knowing what branch my local branch is based on without having to change things? Something

Git Status - List only the direct subfolders with changes, not inner files

删除回忆录丶 提交于 2019-12-02 16:26:52
问题 I love using Git to organize version control and backup all my web files in Wordpress. After updating plugins, I'd like to get the list of changes only on the direct subfolder by using git status . Typically if doing git status will a very long line of changes including the inner of each subfolder. what I'd like is to limit the result to the subfolders with the changes inside the plugins directory. For example, this git command: git status project_folder/wp-content/plugins will result to: