Changes in Git

Go up 🠥
If you have done some changes to one file or many different files you need to add it to the remote repository on Github. To do that you need to first check what changes you made and if you want to keep every single change or just want to keep one specific change.
There are different kind of states that a file can be in throughout your workflow.
Untracked

New files not yet tracked by Git

Modified

Files that have been changed

Staged

Changes ready to be commited

Commited

Changes saved to local repository

Git changes guide - step-by-step:

1. Review changes that you made

2. Add the changed files that you want with

git add filename

or if you want to add all the changed files

git add .

3. Commit the changes with

git commit -m "message"

4. Push the changes to the remote repository with

git push origin "branchName"

Git commands

git status Check status of your files

Shows modified, staged, and untracked files

git checkout "branchName" Change to another branch to maybe pull changes from that branch

Changes branch from the current one to the one you choose

git add . Stage all changes

Adds all modified and new files

git add "filename" Stage a specific file

Adds a specific file to the staging area

git commit -m "message" Commit staged changes

Creates a new commit with a message

git push origin "branchName" Push commits to remote

Uploads commits to GitHub

git checkout -- filename removes all changes made in that specific file that is not commited

brings the file to version of last commit (HEAD) of the file

git reset HEAD filename Unstage a file

Unstages a file

git commit --amend Modify the last commit

Changes the last commit

git revert "commitName" Safely undo a commit

Reverts a commit in a safeway