You are on page 1of 1

Setup Making Changes Stash cont'd Synchronization

Configure user email: 1. Lists all files that yet to be committed: 3. Partial stashing one file or set of files: 1. Fetch the complete repository:
git config --global user.email ‘email_id’ git status git stash -p git fetch <repo_url>
2. Add file or files to the staging area: 5. List all stashes: 2. Fetch a specific branch:
Configure user name:
git add <filename, filename2> git stash list git fetch <repo_url> <branch_name>
git config -- user.name ‘name’
3. Add all files to the staging area: 4. Reapply stash without deleting it: 3. Fetch all the branches simultaneously:
git add . git stash apply git fetch -all
Start Project 4. Commit changes (snapshots commits 5. Reapply stash at index 2, then delete it 4. Default git pull is equivalent to git fetch
Initialize current directory (unversioned permanently in the version history) from stash list. Omit stash@{n} to pop the origin HEAD & git merge HEAD where
project) to Git repository: git commit -m ‘commit_msg’ most recent stash: HEAD is ref pointing current branch:
git init 5. Commit all changes (added changes git stash pop stash@{2} git pull
Initialize a new, empty repository: using add & any changes since then): 6. Show diff summary of stash , Pass -p 5. Fetch specified remote’s copy of current
git init <directory> git commit -a -m ‘commit_msg’ flag to see the full diff: branch & merge it into the local copy:
Create a local copy of a remote repository 6. Add all changes & commit: git stash show stash@{1} git pull <remote>
git clone <url> git commit -am ‘commit_msg’ 7. Delete stash at index, Omit stash@{n} 6. Pull changes from a specific branch:
7. Reset changes: to delete last stash made: git pull origin <branch_name>
Branches git reset <filename> git stash drop stash@{1} 7. Fetches the remote content but does
1. List all local branches (asterisk denotes 8. Delete all stashes: not create a new merge commit:
the current branch):
Merge git stash clear git pull --no-commit <remote>
git branch 1. Merge given branch into the current 8. Same as the previous pull but instead of
2. List all branches (local & remote): branch: Log & Comparisons using git merge to integrate the remote
git branch -a git merge <source_branch> branch with the local one, use git rebase:
1. View changes:
3. Create a new local branch: 2. Merge a branch into a target branch: git pull --rebase <remote>
git log
git branch <branch_name> git merge <source_branch> 9. Gives verbose output during a pull
2. View summary of changes: which displays the content being
4. Create a new branch & switch to it: <target_branch> git log --summary
git checkout -b <branch_name> 3. Merge source branch into the current downloaded and the merge details:
3. View changes briefly (one-line):
5. Clone a remote branch & switch to it: branch, but always generates a merge git pull --verbose
git log --oneline 10. Push the specified branch to , along
git checkout -b <branch_name> commit (even if it’s a fast-forward merge): 4. Preview changes before a merge:
origin/<remote_branch_name> git merge --no-ff <source_branch> with all of the necessary commits &
git diff <source_branch>
6. Rename local branch: 4. Merge & squash all commits to one internal objects. This creates a local
<target_branch> branch in the destination repository:
git branch -m <old_name> <new_name> new commit all changes to one commit: 5. Show changes between two commits:
7. Switch to a branch: git merge –squash <source_branch> git push <remote> <branch>
git diff <commit_id1> <commit_id2> 11. Same as the above command, but
git checkout <branch_name>
8. Switch to last checked out branch: force the push even if it results in a non-
Stash Rebase fast-forward merge:
git checkout -
9. Delete a local branch: 1. Stash takes uncommitted changes 1. Rebase(standard mode) will take the git push <remote> --force
git branch -d <branch_name> (staged and unstaged), saves them away commits in current working branch & 11. Push all local branches to remote repo:
10. Delete a remote branch: for later use, and then reverts them from apply them to the head of passed branch: git push <remote> --all
git push origin --delete <branch_name> your working copy. Add -u to include git rebase <base_branch_name> 12. Push all of local tags to remote repo:
untracked files, Add -a to include 2. Rebase(interactive mode) launches a git push <remote> --tags
untracked, ignored files: interactive rebasing session used to clean
Teja Maridu
git stash up history by removing, splitting, and
@tjmr 2. Stash with a comment: altering an existing series of commits: Don’t forget to
git stash save ‘comment’ git rebase -i <base_branch_name> save this for later
Follow for more

You might also like