git-commit

Why does 'git commit' not save my changes?

一曲冷凌霜 提交于 2019-11-27 09:59:57
I did a git commit -m "message" like this: > git commit -m "save arezzo files" # On branch master # Changes not staged for commit: # (use "git add <file>..." to update what will be committed) # (use "git checkout -- <file>..." to discard changes in working directory) # # modified: arezzo.txt # modified: arezzo.jsp # no changes added to commit (use "git add" and/or "git commit -a") But afterwards, when I do git status it shows the same modified files: > git status # On branch master # Changes not staged for commit: # (use "git add <file>..." to update what will be committed) # (use "git

How can I undo a `git commit` locally and on a remote after `git push`

℡╲_俬逩灬. 提交于 2019-11-27 09:57:01
I have performed git commit followed by a git push . How can I revert that change on both local and remote repositories? $ git log commit 364705c23011b0fc6a7ca2d80c86cef4a7c4db7ac8 Author: Michael Silver <Michael Silver@gmail.com> Date: Tue Jun 11 12:24:23 2011 -0700 Alexander Groß git reset --hard HEAD~1 git push -f <remote> <branch> (Example push: git push -f origin bugfix/bug123 ) This will undo the last commit and push the updated history to the remote. You need to pass the -f because you're replacing upstream history in the remote. Generally, make an "inverse" commit, using: git revert

How to fix committing to the wrong Git branch?

一个人想着一个人 提交于 2019-11-27 09:55:41
I just made a perfectly good commit to the wrong branch. How do I undo the last commit in my master branch and then take those same changes and get them into my upgrade branch? If you haven't yet pushed your changes, you can also do a soft reset: git reset --soft HEAD^ This will revert the commit, but put the committed changes back into your index. Assuming the branches are relatively up-to-date with regard to each other, git will let you do a checkout into the other branch, whereupon you can simply commit: git checkout branch git commit The disadvantage is that you need to re-enter your

Is it possible to set a git commit to have a timestamp prior to 1970?

a 夏天 提交于 2019-11-27 09:00:38
Unix timestamps are signed 32 bit integers (64 bit on some systems today, or so I understand). On some software products this allows you to use dates going back as far as 1903 or so. However, when I try the following: git commit -m "this is a test commit" --date="1960-04-07 18:00:00" I receive an "fatal: invalid date format" error. This isn't very practical (I'm not a time-traveler), but I've been wondering about using git for historical purposes. Can this be forced with a git plumbing command? On a related note: does git always use a 32 bit timestamp, or does this depend on the environment it

Vim for Windows - What do I type to save and exit from a file?

大憨熊 提交于 2019-11-27 08:55:42
问题 Using Windows XP I accidentally typed git commit -a instead of git commit -am "My commit message" , and now I'm viewing my CMD prompt filled with the file version of my commit message ("Please enter the commit message for your..."). I've added my message to the top, but now I can't figure out how to save and leave. I tried to press Ctrl + W + Q , but it doesn't do anything, but add ^ where the cursor is. I also tried Esc first, and then Ctrl + W + Q , but it says No write since last change

What is a Git commit ID?

五迷三道 提交于 2019-11-27 08:34:38
How are the Git commit IDs generated to uniquely identify the commits? Example: 521747298a3790fde1710f3aa2d03b55020575aa How does it work? Are they only unique for each project? Or for the Git repositories globally? A Git commit ID is a SHA-1 hash of every important thing about the commit. I'm not going to list them all, but here's the important ones... The content, all of it, not just the diff. Commit date. Committer's name and email address. Log message. The ID of the previous commit(s). Change any of that and the commit ID changes. And yes, the same commit with the same properties will have

git commit --amend in detached HEAD state

喜欢而已 提交于 2019-11-27 06:48:25
问题 I understand that the correct way of amending an old GIT commit is to use rebase --interactive , but just to get clear on the concepts, I would like to understand what happens when I do git checkout <commit> change something in a file add the changed file to the index and then git commit . --amend When I do this, instead of amending the commit, it branches a new commit off of the PARENT of that same commit. Is this just GIT's way of telling me that I cannot amend a commit that already already

Git: what is a dangling commit/blob and where do they come from?

被刻印的时光 ゝ 提交于 2019-11-27 06:25:54
I'm looking for the basic info on dangling commits & blobs. My repo seems fine. But I ran git fsck for the first time to see what it did and I have a long list of 'dangling blobs' and a single 'dangling commit'. What are these things? Where did they come from? Do they indicate anything unusual (good or bad) about the state of my repo? During the course of working with your git repository, you may end up backing out of operations, and making other moves that cause intermediary blobs, and even some things that git does for you to help avoid loss of information. Eventually (conditionally,

Fix GitLab error: “you are not allowed to push code to protected branches on this project”?

青春壹個敷衍的年華 提交于 2019-11-27 05:57:22
I have a problem when I push my codes to git while I have developer access in my project, but everything is okay when I have master access. Where is the problem come from? And how to fix it? Error message: error: You are not allowed to push code to protected branches on this project. ... error: failed to push some refs to ... Hcorg there's no problem - everything works as expected. In GitLab some branches can be protected. By default only Maintainer/Owner users can commit to protected branches (see permissions docs ). master branch is protected by default - it forces developers to issue merge

How do I commit only some files?

此生再无相见时 提交于 2019-11-27 05:50:54
I have two projects. One is the "official" project and the second is a light modification (some files added). I created new branch and I put new files to them. But in during development some files common to both branches is changed. How do I commit only these files? Alex I suppose you want to commit the changes to one branch and then make those changes visible in the other branch. In git you should have no changes on top of HEAD when changing branches. You commit only the changed files by: git commit [some files] Or if you are sure that you have a clean staging area you can git add [some files