I check out a branch locally and worked with 2 files, say, their names are A.java
and B.java
. Then, I add and commit to the commands i.e. git add .
, git commit -m "some msg"
. Eventually, I push them into the remote branch with command git push -u origin {branch_name}
.
It creates an embarrassing situation where few maven and IDEA
files pushed in the remote. Even, now when I execute the command git status
, I get the following output:
chak@debian8:~/Projects/draglet-backend$ git status
On branch FNB-90
Your branch is up-to-date with 'origin/FNB-90'.
Untracked files:
(use "git add <file>..." to include in what will be committed)
.idea/
draglet-backend.iml
draglet-balser/draglet-balser.iml
draglet-common/draglet-common.iml
draglet-engine/draglet-engine.iml
draglet-mapu/draglet-mapu.iml
draglet-meba/draglet-meba.iml
draglet-remote/draglet-remote.iml
draglet-shaba/draglet-shaba.iml
nothing added to commit but untracked files present (use "git add" to track)
I have few questions in the scenarios to work in the future:
What are the Untracked files here and how are they created? I only write some Java in the project.
How do I set 'git' properly to ignore the maven and idea files like them in the future? I will most likely make changes in the
.java
and the.yml
files.How do I only add and commit the files that I have worked until the previous commit and also is it possible to partially commit only the lines of code I have written? I know its possible to add the files separately with the command
git add [full_path_to_A.java] [full_path_to_B.java]
. However, the full paths are super big and there might be a better way to deal with this.