git-commit

git log show one commit id only

可紊 提交于 2019-11-29 01:23:19
问题 I need some help. It is possible to only show one commit id? Since git log -3 show the log from 1 - 3, I just want to show only 3. What possible command will match for it? I use the command git log -3 --pretty=format:"%h" the result is ffbef87 cf0e073 1c76c5d I only want to display the 1c76c5d only. 回答1: You can use git show referencing the third parent from your current commit (i.e. the second ancestor from HEAD ). Also, git show accepts the same format string as git log : git show HEAD~2 -

Exit Vim without committing changes in Git

最后都变了- 提交于 2019-11-29 00:20:36
问题 When I use git commit --amend or git rebase -i , vim opens up for me to make changes. If I then change my mind and exit vim without making any changes, a commit is still made which shows up in git reflog . How do I exit the editor without committing anything? 回答1: To get git to not make a change when you are executing git commit --amend or git rebase -i . Just delete the message (and save). All git does is look for a non empty message to see if a valid commit happened. Since there is a commit

What flow causes Github commits that are “authored” by one user but “committed” by another?

不想你离开。 提交于 2019-11-28 21:09:32
For example, this commit is claimed to be authored by mattcaswell and committed by richsalz What usage flow could have caused this? Suppose I want a commit which is authored by someone else and committed by me to appear in a repo where I'm a contributor - how would I have that? Git distinguishes between authors and committers (see Difference between author and committer in Git? ). Authors are the people who wrote a specific piece of code - committers are the people who put these changes into the git "history". Normally both are the same (and doesn't change on merging, cloning, pushing or

Git Hub Desktop on Mac, error: cannot run gpg: No such file or directory

半城伤御伤魂 提交于 2019-11-28 19:13:27
Trying to commit my changes by using GitHub Desktop and getting this: error: cannot run gpg: No such file or directory error: could not run gpg. fatal: failed to write commit object (128) Firstly that not worked for terminal too and i create gpg-key and plugged in to my GitHub Account Now it's working well in Terminal but Desktop version still not working. In Oficial doccumentation for GitHub Desktop i found some notation: Note: GitHub Desktop does not support GPG signing. Solved it. So as GitHub Desktop was complaining about not being able to find gpg (I had installed it via homebrew), I

Why am I getting “Commit failed with error: pathspec … did not match any file(s)”?

元气小坏坏 提交于 2019-11-28 18:05:37
I am having some issues with Git. I have a repository where I can commit any file to without problem. However, there is a single file 'Funder.php' which, when I try committing, tells me there is an error as: Commit failed with error: pathspec 'application/libraries/Funder.php' did not match any file(s) known to git. I am quite new to this, so was wondering if anybody could please help? This is the error you get when you attempt to run git commit <file> but <file> hasn't been staged yet; in other words, Git hasn't been told about it, yet. This is most likely what's happening here. Run git add

git status (nothing to commit, working directory clean), however with changes commited

ぃ、小莉子 提交于 2019-11-28 17:57:14
问题 I found many questions with similar subject, but I didn't found any practical guidance about this issue: why git status informs me nothing to commit, working directory clean , even tough I have made a modification at my local branch? Here are the steps which I followed: git init [On branch master - Initial commit, nothing to commit (create/copy files and use "git add" to track)] git remote add https://github.com/username/project.git git pull origin master touch test git add test git commit -m

How to list all my TODO messages in the current git managed code base

匆匆过客 提交于 2019-11-28 17:42:46
问题 I want to see all TODO comments that only I wrote and that exist in the current code base that is git managed. What I've got so far is printing all TODO comments that I've ever created or modified during the complete git history: git log -p --author="My name" -S TODO | grep "\+.*TODO" But this tool chain lists all TODO comments ever written, even those that I've already resolved and thus removed again from code. Is there a tool that can search the current code base line-by-line, check if it

Git prevents pushing after amending a commit

一笑奈何 提交于 2019-11-28 17:23:45
问题 Usually, I just run git add file git commit git push but if I amend the commit before pushing it (with git commit --amend ), the next push fails with hint: Updates were rejected because the tip of your current branch is behind hint: its remote counterpart. Integrate the remote changes (e.g. hint: 'git pull ...') before pushing again. hint: See the 'Note about fast-forwards' in 'git push --help' for details. How can I let git push the changes without merging branches? I only have one branch (

How to get the last commit ID of a remote repo using curl-like command?

主宰稳场 提交于 2019-11-28 17:11:23
I want to get the last commit ID of the remote git repo. The command git rev-parse HEAD works for a locally-cloned git repo, but I want to get it from the original GIT repo by a CURL command or so. Eg: I want to get the last commit ID of the git URL https://git.appfactorypreview.wso2.com/history/apiapp.git/ . How? try this command git log --format="%H" -n 1 I think what you want is this: git ls-remote $URL HEAD If HEAD doesn't exist in the remote repository, then you likely want: git ls-remote $URL refs/heads/master Note that in the first instance, HEAD is going to point to the default branch

How do I reword the very first git commit message?

大城市里の小女人 提交于 2019-11-28 16:27:06
I have a working tree containing 3 commmits: ➜ ~myproject git:(master) git log commit a99cce8240495de29254b5df8745e41815db5a75 Author: My Name <my@mail.com> Date: Thu Aug 16 00:59:05 2012 +0200 .gitignore edits commit 5bccda674c7ca51e849741290530a0d48efd69e8 Author: My Name <my@mail.com> Date: Mon Aug 13 01:36:39 2012 +0200 Create .gitignore file commit 6707a66191c84ec6fbf148f8f1c3e8ac83453ae3 Author: My Name <my@mail.com> Date: Mon Aug 13 01:13:05 2012 +0200 Initial commit (with a misleading message) Now I wish to reword the commit message of my first commit (6707a66) ➜ ~myproject git:(master