Repository files navigation
Use the command "git init" in your working directory to set up git in your working directory.
Area where all of your files and directories and changes are living all the time
Files and directories that we explicitly add to the staging area
Where all our snapshots are stored
"git status" lists the files that are tracked and not tracked (green for tracked and red for untracked)
"git add " moves the file from the working directory to the staging area
'git commit -m "Message here"' moves files in the staging area to the git repository
To see a hisotry of commits, use "git log"
git add files of a certain type
To add only html files, use the command "git add *.html" but don't include the backslash. This is called a wildcard.
To add all files to the staging area, use the command "git add ."
To add all files and folders to the staging area, use the command "git add -A"git
To remove files from the staging area, use the command "git reset HEAD "
Any files listed in the .gitignore will be ignored by git.
Rename a file with "rm "
To list all the branches in the git repository, use the command "git branch"
To create a new branch and switch to it, use the command "git checkout -b <branch_name>"
To switch to a branch, use the command "git checkout <branch_name>"
If we like the new features in our new branch and want to merge it with our master branch:
Switch to the master branch with "git checkout master"
Merge the new branch with the master branch with 'git merge <new_branch_name> -m ""'
Recommended not to delete branches. They don't take up much space and you might need them later on.
To remove a branch, use the command "git branch -d <branch_name>"
About
This is a repository I used to practice git. The notes are in the README.md file.
Resources
Stars
Watchers
Forks
You can’t perform that action at this time.