You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Remove link to a remote repo: git remote remove [remote_link_name]
Push local files to remote repository: git push origin master (username = XXXXX password=Public access token)
Pushing local changes to remote
Check local changes: git status
Commit changes locally: git commit -am "message"
Push changes to remote: git push origin master
Create a new local branch and push to remote
Create a branch (locally) and switch to it: git checkout -b <>
Push the branch to remote: git push origin <>
Merge code
Switch to the branch where u want to merger: git checkout master [ switch to master where develop branch needs to be merged]
Merge code: git merge develop [merge develop branch into master]
Pull changes from Remote to local
Check local branch and go to branch which is to be synced with Remote:
git pull [remote branch url]
Disassociate project from Git
Go to project directory
del /F /S /Q /A .git
rmdir .git
Generate public access token
Settings > Developer Setting > Personal access tokens > Generate new token
Select all check box
Save the token to use later
Add an existing project in github thru SourceTree
Go to local folder where project code is there
Make it a git project: git init
In source tree
Clone/new > Add Working Copy
Ignore the files that are not to be added in Git
Make initial commit (files will be added in local master)
Git Flow > create local branches (develop and master)
Now local Master & Develop branches should be in synch
Add remote branch
Repository > Repository Settings > Remotes
Remote name : origin
URL/Path:
Push local develop and master branch to remote
Check in github url, these 2 branches should get added
Create a folder
Go to the folder inside which you want to create another folder
Click on New file
On the text field for the file name, first write the folder name you want to create
Then type /. This creates a folder
Finally, give the new file a name (for example, .gitkeep)
Finally, click Commit new file
Merging
Fast-Forward
When you try to merge one commit with a commit that can be reached by following the first commit's history in the same branch, Git simplifies things by moving the pointer forward because there is no divergent work to merge together. This is called "fast-forward"
If we commit issuefix branch into master, Git does a 3-way merge, using 2 snapshots pointed to the branch tips(c4,c5) and common ancestor of both (c2).
Instead of moving the branch pointer forward, Git creates a new snapshot(c6) that results from this 3-way merge and automatically create a new commit that points to it.