git-commit

Why is git revert telling me “bad revision” when I use a commit hash?

倖福魔咒の 提交于 2019-12-05 11:06:08
I am trying to revert to an earlier git commit but get the error "bad revision". Why? Here is a transcript (with author names removed): Ellen@ELLEN-PC /c/Users/Susan Mills/git/hello-github (master) $ git status # On branch master nothing to commit, working directory clean Ellen@ELLEN-PC /c/Users/Susan Mills/git/hello-github (master) $ git log | head commit e3eb30cc7ca6d4cd10de755b63821cad75da1e83 Date: Wed Feb 5 17:54:32 2014 -0800 I changed my greeting. commit 063ac580e28bab524286dac7b0a8f88d9e7d365f Date: Mon Feb 3 07:53:19 2014 -0800 Ellen@ELLEN-PC /c/Users/Susan Mills/git/hello-github

Custom Git Commit Message Template

末鹿安然 提交于 2019-12-05 10:48:35
How do I craft customized commit message template? I would like to have something like: # Short (50 chars or fewer) summary of changes # More detailed explanatory text Add following to your ~/.gitconfig : [commit] template = ~/.git-commit-message Create ~/.git-commit-message file with following content: # Short (50 chars or fewer) summary of changes # More detailed explanatory text Ref. commit.template in http://git-scm.com/docs/git-config 来源: https://stackoverflow.com/questions/31873577/custom-git-commit-message-template

What does “*.jpg binary -delta” do in the .gitattributes file?

自闭症网瘾萝莉.ら 提交于 2019-12-05 05:28:45
问题 This thread is suggesting placing *.jpg binary -delta in the .gitattribute file for repos in git but I am not sure what it does. I cannot find any examples of the '-delta' flag for git. The purpose is to apparently speed up commit or push times for larger files. 回答1: That could be related to: Packing objects delta Delta compression will not be attempted for blobs for paths with the attribute delta set to false. I detail delta storage in "Is the git binary diff algorithm (delta storage)

Git Commit during Git Rebase - what really happens?

旧城冷巷雨未停 提交于 2019-12-05 02:46:03
I'm looking for a good description of what happens if one commits during rebase and how this could be 'reverted' in an easy way. Let's consider a scenario, where a large commit is rebased. During rebase a conflict appears and user begins merging changes. Now, imagine a scenario where you were almost done, but you didn't call git rebase --continue - for whatever reason (be it long weekend or such). The next week you just resumed working, stil during rebase. Finally, you call git commit --amend to append the changes to the last commit and... they end up in the commit you were rebasing into.

Display the Authors and commit message for commits that cause a conflict

给你一囗甜甜゛ 提交于 2019-12-05 01:43:44
I have two long-running branches dev , and a far future release called future . We create fixes for the supported release by branching from the tag that exhibits the bug, fix it, and then open pull-requests to the two branches. If there is a conflict in the 'future' branch, our developers are suppose to create a new branch, resolve the conflicts, and open another PR to future. Unfortunately, our team is large enough that plenty of these second PRs haven't been made. I need to now figure out which exact commits caused conflicts. I can do this manually by running git blame on each conflicted

Getting TravisCI to commit and push a modified file with Tags (releases)

自古美人都是妖i 提交于 2019-12-05 01:14:36
问题 I was helped by Sir Athos (thank you greatly) earlier today on a separate question which helped me greatly. I am now stuck at a point where I want to modify a simple text file and include it in my push. So basically I want to add the modified text file to a commit and push it as a commit with it's build number tag as a release. Hope I am making sense here. My code to do try and do this so far is #!/bin/bash YEAR=$(date +"%Y") MONTH=$(date +"%m") git config --global user.email "${GIT_EMAIL}"

How can I skip commits in git?

僤鯓⒐⒋嵵緔 提交于 2019-12-05 00:16:31
I have some commits that I don't want in my project, but there's a commit based on them which I do want in it. This is my GitHub "Network" graph of the repository (ASCII, as I still cannot post images): []--[]--[_] | | | ------->| ---------->[·]--[·]--[*] (-> means a merge) I want to delete the changes made in the two [·] commits, and base the [*] one on the [_] one above. I've tryed merging and rebasing, but they apply the changes of the unwanted commits. Is it possible? Sorry if I'm not clear, English isn't my mother language. Thanks in advance. I can give you two options: Interactive rebase

Share publically a part of a private repo on Github

和自甴很熟 提交于 2019-12-04 22:57:20
问题 I'm wondering what's the best way to publically share on Github a file that's on a private repo on Github. I would like thet every time a make a push in my private repository automatically the file is updated too. In particular I have a .tex project: I would like to keep secret the tex files but I would like to make available to everyone the pdf file. Note I'm aware of the existence of the gitignore option, but I don't want to use it since I want to keep track of the improvements on the tex

How to save changes when in detached-head state?

喜夏-厌秋 提交于 2019-12-04 18:37:13
问题 Working with Git, I had to go back to a specific commit. I made some changes and I now want to commit them. What is a proper way of doing this? My project is now in detached-HEAD state. Will my changes be saved if I make a commit with git commit ? Otherwise, what should I do to not lose my changes? 回答1: Disclaimer: git isn't complicated, it's just versatile. Don't be scared off just because I've rambled into a long answer :) You had: master: a-b-c-d-e-f and wanted to change c . You did: * git

Delete and completely remove the commit from git history

感情迁移 提交于 2019-12-04 11:56:16
I have a commits in my git history 1.commit 4930da17d8dd23d650ed38435d8b421816a0c451 Date: Sat Dec 5 14:34:18 2015 +0530 2.commit e1ebbbb599ee20ebec3ca92c26266d9fd16e7ccc Date: Sat Dec 5 13:22:20 2015 +0530 3.commit 1c4a11a80eb054d24dafec2efed0b0282188e687 Date: Sat Dec 5 12:11:50 2015 +0530 4.commit b4ab3c164a3a8d93e0a71a94b5c561cb5e20ebf6 Date: Sat Dec 5 12:09:56 2015 +0530 5.commit 167b1d10258381f09663ce61fa88ce3bbcd404c4 Date: Sat Dec 5 12:09:21 2015 +0530 6.commit c61bcadac673e1c83f4c14b66d56e23b12fa3198 Date: Sat Dec 5 12:07:58 2015 +0530 In that 3rd and 4th commit contains a wrong code,