commit

How to make a git rebase and keep the commit timestamp?

旧城冷巷雨未停 提交于 2019-12-31 17:23:57
问题 I want to make a rebase to remove a certain commit from my history. I know how to do that. However if I do it, the commit timestamp is set to the moment I completed the rebase. I want the commits to keep the timestamp. I saw the last answer here: https://stackoverflow.com/a/19522951/3995351 , however it didn't work. The last important command just showed a new line with > So I am opening a new question. 回答1: The setup Let's say this is the history around the commit you want to remove ... o -

GitHub - How to revert changes to previous state

我的梦境 提交于 2019-12-31 08:05:43
问题 I am using GitHub as my remote repository. I have already pushed 5 commits to the server and want to revert back to the state before the those commits. If the commit hash is 3425661dba2aadccdbab , how do I revert the entire local/remote back to that commit? I tried $ reset --hard 3425661dba2aadccdbab but that only resetted my working head to that branch and requires me to do a git pull again. I tried checkout, but this caused me to land in a "detached head" branch. 回答1: You basically have two

i cloned a git repo and see strange texts in files. HEAD <<< and >>>>>

点点圈 提交于 2019-12-30 10:33:18
问题 For example i see code <<<<<<< HEAD public function login() { if($this->_identity===null) { $this->_identity=new UserIdentity($this->username,$this->password); $this->_identity->authenticate(); } if($this->_identity->errorCode===UserIdentity::ERROR_NONE) { ======= /** * Logs in the user using the given username and password in the model. * @return boolean whether login is successful */ public function login() { if($this->_identity===null) { $this->_identity=new UserIdentity($this->username,

Git commit count a day

梦想的初衷 提交于 2019-12-30 08:15:30
问题 I have a branch called development . Now I want to know how many commits are happened per day (i.e) each day. I want Toal number of commits (i.e) count of commits in a day. I tried this command, but it is giving all commits count from the branch git shortlog -s -n My question is count number of commits in a day 回答1: This answers the "per day" side of the identity-crisis question you asked, which can't seem to decide whether it wants "per/each day" implying multiple or just "a day" implying

Git number of commits per author on all branches

妖精的绣舞 提交于 2019-12-29 10:12:16
问题 I'd like to get the number of commits per author on all branches. I see that git shortlog -s -n Prints a very nice list but it is not counting the commits that are not yet merged from other branches. If iterate this command over every branch then obviously the common commits get counted multiple times. Could you give me a script/command that would yield me the overall picture? 回答1: git shortlog -s -n --all --no-merges Will give you statistics for all branches. EDIT : Added --no-merges to

Git number of commits per author on all branches

不打扰是莪最后的温柔 提交于 2019-12-29 10:10:07
问题 I'd like to get the number of commits per author on all branches. I see that git shortlog -s -n Prints a very nice list but it is not counting the commits that are not yet merged from other branches. If iterate this command over every branch then obviously the common commits get counted multiple times. Could you give me a script/command that would yield me the overall picture? 回答1: git shortlog -s -n --all --no-merges Will give you statistics for all branches. EDIT : Added --no-merges to

How can I prevent Subversion commits without comments?

前提是你 提交于 2019-12-28 04:51:06
问题 Does anybody know how to prevent commits to a Subversion code repository when there is no commit comment entered? 回答1: You can use a hook (put it into <repository>/hooks and name it pre-commit.bat (Windows)): @echo off :: :: Stops commits that have empty log messages. :: setlocal rem Subversion sends through the path to the repository and transaction id set REPOS=%1 set TXN=%2 rem check for an empty log message svnlook log %REPOS% -t %TXN% | findstr . > nul if %errorlevel% gtr 0 (goto err)

Reference Git branch start commit

柔情痞子 提交于 2019-12-28 04:03:15
问题 I am trying to find how to reference branch start commit from script. I mean the commit sha at which branch was forked. Moreover I expect it work for history made from svn repo. This post just gives first commit of repo creation and not feature branch start commit. 回答1: What you're looking for is the command merge-base : git merge-base master feature-branch will print the best common ancestor of those two branches, i.e. where they forked apart. (The documentation has pretty pretty pictures to

How to get only unique commits in git

谁说我不能喝 提交于 2019-12-25 18:51:55
问题 I want to get list of unique commits in all branches, but if somebody is using rebase in branch commits loose parents. How to solve this problem? How to get list of commits that made unique changes? 回答1: I use git log --oneline --graph --cherry-pick --left-right The operative verb you are looking for is --cherry-pick: --cherry-pick Omit any commit that introduces the same change as another commit on the "other side" when the set of commits are limited with symmetric difference. For example,

How do you merge two Git repositories when one is a subdirectory of the other without losing commit history?

拟墨画扇 提交于 2019-12-25 08:59:38
问题 Current folder structure /root: server code exists here /root/client: client code exists here (a subdirectory within the server's directory). Current git tracking 1 repo tracking Server code in /root that gitignores the entire client directory 1 repo tracking Client code only within /root/client. The Problem I am trying to merge these two repos while keeping one as the subdirectory of the other , combining the historical commits of both (not losing any). Findings So Far I have found a lot of