L
L
loxnemamont2016-10-19 01:59:41
git
loxnemamont, 2016-10-19 01:59:41

How to commit to github only those files that I changed?

Good afternoon! I am doing a test task for the position of a PHP programmer-trainee, it is necessary to make some changes and improvements on the trial version of 1C-Bitrix, Business edition and, I quote "Commit the result of the work to github (only those files that you changed)". I can't figure out how to implement this?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Alexey Ukolov, 2016-10-19
@loxnemamont

Other answerers were confused by the words about "commit only changed files". The fact is that it is basically impossible to commit unmodified files in the git. You can only break a bunch of changed files into several commits, if you wish. Therefore, the question seems stupid and you are sent to read the git documentation.
In fact, the wording should be: "push to Github only those files that you changed."
The problem is solved something like this:
You now have a commit that shows all of your work.
Further actions depend on the preferences of the task manager:
6A . You can just push everything to Github and give a link to your commit - there the reviewer will see everything that is needed and only that.
6B . If the repository should contain only changed files and nothing else at all, then simply create a new empty repository and manually copy the necessary files into it, guided by the git log. And then push it to Github.

A
Alexander Zelenin, 2016-10-19
@zelenin

git status will show all changed files
by git add . add all newly created files to the tracked files
git commit commit all changed tracked files

D
Dark_Scorpion, 2016-10-19
@Dark_Scorpion

Commit only changed files.
git commit -a
Example:
git commit -am "commit only changed files"

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question