How To Use Git Gui
Getting started with git gui on Windows¶
Install git for Windows¶
-
Become a copy of the msysgit
.exe
installer -
Double click to install git on your motorcar
-
Accept all the defaults
A pretend project¶
For simplicity, let the states make a folder for our project in the c:\
bulldoze.
-
Correct click on the
C:\
drive in Windows Explorer, select "New binder", proper namemy_idea
-
Right click in
my_idea
, folder, select New file, of blazon "Text document". Proper name itgood_idea.txt
. -
Open
good_idea.txt
and add some text like "This is my practiced idea", and save.
Putting the projection into version control¶
At present nosotros have a very small projection, just a folder with a unmarried file in it. We'll now put this binder into version control.
Initializing the repository¶
-
Right click in the
my_idea
folder, choose "Git Init Hither" to initialize the git database: -
You lot may notice that in that location is now a subconscious folder chosen
.git
in themy_idea
folder.If you can't see this hidden binder, you lot may need to change the binder viewing options. From Windows XP explorer this is the "Tools" card, and so "Options". You should enable viewing hidden folders in the "View" tab:
Adding stuff to the repository¶
Now we have a git database in our binder, we need to add our file.
-
Correct click in the
my_idea
again, choose "Git Commit Tool" -
You volition get a dialog like this:
Notice that our file is at the acme left, and is "Unstaged". That means that, at the moment, it is not going to be office of any "Commit" we do. A commit is where we record changes into the database. We practise want to record our file, so
-
Either click on the little icon to the left of the
good_idea.txt
filename in the dialog, or get to the "Commit" menu, "Stage to commit" option. Notice thegood_idea.txt
file then goes to the "Staged changes (Will Commit)" department of the dialog. -
Add a message in the lower right box, like
The commencement signs of my thought
. The commit bulletin is a reminder what set of changes the commit has. It'southward very useful to put meaningful messages here for quick reminders of what you intended with the changes. At present click "Commit". Congratulations!
Speak with your own vocalization¶
Each commit has someone who wrote the contents of the commit - the "author". And then y'all can go all the blame, and all the credit, you tin place yourself to git. That way git tin can see who's doing the work (or doing the harm).
-
Right click in "my idea", choose "Git Gui".
-
Click on the "Repository" carte du jour and select "Visualize master's history":
-
Notice that you are 'Author: unknown':
-
Close the history window, correct click and open 'Git Gui' again
-
Get to menu Edit - Options. Prepare your username and and email address in the Right hand panel (global options).
Relieve. Close.
-
Let's show ourselves that I have become myself. Brand a new file
another_idea.txt
. Start "Git Commit Tool" with a right click, stage the file by clicking on the icon next to the filename, add together a message and the click commit. -
Open Git history from the Git Gui, choose the "Repository" menu, "Visualize principal's history". Notice that you lot have two commits now, and the second 1 has your proper noun on it.
Making a backup¶
Now y'all take your changes backed upwardly into your repository, just you volition probably want to back up the repository somewhere.
Let'due south pretend to back the repository up to a shared drive (but in fact nosotros'll back upward to the C:\
drive).
-
Right click in the
my_idea
folder, chose "Git Gui" -
Choose menu "Remote", "Add together":
-
Give a name for your backup (no spaces) and a path to write the backup to. I like to add
.git
to the folder proper noun for the backup, because this will be a fill-in with only the repository (the.git
subfolder, simply non the.txt
files): -
Select "Initialize repository and push", then click "Add together".
-
If y'all become "Success" then your files have been backed up to this other folder.
Working from another motorcar¶
Now yous can piece of work from any computer and send changes dorsum to the backup re-create.
Nosotros tin can pretend to do this by making a new copy every bit if information technology was on (say) your laptop. But in fact we'll create the folder in the C:\
drive over again.
-
Right click on the
C:\
drive, choose 'Git Gui': -
Select "Clone existing repository". For the 'Source location', scan to the fill-in that you just fabricated. Type
C:\laptop_working
for the target directory. Choose "full copy" from the options (for safe). Click on "Clone". -
You now accept a
c:\laptop_working
folder that is a clone of the "my_backup" repository, and that also has the same data as thec:\my_idea
folder. -
Let's make some changes on the laptop. Go to the
c:\laptop_working
folder. Make a new fileidea_on_laptop.txt
and type some text in information technology. Salvage. -
Right click, "Git Commit Tool", stage the
idea_on_laptop.txt
file, add together a commit bulletin and click "Commit".At present you have this contents in your
laptop_working
folder.
You put the changes back into the backup past doing a "Push"
-
Right click in
laptop_working
. "Git Gui", "Remote" carte, "Push …"On the side by side dialog, click "Push".
The changes get back to the
my_backup.git
repository.
Getting changes from a mutual backup¶
Let's pretend that we've gone back to our original computer and we want the changes that nosotros pushed from the laptop.
-
Become back to the
my_idea
folder. Discover you don't have theidea_on_laptop
file nonetheless. -
Right click, "Git Gui", "Remote" card, "Fetch from" from the
my_backup
remote.Now yous have the changes in the repository (the
.git
subdirectory) - but not in the working tree. Specifically, we don't have theidea_on_laptop.txt
file in the folder yet:To get the file, we need to do a merge. This brings the changes from the repository into the working tree. Open the "Git Gui" if it is not open up. Choose the "Merge" menu, "Local Merge" choice.
In the dialog, accept the defaults and click "Merge":
Now you have your file - and you are synchronized with the laptop.
Review¶
-
Code states stored so you tin can
-
Encounter what you've done
-
Go dorsum to an earlier country if you lot make a mistake
-
Send files to and from different computers
-
-
If you are working with someone else they can add their changes
-
Yous tin see what they did, they tin can run into what yous did
-
It'due south easy to undo if one of you makes a error
-
This system is powerful, very useful and sometimes disruptive. Consult an expert if yous become confused. Information technology is fairly difficult to lose information if you ask an skillful after you have made a mistake or got confused.
How To Use Git Gui,
Source: https://matthew-brett.github.io/pydagogue/git_gui_windows.html
Posted by: ratliffpeammeak.blogspot.com
0 Response to "How To Use Git Gui"
Post a Comment