Using Github GUI for Mac and git from the terminal - macos

Is there any problem using both the GUI version of Github and the terminal version interchangeably? For instance, If I start a coding session using the GUI, then need to do something that I only know how to do from the command line. Then switch back to the GUI.
Are there any issues with that?

Both the GUI version and the command line (terminal) version can be used interchangeably. I use both myself on a Mac and haven't encountered any issues thus far.

There is nothing wrong with this, I do it all the time. The GUI is nice because it allows you to see all the newest changes very easily and well as do quick commit + sync. But I use the terminal for finer control like forcing a branch checkout
git checkout -b newBranch
I also switch to the terminal when I want to stash changes I have made and am not ready to commit so I can go to an older branch to fix something that is needed immediately (stashing stack is awesome!)
So yea, there is nothing wrong with this approach at all. Sounds like you know what you are doing, the terminal just give you finer control.

Related

Undoing a single-file Git Checkout

So, I am working on a project with XCode. Happily, I found out that it keeps an Git repository within every project. So, after a mistake on a code, i just used
git checkout aux.c
to move back from theses mistakes. Unfortunately, as i just found out, Xcode does not auto-commit, so, I ended up with a blank file.
I didn't commited anything after this, but still can't figure out how to undo this checkout.
Sorry, you can't. :-( You're going to have to replace the file some other way.
There are two places where git tracks your files - commits, and the index/staging area. Since there was no commit, and you checked the version of the file out of the staging area, there's no other place it would be.
Do run git status just in case, to make sure it doesn't still show staged changes to that file.
Any chance you had it open in an editor still and could undo the changes to the file that git checkout made? Some editors like Textmate and SublimeText will allow that; others don't.
If the file has never been committed to the repository then unfortunately you are out of luck.
From the sounds of it, you simply have an empty git repository, which will mean your file has been lost and something Versions (which comes with Lion) or Time Machine may be your best bet at recovering from your mistake.
To confirm if anything has been committed to the repository, use git log. If you get an empty response then you're out of luck on the git front.
Unfortunately, this probably this isn't the answer you were looking for.
In fact, undoing a first commit on git is impossible. So, if you are running Xcode, commit manually frequently.
But, there is another way.
If you are running OS X 10.7 Lion or latter (not sure about Snow Leopard), you can try to use the versions feature from OS X to recover any file. Too late for me, but it should work
Best way to recover if your uncommitted changes would be to go to (Left Pane) Source Control Navigator -> Stashed Changes -> Look for a file which dated/timed earlier than your commit which you would like to reverse and click to apply stash changes to the file. That would bring back all the unsaved files back.

Git Extensions usable with SVN repos?

