Answer:
Sometimes, when you've removed files without using the git rm and git will warn you the message "Changed but not updated.."
To fix this, you can use the command
# git ls-files --deleted -z | xargs -0 git rm
Linux Ask! is a Q & A web site specific for Linux related questions. Questions are collected, answered and audited by experienced Linux users.
Answer:
Sometimes, when you've removed files without using the git rm and git will warn you the message "Changed but not updated.."
To fix this, you can use the command
# git ls-files --deleted -z | xargs -0 git rm
Show changed files in git log
Answer:
"git log" will not show the changed file in the output, to show it, use
# git log --stat
How to push all local git branches to remote
Answer:
Just remember one command:
# git push --all origin
Rewriting last Git commit
Answer:
Sometimes, when you regret your last commit and before it is pushed to remote, it is easy with the following commands:
git add file1.txt file2.txt
git commit -m 'Add some files'
# Now you regret to include file2.txt
git rm file2.txt
git commit --amend # Edit the commit message in the editor
How to merge a specific file from another branch in Git
Answer:
You have two branches, develop and master. The develop branch contains a lot of commits but you only want to merge a particular commit (of two files), what would you do?
You can use git cherry-pick but the easiest way to do and most people need is the following:
# git checkout master
# git checkout develop /path/to/file1
# git checkout develop /path/to/file2
..
git commit -m 'Merge changes from develop for file1 and file2'