大约有 4,000 项符合查询结果(耗时:0.0292秒) [XML]
Listing each branch and its last revision's date in Git
...
commandlinefu has 2 interesting propositions:
for k in `git branch | perl -pe s/^..//`; do echo -e `git show --pretty=format:"%Cgreen%ci %Cblue%cr%Creset" $k -- | head -n 1`\\t$k; done | sort -r
or:
for k in `git branch | sed s/^..//`; do echo -e `git log -1 --pretty=format:"%C...
Find which commit is currently checked out in Git
I'm in the middle of a git bisect session.
5 Answers
5
...
How do you push a tag to a remote repository using Git?
I have cloned a remote Git repository to my laptop, then I wanted to add a tag so I ran
9 Answers
...
How to check if there's nothing to be committed in the current branch?
...
An alternative to testing whether the output of git status --porcelain is empty is to test each condition you care about separately. One might not always care, for example, if there are untracked files in the output of git status.
For example, to see if there are any loc...
Reverting a single file to a previous version in git [duplicate]
... we want to revert the file to one of the previous versions. First of all, git doesn't keep version numbers for individual files. It just tracks content - a commit is essentially a snapshot of the work tree, along with some metadata (e.g. commit message). So, we have to know which commit has the ver...
git switch branch without discarding local changes
...e and which branch(es) you want them on.
Let's take a classic mistake:
$ git checkout master
... pause for coffee, etc ...
... return, edit a bunch of stuff, then: oops, wanted to be on develop
So now you want these changes, which you have not yet committed to master, to be on develop.
If you ...
How do I copy a version of a single file from one git branch to another?
...
Run this from the branch where you want the file to end up:
git checkout otherbranch myfile.txt
General formulas:
git checkout <commit_hash> <relative_path_to_file_or_dir>
git checkout <remote_name>/<branch_name> <file_or_dir>
Some notes (from commen...
How to grep (search) committed code in the Git history
...s of source, as opposed to commit messages and the like), you need to do:
git grep <regexp> $(git rev-list --all)
git rev-list --all | xargs git grep <expression> will work if you run into an "Argument list too long" error.
If you want to limit the search to some subtree (for instanc...
git recover deleted file where no commit was made after the delete
...
The output tells you what you need to do. git reset HEAD cc.properties etc.
This will unstage the rm operation. After that, running a git status again will tell you that you need to do a git checkout -- cc.properties to get the file back.
Update:
I have this in m...
Resolving a Git conflict with binary files
I've been using Git on Windows (msysgit) to track changes for some design work I've been doing.
12 Answers
...