Can Git Extensions be used without issues (or at least, with very few ones) as a SVN client? I've no problem using the command-line git-svn, but in some cases (picking lines/hunks to commit, for example) I'd rather use a GUI client.
If there are issues, I'd like to see them along with your workarounds/solutions.
As a way of an updated answer (I think this question was asked in 2011), I just started using Git Extensions for a project that uses Subversion as the repo, but I wanted to use Git locally. Learning my way into it, Git Extensions has GUI based actions for commands like SVN Fetch, SVN Rebase, and SVN Dcommit.
So, if (and I don't know because I wasn't using it in 2011) Git Extensions didn't support Subversion repos in 2011, it looks like they have that support now.
Here is an example (see red highlights at bottom):
So, to better answer your question, yes it does have support as an SVN/Git client.
git-svn creates a repository that behaves as a regular Git repository unless you are doing one of it's special operations (dcommit etc.). Thus, it is perfectly fine to interact with that repository via any external Git client as long as you use it to do things you'd normally be able to do from the command line without screwing up git-svn. (E.g. you wouldn't want to try to rebase upstream commits, GUI or not.)
(You will, of course, still have to use the command line for the special git-svn commands, unless you find a GUI that supports them.)
As alluded to by #matth, SVN support was removed from Git Extensions v3.00. However, there is a plugin (mast-eu/GitExtensions.SVN) you can install to add basic git svn commands to Git Extensions. To install it, open Plugins > Plugin Manager and browse for "gitextensions.svn".
Once installed, SVN commands are added to menu bar.
Picture of menu bar with commands

Xcode 4 and version control - But which one?

I have a question, the answer isn't really hard technically, but I am more looking for the experience of most advanced programmers here.
So like many noobs, I am doing my version control in the crappiest way, which is to copy paste my project directory and rename it with the current date/time.
You will agree that it's a quite limited solution :P
I decided to learn version control system(s), but I am facing many choice, and I would like to know what are the best for your points of view ?
Using Xcode integrated version control (git or anything else), with organizer, cloning, commits from xcode etc. I mean totally or almost controlled by Xcode ?
Ignoring Xcode letting him think there no version control and doing it myself in command line ?
A merge of the two above ? How ?
And then :
Using git ? Github is very popular and powerful, but you must learn git, and learn it hard.
Mercurial ? It seems more friendly.
Something else ?
It would be priceless to have some feedbacks about more experienced people, so that me and many others I hope can choose their paths when facing the VCS wall :-)
Thanks a lot !!!
First: Use a VCS at all.
The rest:
Mercurial is nice, but Apple went with Git for Xcode. So if you want source control integration within the IDE, Git is the best option.
The things I miss most when working with Xcode & Mercurial are the "Modified" indicators in the source list and the integrated diff-viewer. (Which is pretty good in Xcode IMO)
The actions you perform in the Organizer are a bit limited at the moment, but you can always fall back to Terminal.app for that.
I can only recommend git. Merging is easy, I remember the days when a merge conflicts occured with SVN, it was pain, horrible pain to resolve those. You can easily start a local repository with git, especially if you are the only one developer.
Have a look at Which SCM system to use with Xcode 4 for a lone developer?.
I suggest some reading on git for the beginning:
Git in five minutes
Git Community Book
The Thing About Git
Take some time to invest in learning the basics of git, it's absolutely no rocket science to get you started on basic usage and you will benefit from it right away. Once you know the basics of git, you aren't locked into another tool wrapping git, you can use git if there are some problems with XCode. Also, git is available for several OS so the knowledge you gain about git will not go away if you move between different computers that have different OS.
Here are my best of bookmarks for git:
http://www.delicious.com/Ralphtheninja/bestof+git
I've had good success with SubVersion.

Editing remote files over SSH, using TextMate?

