git-commit

Completely remove a file from whole git repository

两盒软妹~` 提交于 2019-11-28 15:49:49
问题 Using git for a project, I accidentally added to a commit a big .zip file. I didn't notice until I started uploading it to github. When I noticed, I hit ctrl-c , git remove , git commit and uploaded it again (now with the file untracked). I know that this wasn't the right choice to do, because once I committed the .zip , it stays in the repo until I revert the commit, but sadly I didn't. Now, when someone tries to download from the repo, it takes a lot of time to do it, sometimes yields git

git add . vs git commit -a

喜你入骨 提交于 2019-11-28 15:24:30
What's the difference between: git add . git commit -a Should I be doing both, or is that redundant? git commit -a means almost[*] the same thing as git add -u && git commit . It's not the same as git add . as this would add untracked files that aren't being ignored, git add -u only stages changes (including deletions) to already tracked files. [*] There's a subtle difference if you're not at the root directory of your repository. git add -u stages updates to files in the current directory and below, it's equivalent to git add -u . whereas git commit -a stages and commits changes to all

Differences between Commit, Commit and Push, Commit and Sync

独自空忆成欢 提交于 2019-11-28 15:12:58
I'm using visual studio 2013, and I'm faced with 3 options for when I commit my C# code. I need a necessary explanation of the differences between each of the options regarding what happens to my local repo vs. the GitHub repo. Option 1 says Commit Option 2 says Commit and Push Option 3 says Commit and Sync I don't quite understand the difference between the last 2 options. When should I use Commit and Sync as opposed to Commit and Push? Commit will simply make record of your changes that you have made on your local machine. It will not mark the change in the remote repository. Commit and Push

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

白昼怎懂夜的黑 提交于 2019-11-28 14:55:41
Using WinXP 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 (add ! to override) . nunopolonia Press ESC to make sure you are out of the edit mode and then type: :wq eckes

Reset all changes after last commit in git

折月煮酒 提交于 2019-11-28 14:55:37
How can I undo every change made to my directory after the last commit, including deleting added files, resetting modified files, and adding back deleted files? First reset the changes git reset HEAD --hard then clean out everything untracked. If you want to keep files that are not tracked due to .gitignore , be careful with this command. git clean -fd How can I undo every change made to my directory after the last commit, including deleting added files, resetting modified files, and adding back deleted files? You can undo changes to tracked files with: git reset HEAD --hard You can remove

Pushing empty commits to remote

北城余情 提交于 2019-11-28 14:47:26
问题 I have pushed one commit to remote but now I realized that the commit message is not correct. I would like to change the commit message but AFAIK it is not possible. So i decided to create empty commit with correct message: git commit --allow-empty Are there any disadvantages/consequences of pushing empty commits? Is there any problem I might face in future because of this empty commit?? 回答1: You won't face any terrible consequence, just the history will look kind of confusing. You could

How to review a specific commit on Git

戏子无情 提交于 2019-11-28 10:16:59
I sent a commit (named "A commit") to review (Gerrit) using git review command. Now, I make a new commit (named "B commit") and I want to send it to review as well, but I don't want to re-send the "A commit". There is no dependencies each other. How to send a review to gerrit for a specific commit?. UPDATE : $ git add --all $ git status # On branch delete_role # Changes to be committed: # (use "git reset HEAD <file>..." to unstage) # # modified: path/to/file.ext $ git status # On branch delete_role nothing to commit (working directory clean) $ git branch *delete_role master $ git log --graph -

What does it mean when Git says 'rewrite' or 'rename' in a commit message?

╄→гoц情女王★ 提交于 2019-11-28 09:36:27
Running a git commit leads to the following output: [manu@host] git: git commit -a -m "StreamIt instrumentation" [master 263410f] StreamIt instrumentation 62 files changed, 6117 insertions(+), 5748 deletions(-) rewrite Code/ALCHEMY/streamit-src-2.1.1/src/at/dms/kjc/cluster/ClusterBackend.java (91%) rewrite Code/ALCHEMY/streamit-src-2.1.1/src/at/dms/kjc/cluster/ClusterCodeGenerator.java (95%) rewrite Code/ALCHEMY/streamit-src-2.1.1/src/at/dms/kjc/cluster/code/FlatIRToCluster.java (94%) rewrite Code/ALCHEMY/streamit-src-2.1.1/src/at/dms/kjc/common/ToCCommon.java (92%) rewrite Code/ALCHEMY

Remove empty commits in git

∥☆過路亽.° 提交于 2019-11-28 07:31:34
I just migrated a project from Mercurial to Git. Mercurial adds empty commits when you add tags, so I ended up with empty commits in Git that I would like to remove. How do I remove empty commits (commits that do not have any files in them) from Git? Thanks. One simple (but slow) way to do this is with git filter-branch and --prune-empty . With no other filters, no other commits will be altered, but any empty ones will be discarded (which will cause all subsequent commits to have new parent-IDs and is therefore still "rewrites history": not a big deal if this is your initial import from hg to

git rejected push non-fast-forward

谁说胖子不能爱 提交于 2019-11-28 06:31:08
I am quite new to git, and I had been working on a small side project for the last 2 months and had been pushing stuff onto bitbucket with no problems. A couple of days ago, I zipped my project folder (since I had to reinstall my Linux OS) and now unzipped this after my reinstallation of Linux OS. So, now, I went to my project folder, kept happily working and finally did: git add -A && git commit -m "modified code" && git push origin master ..which is what I usually do.. and I get: To https://johnsproject@bitbucket.org/johnsproject/proj.git ! [rejected] master -> master (non-fast-forward)