git-commit

Git & Intellij, How do I commit only parts of a changed file

对着背影说爱祢 提交于 2019-12-03 04:40:45
问题 I can't seem to commit only a fraction of the changes in a file, it seems to be all of the file or nothing, I'm using Git with Intellij, is it possible? Thanks. 回答1: Not in the IDE. As noted in comments, you can use the command line, but I find it much easier to use a GUI GIT client (I use Tower, but there are many available). 回答2: Update - 2/2018: The first EAP build for 2018.1 has landed and it's HERE! It is implemented as checkboxes for each hunk, so you can selectively check on them

How do I see a commit's path through git history, or “how it got in the current branch”?

喜欢而已 提交于 2019-12-03 03:52:19
I'm looking in the commit history using gitk and git log and I'm trying to see how a specific commit arrived in a certain branch. I can see the commits in the history, so I know they are there. What I want to understand is how they got merged (they were supposed to remain on their own branch). This is a very large project and there are hundreds of commits between the commit in question and the current state of the branch, so I cannot clearly decipher through the limited DAG in gitk , and the commit gets masked in other branches and merges and commit messages. To do this, I have been trying:

Git - Can we recover deleted commits? [duplicate]

ⅰ亾dé卋堺 提交于 2019-12-03 02:57:25
问题 This question already has answers here : How can I recover a lost commit in Git? (3 answers) Closed 3 years ago . I am surprised, I couldn't find the answer to this on SO. Can we recover/restore deleted commits in git? For example, this is what I did: # Remove the last commit from my local branch $ git reset --hard HEAD~1 # Force push the delete $ git push --force Now, is there a way to get back the commit which was deleted? Does git record(log) the delete internally? 回答1: To get back to that

List files modified for particular git commit [duplicate]

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-03 02:10:33
问题 This question already has answers here : How to get a list of all files that changed between two Git commits? (8 answers) Closed 5 years ago . I have commit, abc , and I want to list files that were modified for the commit. What is the git command which will list modified files for that commit? 回答1: For filenames only: git show --name-only abc To see a summary of what happened to them: git show --name-status abc 回答2: You can see the files changed in a particular commit as follows git show -

Track file inside ignored directory

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-03 01:19:34
Some time ago I set up my .gitignore file to not track a folder my_folder with: my_folder/ Now I want to track only a given file inside said folder, named my_file.md . After making .gitignore look like this: my_folder/ !my_folder/my_file.md and checking: git status the file does not appear as a change to be committed. What am I doing wrong? Add I tried changing my .gitignore file to: my_folder/* !my_folder/my_file.md as advised but the file is still not showing up as a change to commit after a git status . Do I need to reset something? Add 2 Attempting to add the file with git add my_folder/my

How to undo the last commit in git [duplicate]

╄→гoц情女王★ 提交于 2019-12-03 00:04:35
问题 This question already has answers here : How do I undo the most recent local commits in Git? (81 answers) Closed 3 years ago . By mistake, I did git add . and git commit in the develop branch. But luckily, I did not do git push . So I wanted to revert it back to original state. I tried git reset --soft and git reset HEAD --hard but looks like I have messed it up. How do I fix this? I want to go back to original state and possibly keep the code changes. 回答1: I think you haven't messed up yet.

How do I get last commit date from git repository?

随声附和 提交于 2019-12-02 21:45:57
I need the last commit date in git. This means the latest update date in my program. I used the command : $ git log -1 but this command will give me the date from the local repository. Rather I need date from remote repository. I tried some commands as follow. git log -n 1 origin/Sprint-6. git rev-parse --verify HEAD love The following command will be helpful: git log -1 --format=%cd This will print the latest change date for one file. The -1 shows one log entry (the most recent), and --format=%cd shows the commit date. See the documentation for git-log for a full description of the options.

fatal: No existing author found with 'XXX'

心已入冬 提交于 2019-12-02 21:41:52
I used git for the first time and I set my user name and user mail. The commands I used are below: git config --global user.email "bob@example.com" git config user.email "bob@example.com" git config --global user.name "bob" git config user.name "bob" When I run git commit --author "bob" , I got an error fatal: No existing author found with 'bob' . How can I set user name and email? meagar You should stop using --author each time you commit, and instead configure an author with git config . Once you've done so, you can type git commit and the author will be pulled from your .gitconfig file. If

How can I fix git commit error “Waiting for your editor to close the file…” with VS Code?

巧了我就是萌 提交于 2019-12-02 19:15:02
I'm trying just git commit and Git is giving this message: hint: Waiting for your editor to close the file... /c/Users/AGT/AppData/Local/Programs/Microsoft VS Code/bin/code: line 28: /Code.exe: No such file or directory error: There was a problem with the editor 'code --wait'. Please supply the message using either -m or -F option. I'm using, or trying it, VS Code as default and I got this same message with it opened or closed. Commits done through VS Code or by command git commit -m "Initial commit" works fine. I tried change config path with: git config --global core.editor "code --wait" git

Can I use a scripted commit template for git?

非 Y 不嫁゛ 提交于 2019-12-02 17:05:26
We are working on tickets, and when we use the ticket number in the git commit message on the first line, then the ticket is updated with the commit message. To make things simple we always work on a branch with the commit number. Now I'd like to be presented with a commit message where the ticket number would already be filled in. It must be possible, because the branch is already in the commit template, but in comments which are removed by git. I have scoured the docs and the 'net a couple of times, but I must be looking for the wrong words, because I cannot find it. Can anyone help? Walter