When you add a huge amount of files to git, you can't really use Git UI tools, like "Git GUI", because it has 5000 files limits for each commit. Here's the command lines that should be used to initial Git repository and add all files:
Open command line, change current directory to the folder you want to create the repository. Run the following commands:
1) Init local repository
git init
2) Add all files
git add --all
3) Commit local repository
git commit -am <commit message>
4) Create a remote repository in github.com, then link remote repository to local repository
git remote add origin https://github.com/user/repo.git
5) Push local repository to remote repository
git push -u origin master
6) Pull from remote branch
If your local repository version is behind from the version in remote repository, push command will fail. So you need run following command first then push again.
git pull <remote repository url> <branch name>
7) Ignore files
Some files you may not want to checkin to Git, you can add them to an ignore file list.
8) Rename local and remote branches
Checkout local branch:
git checkout <local branch name>
Rename local branch:
git branch -m <new local branch name>
Push change to a new remote branch:
git push origin -u <new remote branch name>
Login to github, confirm new remote branch is created.
Delete old remote branch:
git push origin --delete <old remote branch>
For the best practice, your old local branch and old remote branch should have the same name, the same with your new local branch and new remote branch.
9) Check Status
git status
10) List Local Branches
git branch
11) Create and check out branch
git branch -b new-branch
12) Reset change and remove from history
Get version history
git log --oneline
Reset to a specific version
git reset a17028400
Push reverted version
git push -f
to be safer not to override new change in remote
git push --force-with-lease
13) Reset change
Head: Most recent commit
Index: Files for the next commit
Discard change and go back to an old version
git reset --hard <version>
--soft: uncommit changes, changes are left staged (index not move).
--mixed (default): uncommit + unstage changes (index move), changes are left in working tree.
--hard: uncommit + unstage + delete changes.