Git Blogs

Git/DevOps

Rebase

Rebase deletes all commit history for the new feature branch.Rebasing makes the branching history cleaner and with more linear commits repo structure

How to push some changes to remote branch

git checkout -b [branchname]
git push -u origin [branchname]

Commit without any commit message

git commit -am ''
you will see that it fails because an empty commit message is not allowed. Newer versions of git have the --allow-empty-message commandline argument, including the version of git included with the latest version of Xcode. This will let you use this command to make a commit with an empty message:
git commit -a --allow-empty-message -m ' '
Or git commit -am'.'
or shorter:
git commit -am.
This adds a commit with the message .

fast-forward merge


A fast-forward merge can never have a merge conflict because Git won't apply a fast-forward merge if the tip of the target branch has diverged from the source branch.
git merge master (by default treated as fast forward )
A fast forward merge is when we merge a branch that is ahead of our checked out branch.
Fast forward merge creates a linear history after the merge eliminating all the branching scenarios. All the commits of master & feature branch will synchronised into 1. Both master & feature will show the common branch history all the way through..
option --no-ff (i.e. true merge) creates a new commit with multiple parents, and provides a better history tracking.
Otherwise, --ff (i.e. fast-forward merge) is by default.
If we want to reuse the commits of feature branch than good to use --no-ff flag otherwise can work with default fast forward option when changes from feature branch r merged to master and feature branch commits r of no further use.

no-fast-forward

The no-fast-forward merge is also known as a three-way merge or true merge. git merge master --no-ff (no fast forward)
option --no-ff (i.e. true merge) creates a new commit with multiple parents, and provides a better history tracking.
Otherwise, --ff (i.e. fast-forward merge) is by default.
If we want to reuse the commits of feature branch than good to use --no-ff flag

reflog

Once we did git reset --hard all our latest changes removed permanently but after using this command their is still a way to regain those changes by using ->
git reflog
git checkout -b "any new branch name" "sha of the commit we destroyed"
So, we have now resurrected that commit.commits actually don't get destroyed for some 90 days.so, we can undo any commit changes we have removed

git push origin master -- force

When code is not getting pushed to remote branch after using git push origin master or getting message as remote end hung up unexpectedly than use :
git push origin master -- force
If this command don't work than
Use d/f commit than push as :
git commit --amend -m "mssg"
git push


Installing git to local takes larger space than SVN and also SVN repo can handle large binary files but git repo can't.
Using git , the user will have the full version history of the remote repository in their local machine while with SVN only the files the user is working on r kept to the local .
The git changes happen locally so the developer doesn't need to be connected to he internet all the time but with SVN user has to connected to the server to track changes & development work.
____________
BitBucket ,SVN -> Free private repo
TravisCI .

The core difference is GitLab has Continuous Integration/Continuous Delivery (CI/CD) and DevOps workflows built-in. GitHub lets you work with the CI/CD tools of your choice, but you'll need to integrate them yourself. GitHub users typically work with a third-party CI program such as Jenkins, CircleCI, or TravisCI

Putty gives us an interface to connect to linux server.
It is a ssh client used ro make a secure connection with the server .

Sourcetree is a free graphical user interface (GUI) desktop client that simplifies how you interact with Git repositories. Being GUI based , it's easy to visualize ,mange repository which is rather complex incase of command line tool like - git bash.It offers simplified distributed version control
Efficient branching and merging" and "Fast" are the key factors why developers consider Git; whereas "Visual history and branch view", "Beautiful UI" and "Easy repository browsing" are the primary reasons why SourceTree is favored.
Cons of Git
Easy to lose uncommitted work
Cons of source tree
Extremely slowly , fetching data is often slow
Crashes often