How to stage and commit files using Git GUI

Home > Search > How-to
  by

By default, git will not track files. You need to tell git which files you want to track. Create a file named example.txt, and add Hello World to the file.

 

Select Rescan, and example.txt will be displayed under Unstaged Changes.

 


Stage

Select Stage Changed to stage a file for commitment. In this example, the example.txt file is now staged.

 


Commit

Enter a Commit Message and select Commit to commit a file. In this example, example.txt is committed.

 


Changes

Let's make a change to example.txt. The text How are you today is added to example.txt.

 

When a change is made to a staged or commited file, select Rescan, and the changes will be displayed. In this example, +How are you today? is displayed. The file can now be staged and committed again.

 


Working with numerous files

Let's say you have numerous files that you want to stage and commit. There will typically be some files you do not want to stage and commit. To exclude files, create the .gitignore file.

$ touch .gitignore

 

Let's say you do not want to stage and commit files ending in .log. Add the following to the .gitignore file. You will probably want to stage and commit the .gitignore file.

*.log

 

Directories can be ignore by entering the directory name followed by a forward slash.

directoryname/

 



Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.




Please enter in the box below so that we can be sure you are a human.




Comments