I LOVE using TextMate on my MacBook. It's great.
Unfortunately, I want to edit some files directly on my dev server, since it's difficult to recreate the environment locally. I'm using Git, so one alternative is to just edit locally, git commit, git push, and then git merge, but that's kind of complicated every time I want to make a simple change.
I'd rather just ... use another solution. One thing I tried is mounting a hard drive via MacFusion, and then loading that in an editor. But that's so freaking laggy/slow!
Has anyone cooked up a better solution?
OK - here is the one that works on Mountain Lion.
Go to http://osxfuse.github.com/
Install FUSE for OS X
Install SSHFS for OS X
Then the following commands on your terminal:
mkdir /Volumes/SSHFS
/usr/local/bin/sshfs username#host:/path/to/dir /Volumes/SSHFS
Done.
I would also recommend using the ReMate plugin as pointed out by another user to prevent TextMate from beach-balling every time you refocus it. Link:
ReMate http://ciaranwal.sh/remate
I use Fetch and TextMate for just such tasks. Fetch can be set to use TextMate as an external editor and can even automatically open files in TextMate by double clicking.
Saving the window in TextMate automatically pushes the file back to the server. Of course you would have to commit the changes on the server at a later time.
I'm sure most Mac FTP clients could do the same.
The best thing would be using TextMate's rmate script, follow the link and you'll find the instructions bellow, I recommend it since it will make your life easier and handle all the Nitty-Gritty.
I use the free version of TextWrangler for just this and it works great. I can load and save files over sftp.
The correct answer is to use sshfs and make sure "Perform atomic saves" is checked in the Textmate preferences window. The easiest way to setup sshfs is to use Macfusion. http://macfusionapp.org/.
Try one of these methods.
see: http://wiki.macromates.com/Main/FAQ#projects
also have a look at:
http://www.gnu.org/software/tramp/
You don't need to push every time you make simple changes; git is a distributed version control system, you commit to your local repository for the small changes. You should only push to the remote repository once you finished working on a feature/bug (or for really huge feature, a complete subfeature). Well, that's assuming you can recreate the environment; which apparently you can't.
A decent text editor can have integration with your favorite control version system; if you cannot configure your editor to commit and push from inside your editor, get a decent editor.
An even better editor can be set to save, commit, push, compile, and run your program all in one click or keypress.
If you are not able — for whatever reason — to replicate your environment locally and still want to use TextMate, the FTP client+TextMate combo is the best solution I can think of. MacFusion and all the other similar solutions are neat on the paper but awfully slow.
If you feel adventurous and confident enough to drop the TextMate requirement, SSH+Vim in the terminal works amazingly well.
Are you positive you can't replicate at all your remote environment?
I know this question already has several answers, and it's been a while, but I wanted to also point out DokanSSHFS - This will use SSH to make a local drive of the directory location on the server that you choose. Then you can use your editor of choice to edit the files as if they were on a local disk.
Most of the proposed solutions are centered around sshfs in one form or another. I have tried these solutions, but I found that reliability of filesystem is not always as good as desired.
There is tool called rmate, which allows editing of remote files in text mate.
Use command from ssh session to edit file on the server:
rmate file_name
The readme on github provides easy to follow instructions on how to set it up.
MacFusion is pretty sweet for free - basically ssh-mounting of directories.
http://macfusionapp.org/
Transmit 4 has a similar feature, tho it costs $$.
Try http://ciaranwal.sh/remate/ if it seems slow, as that will disable textmate from refreshing the file list so often.
Use Fuse for OS X http://osxfuse.github.com and the companion package, SSHFS (same URL) and install them. I installed the MacFUSE compatibility libraries from there too, just for good measure.
Then, install http://macfusionapp.org and follow the instructions located here ( https://github.com/osxfuse/osxfuse/wiki/SSHFS ) to configure macfusion to use the newer libraries.
I had trouble getting authenticated with password, so I set up ssh key authentication and used macfusion without password. Works like a charm.
If you do use an IDE, you could just set up an SSH tunnel to your dev server and edit your files from the comfort of your favourite IDE. Saving the files locally would automatically then push the files on the dev server as well
P.S: I am NOT endorsing the use of IDE
You need rmate it works fine to edit files on your server via ssh using TextMate on you local machine.
Github link here
rmate might be another choice. On server side, you type rmate /path/to/file. The file will be transferred to local machine, where you use some editor like Sublime Text or VS Code (TexMate may also work). To use it, one needs to install both server and client.
For server side, there are several ones in various languages. Choose one you like. Here is the Github repo.
On local machine, as far as I know, VS Code and Sublime Text have their extensions to receive files. For VS Code, refer to here. For Sublime Text, refer to here.
On the other hand, Microsoft just announced an official remote editing extension for VS Code (not released yet).
For those remote machines not having ruby or if bash not compiled with /dev/tcp, but has python, this works: https://github.com/scriptmaster/rmate-python
If you have pip:
pip install rmate
or simply:
wget https://raw.githubusercontent.com/scriptmaster/rmate-python/master/bin/rmate
chmod +x ./rmate
mv ./rmate /usr/local/bin/rmate
then rmate /path/to/file
especially if you are in a containerd-os with restrictions (with only python and docker) such as kubernetes-vm or gce-vm
you don't need vs-code-server, atom-editor,

Git On Windows Without Cygwin?

Are there any native Git implementations for Windows that do not require Cygwin? I've become a fan of the TortoiseSVN client, and would really like to see a similar Git client for Windows.
Edit: I am also considering Mercurial, but would prefer to check out a few before I make a decision.
There is a TortoiseGit -- Window Explore Extenstion to Operate Git.
I started GitExtensions about a week ago. Allthough version 0.6 is a pretty complete package, I do not consider it release-ready yet. The toolset should be ready for its first stable release in a few days. There are a few things I need to fix before anyone should use it in production. The most important problem now is that the shell extension part is written in c# and therefore can cause problems. I'm rewriting this in c++ at the moment, should just take another few hours. I also want to build in some features that should prevent users from screwing up (like create a stash ontop of another stash and throwing away work or commiting changes when in the middle of a merge). I allready finished allmost all git commands I ever use (push, pull, fetch, stash, branch, commit, merge, format-patch, am, apply, etc), so it should be usable pretty soon. The toolset is written in C# (.Net 3.5 until version 0.6, later versions use .Net 2.0) except the shell extension part. There is also a visual studio plugin, but this is still pretty basic.
I have not tried TortoiseGit yet btw, but I really like TortoiseSVN!
Henk
Take a look at MSysGit. However this is just the command line git compiled with MingW instead of cygwin. This is not a GUI Tool like TortoiseSVN.
There is GitExtensions that takes the same path as Tortoise but it does not look ready yet.
Have you tried looking at the TortoiseGit page on Google Code? I believe it's the same project as the other link posted, but it's a bit friendlier. You can download the latest version as an installer from there.

Resources