[1] Getting & Creating Projects:
1. git init
Description: Initialize a local Git repository)
2. git add [file-name]
Description: Add a file to the staging area
3. git add -A
4. git commit -m "[commit message]"
5. git rm -r [file-name]
2. git branch -a
Description: List all branches (local and remote)
3. git branch [branch name]
Description: Create a new branch
4. git branch -d [branch name]
Description: Delete a branch
5. git push origin --delete [branch name]
Description: Delete a remote branch
6. git checkout -b [branch name]
Description: Create a new branch and switch to it
7. git checkout -b [branch name] origin/[branch name]
Description: Clone a remote branch and switch to it
8. git checkout [branch name]
Description: Switch to a branch
9. git checkout
Description: Switch to the branch last checked out
10. git checkout -- [file-name]
Description: Discard changes to a file
11. git merge [branch name]
Description: Merge a branch into the active branch
12. git merge [source branch] [target branch]
Description: Merge a branch into a target branch
13. git stash
Description: Stash changes in a dirty working directory
14. git stash clear
Description: Remove all stashed entries
2. git push -u origin [branch name]
Description: Push changes to the remote repository (and remember
the branch)
3. git push
Description: Push changes to the remote repository (remembered
branch)
4. git push origin --delete [branch name]
Description: Delete a remote branch
5. git pull
Description: Update local repository to the newest commit
6. git pull origin [branch name]
Description: Pull changes from remote repository
7. git remote add origin ssh://git@github.com/[username]/[repository-name].git
Description: Add a remote repository
8. git remote set-url origin ssh://git@github.com/[username]/[repository-name].git
Description: Set a repository's origin branch to SSH
2. git log –summary
3. git diff [source branch] [target branch]
Description: Initialize a local Git repository)
2. git clone ssh://git@github.com/[username]/[repository-name].git
Description: This creates a local copy of a remote repository.
[2] Basic Snapshotting:
1. git status
Description: Check the status
2. git add [file-name]
Description: Add a file to the staging area
3. git add -A
Description: Add all new and changed files to the staging
area
4. git commit -m "[commit message]"
Description: Commit changes
5. git rm -r [file-name]
Description: Remove a file (or folder)
[3] Branching & Merging:
1. git branch
Description: List branches (the asterisk denotes the current
branch)
2. git branch -a
3. git branch [branch name]
4. git branch -d [branch name]
5. git push origin --delete [branch name]
6. git checkout -b [branch name]
7. git checkout -b [branch name] origin/[branch name]
8. git checkout [branch name]
9. git checkout
10. git checkout -- [file-name]
11. git merge [branch name]
12. git merge [source branch] [target branch]
13. git stash
14. git stash clear
[4] Sharing & Updating Projects:
1. git push origin [branch name]
Description: Push a branch to your remote repository
2. git push -u origin [branch name]
3. git push
4. git push origin --delete [branch name]
5. git pull
6. git pull origin [branch name]
7. git remote add origin ssh://git@github.com/[username]/[repository-name].git
8. git remote set-url origin ssh://git@github.com/[username]/[repository-name].git
[5] Inspection & Comparison:
1. git log
Description: View changes
2. git log –summary
Description: View changes (detailed)
3. git diff [source branch] [target branch]
Description: Preview changes before merging
No comments:
Post a Comment