commit

How to get (only) author name or email in git given SHA1?

杀马特。学长 韩版系。学妹 提交于 2019-11-30 11:14:48
I would like to check for author's e-mail and name, surname to verify who's pushing to my repo. Is there any way that I can come up with a command in git to show commiter's name/e-mail given only SHA1 of the commit? This is what I came up with but it's far from ideal solution (the first solution is for git hook that's why it's using 2 SHA1s with rev-list . The second one simply uses git show ): git rev-list -n 1 --pretty=short ccd3970..6ddf170 | grep Author | cut -d ' ' -f2- | rev | cut -d ' ' -f2- | rev git show 6ddf170 | grep Author | cut -d ' ' -f2- | rev | cut -d ' ' -f2- | rev Igal S. You

How do I reverse a commit in git?

给你一囗甜甜゛ 提交于 2019-11-30 10:38:14
问题 I'm not really familiar with how git works. I pushed a commit by mistake and want to revert it. I did a git reset --hard HEAD~1 Beware Fellow Googlers: This does not only revert the commit, but discards all file changes! and now the project is reverted on my machine, but not on github. If I try to push this code, I get the error 'Your branch is behind 'origin/master' by 1 commit, and can be fast-forwarded.' How do I remove this commit from github? 回答1: You can do git push --force but be aware

Replay the last N git commits on a different branch

梦想的初衷 提交于 2019-11-30 10:15:32
问题 I accidentally made 10 commits on branch "testing" when I intended to commit them on branch "master". The other commits on the "testing" branch are garbage, so I don't want to merge it with "master". Instead, I just want to replay the last 10 commits on master. 回答1: git checkout master git whatchanged testing git cherry-pick _________ ? 回答2: Rebase should do it. git rebase -p --onto master testing~10 testing This will copy the last ten commits on testing to master and make that the new

PHP & mySQL: Simple code to implement Transaction - Commit & Rollback

北慕城南 提交于 2019-11-30 10:08:45
MY PLATFORM: PHP & mySQL MY SITUATION: I am trying to implement transactions within my code. I tried to follow examples, but it's not much help. I am running 3 queries and I wanted to write a transaction in such a way so that if any of the query(ies) fail, the whole transaction should roll back. I would really appreciate a simple, efficient and non-object oriented PHP code to achieve this goal. Thank you in advance. MY PHP CODE: //db_res calls a custom function that performs a mysql_query on the query $res1 = db_res("SELECT c1, c2 FROM t1 WHERE c5 = 3"); $res2 = db_res("UPDATE t2 SET c1 = 5

Temporarily switch working copy to a specific Git commit

烂漫一生 提交于 2019-11-30 10:03:10
问题 How to switch to specific Git commit without losing all the commits made after it ? I want that local files will be changed, but commits' database will remain intact, only the current position pointer is set to currently selected commit. I want to change files' state to specific commit, run project and, when finished, restore files back to last commit. How to do this without zipping the whole project's folder? 回答1: If you are at a certain branch mybranch , just go ahead and git checkout

Commit behavior and atomicity in python sqlite3 module

拈花ヽ惹草 提交于 2019-11-30 09:44:37
If I want to create a table and insert a new entry in another table, can this be made atomic in the sqlite module? Refering to the docs at http://docs.python.org/2/library/sqlite3.html : By default, the sqlite3 module opens transactions implicitly before a Data Modification Language (DML) statement (i.e. INSERT/UPDATE/DELETE/REPLACE), and commits transactions implicitly before a non-DML, non-query statement (i. e. anything other than SELECT or the aforementioned). So if you are within a transaction and issue a command like CREATE TABLE ..., VACUUM, PRAGMA, the sqlite3 module will commit

Atomically set SERIAL value when committing transaction

回眸只為那壹抹淺笑 提交于 2019-11-30 09:13:08
Say I have a table where I want to use a serial as primary key to ask for changes from the client. The client will ask "give me the changes after key X". Without using SERIALIZABLE isolation level or locking, this is prone to race conditions. Transaction A can start first, and do its writes, then take a long time to commit. Meanwhile transaction B will start and commit, before A commits. The write from B will get a higher primary key than the write from A. If a client now asks for changes it will miss the still uncommitted write from A, and note the newest highest primary key. So even after A

How to see what has been checked into git, but hasn't been committed to svn via dcommit?

青春壹個敷衍的年華 提交于 2019-11-30 08:49:35
I'm using git-svn. How can I get a list of what I've committed into git, but haven't yet committed to the SVN repository since the last git svn dcommit ? That is, how can I verify what is about to be sent if I do a dcommit? The --dry-run option for git svn dcommit is very useful for finding out exactly what will be committed to Subversion. In particular that has the properties that: It doesn't actually commit anything to Subversion It tells you which diffs will be calculated to create new revisions in Subversion It tells you which branch in Subversion you will be committing to - this is

Git Commit Generation Numbers

旧街凉风 提交于 2019-11-30 08:16:36
What are git commit generation numbers ( hacker news link ) and what are their significance? VonC Just to add to siri 's answer , "Commit Generation Numbers" are: explained here : A commit's generation is its height in the history graph, as measured from the farthest root . It is defined as: If the commit has no parents, then its generation is 0. Otherwise, its generation is 1 more than the maximum of its parents generations. an old topic already mentioned at the creation of Git in 2005: Linus Torwald (yester, July 14th): Ok, so I see that the old discussion about generation numbers has

apparently same commits give different sha1, why?

雨燕双飞 提交于 2019-11-30 07:26:05
问题 After re-write of a subtree history from a repository with a script of mine, I compared it with what would do a git filter-branch ... on that same subtree. I see that initial commits have different sha1 although I expected them to be identical (consequence of this is that all commits from both histories have different sha1). Doing a git show --format=raw <commit-sha1> on both commits gives exactly the same output (except for first line, which is commit <commit-sha1> , introducing the result).