Skip to content

tabpole/git-handbook

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 

Repository files navigation

Git Handbook

English     English

Complete Playlist

Topics

  • Repository
    What is a repository?

 

  • Git clone
    Git clone is a command for downloading existing source code from a remote repository (like Github, for example). In other words, Git clone basically makes an identical copy of the latest version of a project in a repository and saves it to your computer.

     git clone <https://name-of-the-repository-link>

   English : GitKraken

  • Git status
    The Git status command gives us all the necessary information about the current branch.

     git clone status

  • Git add
    When we create, modify or delete a file, these changes will happen in our local and won't be included in the next commit (unless we change the configurations). We need to use the git add command to include the changes of a file(s) into our next commit.

     git add .

   Bangli: Anisul Islam

  • Git commit
    This is maybe the most-used command of Git. Once we reach a certain point in development, we want to save our changes (maybe after a specific task or issue).

     git commit -m "write your meaningfull message"

   Bangla: Anisul Islam

  • Git pull
    The git pull command is used to get updates from the remote repo.

     git pull <remote>

   Bangla : Anisul Islam

  • Git push
    After committing your changes, the next thing you want to do is send your changes to the remote server. Git push uploads your commits to the remote repository.

     git push <remote> <branch-name>

   Bangla: Anisum Islam

  • Git revert
    The git revert command is used for undoing changes to a repository's commit history.

     git revert main

  • Git branch
    Branches are highly important in the git world. By using branches, several developers are able to work in parallel on the same project simultaneously.

     git branch <branch-name>

   English : The Net Ninja    Bangali : Anisul Islam

  • Git checkout
    This is also one of the most used Git commands. To work in a branch, first you need to switch to it. We use git checkout mostly for switching from one branch to another. We can also use it for checking out files and commits.

     git checkout <name-of-your-branch>

   English : Becoming a Data Scientist

  • Git merge
    When you've completed development in your branch and everything works fine, the final step is merging the branch with the parent branch (dev or master). This is done with the git merge command.

     git merge <branch-name>

   English : The Net Ninja    Bangali : Anisul Islam

  • Fork
    A fork is a copy of a repository. Forking a repository allows you to freely experiment with changes without affecting the original project.

   English The net Ninja    Bangali Anisul Islam

  • Pull Request
    Pull requests let you tell others about changes you've pushed to a branch in a repository on GitHub. Once a pull request is opened, you can discuss and review the potential changes with collaborators and add follow-up commits before your changes are merged into the base branch.

   English : Simplilearn    Bangali: Anisul Islam

Git Commands

Getting & Creating Projects

Command Description
git init Initialize a local Git repository
git clone ssh://[email protected]/[username]/[repository-name].git Create a local copy of a remote repository

Basic Snapshotting

Command Description
git status Check status
git add [file-name.txt] Add a file to the staging area
git add -A Add all new and changed files to the staging area
git commit -m "[commit message]" Commit changes
git rm -r [file-name.txt] Remove a file (or folder)

Branching & Merging

Command Description
git branch List branches (the asterisk denotes the current branch)
git branch -a List all branches (local and remote)
git branch [branch name] Create a new branch
git branch -d [branch name] Delete a branch
git push origin --delete [branch name] Delete a remote branch
git checkout -b [branch name] Create a new branch and switch to it
git checkout -b [branch name] origin/[branch name] Clone a remote branch and switch to it
git branch -m [old branch name] [new branch name] Rename a local branch
git checkout [branch name] Switch to a branch
git checkout - Switch to the branch last checked out
git checkout -- [file-name.txt] Discard changes to a file
git merge [branch name] Merge a branch into the active branch
git merge [source branch] [target branch] Merge a branch into a target branch
git stash Stash changes in a dirty working directory
git stash clear Remove all stashed entries

Sharing & Updating Projects

Command Description
git push origin [branch name] Push a branch to your remote repository
git push -u origin [branch name] Push changes to remote repository (and remember the branch)
git push Push changes to remote repository (remembered branch)
git push origin --delete [branch name] Delete a remote branch
git pull Update local repository to the newest commit
git pull origin [branch name] Pull changes from remote repository
git remote add origin ssh://[email protected]/[username]/[repository-name].git Add a remote repository
git remote set-url origin ssh://[email protected]/[username]/[repository-name].git Set a repository's origin branch to SSH

Inspection & Comparison

Command Description
git log View changes
git log --summary View changes (detailed)
git log --oneline View changes (briefly)
git diff [source branch] [target branch] Preview changes before merging

References

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •